Notification屏蔽下拉菜单具体消息

正常情况下,系统发送一条通知会,在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 activeNotifications = mNotificationData.getActiveNotifications();
        ArrayList toShow = new ArrayList<>(activeNotifications.size());
        final int N = activeNotifications.size();
        for (int i=0; i


你可能感兴趣的:(android)