OSDN Git Service

Remove 'peekable' preference.
authorJulia Reynolds <juliacr@google.com>
Wed, 18 Nov 2015 22:03:56 +0000 (17:03 -0500)
committerJulia Reynolds <juliacr@google.com>
Wed, 18 Nov 2015 22:05:02 +0000 (17:05 -0500)
To be replaced by 'importance' in the future.

Bug: 22854014
Change-Id: Idc9ca79b145d5c69e769c9239ed9291dce40d8c8

core/java/android/app/INotificationManager.aidl
core/java/android/app/Notification.java
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
services/core/java/com/android/server/notification/NotificationManagerService.java
services/core/java/com/android/server/notification/RankingConfig.java
services/core/java/com/android/server/notification/RankingHelper.java

index 30232da..84ddd9f 100644 (file)
@@ -50,9 +50,6 @@ interface INotificationManager
     void setPackagePriority(String pkg, int uid, int priority);
     int getPackagePriority(String pkg, int uid);
 
-    void setPackagePeekable(String pkg, int uid, boolean peekable);
-    boolean getPackagePeekable(String pkg, int uid);
-
     void setPackageVisibilityOverride(String pkg, int uid, int visibility);
     int getPackageVisibilityOverride(String pkg, int uid);
 
index 390c280..4e6548b 100644 (file)
@@ -838,13 +838,6 @@ public class Notification implements Parcelable
     public static final String EXTRA_PEOPLE = "android.people";
 
     /**
-     * {@link #extras} key: used to provide hints about the appropriateness of
-     * displaying this notification as a heads-up notification.
-     * @hide
-     */
-    public static final String EXTRA_AS_HEADS_UP = "headsup";
-
-    /**
      * Allow certain system-generated notifications to appear before the device is provisioned.
      * Only available to notifications coming from the android package.
      * @hide
@@ -887,32 +880,6 @@ public class Notification implements Parcelable
      */
     public static final String EXTRA_BUILDER_APPLICATION_INFO = "android.appInfo";
 
-    /**
-     * Value for {@link #EXTRA_AS_HEADS_UP} that indicates this notification should not be
-     * displayed in the heads up space.
-     *
-     * <p>
-     * If this notification has a {@link #fullScreenIntent}, then it will always launch the
-     * full-screen intent when posted.
-     * </p>
-     * @hide
-     */
-    public static final int HEADS_UP_NEVER = 0;
-
-    /**
-     * Default value for {@link #EXTRA_AS_HEADS_UP} that indicates this notification may be
-     * displayed as a heads up.
-     * @hide
-     */
-    public static final int HEADS_UP_ALLOWED = 1;
-
-    /**
-     * Value for {@link #EXTRA_AS_HEADS_UP} that indicates this notification is a
-     * good candidate for display as a heads up.
-     * @hide
-     */
-    public static final int HEADS_UP_REQUESTED = 2;
-
     private Icon mSmallIcon;
     private Icon mLargeIcon;
 
index d3d9bef..f8ab35f 100644 (file)
@@ -2161,13 +2161,10 @@ public abstract class BaseStatusBar extends SystemUI implements
         boolean isHighPriority = sbn.getScore() >= INTERRUPTION_THRESHOLD;
         boolean isFullscreen = notification.fullScreenIntent != null;
         boolean hasTicker = mHeadsUpTicker && !TextUtils.isEmpty(notification.tickerText);
-        boolean isAllowed = notification.extras.getInt(Notification.EXTRA_AS_HEADS_UP,
-                Notification.HEADS_UP_ALLOWED) != Notification.HEADS_UP_NEVER;
         boolean accessibilityForcesLaunch = isFullscreen
                 && mAccessibilityManager.isTouchExplorationEnabled();
         boolean justLaunchedFullScreenIntent = entry.hasJustLaunchedFullScreenIntent();
         boolean interrupt = (isFullscreen || (isHighPriority && (isNoisy || hasTicker)))
-                && isAllowed
                 && !accessibilityForcesLaunch
                 && !justLaunchedFullScreenIntent
                 && mPowerManager.isScreenOn()
index fd1e9dd..4424838 100644 (file)
@@ -1224,19 +1224,6 @@ public class NotificationManagerService extends SystemService {
         }
 
         @Override
-        public void setPackagePeekable(String pkg, int uid, boolean peekable) {
-            checkCallerIsSystem();
-
-            mRankingHelper.setPackagePeekable(pkg, uid, peekable);
-        }
-
-        @Override
-        public boolean getPackagePeekable(String pkg, int uid) {
-            checkCallerIsSystem();
-            return mRankingHelper.getPackagePeekable(pkg, uid);
-        }
-
-        @Override
         public void setPackageVisibilityOverride(String pkg, int uid, int visibility) {
             checkCallerIsSystem();
             mRankingHelper.setPackageVisibilityOverride(pkg, uid, visibility);
@@ -2157,14 +2144,6 @@ public class NotificationManagerService extends SystemService {
                             notification.priority = Notification.PRIORITY_HIGH;
                         }
                     }
