Loading packages/SystemUI/aconfig/systemui.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,13 @@ flag { bug: "308623704" } flag { name: "refactor_get_current_user" namespace: "systemui" description: "KeyguardUpdateMonitor.getCurrentUser() was providing outdated results." bug: "305984787" } flag { name: "notification_throttle_hun" namespace: "systemui" Loading packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java +2 −2 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ import static android.view.WindowManager.TransitionFlags; import static android.view.WindowManager.TransitionOldType; import static android.view.WindowManager.TransitionType; import static com.android.systemui.flags.Flags.REFACTOR_GETCURRENTUSER; import static com.android.systemui.Flags.refactorGetCurrentUser; import android.annotation.NonNull; import android.app.ActivityManager; Loading Loading @@ -609,7 +609,7 @@ public class KeyguardService extends Service { public void setCurrentUser(int userId) { trace("Deprecated/NOT USED: setCurrentUser userId=" + userId); checkPermission(); if (!mFlags.isEnabled(REFACTOR_GETCURRENTUSER)) { if (!refactorGetCurrentUser()) { mKeyguardViewMediator.setCurrentUser(userId); } } Loading packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +3 −3 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STR import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_FOR_UNATTENDED_UPDATE; import static com.android.systemui.DejankUtils.whitelistIpcs; import static com.android.systemui.flags.Flags.REFACTOR_GETCURRENTUSER; import static com.android.systemui.Flags.refactorGetCurrentUser; import static com.android.systemui.keyguard.ui.viewmodel.LockscreenToDreamingTransitionViewModel.DREAMING_ANIMATION_DURATION_MS; import static com.android.systemui.util.kotlin.JavaAdapterKt.collectFlow; Loading Loading @@ -617,7 +617,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, public void onUserSwitching(int userId) { if (DEBUG) Log.d(TAG, String.format("onUserSwitching %d", userId)); synchronized (KeyguardViewMediator.this) { if (mFeatureFlags.isEnabled(REFACTOR_GETCURRENTUSER)) { if (refactorGetCurrentUser()) { notifyTrustedChangedLocked(mUpdateMonitor.getUserHasTrust(userId)); } resetKeyguardDonePendingLocked(); Loading Loading @@ -1502,7 +1502,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); if (!mFeatureFlags.isEnabled(REFACTOR_GETCURRENTUSER)) { if (!refactorGetCurrentUser()) { KeyguardUpdateMonitor.setCurrentUser(mUserTracker.getUserId()); } Loading packages/SystemUI/src/com/android/systemui/user/domain/interactor/SelectedUserInteractor.kt +3 −9 Original line number Diff line number Diff line Loading @@ -2,9 +2,8 @@ package com.android.systemui.user.domain.interactor import android.annotation.UserIdInt import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.Flags.refactorGetCurrentUser import com.android.systemui.dagger.SysUISingleton import com.android.systemui.flags.FeatureFlagsClassic import com.android.systemui.flags.Flags.REFACTOR_GETCURRENTUSER import com.android.systemui.user.data.repository.UserRepository import javax.inject.Inject import kotlinx.coroutines.flow.distinctUntilChanged Loading @@ -12,12 +11,7 @@ import kotlinx.coroutines.flow.map /** Encapsulates business logic to interact the selected user */ @SysUISingleton class SelectedUserInteractor @Inject constructor( private val repository: UserRepository, private val flags: FeatureFlagsClassic, ) { class SelectedUserInteractor @Inject constructor(private val repository: UserRepository) { /** Flow providing the ID of the currently selected user. */ val selectedUser = repository.selectedUserInfo.map { it.id }.distinctUntilChanged() Loading @@ -34,7 +28,7 @@ constructor( @UserIdInt @JvmOverloads fun getSelectedUserId(bypassFlag: Boolean = false): Int { return if (bypassFlag || flags.isEnabled(REFACTOR_GETCURRENTUSER)) { return if (bypassFlag || refactorGetCurrentUser()) { repository.getSelectedUserInfo().id } else { KeyguardUpdateMonitor.getCurrentUser() Loading packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static android.view.WindowManagerPolicyConstants.OFF_BECAUSE_OF_USER; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_NON_STRONG_BIOMETRICS_TIMEOUT; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN; import static com.android.systemui.Flags.FLAG_REFACTOR_GET_CURRENT_USER; import static com.android.systemui.keyguard.KeyguardViewMediator.DELAYED_KEYGUARD_ACTION; import static com.android.systemui.keyguard.KeyguardViewMediator.KEYGUARD_LOCK_AFTER_DELAY_DEFAULT; import static com.android.systemui.keyguard.KeyguardViewMediator.REBOOT_MAINLINE_UPDATE; Loading Loading @@ -266,7 +267,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { mSceneContainerFlags); mFeatureFlags = new FakeFeatureFlags(); mFeatureFlags.set(Flags.KEYGUARD_WM_STATE_REFACTOR, false); mFeatureFlags.set(Flags.REFACTOR_GETCURRENTUSER, true); mSetFlagsRule.enableFlags(FLAG_REFACTOR_GET_CURRENT_USER); DejankUtils.setImmediate(true); Loading Loading
packages/SystemUI/aconfig/systemui.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,13 @@ flag { bug: "308623704" } flag { name: "refactor_get_current_user" namespace: "systemui" description: "KeyguardUpdateMonitor.getCurrentUser() was providing outdated results." bug: "305984787" } flag { name: "notification_throttle_hun" namespace: "systemui" Loading
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java +2 −2 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ import static android.view.WindowManager.TransitionFlags; import static android.view.WindowManager.TransitionOldType; import static android.view.WindowManager.TransitionType; import static com.android.systemui.flags.Flags.REFACTOR_GETCURRENTUSER; import static com.android.systemui.Flags.refactorGetCurrentUser; import android.annotation.NonNull; import android.app.ActivityManager; Loading Loading @@ -609,7 +609,7 @@ public class KeyguardService extends Service { public void setCurrentUser(int userId) { trace("Deprecated/NOT USED: setCurrentUser userId=" + userId); checkPermission(); if (!mFlags.isEnabled(REFACTOR_GETCURRENTUSER)) { if (!refactorGetCurrentUser()) { mKeyguardViewMediator.setCurrentUser(userId); } } Loading
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +3 −3 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STR import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_FOR_UNATTENDED_UPDATE; import static com.android.systemui.DejankUtils.whitelistIpcs; import static com.android.systemui.flags.Flags.REFACTOR_GETCURRENTUSER; import static com.android.systemui.Flags.refactorGetCurrentUser; import static com.android.systemui.keyguard.ui.viewmodel.LockscreenToDreamingTransitionViewModel.DREAMING_ANIMATION_DURATION_MS; import static com.android.systemui.util.kotlin.JavaAdapterKt.collectFlow; Loading Loading @@ -617,7 +617,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, public void onUserSwitching(int userId) { if (DEBUG) Log.d(TAG, String.format("onUserSwitching %d", userId)); synchronized (KeyguardViewMediator.this) { if (mFeatureFlags.isEnabled(REFACTOR_GETCURRENTUSER)) { if (refactorGetCurrentUser()) { notifyTrustedChangedLocked(mUpdateMonitor.getUserHasTrust(userId)); } resetKeyguardDonePendingLocked(); Loading Loading @@ -1502,7 +1502,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); if (!mFeatureFlags.isEnabled(REFACTOR_GETCURRENTUSER)) { if (!refactorGetCurrentUser()) { KeyguardUpdateMonitor.setCurrentUser(mUserTracker.getUserId()); } Loading
packages/SystemUI/src/com/android/systemui/user/domain/interactor/SelectedUserInteractor.kt +3 −9 Original line number Diff line number Diff line Loading @@ -2,9 +2,8 @@ package com.android.systemui.user.domain.interactor import android.annotation.UserIdInt import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.Flags.refactorGetCurrentUser import com.android.systemui.dagger.SysUISingleton import com.android.systemui.flags.FeatureFlagsClassic import com.android.systemui.flags.Flags.REFACTOR_GETCURRENTUSER import com.android.systemui.user.data.repository.UserRepository import javax.inject.Inject import kotlinx.coroutines.flow.distinctUntilChanged Loading @@ -12,12 +11,7 @@ import kotlinx.coroutines.flow.map /** Encapsulates business logic to interact the selected user */ @SysUISingleton class SelectedUserInteractor @Inject constructor( private val repository: UserRepository, private val flags: FeatureFlagsClassic, ) { class SelectedUserInteractor @Inject constructor(private val repository: UserRepository) { /** Flow providing the ID of the currently selected user. */ val selectedUser = repository.selectedUserInfo.map { it.id }.distinctUntilChanged() Loading @@ -34,7 +28,7 @@ constructor( @UserIdInt @JvmOverloads fun getSelectedUserId(bypassFlag: Boolean = false): Int { return if (bypassFlag || flags.isEnabled(REFACTOR_GETCURRENTUSER)) { return if (bypassFlag || refactorGetCurrentUser()) { repository.getSelectedUserInfo().id } else { KeyguardUpdateMonitor.getCurrentUser() Loading
packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static android.view.WindowManagerPolicyConstants.OFF_BECAUSE_OF_USER; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_NON_STRONG_BIOMETRICS_TIMEOUT; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN; import static com.android.systemui.Flags.FLAG_REFACTOR_GET_CURRENT_USER; import static com.android.systemui.keyguard.KeyguardViewMediator.DELAYED_KEYGUARD_ACTION; import static com.android.systemui.keyguard.KeyguardViewMediator.KEYGUARD_LOCK_AFTER_DELAY_DEFAULT; import static com.android.systemui.keyguard.KeyguardViewMediator.REBOOT_MAINLINE_UPDATE; Loading Loading @@ -266,7 +267,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { mSceneContainerFlags); mFeatureFlags = new FakeFeatureFlags(); mFeatureFlags.set(Flags.KEYGUARD_WM_STATE_REFACTOR, false); mFeatureFlags.set(Flags.REFACTOR_GETCURRENTUSER, true); mSetFlagsRule.enableFlags(FLAG_REFACTOR_GET_CURRENT_USER); DejankUtils.setImmediate(true); Loading