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

Commit 0fc2d329 authored by Felipe Leme's avatar Felipe Leme
Browse files

Added UserManager.isUsersOnSecondaryDisplaysSupported()

By default it reads the value from
config_multiuserUsersOnSecondaryDisplays
overridden by the system property for development purposes.

Test: adb shell setprop fw.users_on_secondary_displays true && \
      adb shell dumpsys user | grep -i "secondary display"

Fixes: 240613396

Change-Id: I1428a117a683e99fcaef71492be297c844d520e2
parent d9131a60
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -2837,6 +2837,26 @@ public class UserManager {
        }
    }

    /**
     * @hide
     */
    public static boolean isUsersOnSecondaryDisplaysEnabled() {
        return SystemProperties.getBoolean("fw.users_on_secondary_displays",
                Resources.getSystem()
                        .getBoolean(R.bool.config_multiuserUsersOnSecondaryDisplays));
    }

    /**
     * Returns whether the device allows users to run (and launch activities) on secondary displays.
     *
     * @return {@code false} for most devices, except automotive vehicles with passenger displays.
     *
     * @hide
     */
    public boolean isUsersOnSecondaryDisplaysSupported() {
        return isUsersOnSecondaryDisplaysEnabled();
    }

    /**
     * Return whether the context user is running in an "unlocked" state.
     * <p>
+4 −0
Original line number Diff line number Diff line
@@ -2629,6 +2629,10 @@
         will be locked. -->
    <bool name="config_multiuserDelayUserDataLocking">false</bool>

    <!-- Whether the device allows users to start in background on secondary displays.
         Should be false for most devices, except automotive vehicle with passenger displays. -->
    <bool name="config_multiuserUsersOnSecondaryDisplays">false</bool>

    <!-- Whether to automatically switch a non-primary user back to the primary user after a
         timeout when the device is docked.  -->
    <bool name="config_enableTimeoutToUserZeroWhenDocked">false</bool>
+1 −0
Original line number Diff line number Diff line
@@ -453,6 +453,7 @@
  <java-symbol type="integer" name="config_multiuserMaximumUsers" />
  <java-symbol type="integer" name="config_multiuserMaxRunningUsers" />
  <java-symbol type="bool" name="config_multiuserDelayUserDataLocking" />
  <java-symbol type="bool" name="config_multiuserUsersOnSecondaryDisplays" />
  <java-symbol type="bool" name="config_enableTimeoutToUserZeroWhenDocked" />
  <java-symbol type="integer" name="config_userTypePackageWhitelistMode"/>
  <java-symbol type="xml" name="config_user_types" />
+4 −0
Original line number Diff line number Diff line
@@ -6010,6 +6010,10 @@ public class UserManagerService extends IUserManager.Stub {

        } // synchronized (mPackagesLock)

        // Multiple Users on Multiple Display info
        pw.println("  Supports users on secondary displays: "
                + UserManager.isUsersOnSecondaryDisplaysEnabled());

        // Dump some capabilities
        pw.println();
        pw.print("  Max users: " + UserManager.getMaxSupportedUsers());