diff options
9 files changed, 35 insertions, 35 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 76b8f6610590..f2423437c3fc 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -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); diff --git a/api/test-current.txt b/api/test-current.txt index 5d7144c52738..23675d6be25a 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -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); diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl index 7884872a7ef3..b3c2429004b8 100644 --- a/core/java/android/app/INotificationManager.aidl +++ b/core/java/android/app/INotificationManager.aidl @@ -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); diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index d54aca89c50d..dd39376f80ca 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -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(); } diff --git a/core/java/android/service/notification/INotificationListener.aidl b/core/java/android/service/notification/INotificationListener.aidl index 8bb5f97ca878..5977bafd7cf1 100644 --- a/core/java/android/service/notification/INotificationListener.aidl +++ b/core/java/android/service/notification/INotificationListener.aidl @@ -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(); } diff --git a/core/java/android/service/notification/NotificationAssistantService.java b/core/java/android/service/notification/NotificationAssistantService.java index b4fd39701233..cafeb87691bd 100644 --- a/core/java/android/service/notification/NotificationAssistantService.java +++ b/core/java/android/service/notification/NotificationAssistantService.java @@ -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; } } diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index 678072346f01..3ec21e39e514 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -1400,7 +1400,7 @@ public abstract class NotificationListenerService extends Service { } @Override - public void onCapabilitiesChanged() { + public void onAllowedAdjustmentsChanged() { // no-op in the listener } diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index dec47a1082fc..be6c017a2d11 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -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); } diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java index bafcd5f0f8bd..91d9078e72cc 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java @@ -4948,15 +4948,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)); } |