Loading services/companion/java/com/android/server/companion/association/DisassociationProcessor.java +13 −9 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREG import static android.companion.AssociationRequest.DEVICE_PROFILE_AUTOMOTIVE_PROJECTION; import static com.android.internal.util.CollectionUtils.any; import static com.android.server.companion.utils.RolesUtils.NLS_PROFILES; import static com.android.server.companion.utils.RolesUtils.removeRoleHolderForAssociation; import static java.util.concurrent.TimeUnit.DAYS; Loading Loading @@ -148,6 +149,8 @@ public class DisassociationProcessor { // Revoke NLS if the last association has been removed for the package Binder.withCleanCallingIdentity(() -> { if (mAssociationStore.getAssociationsByPackage(userId, packageName).isEmpty()) { if (association.getDeviceProfile() != null && NLS_PROFILES.contains(association.getDeviceProfile())) { Intent nlsIntent = new Intent( NotificationListenerService.SERVICE_INTERFACE); List<ResolveInfo> matchedServiceList = mContext.getPackageManager() Loading @@ -160,6 +163,7 @@ public class DisassociationProcessor { } } } } }); // If role is not in use by other associations, revoke the role. Loading services/companion/java/com/android/server/companion/utils/RolesUtils.java +6 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,12 @@ public final class RolesUtils { PERMISSION_NEARBY_DEVICES, PERMISSION_POST_NOTIFICATIONS) ); public static final Set<String> NLS_PROFILES = Set.of( DEVICE_PROFILE_WATCH, DEVICE_PROFILE_GLASSES, DEVICE_PROFILE_APP_STREAMING, DEVICE_PROFILE_COMPUTER); private static final Set<String> ROLELESS_DEVICE_PROFILES; static { final Set<String> profiles = new ArraySet<>(); Loading Loading
services/companion/java/com/android/server/companion/association/DisassociationProcessor.java +13 −9 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREG import static android.companion.AssociationRequest.DEVICE_PROFILE_AUTOMOTIVE_PROJECTION; import static com.android.internal.util.CollectionUtils.any; import static com.android.server.companion.utils.RolesUtils.NLS_PROFILES; import static com.android.server.companion.utils.RolesUtils.removeRoleHolderForAssociation; import static java.util.concurrent.TimeUnit.DAYS; Loading Loading @@ -148,6 +149,8 @@ public class DisassociationProcessor { // Revoke NLS if the last association has been removed for the package Binder.withCleanCallingIdentity(() -> { if (mAssociationStore.getAssociationsByPackage(userId, packageName).isEmpty()) { if (association.getDeviceProfile() != null && NLS_PROFILES.contains(association.getDeviceProfile())) { Intent nlsIntent = new Intent( NotificationListenerService.SERVICE_INTERFACE); List<ResolveInfo> matchedServiceList = mContext.getPackageManager() Loading @@ -160,6 +163,7 @@ public class DisassociationProcessor { } } } } }); // If role is not in use by other associations, revoke the role. Loading
services/companion/java/com/android/server/companion/utils/RolesUtils.java +6 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,12 @@ public final class RolesUtils { PERMISSION_NEARBY_DEVICES, PERMISSION_POST_NOTIFICATIONS) ); public static final Set<String> NLS_PROFILES = Set.of( DEVICE_PROFILE_WATCH, DEVICE_PROFILE_GLASSES, DEVICE_PROFILE_APP_STREAMING, DEVICE_PROFILE_COMPUTER); private static final Set<String> ROLELESS_DEVICE_PROFILES; static { final Set<String> profiles = new ArraySet<>(); Loading