summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Felipe Leme <felipeal@google.com> 2022-12-21 17:00:33 -0800
committer Felipe Leme <felipeal@google.com> 2023-01-09 18:42:15 -0800
commitb2cefd58ea80b0b6b7f4cfb4fb9948a5c0468488 (patch)
tree6fb73fbc35633fdb9c3dc2191d3d8a274be22f43
parent3fac68878094401df00a04890a9e1fe0a85a855b (diff)
Removed UserManager.isSplitSystemUserMode() and its usage.
This mode was never really supported. Test: build and boot Fixes: 137101239 Change-Id: If000b29c12a6658d9e9aa68acfef6aff2a2cac92
-rw-r--r--core/api/test-current.txt3
-rw-r--r--core/java/android/content/pm/UserInfo.java20
-rw-r--r--core/java/android/os/UserManager.java12
-rw-r--r--core/java/com/android/internal/os/RoSystemProperties.java3
-rw-r--r--core/java/com/android/internal/widget/LockPatternUtils.java3
-rw-r--r--packages/PackageInstaller/src/com/android/packageinstaller/handheld/UninstallAlertDialogFragment.java7
-rw-r--r--packages/PackageInstaller/src/com/android/packageinstaller/television/UninstallAlertFragment.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java65
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java11
-rw-r--r--services/core/java/com/android/server/accounts/AccountManagerService.java8
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java5
-rw-r--r--services/core/java/com/android/server/am/UserController.java6
-rw-r--r--services/core/java/com/android/server/am/UserSwitchingDialog.java4
-rw-r--r--services/core/java/com/android/server/pm/UserManagerService.java9
15 files changed, 36 insertions, 131 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index e3554a5aa043..901235222a44 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -906,8 +906,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);
@@ -2029,7 +2027,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 2be0323a1e8b..929e22686580 100644
--- a/core/java/android/content/pm/UserInfo.java
+++ b/core/java/android/content/pm/UserInfo.java
@@ -389,24 +389,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() {
@@ -437,7 +419,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 fc0252487814..0d825be3fe50 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;
@@ -2068,17 +2067,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 6870d09c8a7f..bfc49cb5c1ee 100644
--- a/core/java/com/android/internal/os/RoSystemProperties.java
+++ b/core/java/com/android/internal/os/RoSystemProperties.java
@@ -48,9 +48,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 91a5d3a0041c..ea13615efeed 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -624,12 +624,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 3d4347efd17d..9c4aabd36ed0 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -144,12 +144,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
@@ -577,12 +577,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
@@ -1240,11 +1234,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);
@@ -1911,31 +1900,28 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
return;
}
- // 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");
@@ -2500,15 +2486,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 2cf5fb98d07e..5728ca3975b8 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 000fe140882c..57cb9aedb6d2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
@@ -24,8 +24,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;
@@ -181,11 +179,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");
@@ -216,9 +209,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 88492edc9a73..67055858e820 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 fc6d30bf58c9..bc85adeeff60 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -8447,10 +8447,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 234eec387590..7b108adc7a55 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 6bac90532645..21dddc69de1a 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -3677,14 +3677,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);
}
@@ -6435,7 +6433,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) {