Loading packages/SystemUI/src/com/android/systemui/settings/UserTrackerImpl.kt +3 −5 Original line number Diff line number Diff line Loading @@ -103,11 +103,8 @@ internal constructor( override val userContentResolver: ContentResolver get() = userContext.contentResolver override val userInfo: UserInfo get() { val user = userId return userProfiles.first { it.id == user } } override var userInfo: UserInfo by SynchronizedDelegate(UserInfo(context.userId, "", 0)) protected set /** * Returns a [List<UserInfo>] of all profiles associated with the current user. Loading Loading @@ -187,6 +184,7 @@ internal constructor( userHandle = handle userContext = ctx userProfiles = profiles.map { UserInfo(it) } userInfo = profiles.first { it.id == user } } return ctx to profiles } Loading packages/SystemUI/tests/src/com/android/systemui/settings/UserTrackerImplReceiveTest.kt +15 −15 Original line number Diff line number Diff line Loading @@ -79,21 +79,6 @@ class UserTrackerImplReceiveTest : SysuiTestCase() { @Test fun callsCallbackAndUpdatesProfilesWhenAnIntentReceived() = runTest { tracker = UserTrackerImpl( context, { fakeFeatures }, userManager, iActivityManager, dumpManager, this, testDispatcher, handler ) tracker.initialize(0) tracker.addCallback(callback, executor) val profileID = tracker.userId + 10 `when`(userManager.getProfiles(anyInt())).thenAnswer { invocation -> val id = invocation.getArgument<Int>(0) val info = UserInfo(id, "", UserInfo.FLAG_FULL) Loading @@ -109,6 +94,21 @@ class UserTrackerImplReceiveTest : SysuiTestCase() { listOf(info, infoProfile) } tracker = UserTrackerImpl( context, { fakeFeatures }, userManager, iActivityManager, dumpManager, this, testDispatcher, handler ) tracker.initialize(0) tracker.addCallback(callback, executor) val profileID = tracker.userId + 10 tracker.onReceive(context, Intent(intentAction)) verify(callback, times(0)).onUserChanged(anyInt(), any()) Loading Loading
packages/SystemUI/src/com/android/systemui/settings/UserTrackerImpl.kt +3 −5 Original line number Diff line number Diff line Loading @@ -103,11 +103,8 @@ internal constructor( override val userContentResolver: ContentResolver get() = userContext.contentResolver override val userInfo: UserInfo get() { val user = userId return userProfiles.first { it.id == user } } override var userInfo: UserInfo by SynchronizedDelegate(UserInfo(context.userId, "", 0)) protected set /** * Returns a [List<UserInfo>] of all profiles associated with the current user. Loading Loading @@ -187,6 +184,7 @@ internal constructor( userHandle = handle userContext = ctx userProfiles = profiles.map { UserInfo(it) } userInfo = profiles.first { it.id == user } } return ctx to profiles } Loading
packages/SystemUI/tests/src/com/android/systemui/settings/UserTrackerImplReceiveTest.kt +15 −15 Original line number Diff line number Diff line Loading @@ -79,21 +79,6 @@ class UserTrackerImplReceiveTest : SysuiTestCase() { @Test fun callsCallbackAndUpdatesProfilesWhenAnIntentReceived() = runTest { tracker = UserTrackerImpl( context, { fakeFeatures }, userManager, iActivityManager, dumpManager, this, testDispatcher, handler ) tracker.initialize(0) tracker.addCallback(callback, executor) val profileID = tracker.userId + 10 `when`(userManager.getProfiles(anyInt())).thenAnswer { invocation -> val id = invocation.getArgument<Int>(0) val info = UserInfo(id, "", UserInfo.FLAG_FULL) Loading @@ -109,6 +94,21 @@ class UserTrackerImplReceiveTest : SysuiTestCase() { listOf(info, infoProfile) } tracker = UserTrackerImpl( context, { fakeFeatures }, userManager, iActivityManager, dumpManager, this, testDispatcher, handler ) tracker.initialize(0) tracker.addCallback(callback, executor) val profileID = tracker.userId + 10 tracker.onReceive(context, Intent(intentAction)) verify(callback, times(0)).onUserChanged(anyInt(), any()) Loading