-                    // force no heads up per package config
-                    if (!mRankingHelper.getPackagePeekable(pkg, callingUid)) {
-                        if (notification.extras == null) {
-                            notification.extras = new Bundle();
-                        }
-                        notification.extras.putInt(Notification.EXTRA_AS_HEADS_UP,
-                                Notification.HEADS_UP_NEVER);
-                    }
 
                     // 1. initial score: buckets of 10, around the app [-20..20]
                     final int score = notification.priority * NOTIFICATION_PRIORITY_MULTIPLIER;
index 803db10..aea137b 100644 (file)
@@ -20,10 +20,6 @@ public interface RankingConfig {
 
     void setPackagePriority(String packageName, int uid, int priority);
 
-    boolean getPackagePeekable(String packageName, int uid);
-
-    void setPackagePeekable(String packageName, int uid, boolean peekable);
-
     int getPackageVisibilityOverride(String packageName, int uid);
 
     void setPackageVisibilityOverride(String packageName, int uid, int visibility);
index 66381f5..f8b661f 100644 (file)
@@ -49,11 +49,9 @@ public class RankingHelper implements RankingConfig {
     private static final String ATT_NAME = "name";
     private static final String ATT_UID = "uid";
     private static final String ATT_PRIORITY = "priority";
-    private static final String ATT_PEEKABLE = "peekable";
     private static final String ATT_VISIBILITY = "visibility";
 
     private static final int DEFAULT_PRIORITY = Notification.PRIORITY_DEFAULT;
-    private static final boolean DEFAULT_PEEKABLE = true;
     private static final int DEFAULT_VISIBILITY =
             NotificationListenerService.Ranking.VISIBILITY_NO_OVERRIDE;
 
@@ -141,7 +139,6 @@ public class RankingHelper implements RankingConfig {
                 if (TAG_PACKAGE.equals(tag)) {
                     int uid = safeInt(parser, ATT_UID, Record.UNKNOWN_UID);
                     int priority = safeInt(parser, ATT_PRIORITY, DEFAULT_PRIORITY);
-                    boolean peekable = safeBool(parser, ATT_PEEKABLE, DEFAULT_PEEKABLE);
                     int vis = safeInt(parser, ATT_VISIBILITY, DEFAULT_VISIBILITY);
                     String name = parser.getAttributeValue(null, ATT_NAME);
 
@@ -167,9 +164,6 @@ public class RankingHelper implements RankingConfig {
                         if (priority != DEFAULT_PRIORITY) {
                             r.priority = priority;
                         }
-                        if (peekable != DEFAULT_PEEKABLE) {
-                            r.peekable = peekable;
-                        }
                         if (vis != DEFAULT_VISIBILITY) {
                             r.visibility = vis;
                         }
@@ -200,8 +194,7 @@ public class RankingHelper implements RankingConfig {
         final int N = mRecords.size();
         for (int i = N - 1; i >= 0; i--) {
             final Record r = mRecords.valueAt(i);
-            if (r.priority == DEFAULT_PRIORITY && r.peekable == DEFAULT_PEEKABLE
-                    && r.visibility == DEFAULT_VISIBILITY) {
+            if (r.priority == DEFAULT_PRIORITY && r.visibility == DEFAULT_VISIBILITY) {
                 mRecords.remove(i);
             }
         }
@@ -223,9 +216,6 @@ public class RankingHelper implements RankingConfig {
             if (r.priority != DEFAULT_PRIORITY) {
                 out.attribute(null, ATT_PRIORITY, Integer.toString(r.priority));
             }
-            if (r.peekable != DEFAULT_PEEKABLE) {
-                out.attribute(null, ATT_PEEKABLE, Boolean.toString(r.peekable));
-            }
             if (r.visibility != DEFAULT_VISIBILITY) {
                 out.attribute(null, ATT_VISIBILITY, Integer.toString(r.visibility));
             }
@@ -348,22 +338,6 @@ public class RankingHelper implements RankingConfig {
     }
 
     @Override
-    public boolean getPackagePeekable(String packageName, int uid) {
-        final Record r = mRecords.get(recordKey(packageName, uid));
-        return r != null ? r.peekable : DEFAULT_PEEKABLE;
-    }
-
-    @Override
-    public void setPackagePeekable(String packageName, int uid, boolean peekable) {
-        if (peekable == getPackagePeekable(packageName, uid)) {
-            return;
-        }
-        getOrCreateRecord(packageName, uid).peekable = peekable;
-        removeDefaultRecords();
-        updateConfig();
-    }
-
-    @Override
     public int getPackageVisibilityOverride(String packageName, int uid) {
         final Record r = mRecords.get(recordKey(packageName, uid));
         return r != null ? r.visibility : DEFAULT_VISIBILITY;
@@ -415,10 +389,6 @@ public class RankingHelper implements RankingConfig {
                     pw.print(" priority=");
                     pw.print(Notification.priorityToString(r.priority));
                 }
-                if (r.peekable != DEFAULT_PEEKABLE) {
-                    pw.print(" peekable=");
-                    pw.print(r.peekable);
-                }
                 if (r.visibility != DEFAULT_VISIBILITY) {
                     pw.print(" visibility=");
                     pw.print(Notification.visibilityToString(r.visibility));
@@ -460,7 +430,6 @@ public class RankingHelper implements RankingConfig {
         String pkg;
         int uid = UNKNOWN_UID;
         int priority = DEFAULT_PRIORITY;
-        boolean peekable = DEFAULT_PEEKABLE;
         int visibility = DEFAULT_VISIBILITY;
     }