diff options
| author | 2024-05-23 15:58:18 -0700 | |
|---|---|---|
| committer | 2024-05-23 15:58:18 -0700 | |
| commit | 0d394193796f10efeb28a052399a63bf4a96455f (patch) | |
| tree | 03afbfeec43cc2f5b0022489dab858b7809b32df | |
| parent | e9ba7c113e210b0b07d181043fe8178723ac99f8 (diff) | |
[flexiglass] Move "show lockscreen when folded" to the main thread.
As of ag/27342795, changing the scene on STL throws an exception when
called off the main thread. This CL fixes it for the
KeyguardService.showDismissibleKeyguard case.
Test: manually verified that the scene is changed to lockscreen when
folding closed an unfolded, unlocked foldable
Bug: 341445974
Flag: com.android.systemui.scene_container
Change-Id: I2787ccc8fe94caeabdc709d74e5665f4f0400e19
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java index 9cdba5853959..956c0f51cda0 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java @@ -77,6 +77,7 @@ import com.android.internal.policy.IKeyguardStateCallback; import com.android.keyguard.mediator.ScreenOnCoordinator; import com.android.systemui.SystemUIApplication; import com.android.systemui.dagger.qualifiers.Application; +import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.keyguard.ui.binder.KeyguardSurfaceBehindParamsApplier; import com.android.systemui.keyguard.ui.binder.KeyguardSurfaceBehindViewBinder; @@ -101,6 +102,7 @@ import kotlinx.coroutines.CoroutineScope; import java.util.ArrayList; import java.util.Map; import java.util.WeakHashMap; +import java.util.concurrent.Executor; import javax.inject.Inject; @@ -116,6 +118,7 @@ public class KeyguardService extends Service { private final DisplayTracker mDisplayTracker; private final PowerInteractor mPowerInteractor; private final Lazy<SceneInteractor> mSceneInteractorLazy; + private final Executor mMainExecutor; private static RemoteAnimationTarget[] wrap(TransitionInfo info, boolean wallpapers, SurfaceControl.Transaction t, ArrayMap<SurfaceControl, SurfaceControl> leashMap, @@ -331,7 +334,8 @@ public class KeyguardService extends Service { FeatureFlags featureFlags, PowerInteractor powerInteractor, WindowManagerOcclusionManager windowManagerOcclusionManager, - Lazy<SceneInteractor> sceneInteractorLazy) { + Lazy<SceneInteractor> sceneInteractorLazy, + @Main Executor mainExecutor) { super(); mKeyguardViewMediator = keyguardViewMediator; mKeyguardLifecyclesDispatcher = keyguardLifecyclesDispatcher; @@ -341,6 +345,7 @@ public class KeyguardService extends Service { mFlags = featureFlags; mPowerInteractor = powerInteractor; mSceneInteractorLazy = sceneInteractorLazy; + mMainExecutor = mainExecutor; if (KeyguardWmStateRefactor.isEnabled()) { WindowManagerLockscreenVisibilityViewBinder.bind( @@ -619,8 +624,8 @@ public class KeyguardService extends Service { mKeyguardViewMediator.showDismissibleKeyguard(); if (SceneContainerFlag.isEnabled() && mFoldGracePeriodProvider.get().isEnabled()) { - mSceneInteractorLazy.get().changeScene( - Scenes.Lockscreen, "KeyguardService.showDismissibleKeyguard"); + mMainExecutor.execute(() -> mSceneInteractorLazy.get().changeScene( + Scenes.Lockscreen, "KeyguardService.showDismissibleKeyguard")); } } |