Notification屏蔽下拉菜单具体消息

来源:互联网 发布:淘宝上如何申请换货 编辑:程序博客网 时间:2024/06/08 15:12

正常情况下,系统发送一条通知会,在PhoneStatusBar状态栏上会有一个通知的图标,然后在下拉扩展界面会有对应的通知信息。

客户反馈,在使用VoLTE业务的时候,下拉通知栏的VoLTE对应的通知没有具体内容,只有一个VoLTE的图标,这样显示起来很不美观,客户需求要去掉下拉栏的详细通知,保留状态栏上的图标。

跟踪系统notification源码,并没有发现有关于屏蔽下拉状态栏的属性或标记。所以决定自己加一个相关的属性来控制是否显示通知的下拉状态栏。

1. frameworks/base/core/java/android/app/Notification.java

//增加属性/* yueshuai 20151118 modify for hide notification drawer begin *//*** hide notification drawer* @hide*/public static final String EXTRA_AS_HIDE_VIEW = "hideview";/* yueshuai 20151118 modify for hide notification drawer end */


2. packages/services/Telephony/src/com/android/phone/NotificationMgr.java


    /* yueshuai 20151118 modify for hide notification drawer begin */    private static final String HIDE_VIEW = "hideview";    /* yueshuai 20151118 modify for hide notification drawer end */

void updateImsRegistration(boolean registered) {        if (registered) {            Notification notification = new Notification.Builder(mContext)                    .setSmallIcon(R.drawable.ims_state).build();            notification.flags |= Notification.FLAG_ONGOING_EVENT;    /* yueshuai 20151118 modify for hide notification drawer begin */            //加入hideview属性    notification.extras.putString(Notification.EXTRA_AS_HIDE_VIEW,HIDE_VIEW);    /* yueshuai 20151118 modify for hide notification drawer end */            mNotificationManager.notify(                    IMS_REGISTERED_NOTIFICATION,                    notification);        } else {            mNotificationManager.cancel(IMS_REGISTERED_NOTIFICATION);        }    }


3. frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

 /* yueshuai 20151118 modify for hide notification drawer begin */    private static final String NO_HIDE_VIEW = "nohideview";    private static final String HIDE_VIEW = "hideview";    /* yueshuai 20151118 modify for hide notification drawer end */

 private void updateNotificationShade() {        if (mStackScroller == null) return;……        ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();        ArrayList<ExpandableNotificationRow> toShow = new ArrayList<>(activeNotifications.size());        final int N = activeNotifications.size();        for (int i=0; i<N; i++) {            Entry ent = activeNotifications.get(i);    /* yueshuai 20151118 modify for hide notification drawer begin */             //看是否存在HIDE_VIEW的属性,如果存在则跳过,不需要下拉栏中    if((ent.notification.getNotification().extras.getString(Notification.EXTRA_AS_HIDE_VIEW,NO_HIDE_VIEW)).equals(HIDE_VIEW)){continue;    }/* yueshuai 20151118 modify for hide notification drawer end */            int vis = ent.notification.getNotification().visibility;            // Display public version of the notification if we need to redact.            final boolean hideSensitive =                    !userAllowsPrivateNotificationsInPublic(ent.notification.getUserId());            boolean sensitiveNote = vis == Notification.VISIBILITY_PRIVATE;            boolean sensitivePackage = packageHasVisibilityOverride(ent.notification.getKey());            boolean sensitive = (sensitiveNote && hideSensitive) || sensitivePackage;            boolean showingPublic = sensitive && isLockscreenPublicMode();…… mNotificationPanel.setQsExpansionEnabled(isDeviceProvisioned()                && (mUserSetup || mUserSwitcherController == null                        || !mUserSwitcherController.isSimpleUserSwitcher()));        mShadeUpdates.check();    }


0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 她的沙雕又暴露了 在虐文里绑定了男主系统 我在末世成了领主大人 玄学老祖上综艺后轰动全球了 我继承了老公的神位 仵作掌中娇 世子爷她不可能是女的 穿进红楼后,我成了人生赢家 假死后夫人她称霸黑莲界 奶萌小团宠她觉醒了种田系统 巨星的大佬青梅 总裁的小撩精又生气了 开荒种田:农门辣妻有空间 签到后,小白花她在娱乐圈翻红了 江月照 魂飞魄散的上古大仙在修真界诈尸 快穿:大佬她又抢了反派剧本 夫人她总想逃 穿成阴戾反派未来嫂嫂 上神大人他偏甜系啊 咸鱼后妈带崽在综艺当对照组 系统BUG让我成了舔包专业户 快穿:系统有的是力气和手段 当我的霸总老公有了读心术 穿成炮灰渣妻后我和反派开农场 前任小姐姐帅又飒 弄潮1990从厂长开始 光阴之外 心动侵占 重回逃荒开端,手握空间来逆袭 重生之网红教父 蛮荒求生:反派大佬被迫种田 玄学大佬在星际重建地府 总裁又惹火夫人了 农门空间:重生娇娘撩糙汉 重生后我弃了天运之子 快穿:绑定系统后我疯狂崩人设 慕爷你虐错了夫人就是白月光 欢乐班 快穿之反派今天也在求负责 喜提娇夫:快穿作精她被迫崛起了