Merge "Use long-running executor for bg guest creation" into tm-dev

This commit is contained in:
Peter Kalauskas
2022-04-01 01:52:25 +00:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 1 deletions

View File

@@ -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);

View File

@@ -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,