Introduce concept of DockUser

Dreams and docking often refers to "user zero" or "system user".
But more generally, the special user for dreams or switching-to-on-docking
need not be user 0, and in fact won't be in certain modes. So this needs updating.

Test: the files mentioned in the topic
Bug: 257333623
Change-Id: If068aa79a770bed4abf3f7ca1859a95cd1eb4ecd
Merged-In: If068aa79a770bed4abf3f7ca1859a95cd1eb4ecd
This commit is contained in:
Adam Bookatz
2022-11-07 10:51:01 -08:00
parent e4b09e55ca
commit e5e232428d
11 changed files with 63 additions and 60 deletions

View File

@@ -39,9 +39,10 @@ public class ScreenSaverPreferenceController extends AbstractPreferenceControlle
public boolean isAvailable() {
final boolean dreamsSupported = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_dreamsSupported);
final boolean dreamsOnlyEnabledForSystemUser = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_dreamsOnlyEnabledForSystemUser);
return dreamsSupported && (!dreamsOnlyEnabledForSystemUser || isSystemUser());
final boolean dreamsOnlyEnabledForDockUser = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_dreamsOnlyEnabledForDockUser);
// TODO(b/257333623): Allow the Dock User to be non-SystemUser user in HSUM.
return dreamsSupported && (!dreamsOnlyEnabledForDockUser || isSystemUser());
}
@Override