OSDN Git Service

Rename capabilities to adjustments
authorJulia Reynolds <juliacr@google.com>
Wed, 10 Apr 2019 16:43:27 +0000 (12:43 -0400)
committerJulia Reynolds <juliacr@google.com>
Wed, 10 Apr 2019 18:05:39 +0000 (14:05 -0400)
To match existing API

Test: make, cts
Fixes: 130224929
Change-Id: I881ce11b583b389ee43bad6b45f837c85f949aa5

api/system-current.txt
api/test-current.txt
core/java/android/app/INotificationManager.aidl
core/java/android/app/NotificationManager.java
core/java/android/service/notification/INotificationListener.aidl
core/java/android/service/notification/NotificationAssistantService.java
core/java/android/service/notification/NotificationListenerService.java
services/core/java/com/android/server/notification/NotificationManagerService.java
services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java

index 76b8f66..f242343 100644 (file)
@@ -553,7 +553,7 @@ package android.app {
   }
 
   public class NotificationManager {
-    method @NonNull public java.util.List<java.lang.String> getAllowedAssistantCapabilities();
+    method @NonNull public java.util.List<java.lang.String> getAllowedAssistantAdjustments();
     method @Nullable public android.content.ComponentName getAllowedNotificationAssistant();
     method public boolean isNotificationAssistantAccessGranted(@NonNull android.content.ComponentName);
     method public void setNotificationAssistantAccessGranted(@Nullable android.content.ComponentName, boolean);
@@ -6631,8 +6631,8 @@ package android.service.notification {
     method public final void adjustNotification(@NonNull android.service.notification.Adjustment);
     method public final void adjustNotifications(@NonNull java.util.List<android.service.notification.Adjustment>);
     method public void onActionInvoked(@NonNull String, @NonNull android.app.Notification.Action, int);
+    method public void onAllowedAdjustmentsChanged();
     method @NonNull public final android.os.IBinder onBind(@Nullable android.content.Intent);
-    method public void onCapabilitiesChanged();
     method public void onNotificationDirectReplied(@NonNull String);
     method @Nullable public abstract android.service.notification.Adjustment onNotificationEnqueued(@NonNull android.service.notification.StatusBarNotification);
     method @Nullable public android.service.notification.Adjustment onNotificationEnqueued(@NonNull android.service.notification.StatusBarNotification, @NonNull android.app.NotificationChannel);
index 7121a54..2932ad6 100644 (file)
@@ -328,9 +328,9 @@ package android.app {
   }
 
   public class NotificationManager {
-    method public void allowAssistantCapability(String);
-    method public void disallowAssistantCapability(String);
-    method @NonNull public java.util.List<java.lang.String> getAllowedAssistantCapabilities();
+    method public void allowAssistantAdjustment(String);
+    method public void disallowAssistantAdjustment(String);
+    method @NonNull public java.util.List<java.lang.String> getAllowedAssistantAdjustments();
     method @Nullable public android.content.ComponentName getAllowedNotificationAssistant();
     method public android.content.ComponentName getEffectsSuppressor();
     method public boolean isNotificationAssistantAccessGranted(@NonNull android.content.ComponentName);
@@ -2488,8 +2488,8 @@ package android.service.notification {
     method public final void adjustNotification(@NonNull android.service.notification.Adjustment);
     method public final void adjustNotifications(@NonNull java.util.List<android.service.notification.Adjustment>);
     method public void onActionInvoked(@NonNull String, @NonNull android.app.Notification.Action, int);
+    method public void onAllowedAdjustmentsChanged();
     method @NonNull public final android.os.IBinder onBind(@Nullable android.content.Intent);
-    method public void onCapabilitiesChanged();
     method public void onNotificationDirectReplied(@NonNull String);
     method @Nullable public abstract android.service.notification.Adjustment onNotificationEnqueued(@NonNull android.service.notification.StatusBarNotification);
     method @Nullable public android.service.notification.Adjustment onNotificationEnqueued(@NonNull android.service.notification.StatusBarNotification, @NonNull android.app.NotificationChannel);
index 7884872..b3c2429 100644 (file)
@@ -70,9 +70,9 @@ interface INotificationManager
     boolean areNotificationsEnabled(String pkg);
     int getPackageImportance(String pkg);
 
-    List<String> getAllowedAssistantCapabilities(String pkg);
-    void allowAssistantCapability(String adjustmentType);
-    void disallowAssistantCapability(String adjustmentType);
+    List<String> getAllowedAssistantAdjustments(String pkg);
+    void allowAssistantAdjustment(String adjustmentType);
+    void disallowAssistantAdjustment(String adjustmentType);
 
     boolean shouldHideSilentStatusIcons(String callingPkg);
     void setHideSilentStatusIcons(boolean hide);
index d54aca8..dd39376 100644 (file)
@@ -1206,10 +1206,10 @@ public class NotificationManager {
      */
     @SystemApi
     @TestApi
-    public @NonNull @Adjustment.Keys List<String> getAllowedAssistantCapabilities() {
+    public @NonNull @Adjustment.Keys List<String> getAllowedAssistantAdjustments() {
         INotificationManager service = getService();
         try {
-            return service.getAllowedAssistantCapabilities(mContext.getOpPackageName());
+            return service.getAllowedAssistantAdjustments(mContext.getOpPackageName());
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
@@ -1219,10 +1219,10 @@ public class NotificationManager {
      * @hide
      */
     @TestApi
-    public void allowAssistantCapability(String capability) {
+    public void allowAssistantAdjustment(String capability) {
         INotificationManager service = getService();
         try {
-            service.allowAssistantCapability(capability);
+            service.allowAssistantAdjustment(capability);
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
@@ -1232,10 +1232,10 @@ public class NotificationManager {
      * @hide
      */
     @TestApi
-    public void disallowAssistantCapability(String capability) {
+    public void disallowAssistantAdjustment(String capability) {
         INotificationManager service = getService();
         try {
-            service.disallowAssistantCapability(capability);
+            service.disallowAssistantAdjustment(capability);
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
index 8bb5f97..5977baf 100644 (file)
@@ -53,5 +53,5 @@ oneway interface INotificationListener
     void onNotificationDirectReply(String key);
     void onSuggestedReplySent(String key, in CharSequence reply, int source);
     void onActionClicked(String key, in Notification.Action action, int source);
-    void onCapabilitiesChanged();
+    void onAllowedAdjustmentsChanged();
 }
index b4fd397..cafeb87 100644 (file)
@@ -220,10 +220,10 @@ public abstract class NotificationAssistantService extends NotificationListenerS
     /**
      * Implement this to know when a user has changed which features of
      * their notifications the assistant can modify.
-     * <p> Query {@link NotificationManager#getAllowedAssistantCapabilities()} to see what
+     * <p> Query {@link NotificationManager#getAllowedAssistantAdjustments()} to see what
      * {@link Adjustment adjustments} you are currently allowed to make.</p>
      */
-    public void onCapabilitiesChanged() {
+    public void onAllowedAdjustmentsChanged() {
     }
 
     /**
@@ -361,8 +361,8 @@ public abstract class NotificationAssistantService extends NotificationListenerS
         }
 
         @Override
-        public void onCapabilitiesChanged() {
-            mHandler.obtainMessage(MyHandler.MSG_ON_CAPABILITIES_CHANGED).sendToTarget();
+        public void onAllowedAdjustmentsChanged() {
+            mHandler.obtainMessage(MyHandler.MSG_ON_ALLOWED_ADJUSTMENTS_CHANGED).sendToTarget();
         }
     }
 
@@ -374,7 +374,7 @@ public abstract class NotificationAssistantService extends NotificationListenerS
         public static final int MSG_ON_NOTIFICATION_DIRECT_REPLY_SENT = 5;
         public static final int MSG_ON_SUGGESTED_REPLY_SENT = 6;
         public static final int MSG_ON_ACTION_INVOKED = 7;
-        public static final int MSG_ON_CAPABILITIES_CHANGED = 8;
+        public static final int MSG_ON_ALLOWED_ADJUSTMENTS_CHANGED = 8;
 
         public MyHandler(Looper looper) {
             super(looper, null, false);
@@ -456,8 +456,8 @@ public abstract class NotificationAssistantService extends NotificationListenerS
                     onActionInvoked(key, action, source);
                     break;
                 }
-                case MSG_ON_CAPABILITIES_CHANGED: {
-                    onCapabilitiesChanged();
+                case MSG_ON_ALLOWED_ADJUSTMENTS_CHANGED: {
+                    onAllowedAdjustmentsChanged();
                     break;
                 }
             }
index 016f4aa..ed236eb 100644 (file)
@@ -1399,7 +1399,7 @@ public abstract class NotificationListenerService extends Service {
         }
 
         @Override
-        public void onCapabilitiesChanged() {
+        public void onAllowedAdjustmentsChanged() {
             // no-op in the listener
         }
 
index dec47a1..be6c017 100644 (file)
@@ -2856,7 +2856,7 @@ public class NotificationManagerService extends SystemService {
         }
 
         @Override
-        public List<String> getAllowedAssistantCapabilities(String pkg) {
+        public List<String> getAllowedAssistantAdjustments(String pkg) {
             checkCallerIsSystemOrSameApp(pkg);
 
             if (!isCallerSystemOrPhone()
@@ -2864,11 +2864,11 @@ public class NotificationManagerService extends SystemService {
                     throw new SecurityException("Not currently an assistant");
             }
 
-            return mAssistants.getAllowedAssistantCapabilities();
+            return mAssistants.getAllowedAssistantAdjustments();
         }
 
         @Override
-        public void allowAssistantCapability(String adjustmentType) {
+        public void allowAssistantAdjustment(String adjustmentType) {
             checkCallerIsSystemOrSystemUiOrShell();
             mAssistants.allowAdjustmentType(adjustmentType);
 
@@ -2876,7 +2876,7 @@ public class NotificationManagerService extends SystemService {
         }
 
         @Override
-        public void disallowAssistantCapability(String adjustmentType) {
+        public void disallowAssistantAdjustment(String adjustmentType) {
             checkCallerIsSystemOrSystemUiOrShell();
             mAssistants.disallowAdjustmentType(adjustmentType);
 
@@ -7410,7 +7410,7 @@ public class NotificationManagerService extends SystemService {
             }
         }
 
-        protected List<String> getAllowedAssistantCapabilities() {
+        protected List<String> getAllowedAssistantAdjustments() {
             synchronized (mLock) {
                 List<String> types = new ArrayList<>();
                 types.addAll(mAllowedAdjustments);
@@ -7470,7 +7470,7 @@ public class NotificationManagerService extends SystemService {
         private void notifyCapabilitiesChanged(final ManagedServiceInfo info) {
             final INotificationListener assistant = (INotificationListener) info.service;
             try {
-                assistant.onCapabilitiesChanged();
+                assistant.onAllowedAdjustmentsChanged();
             } catch (RemoteException ex) {
                 Slog.e(TAG, "unable to notify assistant (capabilities): " + assistant, ex);
             }
index b078825..659ec74 100644 (file)
@@ -4918,15 +4918,15 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
         assertEquals(1, mService.getNotificationRecordCount());
     }
 
-    public void testGetAllowedAssistantCapabilities() throws Exception {
-        List<String> capabilities = mBinderService.getAllowedAssistantCapabilities(null);
+    public void testGetAllowedAssistantAdjustments() throws Exception {
+        List<String> capabilities = mBinderService.getAllowedAssistantAdjustments(null);
         assertNotNull(capabilities);
 
         for (int i = capabilities.size() - 1; i >= 0; i--) {
             String capability = capabilities.get(i);
-            mBinderService.disallowAssistantCapability(capability);
-            assertEquals(i + 1, mBinderService.getAllowedAssistantCapabilities(null).size());
-            List<String> currentCapabilities = mBinderService.getAllowedAssistantCapabilities(null);
+            mBinderService.disallowAssistantAdjustment(capability);
+            assertEquals(i + 1, mBinderService.getAllowedAssistantAdjustments(null).size());
+            List<String> currentCapabilities = mBinderService.getAllowedAssistantAdjustments(null);
             assertNotNull(currentCapabilities);
             assertFalse(currentCapabilities.contains(capability));
         }