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
This commit is contained in:
Felipe Leme
2022-08-05 16:12:09 +00:00
parent d9131a60b5
commit 0fc2d3299a
4 changed files with 29 additions and 0 deletions

View File

@@ -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>

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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());