Implements profile selection tab in Storage Settings
- StorageDashboardFragment and StorageItemPreferenceController works only
for one profile per instance.
- StorageAsyncLoader loads for all users(profiles) and regards each user independent.
- SecondaryUserController will not load personal profile user in work profile tab.
- Cleanup some unused profile related files.
Bug: 174964885
Test: atest com.android.settings.deviceinfo
atest com.android.settings.deviceinfo.storage
make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.deviceinfo
make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.deviceinfo.storage
Change-Id: I8361c29bc240c519c7261b19522c41439479c1c2
Merged-In: I8361c29bc240c519c7261b19522c41439479c1c2
This commit is contained in:
@@ -469,6 +469,19 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
return UserHandle.USER_NULL;
|
||||
}
|
||||
|
||||
/** Returns user ID of current user, throws IllegalStateException if it's not available. */
|
||||
public static int getCurrentUserId(UserManager userManager, boolean isWorkProfile)
|
||||
throws IllegalStateException {
|
||||
if (isWorkProfile) {
|
||||
final UserHandle managedUserHandle = getManagedProfile(userManager);
|
||||
if (managedUserHandle == null) {
|
||||
throw new IllegalStateException("Work profile user ID is not available.");
|
||||
}
|
||||
return managedUserHandle.getIdentifier();
|
||||
}
|
||||
return UserHandle.myUserId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the target user for a Settings activity.
|
||||
* <p>
|
||||
|
||||
Reference in New Issue
Block a user