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

@@ -60,7 +60,7 @@ public class ScreenSaverPreferenceControllerTest {
when(mResources.getBoolean(
com.android.internal.R.bool.config_dreamsSupported)).thenReturn(true);
when(mResources.getBoolean(
com.android.internal.R.bool.config_dreamsOnlyEnabledForSystemUser))
com.android.internal.R.bool.config_dreamsOnlyEnabledForDockUser))
.thenReturn(false);
when(mUserManager.isSystemUser()).thenReturn(true);
assertTrue(mController.isAvailable());
@@ -71,7 +71,7 @@ public class ScreenSaverPreferenceControllerTest {
when(mResources.getBoolean(
com.android.internal.R.bool.config_dreamsSupported)).thenReturn(true);
when(mResources.getBoolean(
com.android.internal.R.bool.config_dreamsOnlyEnabledForSystemUser))
com.android.internal.R.bool.config_dreamsOnlyEnabledForDockUser))
.thenReturn(false);
when(mUserManager.isSystemUser()).thenReturn(false);
assertTrue(mController.isAvailable());
@@ -82,7 +82,7 @@ public class ScreenSaverPreferenceControllerTest {
when(mResources.getBoolean(
com.android.internal.R.bool.config_dreamsSupported)).thenReturn(false);
when(mResources.getBoolean(
com.android.internal.R.bool.config_dreamsOnlyEnabledForSystemUser))
com.android.internal.R.bool.config_dreamsOnlyEnabledForDockUser))
.thenReturn(false);
when(mUserManager.isSystemUser()).thenReturn(true);
assertFalse(mController.isAvailable());
@@ -93,7 +93,7 @@ public class ScreenSaverPreferenceControllerTest {
when(mResources.getBoolean(
com.android.internal.R.bool.config_dreamsSupported)).thenReturn(true);
when(mResources.getBoolean(
com.android.internal.R.bool.config_dreamsOnlyEnabledForSystemUser))
com.android.internal.R.bool.config_dreamsOnlyEnabledForDockUser))
.thenReturn(true);
when(mUserManager.isSystemUser()).thenReturn(true);
assertTrue(mController.isAvailable());
@@ -104,7 +104,7 @@ public class ScreenSaverPreferenceControllerTest {
when(mResources.getBoolean(
com.android.internal.R.bool.config_dreamsSupported)).thenReturn(true);
when(mResources.getBoolean(
com.android.internal.R.bool.config_dreamsOnlyEnabledForSystemUser))
com.android.internal.R.bool.config_dreamsOnlyEnabledForDockUser))
.thenReturn(true);
when(mUserManager.isSystemUser()).thenReturn(false);
assertFalse(mController.isAvailable());