diff options
| author | 2023-01-18 18:57:52 +0000 | |
|---|---|---|
| committer | 2023-01-18 18:57:52 +0000 | |
| commit | 8ef411962a97bd935e7f9f11f2e280594b9d9012 (patch) | |
| tree | 4e0c88fbf591d8e0641b2c889906ca4af4219579 | |
| parent | d8b8823e5231d7bcbd24f631a7d1419660a1bd6c (diff) | |
| parent | b2cefd58ea80b0b6b7f4cfb4fb9948a5c0468488 (diff) | |
Merge "Removed UserManager.isSplitSystemUserMode() and its usage."
15 files changed, 36 insertions, 131 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 8c64e4046013..ce6100004679 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -908,8 +908,6 @@ package android.content.pm { method public boolean isProfile(); method public boolean isQuietModeEnabled(); method public boolean isRestricted(); - method public boolean isSystemOnly(); - method public static boolean isSystemOnly(int); method public boolean supportsSwitchTo(); method public boolean supportsSwitchToByUser(); method public void writeToParcel(android.os.Parcel, int); @@ -2032,7 +2030,6 @@ package android.os { method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS, android.Manifest.permission.QUERY_USERS}) public String getUserType(); method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public java.util.List<android.content.pm.UserInfo> getUsers(boolean, boolean, boolean); method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public boolean hasBaseUserRestriction(@NonNull String, @NonNull android.os.UserHandle); - method public static boolean isSplitSystemUser(); method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public boolean isUserTypeEnabled(@NonNull String); method public boolean isVisibleBackgroundUsersSupported(); method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public android.content.pm.UserInfo preCreateUser(@NonNull String) throws android.os.UserManager.UserOperationException; diff --git a/core/java/android/content/pm/UserInfo.java b/core/java/android/content/pm/UserInfo.java index 44747fabad97..e38cb65f991f 100644 --- a/core/java/android/content/pm/UserInfo.java +++ b/core/java/android/content/pm/UserInfo.java @@ -406,24 +406,6 @@ public class UserInfo implements Parcelable { } /** - * Returns true if the user is a split system user. - * <p>If {@link UserManager#isSplitSystemUser split system user mode} is not enabled, - * the method always returns false. - */ - public boolean isSystemOnly() { - return isSystemOnly(id); - } - - /** - * Returns true if the given user is a split system user. - * <p>If {@link UserManager#isSplitSystemUser split system user mode} is not enabled, - * the method always returns false. - */ - public static boolean isSystemOnly(int userId) { - return userId == UserHandle.USER_SYSTEM && UserManager.isSplitSystemUser(); - } - - /** * @return true if this user can be switched to. **/ public boolean supportsSwitchTo() { @@ -454,7 +436,7 @@ public class UserInfo implements Parcelable { if (isProfile() || isGuest() || isRestricted()) { return false; } - if (UserManager.isSplitSystemUser() || UserManager.isHeadlessSystemUserMode()) { + if (UserManager.isHeadlessSystemUserMode()) { return id != UserHandle.USER_SYSTEM; } else { return id == UserHandle.USER_SYSTEM; diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index 62d8fb29e697..9a25c703003c 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -65,7 +65,6 @@ import android.util.Log; import android.view.WindowManager.LayoutParams; import com.android.internal.R; -import com.android.internal.os.RoSystemProperties; import com.android.internal.util.FrameworkStatsLog; import java.io.IOException; @@ -2111,17 +2110,6 @@ public class UserManager { } /** - * @hide - * @return Whether the device is running with split system user. It means the system user and - * primary user are two separate users. Previously system user and primary user are combined as - * a single owner user. see @link {android.os.UserHandle#USER_OWNER} - */ - @TestApi - public static boolean isSplitSystemUser() { - return RoSystemProperties.FW_SYSTEM_USER_SPLIT; - } - - /** * @return Whether guest user is always ephemeral * @hide */ diff --git a/core/java/com/android/internal/os/RoSystemProperties.java b/core/java/com/android/internal/os/RoSystemProperties.java index af205d2a7e0b..40d5c4761dff 100644 --- a/core/java/com/android/internal/os/RoSystemProperties.java +++ b/core/java/com/android/internal/os/RoSystemProperties.java @@ -50,9 +50,6 @@ public class RoSystemProperties { public static final boolean CONFIG_SMALL_BATTERY = SystemProperties.getBoolean("ro.config.small_battery", false); - // ------ ro.fw.* ------------ // - public static final boolean FW_SYSTEM_USER_SPLIT = - SystemProperties.getBoolean("ro.fw.system_user_split", false); /** * Indicates whether the device should run in headless system user mode, * in which user 0 only runs the system, not a real user. diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 3c305f6e443e..86fd9569c61e 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -619,12 +619,11 @@ public class LockPatternUtils { } boolean disabledByDefault = mContext.getResources().getBoolean( com.android.internal.R.bool.config_disableLockscreenByDefault); - boolean isSystemUser = UserManager.isSplitSystemUser() && userId == UserHandle.USER_SYSTEM; UserInfo userInfo = getUserManager().getUserInfo(userId); boolean isDemoUser = UserManager.isDeviceInDemoMode(mContext) && userInfo != null && userInfo.isDemo(); return getBoolean(DISABLE_LOCKSCREEN_KEY, false, userId) - || (disabledByDefault && !isSystemUser) + || disabledByDefault || isDemoUser; } diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/handheld/UninstallAlertDialogFragment.java b/packages/PackageInstaller/src/com/android/packageinstaller/handheld/UninstallAlertDialogFragment.java index 21f4be0004f4..1bbdad5ddfc8 100644 --- a/packages/PackageInstaller/src/com/android/packageinstaller/handheld/UninstallAlertDialogFragment.java +++ b/packages/PackageInstaller/src/com/android/packageinstaller/handheld/UninstallAlertDialogFragment.java @@ -275,8 +275,11 @@ public class UninstallAlertDialogFragment extends DialogFragment implements } /** - * Returns whether there is only one user on this device, not including - * the system-only user. + * Returns whether there is only one "full" user on this device. + * + * <p><b>Note:</b> on devices that use {@link android.os.UserManager#isHeadlessSystemUserMode() + * headless system user mode}, the system user is not "full", so it's not be considered in the + * calculation. */ private boolean isSingleUser(UserManager userManager) { final int userCount = userManager.getUserCount(); diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/television/UninstallAlertFragment.java b/packages/PackageInstaller/src/com/android/packageinstaller/television/UninstallAlertFragment.java index 5c5720a61186..cc2e3a600a7a 100644 --- a/packages/PackageInstaller/src/com/android/packageinstaller/television/UninstallAlertFragment.java +++ b/packages/PackageInstaller/src/com/android/packageinstaller/television/UninstallAlertFragment.java @@ -128,8 +128,7 @@ public class UninstallAlertFragment extends GuidedStepFragment { } /** - * Returns whether there is only one user on this device, not including - * the system-only user. + * Returns whether there is only one user on this device. */ private boolean isSingleUser(UserManager userManager) { final int userCount = userManager.getUserCount(); diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 18854e513bed..a120e17f1126 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -148,12 +148,12 @@ import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.UserSwitcherController; import com.android.systemui.util.DeviceConfigProxy; +import dagger.Lazy; + import java.io.PrintWriter; import java.util.ArrayList; import java.util.concurrent.Executor; -import dagger.Lazy; - /** * Mediates requests related to the keyguard. This includes queries about the * state of the keyguard, power management events that effect whether the keyguard @@ -589,12 +589,6 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, @Override public void onDeviceProvisioned() { sendUserPresentBroadcast(); - synchronized (KeyguardViewMediator.this) { - // If system user is provisioned, we might want to lock now to avoid showing launcher - if (mustNotUnlockCurrentUser()) { - doKeyguardLocked(null); - } - } } @Override @@ -1265,11 +1259,6 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mPM.userActivity(SystemClock.uptimeMillis(), false); } - boolean mustNotUnlockCurrentUser() { - return UserManager.isSplitSystemUser() - && KeyguardUpdateMonitor.getCurrentUser() == UserHandle.USER_SYSTEM; - } - private void setupLocked() { mShowKeyguardWakeLock = mPM.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "show keyguard"); mShowKeyguardWakeLock.setReferenceCounted(false); @@ -1947,31 +1936,28 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, } } - // In split system user mode, we never unlock system user. - if (!mustNotUnlockCurrentUser() - || !mUpdateMonitor.isDeviceProvisioned()) { + // if the setup wizard hasn't run yet, don't show + final boolean requireSim = !SystemProperties.getBoolean("keyguard.no_require_sim", false); + final boolean absent = SubscriptionManager.isValidSubscriptionId( + mUpdateMonitor.getNextSubIdForState(TelephonyManager.SIM_STATE_ABSENT)); + final boolean disabled = SubscriptionManager.isValidSubscriptionId( + mUpdateMonitor.getNextSubIdForState(TelephonyManager.SIM_STATE_PERM_DISABLED)); + final boolean lockedOrMissing = mUpdateMonitor.isSimPinSecure() + || ((absent || disabled) && requireSim); - // if the setup wizard hasn't run yet, don't show - final boolean requireSim = !SystemProperties.getBoolean("keyguard.no_require_sim", false); - final boolean absent = SubscriptionManager.isValidSubscriptionId( - mUpdateMonitor.getNextSubIdForState(TelephonyManager.SIM_STATE_ABSENT)); - final boolean disabled = SubscriptionManager.isValidSubscriptionId( - mUpdateMonitor.getNextSubIdForState(TelephonyManager.SIM_STATE_PERM_DISABLED)); - final boolean lockedOrMissing = mUpdateMonitor.isSimPinSecure() - || ((absent || disabled) && requireSim); - - if (!lockedOrMissing && shouldWaitForProvisioning()) { - if (DEBUG) Log.d(TAG, "doKeyguard: not showing because device isn't provisioned" - + " and the sim is not locked or missing"); - return; + if (!lockedOrMissing && shouldWaitForProvisioning()) { + if (DEBUG) { + Log.d(TAG, "doKeyguard: not showing because device isn't provisioned and the sim is" + + " not locked or missing"); } + return; + } - boolean forceShow = options != null && options.getBoolean(OPTION_FORCE_SHOW, false); - if (mLockPatternUtils.isLockScreenDisabled(KeyguardUpdateMonitor.getCurrentUser()) - && !lockedOrMissing && !forceShow) { - if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off"); - return; - } + boolean forceShow = options != null && options.getBoolean(OPTION_FORCE_SHOW, false); + if (mLockPatternUtils.isLockScreenDisabled(KeyguardUpdateMonitor.getCurrentUser()) + && !lockedOrMissing && !forceShow) { + if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off"); + return; } if (DEBUG) Log.d(TAG, "doKeyguard: showing the lock screen"); @@ -2539,15 +2525,6 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, synchronized (KeyguardViewMediator.this) { if (DEBUG) Log.d(TAG, "handleHide"); - if (mustNotUnlockCurrentUser()) { - // In split system user mode, we never unlock system user. The end user has to - // switch to another user. - // TODO: We should stop it early by disabling the swipe up flow. Right now swipe up - // still completes and makes the screen blank. - if (DEBUG) Log.d(TAG, "Split system user, quit unlocking."); - mKeyguardExitAnimationRunner = null; - return; - } mHiding = true; if (mShowing && !mOccluded) { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt index a92540d733b5..6679b2221119 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt @@ -20,8 +20,6 @@ import android.content.res.ColorStateList import android.hardware.biometrics.BiometricSourceType import android.os.Handler import android.os.Trace -import android.os.UserHandle -import android.os.UserManager import android.view.View import com.android.keyguard.KeyguardSecurityModel import com.android.keyguard.KeyguardUpdateMonitor @@ -134,12 +132,6 @@ constructor( return } - val keyguardUserId = KeyguardUpdateMonitor.getCurrentUser() - if (keyguardUserId == UserHandle.USER_SYSTEM && UserManager.isSplitSystemUser()) { - // In split system user mode, we never unlock system user. - return - } - Trace.beginSection("KeyguardBouncer#show") repository.setPrimaryScrimmed(isScrimmed) if (isScrimmed) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index d31875935dd3..6873de735015 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -26,8 +26,6 @@ import android.content.res.ColorStateList; import android.hardware.biometrics.BiometricSourceType; import android.os.Handler; import android.os.Trace; -import android.os.UserHandle; -import android.os.UserManager; import android.util.Log; import android.view.KeyEvent; import android.view.View; @@ -177,11 +175,6 @@ public class KeyguardBouncer { */ public void show(boolean resetSecuritySelection, boolean isScrimmed) { final int keyguardUserId = KeyguardUpdateMonitor.getCurrentUser(); - if (keyguardUserId == UserHandle.USER_SYSTEM && UserManager.isSplitSystemUser()) { - // In split system user mode, we never unlock system user. - return; - } - try { Trace.beginSection("KeyguardBouncer#show"); @@ -212,9 +205,7 @@ public class KeyguardBouncer { } final int activeUserId = KeyguardUpdateMonitor.getCurrentUser(); - final boolean isSystemUser = - UserManager.isSplitSystemUser() && activeUserId == UserHandle.USER_SYSTEM; - final boolean allowDismissKeyguard = !isSystemUser && activeUserId == keyguardUserId; + final boolean allowDismissKeyguard = activeUserId == keyguardUserId; // If allowed, try to dismiss the Keyguard. If no security auth (password/pin/pattern) // is set, this will dismiss the whole Keyguard. Otherwise, show the bouncer. diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java index 35b5f1b05788..c16314b6a117 100644 --- a/services/core/java/com/android/server/accounts/AccountManagerService.java +++ b/services/core/java/com/android/server/accounts/AccountManagerService.java @@ -1491,13 +1491,7 @@ public class AccountManagerService Account[] sharedAccounts = getSharedAccountsAsUser(userId); if (sharedAccounts == null || sharedAccounts.length == 0) return; Account[] accounts = getAccountsAsUser(null, userId, mContext.getOpPackageName()); - int parentUserId = UserManager.isSplitSystemUser() - ? getUserManager().getUserInfo(userId).restrictedProfileParentId - : UserHandle.USER_SYSTEM; - if (parentUserId < 0) { - Log.w(TAG, "User " + userId + " has shared accounts, but no parent user"); - return; - } + int parentUserId = UserHandle.USER_SYSTEM; for (Account sa : sharedAccounts) { if (ArrayUtils.contains(accounts, sa)) continue; // Account doesn't exist. Copy it now. diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index d2b50f67a3e4..8dc20844e1b8 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -8471,10 +8471,7 @@ public class ActivityManagerService extends IActivityManager.Stub // Enable home activity for system user, so that the system can always boot. We don't // do this when the system user is not setup since the setup wizard should be the one // to handle home activity in this case. - if (UserManager.isSplitSystemUser() && - Settings.Secure.getIntForUser(mContext.getContentResolver(), - Settings.Secure.USER_SETUP_COMPLETE, 0, currentUserId) != 0 - || SystemProperties.getBoolean(SYSTEM_USER_HOME_NEEDED, false)) { + if (SystemProperties.getBoolean(SYSTEM_USER_HOME_NEEDED, false)) { t.traceBegin("enableHomeActivity"); ComponentName cName = new ComponentName(mContext, SystemUserHomeActivity.class); try { diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java index f61737e3f549..3df060b2b47d 100644 --- a/services/core/java/com/android/server/am/UserController.java +++ b/services/core/java/com/android/server/am/UserController.java @@ -555,12 +555,6 @@ class UserController implements Handler.Callback { // This user is already stopping, doesn't count. continue; } - if (userId == UserHandle.USER_SYSTEM) { - // We only count system user as running when it is not a pure system user. - if (UserInfo.isSystemOnly(userId)) { - continue; - } - } runningUsers.add(userId); } return runningUsers; diff --git a/services/core/java/com/android/server/am/UserSwitchingDialog.java b/services/core/java/com/android/server/am/UserSwitchingDialog.java index 7a6603d1f243..a5651bfa3dde 100644 --- a/services/core/java/com/android/server/am/UserSwitchingDialog.java +++ b/services/core/java/com/android/server/am/UserSwitchingDialog.java @@ -95,9 +95,7 @@ class UserSwitchingDialog extends AlertDialog R.layout.user_switching_dialog, null); String viewMessage = null; - if (UserManager.isSplitSystemUser() && mNewUser.id == UserHandle.USER_SYSTEM) { - viewMessage = res.getString(R.string.user_logging_out_message, mOldUser.name); - } else if (UserManager.isDeviceInDemoMode(mContext)) { + if (UserManager.isDeviceInDemoMode(mContext)) { if (mOldUser.isDemo()) { viewMessage = res.getString(R.string.demo_restarting_message); } else { diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java index 53a5648c8403..d7b761d289a7 100644 --- a/services/core/java/com/android/server/pm/UserManagerService.java +++ b/services/core/java/com/android/server/pm/UserManagerService.java @@ -3718,14 +3718,12 @@ public class UserManagerService extends IUserManager.Stub { } if (userVersion < 6) { - final boolean splitSystemUser = UserManager.isSplitSystemUser(); synchronized (mUsersLock) { for (int i = 0; i < mUsers.size(); i++) { UserData userData = mUsers.valueAt(i); - // In non-split mode, only user 0 can have restricted profiles - if (!splitSystemUser && userData.info.isRestricted() - && (userData.info.restrictedProfileParentId - == UserInfo.NO_PROFILE_GROUP_ID)) { + // Only system user can have restricted profiles + if (userData.info.isRestricted() && (userData.info.restrictedProfileParentId + == UserInfo.NO_PROFILE_GROUP_ID)) { userData.info.restrictedProfileParentId = UserHandle.USER_SYSTEM; userIdsToWrite.add(userData.info.id); } @@ -6496,7 +6494,6 @@ public class UserManagerService extends IUserManager.Stub { pw.println(" All guests ephemeral: " + Resources.getSystem().getBoolean( com.android.internal.R.bool.config_guestUserEphemeral)); pw.println(" Force ephemeral users: " + mForceEphemeralUsers); - pw.println(" Is split-system user: " + UserManager.isSplitSystemUser()); final boolean isHeadlessSystemUserMode = isHeadlessSystemUserMode(); pw.println(" Is headless-system mode: " + isHeadlessSystemUserMode); if (isHeadlessSystemUserMode != RoSystemProperties.MULTIUSER_HEADLESS_SYSTEM_USER) { |