Loading core/api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -9856,7 +9856,7 @@ package android.companion { method @RequiresPermission(value=android.Manifest.permission.REQUEST_COMPANION_PROFILE_WATCH, conditional=true) public void associate(@NonNull android.companion.AssociationRequest, @NonNull android.companion.CompanionDeviceManager.Callback, @Nullable android.os.Handler); method public void disassociate(@NonNull String); method @NonNull public java.util.List<java.lang.String> getAssociations(); method public boolean hasNotificationAccess(android.content.ComponentName); method @Deprecated public boolean hasNotificationAccess(android.content.ComponentName); method public void requestNotificationAccess(android.content.ComponentName); method @RequiresPermission(android.Manifest.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE) public void startObservingDevicePresence(@NonNull String) throws android.companion.DeviceNotAssociatedException; method @RequiresPermission(android.Manifest.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE) public void stopObservingDevicePresence(@NonNull String) throws android.companion.DeviceNotAssociatedException; core/java/android/companion/CompanionDeviceManager.java +5 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.annotation.SystemApi; import android.annotation.SystemService; import android.app.Activity; import android.app.Application; import android.app.NotificationManager; import android.app.PendingIntent; import android.bluetooth.BluetoothDevice; import android.content.ComponentName; Loading Loading @@ -259,7 +260,11 @@ public final class CompanionDeviceManager { * * @param component the name of the component * @return whether the given component has the notification listener permission * * @deprecated Use * {@link NotificationManager#isNotificationListenerAccessGranted(ComponentName)} instead. */ @Deprecated public boolean hasNotificationAccess(ComponentName component) { if (!checkFeaturePresent()) { return false; Loading services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java +8 −3 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import android.annotation.Nullable; import android.annotation.SuppressLint; import android.app.ActivityManagerInternal; import android.app.AppOpsManager; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.role.RoleManager; import android.bluetooth.BluetoothAdapter; Loading Loading @@ -584,12 +585,16 @@ public class CompanionDeviceManagerService extends SystemService implements Bind } } /** * @deprecated Use * {@link NotificationManager#isNotificationListenerAccessGranted(ComponentName)} instead. */ @Deprecated @Override public boolean hasNotificationAccess(ComponentName component) throws RemoteException { checkCanCallNotificationApi(component.getPackageName()); String setting = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ENABLED_NOTIFICATION_LISTENERS); return new ComponentNameSet(setting).contains(component); NotificationManager nm = getContext().getSystemService(NotificationManager.class); return nm.isNotificationListenerAccessGranted(component); } @Override Loading Loading
core/api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -9856,7 +9856,7 @@ package android.companion { method @RequiresPermission(value=android.Manifest.permission.REQUEST_COMPANION_PROFILE_WATCH, conditional=true) public void associate(@NonNull android.companion.AssociationRequest, @NonNull android.companion.CompanionDeviceManager.Callback, @Nullable android.os.Handler); method public void disassociate(@NonNull String); method @NonNull public java.util.List<java.lang.String> getAssociations(); method public boolean hasNotificationAccess(android.content.ComponentName); method @Deprecated public boolean hasNotificationAccess(android.content.ComponentName); method public void requestNotificationAccess(android.content.ComponentName); method @RequiresPermission(android.Manifest.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE) public void startObservingDevicePresence(@NonNull String) throws android.companion.DeviceNotAssociatedException; method @RequiresPermission(android.Manifest.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE) public void stopObservingDevicePresence(@NonNull String) throws android.companion.DeviceNotAssociatedException;
core/java/android/companion/CompanionDeviceManager.java +5 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.annotation.SystemApi; import android.annotation.SystemService; import android.app.Activity; import android.app.Application; import android.app.NotificationManager; import android.app.PendingIntent; import android.bluetooth.BluetoothDevice; import android.content.ComponentName; Loading Loading @@ -259,7 +260,11 @@ public final class CompanionDeviceManager { * * @param component the name of the component * @return whether the given component has the notification listener permission * * @deprecated Use * {@link NotificationManager#isNotificationListenerAccessGranted(ComponentName)} instead. */ @Deprecated public boolean hasNotificationAccess(ComponentName component) { if (!checkFeaturePresent()) { return false; Loading
services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java +8 −3 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import android.annotation.Nullable; import android.annotation.SuppressLint; import android.app.ActivityManagerInternal; import android.app.AppOpsManager; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.role.RoleManager; import android.bluetooth.BluetoothAdapter; Loading Loading @@ -584,12 +585,16 @@ public class CompanionDeviceManagerService extends SystemService implements Bind } } /** * @deprecated Use * {@link NotificationManager#isNotificationListenerAccessGranted(ComponentName)} instead. */ @Deprecated @Override public boolean hasNotificationAccess(ComponentName component) throws RemoteException { checkCanCallNotificationApi(component.getPackageName()); String setting = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ENABLED_NOTIFICATION_LISTENERS); return new ComponentNameSet(setting).contains(component); NotificationManager nm = getContext().getSystemService(NotificationManager.class); return nm.isNotificationListenerAccessGranted(component); } @Override Loading