Merge "Add a system config flag for making all guests ephemeral."
This commit is contained in:
committed by
Android (Google) Code Review
commit
9c844b13ef
@@ -2442,4 +2442,7 @@
|
||||
<integer name="config_jobSchedulerInactivityIdleThreshold">4260000</integer>
|
||||
<!-- The alarm window (in milliseconds) that JobScheduler uses to enter the idle state -->
|
||||
<integer name="config_jobSchedulerIdleWindowSlop">300000</integer>
|
||||
|
||||
<!-- If true, all guest users created on the device will be ephemeral. -->
|
||||
<bool name="config_guestUserEphemeral">false</bool>
|
||||
</resources>
|
||||
|
||||
@@ -305,6 +305,7 @@
|
||||
<java-symbol type="bool" name="config_supportSpeakerNearUltrasound" />
|
||||
<java-symbol type="bool" name="config_supportAudioSourceUnprocessed" />
|
||||
<java-symbol type="bool" name="config_freeformWindowManagement" />
|
||||
<java-symbol type="bool" name="config_guestUserEphemeral" />
|
||||
<java-symbol type="string" name="config_defaultPictureInPictureBounds" />
|
||||
<java-symbol type="string" name="config_centeredPictureInPictureBounds" />
|
||||
<java-symbol type="integer" name="config_wifi_framework_5GHz_preference_boost_threshold" />
|
||||
|
||||
@@ -32,6 +32,7 @@ import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
@@ -1841,7 +1842,11 @@ public class UserManagerService extends IUserManager.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
if (parent != null && parent.info.isEphemeral()) {
|
||||
// Add ephemeral flag to guests if required. Also inherit it from parent.
|
||||
boolean ephemeralGuests = Resources.getSystem()
|
||||
.getBoolean(com.android.internal.R.bool.config_guestUserEphemeral);
|
||||
if ((isGuest && ephemeralGuests)
|
||||
|| (parent != null && parent.info.isEphemeral())) {
|
||||
flags |= UserInfo.FLAG_EPHEMERAL;
|
||||
}
|
||||
userId = getNextAvailableId();
|
||||
@@ -2800,6 +2805,8 @@ public class UserManagerService extends IUserManager.Stub {
|
||||
pw.println();
|
||||
pw.println(" Max users: " + UserManager.getMaxSupportedUsers());
|
||||
pw.println(" Supports switchable users: " + UserManager.supportsMultipleUsers());
|
||||
pw.println(" All guests ephemeral: " + Resources.getSystem().getBoolean(
|
||||
com.android.internal.R.bool.config_guestUserEphemeral));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user