Loading services/companion/java/com/android/server/companion/CompanionApplicationController.java +24 −17 Original line number Diff line number Diff line Loading @@ -108,8 +108,16 @@ class CompanionApplicationController { final List<ComponentName> companionServices = mCompanionServicesRegister.forPackage(userId, packageName); final List<CompanionDeviceServiceConnector> serviceConnectors; if (companionServices.isEmpty()) { Slog.w(TAG, "Can not bind companion applications u" + userId + "/" + packageName + ": " + "eligible CompanionDeviceService not found.\n" + "A CompanionDeviceService should declare an intent-filter for " + "\"android.companion.CompanionDeviceService\" action and require " + "\"android.permission.BIND_COMPANION_DEVICE_SERVICE\" permission."); return; } final List<CompanionDeviceServiceConnector> serviceConnectors; synchronized (mBoundCompanionApplications) { if (mBoundCompanionApplications.containsValueForPackage(userId, packageName)) { if (DEBUG) Log.e(TAG, "u" + userId + "/" + packageName + " is ALREADY bound."); Loading @@ -118,13 +126,6 @@ class CompanionApplicationController { serviceConnectors = CollectionUtils.map(companionServices, componentName -> new CompanionDeviceServiceConnector(mContext, userId, componentName)); if (serviceConnectors.isEmpty()) { Slog.e(TAG, "Can't find CompanionDeviceService implementer in package: " + packageName + ". Please check if they are correctly declared."); return; } mBoundCompanionApplications.setValueForPackage(userId, packageName, serviceConnectors); } Loading @@ -145,7 +146,11 @@ class CompanionApplicationController { serviceConnectors = mBoundCompanionApplications.removePackage(userId, packageName); } if (serviceConnectors == null) { if (DEBUG) Log.e(TAG, "u" + userId + "/" + packageName + " is NOT bound"); if (DEBUG) { Log.e(TAG, "unbindCompanionApplication(): " + "u" + userId + "/" + packageName + " is NOT bound"); Log.d(TAG, "Stacktrace", new Throwable()); } return; } Loading Loading @@ -191,7 +196,11 @@ class CompanionApplicationController { final CompanionDeviceServiceConnector primaryServiceConnector = getPrimaryServiceConnector(userId, packageName); if (primaryServiceConnector == null) { if (DEBUG) Log.e(TAG, "u" + userId + "/" + packageName + " is NOT bound."); if (DEBUG) { Log.e(TAG, "notify_CompanionApplicationDevice_Appeared(): " + "u" + userId + "/" + packageName + " is NOT bound."); Log.d(TAG, "Stacktrace", new Throwable()); } return; } Loading @@ -209,7 +218,11 @@ class CompanionApplicationController { final CompanionDeviceServiceConnector primaryServiceConnector = getPrimaryServiceConnector(userId, packageName); if (primaryServiceConnector == null) { if (DEBUG) Log.e(TAG, "u" + userId + "/" + packageName + " is NOT bound."); if (DEBUG) { Log.e(TAG, "notify_CompanionApplicationDevice_Disappeared(): " + "u" + userId + "/" + packageName + " is NOT bound."); Log.d(TAG, "Stacktrace", new Throwable()); } return; } Loading Loading @@ -253,12 +266,6 @@ class CompanionApplicationController { return forUser(userId).getOrDefault(packageName, Collections.emptyList()); } synchronized @NonNull ComponentName primaryForPackage( @UserIdInt int userId, @NonNull String packageName) { // The primary service is always at the head of the list. return forPackage(userId, packageName).get(0); } synchronized void invalidate(@UserIdInt int userId) { remove(userId); } Loading Loading
services/companion/java/com/android/server/companion/CompanionApplicationController.java +24 −17 Original line number Diff line number Diff line Loading @@ -108,8 +108,16 @@ class CompanionApplicationController { final List<ComponentName> companionServices = mCompanionServicesRegister.forPackage(userId, packageName); final List<CompanionDeviceServiceConnector> serviceConnectors; if (companionServices.isEmpty()) { Slog.w(TAG, "Can not bind companion applications u" + userId + "/" + packageName + ": " + "eligible CompanionDeviceService not found.\n" + "A CompanionDeviceService should declare an intent-filter for " + "\"android.companion.CompanionDeviceService\" action and require " + "\"android.permission.BIND_COMPANION_DEVICE_SERVICE\" permission."); return; } final List<CompanionDeviceServiceConnector> serviceConnectors; synchronized (mBoundCompanionApplications) { if (mBoundCompanionApplications.containsValueForPackage(userId, packageName)) { if (DEBUG) Log.e(TAG, "u" + userId + "/" + packageName + " is ALREADY bound."); Loading @@ -118,13 +126,6 @@ class CompanionApplicationController { serviceConnectors = CollectionUtils.map(companionServices, componentName -> new CompanionDeviceServiceConnector(mContext, userId, componentName)); if (serviceConnectors.isEmpty()) { Slog.e(TAG, "Can't find CompanionDeviceService implementer in package: " + packageName + ". Please check if they are correctly declared."); return; } mBoundCompanionApplications.setValueForPackage(userId, packageName, serviceConnectors); } Loading @@ -145,7 +146,11 @@ class CompanionApplicationController { serviceConnectors = mBoundCompanionApplications.removePackage(userId, packageName); } if (serviceConnectors == null) { if (DEBUG) Log.e(TAG, "u" + userId + "/" + packageName + " is NOT bound"); if (DEBUG) { Log.e(TAG, "unbindCompanionApplication(): " + "u" + userId + "/" + packageName + " is NOT bound"); Log.d(TAG, "Stacktrace", new Throwable()); } return; } Loading Loading @@ -191,7 +196,11 @@ class CompanionApplicationController { final CompanionDeviceServiceConnector primaryServiceConnector = getPrimaryServiceConnector(userId, packageName); if (primaryServiceConnector == null) { if (DEBUG) Log.e(TAG, "u" + userId + "/" + packageName + " is NOT bound."); if (DEBUG) { Log.e(TAG, "notify_CompanionApplicationDevice_Appeared(): " + "u" + userId + "/" + packageName + " is NOT bound."); Log.d(TAG, "Stacktrace", new Throwable()); } return; } Loading @@ -209,7 +218,11 @@ class CompanionApplicationController { final CompanionDeviceServiceConnector primaryServiceConnector = getPrimaryServiceConnector(userId, packageName); if (primaryServiceConnector == null) { if (DEBUG) Log.e(TAG, "u" + userId + "/" + packageName + " is NOT bound."); if (DEBUG) { Log.e(TAG, "notify_CompanionApplicationDevice_Disappeared(): " + "u" + userId + "/" + packageName + " is NOT bound."); Log.d(TAG, "Stacktrace", new Throwable()); } return; } Loading Loading @@ -253,12 +266,6 @@ class CompanionApplicationController { return forUser(userId).getOrDefault(packageName, Collections.emptyList()); } synchronized @NonNull ComponentName primaryForPackage( @UserIdInt int userId, @NonNull String packageName) { // The primary service is always at the head of the list. return forPackage(userId, packageName).get(0); } synchronized void invalidate(@UserIdInt int userId) { remove(userId); } Loading