[DO NOT MERGE] Fixes CompanionDeviceManagerTest
Context: 'getCallingUserId' always return 0, but assocation was created and added to user under test (e.g. user 10, 11, etc). The main issue is in CompanionDeviceManagerService#updateAssociations when readAllAssocations is read using user 0 (the one retrieved via getCallinguserId, and not the user under test). Test switching user: 1. Create new user: `adb shell pm create-user "blah"` 2. Switch user: `adb shell am switch-user <id for blah>` 3. Run test again: `atest CompanionDeviceManagerTest` Fixes: 147898029 Test: atest CompanionDeviceManagerTest Test: tested switching user (see script above) Change-Id: I87aa504684277e7c03d84fe6a7f011f661f63d8a
This commit is contained in:
@@ -563,7 +563,8 @@ public class CompanionDeviceManagerService extends SystemService implements Bind
|
||||
if (DEBUG) {
|
||||
Log.i(LOG_TAG, "recordAssociation(" + association + ")");
|
||||
}
|
||||
updateAssociations(associations -> CollectionUtils.add(associations, association));
|
||||
updateAssociations(associations -> CollectionUtils.add(associations, association),
|
||||
association.userId);
|
||||
}
|
||||
|
||||
private void recordAssociation(String privilegedPackage, String deviceAddress) {
|
||||
|
||||
Reference in New Issue
Block a user