Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c844b13 authored by Lenka Trochtova's avatar Lenka Trochtova Committed by Android (Google) Code Review
Browse files

Merge "Add a system config flag for making all guests ephemeral."

parents 6771fc41 02fee15d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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>
+1 −0
Original line number Diff line number Diff line
@@ -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" />
+8 −1
Original line number Diff line number Diff line
@@ -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));
        }
    }