Return true only if the userManager belongs to private profile
The existing code asks the main user's userManager if there's a private profile belonging to it. If a private profile exists then the answer to that question will always be true. So, we always end up showing the apps from the private profile for the personal case. We should instead ask the userManager if it belongs to the private profile or not. Bug: 327598131 Test: manual Change-Id: I7bc9d58c371341235579d3456b54ea85f598892b
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package com.android.settings.applications.credentials;
|
||||
|
||||
import android.os.UserManager;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.dashboard.profileselector.ProfileSelectFragment.ProfileType;
|
||||
@@ -33,13 +32,6 @@ public class DefaultCombinedPickerPrivate extends DefaultCombinedPicker {
|
||||
|
||||
/** Returns whether the user is handled by this fragment. */
|
||||
public static boolean isUserHandledByFragment(UserManager userManager) {
|
||||
try {
|
||||
// If there is no private profile then this will throw an exception.
|
||||
Utils.getCurrentUserIdOfType(userManager, ProfileType.PRIVATE);
|
||||
return true;
|
||||
} catch (IllegalStateException e) {
|
||||
Slog.e(TAG, "Failed to get private profile user id", e);
|
||||
return false;
|
||||
}
|
||||
return android.os.Flags.allowPrivateProfile() && userManager.isPrivateProfile();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user