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); } }
/* 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
- Notification屏蔽下拉菜单具体消息
- 一种屏蔽系统下拉菜单的方式
- android 下拉菜单Spinner的具体用法
- Toast(弹出信息)和Notification(下拉菜单通知)
- [RK3288][Android6.0] 调试笔记 --- 屏蔽系统下拉菜单显示
- 如何屏蔽pocketpc 长按触笔时,发出的菜单消息
- Android屏蔽Home键、屏蔽下拉菜单最有效的办法(部分手机无效)
- Android实现系统下拉栏的消息提示——Notification
- 下拉通知Notification
- Android Notification下拉样式
- Notification下拉通知
- android屏蔽状态栏下拉
- 下拉菜单
- 下拉菜单
- 下拉菜单
- 下拉菜单
- 下拉菜单
- 下拉菜单
- Git学习笔记 (一)
- Windows下QScintilla的配置方法
- Android中设置TextView的颜色setTextColor
- 快速删除数据库中的所有表记录
- Objective-C中的Block
- Notification屏蔽下拉菜单具体消息
- 引用符号&以及const &的使用
- Linux笔记(10)——Shell概述
- STOMP
- 日期格式化
- java获取当前日期是星期几
- 优先队列重载 3种写法
- ios,android提交文件及图片到 PHP服务端
- 实体类转换-映射EntityConverter