aboutsummaryrefslogtreecommitdiff
path: root/car-lib
diff options
context:
space:
mode:
authorYing Zheng <yizheng@google.com>2018-06-21 10:05:58 -0700
committerYing Zheng <yizheng@google.com>2018-06-21 12:49:00 -0700
commit2f2d640a62ef9afbfe147d85e44ac28a4cb8a1fc (patch)
tree0c61ed773ae44d2abcd90e63a700b221f40c8831 /car-lib
parent12eecfd9600c0f48b3652733f60c29e70ad6650b (diff)
downloadCar-2f2d640a62ef9afbfe147d85e44ac28a4cb8a1fc.tar.gz
Update set last active user to exclude ephemeral users.
Bug: 110156344,78908555 Test: Unit test Change-Id: I4975184ef47adaeb472ea295b7d433cee24ea3a4
Diffstat (limited to 'car-lib')
-rw-r--r--car-lib/src/android/car/user/CarUserManagerHelper.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/car-lib/src/android/car/user/CarUserManagerHelper.java b/car-lib/src/android/car/user/CarUserManagerHelper.java
index 41053536d3..a0f4e15d7b 100644
--- a/car-lib/src/android/car/user/CarUserManagerHelper.java
+++ b/car-lib/src/android/car/user/CarUserManagerHelper.java
@@ -161,7 +161,8 @@ public class CarUserManagerHelper {
}
/**
- * Get user id for the initial user to boot into.
+ * Get user id for the initial user to boot into. This is only applicable for headless
+ * user 0 model.
*
* <p>If failed to retrieve the id stored in global settings or the retrieved id does not
* exist on device, then return the user with smallest user id.
@@ -184,7 +185,8 @@ public class CarUserManagerHelper {
// If the last active user is system user or the user id doesn't exist on device,
// return the smallest id or all users.
if (lastActiveUserId == UserHandle.USER_SYSTEM || !isUserExist) {
- Log.e(TAG, "Can't get last active user id or the user no longer exist.");
+ Log.e(TAG, "Can't get last active user id or the user no longer exist, user id: ."
+ + lastActiveUserId);
lastActiveUserId = smallestUserId;
}
@@ -289,7 +291,7 @@ public class CarUserManagerHelper {
for (Iterator<UserInfo> iterator = users.iterator(); iterator.hasNext(); ) {
UserInfo userInfo = iterator.next();
if (userInfo.isEphemeral()) {
- // Remove user that is not admin.
+ // Remove user that is ephemeral.
iterator.remove();
}
}
@@ -417,6 +419,13 @@ public class CarUserManagerHelper {
}
/**
+ * Checks if the foreground user is ephemeral.
+ */
+ public boolean isForegroundUserEphemeral() {
+ return getCurrentForegroundUserInfo().isEphemeral();
+ }
+
+ /**
* Returns whether this user can be removed from the system.
*
* @param userInfo User to be removed