Loading packages/SystemUI/src/com/android/systemui/user/domain/interactor/UserInteractor.kt +3 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.content.pm.UserInfo import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable import android.graphics.drawable.Icon import android.os.Process import android.os.RemoteException import android.os.UserHandle import android.os.UserManager Loading Loading @@ -334,6 +335,7 @@ constructor( onBroadcastReceived(intent, previousSelectedUser) } .launchIn(applicationScope) restartSecondaryService(repository.getSelectedUserInfo().id) keyguardUpdateMonitor.registerCallback(keyguardUpdateMonitorCallback) } Loading Loading @@ -646,7 +648,7 @@ constructor( // Connect to the new secondary user's service (purely to ensure that a persistent // SystemUI application is created for that user) if (userId != UserHandle.USER_SYSTEM) { if (userId != Process.myUserHandle().identifier) { applicationContext.startServiceAsUser( intent, UserHandle.of(userId), Loading packages/SystemUI/tests/src/com/android/systemui/shade/data/repository/ShadeInteractorTest.kt +19 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.app.ActivityManager import android.app.StatusBarManager.DISABLE2_NONE import android.app.StatusBarManager.DISABLE2_NOTIFICATION_SHADE import android.app.StatusBarManager.DISABLE2_QUICK_SETTINGS import android.content.pm.UserInfo import android.os.UserManager import androidx.test.filters.SmallTest import com.android.internal.logging.UiEventLogger Loading Loading @@ -47,6 +48,7 @@ import com.android.systemui.user.domain.interactor.UserInteractor import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runTest Loading Loading @@ -92,6 +94,23 @@ class ShadeInteractorTest : SysuiTestCase() { mainDispatcher = testDispatcher, repository = userRepository, ) runBlocking { val userInfos = listOf( UserInfo( /* id= */ 0, /* name= */ "zero", /* iconPath= */ "", /* flags= */ UserInfo.FLAG_PRIMARY or UserInfo.FLAG_ADMIN or UserInfo.FLAG_FULL, UserManager.USER_TYPE_FULL_SYSTEM, ), ) userRepository.setUserInfos(userInfos) userRepository.setSelectedUserInfo(userInfos[0]) } userInteractor = UserInteractor( applicationContext = context, Loading Loading
packages/SystemUI/src/com/android/systemui/user/domain/interactor/UserInteractor.kt +3 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.content.pm.UserInfo import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable import android.graphics.drawable.Icon import android.os.Process import android.os.RemoteException import android.os.UserHandle import android.os.UserManager Loading Loading @@ -334,6 +335,7 @@ constructor( onBroadcastReceived(intent, previousSelectedUser) } .launchIn(applicationScope) restartSecondaryService(repository.getSelectedUserInfo().id) keyguardUpdateMonitor.registerCallback(keyguardUpdateMonitorCallback) } Loading Loading @@ -646,7 +648,7 @@ constructor( // Connect to the new secondary user's service (purely to ensure that a persistent // SystemUI application is created for that user) if (userId != UserHandle.USER_SYSTEM) { if (userId != Process.myUserHandle().identifier) { applicationContext.startServiceAsUser( intent, UserHandle.of(userId), Loading
packages/SystemUI/tests/src/com/android/systemui/shade/data/repository/ShadeInteractorTest.kt +19 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.app.ActivityManager import android.app.StatusBarManager.DISABLE2_NONE import android.app.StatusBarManager.DISABLE2_NOTIFICATION_SHADE import android.app.StatusBarManager.DISABLE2_QUICK_SETTINGS import android.content.pm.UserInfo import android.os.UserManager import androidx.test.filters.SmallTest import com.android.internal.logging.UiEventLogger Loading Loading @@ -47,6 +48,7 @@ import com.android.systemui.user.domain.interactor.UserInteractor import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runTest Loading Loading @@ -92,6 +94,23 @@ class ShadeInteractorTest : SysuiTestCase() { mainDispatcher = testDispatcher, repository = userRepository, ) runBlocking { val userInfos = listOf( UserInfo( /* id= */ 0, /* name= */ "zero", /* iconPath= */ "", /* flags= */ UserInfo.FLAG_PRIMARY or UserInfo.FLAG_ADMIN or UserInfo.FLAG_FULL, UserManager.USER_TYPE_FULL_SYSTEM, ), ) userRepository.setUserInfos(userInfos) userRepository.setSelectedUserInfo(userInfos[0]) } userInteractor = UserInteractor( applicationContext = context, Loading