Merge "Rename NotificationChannel#setBlockableSystem" into rvc-dev
diff --git a/api/system-current.txt b/api/system-current.txt
index 1f228ca..fe4e930 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -665,7 +665,7 @@
     method public int getUserLockedFields();
     method public boolean isDeleted();
     method public void populateFromXml(org.xmlpull.v1.XmlPullParser);
-    method public void setBlockableSystem(boolean);
+    method public void setBlockable(boolean);
     method public org.json.JSONObject toJson() throws org.json.JSONException;
     method public void writeXml(org.xmlpull.v1.XmlSerializer) throws java.io.IOException;
     field public static final int USER_LOCKED_SOUND = 32; // 0x20
diff --git a/api/test-current.txt b/api/test-current.txt
index c0bb70a..5505f50 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -426,11 +426,11 @@
 
   public final class NotificationChannel implements android.os.Parcelable {
     method public int getOriginalImportance();
-    method public boolean isBlockableSystem();
+    method public boolean isBlockable();
     method public boolean isImportanceLockedByCriticalDeviceFunction();
     method public boolean isImportanceLockedByOEM();
     method public void lockFields(int);
-    method public void setBlockableSystem(boolean);
+    method public void setBlockable(boolean);
     method public void setDeleted(boolean);
     method public void setFgServiceShown(boolean);
     method public void setImportanceLockedByCriticalDeviceFunction(boolean);
diff --git a/core/java/android/app/NotificationChannel.java b/core/java/android/app/NotificationChannel.java
index 94b237c..d1d67f0 100644
--- a/core/java/android/app/NotificationChannel.java
+++ b/core/java/android/app/NotificationChannel.java
@@ -370,15 +370,18 @@
 
     /**
      * Allows users to block notifications sent through this channel, if this channel belongs to
-     * a package that is signed with the system signature. If the channel does not belong to a
-     * package that is signed with the system signature, this method does nothing.
-     * @param blockableSystem if {@code true}, allows users to block notifications on this channel.
+     * a package that is signed with the system signature.
+     *
+     * If the channel does not belong to a package that is signed with the system signature, this
+     * method does nothing, since such channels are blockable by default and cannot be set to be
+     * unblockable.
+     * @param blockable if {@code true}, allows users to block notifications on this channel.
      * @hide
      */
     @SystemApi
     @TestApi
-    public void setBlockableSystem(boolean blockableSystem) {
-        mBlockableSystem = blockableSystem;
+    public void setBlockable(boolean blockable) {
+        mBlockableSystem = blockable;
     }
     // Modifiable by apps post channel creation
 
@@ -749,7 +752,7 @@
      * @hide
      */
     @TestApi
-    public boolean isBlockableSystem() {
+    public boolean isBlockable() {
         return mBlockableSystem;
     }
 
@@ -873,7 +876,7 @@
         setGroup(parser.getAttributeValue(null, ATT_GROUP));
         lockFields(safeInt(parser, ATT_USER_LOCKED, 0));
         setFgServiceShown(safeBool(parser, ATT_FG_SERVICE_SHOWN, false));
-        setBlockableSystem(safeBool(parser, ATT_BLOCKABLE_SYSTEM, false));
+        setBlockable(safeBool(parser, ATT_BLOCKABLE_SYSTEM, false));
         setAllowBubbles(safeBool(parser, ATT_ALLOW_BUBBLE, DEFAULT_ALLOW_BUBBLE));
         setOriginalImportance(safeInt(parser, ATT_ORIG_IMP, DEFAULT_IMPORTANCE));
         setConversationId(parser.getAttributeValue(null, ATT_PARENT_CHANNEL),
@@ -995,8 +998,8 @@
         if (getGroup() != null) {
             out.attribute(null, ATT_GROUP, getGroup());
         }
-        if (isBlockableSystem()) {
-            out.attribute(null, ATT_BLOCKABLE_SYSTEM, Boolean.toString(isBlockableSystem()));
+        if (isBlockable()) {
+            out.attribute(null, ATT_BLOCKABLE_SYSTEM, Boolean.toString(isBlockable()));
         }
         if (canBubble() != DEFAULT_ALLOW_BUBBLE) {
             out.attribute(null, ATT_ALLOW_BUBBLE, Boolean.toString(canBubble()));
@@ -1060,7 +1063,7 @@
         record.put(ATT_SHOW_BADGE, Boolean.toString(canShowBadge()));
         record.put(ATT_DELETED, Boolean.toString(isDeleted()));
         record.put(ATT_GROUP, getGroup());
-        record.put(ATT_BLOCKABLE_SYSTEM, isBlockableSystem());
+        record.put(ATT_BLOCKABLE_SYSTEM, isBlockable());
         record.put(ATT_ALLOW_BUBBLE, canBubble());
         // TODO: original importance
         return record;
@@ -1162,7 +1165,7 @@
                 && mVibrationEnabled == that.mVibrationEnabled
                 && mShowBadge == that.mShowBadge
                 && isDeleted() == that.isDeleted()
-                && isBlockableSystem() == that.isBlockableSystem()
+                && isBlockable() == that.isBlockable()
                 && mAllowBubbles == that.mAllowBubbles
                 && Objects.equals(getId(), that.getId())
                 && Objects.equals(getName(), that.getName())
@@ -1186,7 +1189,7 @@
                 getLockscreenVisibility(), getSound(), mLights, getLightColor(),
                 getUserLockedFields(),
                 isFgServiceShown(), mVibrationEnabled, mShowBadge, isDeleted(), getGroup(),
-                getAudioAttributes(), isBlockableSystem(), mAllowBubbles,
+                getAudioAttributes(), isBlockable(), mAllowBubbles,
                 mImportanceLockedByOEM, mImportanceLockedDefaultApp, mOriginalImportance,
                 mParentId, mConversationId, mDemoted, mImportantConvo);
         result = 31 * result + Arrays.hashCode(mVibration);
diff --git a/core/java/com/android/internal/notification/SystemNotificationChannels.java b/core/java/com/android/internal/notification/SystemNotificationChannels.java
index 1296ddc..41be5c4 100644
--- a/core/java/com/android/internal/notification/SystemNotificationChannels.java
+++ b/core/java/com/android/internal/notification/SystemNotificationChannels.java
@@ -65,7 +65,7 @@
                 VIRTUAL_KEYBOARD,
                 context.getString(R.string.notification_channel_virtual_keyboard),
                 NotificationManager.IMPORTANCE_LOW);
-        keyboard.setBlockableSystem(true);
+        keyboard.setBlockable(true);
         channelsList.add(keyboard);
 
         final NotificationChannel physicalKeyboardChannel = new NotificationChannel(
@@ -74,7 +74,7 @@
                 NotificationManager.IMPORTANCE_DEFAULT);
         physicalKeyboardChannel.setSound(Settings.System.DEFAULT_NOTIFICATION_URI,
                 Notification.AUDIO_ATTRIBUTES_DEFAULT);
-        physicalKeyboardChannel.setBlockableSystem(true);
+        physicalKeyboardChannel.setBlockable(true);
         channelsList.add(physicalKeyboardChannel);
 
         final NotificationChannel security = new NotificationChannel(
@@ -87,7 +87,7 @@
                 CAR_MODE,
                 context.getString(R.string.notification_channel_car_mode),
                 NotificationManager.IMPORTANCE_LOW);
-        car.setBlockableSystem(true);
+        car.setBlockable(true);
         channelsList.add(car);
 
         channelsList.add(newAccountChannel(context));
@@ -96,14 +96,14 @@
                 DEVELOPER,
                 context.getString(R.string.notification_channel_developer),
                 NotificationManager.IMPORTANCE_LOW);
-        developer.setBlockableSystem(true);
+        developer.setBlockable(true);
         channelsList.add(developer);
 
         final NotificationChannel developerImportant = new NotificationChannel(
                 DEVELOPER_IMPORTANT,
                 context.getString(R.string.notification_channel_developer_important),
                 NotificationManager.IMPORTANCE_HIGH);
-        developer.setBlockableSystem(true);
+        developer.setBlockable(true);
         channelsList.add(developerImportant);
 
         final NotificationChannel updates = new NotificationChannel(
@@ -116,21 +116,21 @@
                 NETWORK_STATUS,
                 context.getString(R.string.notification_channel_network_status),
                 NotificationManager.IMPORTANCE_LOW);
-        network.setBlockableSystem(true);
+        network.setBlockable(true);
         channelsList.add(network);
 
         final NotificationChannel networkAlertsChannel = new NotificationChannel(
                 NETWORK_ALERTS,
                 context.getString(R.string.notification_channel_network_alerts),
                 NotificationManager.IMPORTANCE_HIGH);
-        networkAlertsChannel.setBlockableSystem(true);
+        networkAlertsChannel.setBlockable(true);
         channelsList.add(networkAlertsChannel);
 
         final NotificationChannel networkAvailable = new NotificationChannel(
                 NETWORK_AVAILABLE,
                 context.getString(R.string.notification_channel_network_available),
                 NotificationManager.IMPORTANCE_LOW);
-        networkAvailable.setBlockableSystem(true);
+        networkAvailable.setBlockable(true);
         channelsList.add(networkAvailable);
 
         final NotificationChannel vpn = new NotificationChannel(
@@ -167,7 +167,7 @@
                 FOREGROUND_SERVICE,
                 context.getString(R.string.notification_channel_foreground_service),
                 NotificationManager.IMPORTANCE_LOW);
-        foregroundChannel.setBlockableSystem(true);
+        foregroundChannel.setBlockable(true);
         channelsList.add(foregroundChannel);
 
         NotificationChannel heavyWeightChannel = new NotificationChannel(
diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstalledNotificationUtils.java b/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstalledNotificationUtils.java
index 2ebbefa..caf9718 100644
--- a/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstalledNotificationUtils.java
+++ b/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstalledNotificationUtils.java
@@ -219,7 +219,7 @@
         channel.enableVibration(false);
         channel.setSound(null, null);
         channel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
-        channel.setBlockableSystem(true);
+        channel.setBlockable(true);
 
         mNotificationManager.createNotificationChannel(channel);
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
index 5f2b256..0ff058b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
@@ -527,7 +527,7 @@
         if (!isNonblockable && mEntry != null && mEntry.mIsSystemNotification != null) {
             if (mEntry.mIsSystemNotification) {
                 if (mEntry.getChannel() != null
-                        && !mEntry.getChannel().isBlockableSystem()) {
+                        && !mEntry.getChannel().isBlockable()) {
                     isNonblockable = true;
                 }
             }
diff --git a/packages/SystemUI/src/com/android/systemui/util/NotificationChannels.java b/packages/SystemUI/src/com/android/systemui/util/NotificationChannels.java
index 8c60747..90b95ea 100644
--- a/packages/SystemUI/src/com/android/systemui/util/NotificationChannels.java
+++ b/packages/SystemUI/src/com/android/systemui/util/NotificationChannels.java
@@ -53,7 +53,7 @@
                 .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
                 .setUsage(AudioAttributes.USAGE_NOTIFICATION_EVENT)
                 .build());
-        batteryChannel.setBlockableSystem(true);
+        batteryChannel.setBlockable(true);
 
         final NotificationChannel alerts = new NotificationChannel(
                 ALERTS,
@@ -118,7 +118,7 @@
 
         screenshotChannel.setSound(null, // silent
                 new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_NOTIFICATION).build());
-        screenshotChannel.setBlockableSystem(true);
+        screenshotChannel.setBlockable(true);
 
         if (legacySS != null) {
             // Respect any user modified fields from the old channel.
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java
index 23a90f2..af528dc 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java
@@ -372,7 +372,7 @@
                         notification.getChannelId(),
                         notification.getChannelId(),
                         importance);
-        channel.setBlockableSystem(true);
+        channel.setBlockable(true);
 
         NotificationEntry entry = new NotificationEntryBuilder()
                 .setPkg(pkg)
diff --git a/services/core/java/com/android/server/notification/PreferencesHelper.java b/services/core/java/com/android/server/notification/PreferencesHelper.java
index 6fd09bb..32cfaf6 100644
--- a/services/core/java/com/android/server/notification/PreferencesHelper.java
+++ b/services/core/java/com/android/server/notification/PreferencesHelper.java
@@ -725,8 +725,8 @@
                     existing.setDescription(channel.getDescription());
                     needsPolicyFileChange = true;
                 }
-                if (channel.isBlockableSystem() != existing.isBlockableSystem()) {
-                    existing.setBlockableSystem(channel.isBlockableSystem());
+                if (channel.isBlockable() != existing.isBlockable()) {
+                    existing.setBlockable(channel.isBlockable());
                     needsPolicyFileChange = true;
                 }
                 if (channel.getGroup() != null && existing.getGroup() == null) {
diff --git a/services/core/java/com/android/server/power/batterysaver/BatterySaverStateMachine.java b/services/core/java/com/android/server/power/batterysaver/BatterySaverStateMachine.java
index 42aaec9..2256b62 100644
--- a/services/core/java/com/android/server/power/batterysaver/BatterySaverStateMachine.java
+++ b/services/core/java/com/android/server/power/batterysaver/BatterySaverStateMachine.java
@@ -828,7 +828,7 @@
         NotificationChannel channel = new NotificationChannel(
                 channelId, mContext.getText(nameId), NotificationManager.IMPORTANCE_DEFAULT);
         channel.setSound(null, null);
-        channel.setBlockableSystem(true);
+        channel.setBlockable(true);
         manager.createNotificationChannel(channel);
     }
 
diff --git a/services/core/java/com/android/server/wm/AlertWindowNotification.java b/services/core/java/com/android/server/wm/AlertWindowNotification.java
index 0de94d9..7b511ec 100644
--- a/services/core/java/com/android/server/wm/AlertWindowNotification.java
+++ b/services/core/java/com/android/server/wm/AlertWindowNotification.java
@@ -160,7 +160,7 @@
         channel = new NotificationChannel(mNotificationTag, nameChannel, IMPORTANCE_MIN);
         channel.enableLights(false);
         channel.enableVibration(false);
-        channel.setBlockableSystem(true);
+        channel.setBlockable(true);
         channel.setGroup(sChannelGroup.getId());
         channel.setBypassDnd(true);
         mNotificationManager.createNotificationChannel(channel);