diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java index 2c05a4ea82385..fe08fb0a9d4fa 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java @@ -73,6 +73,7 @@ import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.broadcast.BroadcastSender; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Background; +import com.android.systemui.dagger.qualifiers.LongRunning; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.ActivityStarter; @@ -153,6 +154,7 @@ public class UserSwitcherController implements Dumpable { private final IActivityManager mActivityManager; private final Executor mBgExecutor; private final Executor mUiExecutor; + private final Executor mLongRunningExecutor; private final boolean mGuestUserAutoCreated; private final AtomicBoolean mGuestIsResetting; private final AtomicBoolean mGuestCreationScheduled; @@ -177,6 +179,7 @@ public class UserSwitcherController implements Dumpable { TelephonyListenerManager telephonyListenerManager, SecureSettings secureSettings, @Background Executor bgExecutor, + @LongRunning Executor longRunningExecutor, @Main Executor uiExecutor, InteractionJankMonitor interactionJankMonitor, LatencyTracker latencyTracker, @@ -195,6 +198,7 @@ public class UserSwitcherController implements Dumpable { mGuestResumeSessionReceiver = new GuestResumeSessionReceiver( this, mUserTracker, mUiEventLogger, secureSettings); mBgExecutor = bgExecutor; + mLongRunningExecutor = longRunningExecutor; mUiExecutor = uiExecutor; if (!UserManager.isGuestUserEphemeral()) { mGuestResumeSessionReceiver.register(mBroadcastDispatcher); @@ -794,7 +798,7 @@ public class UserSwitcherController implements Dumpable { return; } - mBgExecutor.execute(() -> { + mLongRunningExecutor.execute(() -> { int newGuestId = createGuest(); mGuestCreationScheduled.set(false); mGuestIsResetting.set(false); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/UserSwitcherControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/UserSwitcherControllerTest.kt index 1caacb89ba100..799dafcd01b86 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/UserSwitcherControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/UserSwitcherControllerTest.kt @@ -97,6 +97,7 @@ class UserSwitcherControllerTest : SysuiTestCase() { @Mock private lateinit var dialogLaunchAnimator: DialogLaunchAnimator private lateinit var testableLooper: TestableLooper private lateinit var bgExecutor: FakeExecutor + private lateinit var longRunningExecutor: FakeExecutor private lateinit var uiExecutor: FakeExecutor private lateinit var uiEventLogger: UiEventLoggerFake private lateinit var userSwitcherController: UserSwitcherController @@ -117,6 +118,7 @@ class UserSwitcherControllerTest : SysuiTestCase() { MockitoAnnotations.initMocks(this) testableLooper = TestableLooper.get(this) bgExecutor = FakeExecutor(FakeSystemClock()) + longRunningExecutor = FakeExecutor(FakeSystemClock()) uiExecutor = FakeExecutor(FakeSystemClock()) uiEventLogger = UiEventLoggerFake() @@ -167,6 +169,7 @@ class UserSwitcherControllerTest : SysuiTestCase() { telephonyListenerManager, secureSettings, bgExecutor, + longRunningExecutor, uiExecutor, interactionJankMonitor, latencyTracker,