From 9681849b164d822c8f096c1baf110b4d21f442f1 Mon Sep 17 00:00:00 2001 From: Josh Tsuji Date: Fri, 7 May 2021 18:39:38 -0400 Subject: [PATCH] Adds launcher-side support for the SmartSpace shared element transition. This adds a new SmartSpaceTransitionController, which Launcher uses to register its SmartSpace with SysUI so that SysUI can manipulate it during an unlock animation. Bug: 187025480 Test: manual with all the different lock types Change-Id: I8ebf33e1a253e90f97875548113106cd828721e0 --- .../launcher3/BaseQuickstepLauncher.java | 2 +- .../com/android/quickstep/SystemUiProxy.java | 31 +++++++++++++++++-- .../quickstep/TouchInteractionService.java | 8 ++++- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java index e777ee7354..1b711d352d 100644 --- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java @@ -184,7 +184,7 @@ public abstract class BaseQuickstepLauncher extends Launcher } @Override - protected void onUiChangedWhileSleeping() { + public void onUiChangedWhileSleeping() { // Remove the snapshot because the content view may have obvious changes. UI_HELPER_EXECUTOR.execute( () -> ActivityManagerWrapper.getInstance().invalidateHomeTaskSnapshot(this)); diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index acf999253f..c20a4ccdda 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -40,6 +40,8 @@ import com.android.launcher3.util.SplitConfigurationOptions; import com.android.systemui.shared.recents.ISystemUiProxy; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.system.RemoteTransitionCompat; +import com.android.systemui.shared.system.smartspace.ISmartspaceCallback; +import com.android.systemui.shared.system.smartspace.ISmartspaceTransitionController; import com.android.wm.shell.onehanded.IOneHanded; import com.android.wm.shell.pip.IPip; import com.android.wm.shell.pip.IPipAnimationListener; @@ -61,6 +63,7 @@ public class SystemUiProxy implements ISystemUiProxy, private ISystemUiProxy mSystemUiProxy; private IPip mPip; + private ISmartspaceTransitionController mSmartspaceTransitionController; private ISplitScreen mSplitScreen; private IOneHanded mOneHanded; private IShellTransitions mShellTransitions; @@ -74,6 +77,7 @@ public class SystemUiProxy implements ISystemUiProxy, private IPipAnimationListener mPendingPipAnimationListener; private ISplitScreenListener mPendingSplitScreenListener; private IStartingWindowListener mPendingStartingWindowListener; + private ISmartspaceCallback mPendingSmartspaceCallback; // Used to dedupe calls to SystemUI private int mLastShelfHeight; @@ -125,7 +129,8 @@ public class SystemUiProxy implements ISystemUiProxy, public void setProxy(ISystemUiProxy proxy, IPip pip, ISplitScreen splitScreen, IOneHanded oneHanded, IShellTransitions shellTransitions, - IStartingWindow startingWindow) { + IStartingWindow startingWindow, + ISmartspaceTransitionController smartSpaceTransitionController) { unlinkToDeath(); mSystemUiProxy = proxy; mPip = pip; @@ -133,6 +138,7 @@ public class SystemUiProxy implements ISystemUiProxy, mOneHanded = oneHanded; mShellTransitions = shellTransitions; mStartingWindow = startingWindow; + mSmartspaceTransitionController = smartSpaceTransitionController; linkToDeath(); // re-attach the listeners once missing due to setProxy has not been initialized yet. if (mPendingPipAnimationListener != null && mPip != null) { @@ -147,10 +153,14 @@ public class SystemUiProxy implements ISystemUiProxy, setStartingWindowListener(mPendingStartingWindowListener); mPendingStartingWindowListener = null; } + if (mPendingSmartspaceCallback != null && mSmartspaceTransitionController != null) { + setSmartspaceCallback(mPendingSmartspaceCallback); + mPendingSmartspaceCallback = null; + } } public void clearProxy() { - setProxy(null, null, null, null, null, null); + setProxy(null, null, null, null, null, null, null); } // TODO(141886704): Find a way to remove this @@ -631,4 +641,21 @@ public class SystemUiProxy implements ISystemUiProxy, mPendingStartingWindowListener = listener; } } + + + // + // SmartSpace transitions + // + + public void setSmartspaceCallback(ISmartspaceCallback callback) { + if (mSmartspaceTransitionController != null) { + try { + mSmartspaceTransitionController.setSmartspace(callback); + } catch (RemoteException e) { + Log.w(TAG, "Failed call setStartingWindowListener", e); + } + } else { + mPendingSmartspaceCallback = callback; + } + } } diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index edc7a3c8b8..419c60c5af 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -30,6 +30,7 @@ import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHE import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_SHELL_TRANSITIONS; import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_SPLIT_SCREEN; import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_STARTING_WINDOW; +import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SMARTSPACE_TRANSITION_CONTROLLER; import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYSUI_PROXY; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_TRACING_ENABLED; @@ -107,6 +108,7 @@ import com.android.systemui.shared.system.InputChannelCompat; import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver; import com.android.systemui.shared.system.InputConsumerController; import com.android.systemui.shared.system.InputMonitorCompat; +import com.android.systemui.shared.system.smartspace.ISmartspaceTransitionController; import com.android.systemui.shared.tracing.ProtoTraceable; import com.android.wm.shell.onehanded.IOneHanded; import com.android.wm.shell.pip.IPip; @@ -176,9 +178,13 @@ public class TouchInteractionService extends Service implements PluginListener { SystemUiProxy.INSTANCE.get(TouchInteractionService.this).setProxy(proxy, pip, - splitscreen, onehanded, shellTransitions, startingWindow); + splitscreen, onehanded, shellTransitions, startingWindow, + smartspaceTransitionController); TouchInteractionService.this.initInputMonitor(); preloadOverview(true /* fromInit */); mDeviceState.runOnUserUnlocked(() -> {