Merge "Update calls to go through the feature interface instead of sysui proxy" into sc-dev

This commit is contained in:
Winson Chung authored and Android (Google) Code Review committed 2021-03-19 06:55:32 +00:00
commit 6ffdceadfe
4 files changed
+178 -129

No files matched your search

@@ -84,7 +84,6 @@ import com.android.quickstep.util.RemoteAnimationProvider;
import com.android.quickstep.util.StaggeredWorkspaceAnim; import com.android.quickstep.util.StaggeredWorkspaceAnim;
import com.android.quickstep.util.SurfaceTransactionApplier; import com.android.quickstep.util.SurfaceTransactionApplier;
import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.recents.IStartingWindowListener;
import com.android.systemui.shared.system.ActivityCompat; import com.android.systemui.shared.system.ActivityCompat;
import com.android.systemui.shared.system.ActivityOptionsCompat; import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper; import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
@@ -96,6 +95,7 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.RemoteTransitionCompat; import com.android.systemui.shared.system.RemoteTransitionCompat;
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams; import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
import com.android.systemui.shared.system.WindowManagerWrapper; import com.android.systemui.shared.system.WindowManagerWrapper;
import com.android.wm.shell.startingsurface.IStartingWindowListener;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
@@ -35,12 +35,17 @@ import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import com.android.launcher3.util.MainThreadInitializedObject; import com.android.launcher3.util.MainThreadInitializedObject;
import com.android.systemui.shared.recents.IPinnedStackAnimationListener;
import com.android.systemui.shared.recents.ISplitScreenListener;
import com.android.systemui.shared.recents.IStartingWindowListener;
import com.android.systemui.shared.recents.ISystemUiProxy; import com.android.systemui.shared.recents.ISystemUiProxy;
import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.system.RemoteTransitionCompat; import com.android.systemui.shared.system.RemoteTransitionCompat;
import com.android.wm.shell.onehanded.IOneHanded;
import com.android.wm.shell.pip.IPip;
import com.android.wm.shell.pip.IPipAnimationListener;
import com.android.wm.shell.splitscreen.ISplitScreen;
import com.android.wm.shell.splitscreen.ISplitScreenListener;
import com.android.wm.shell.startingsurface.IStartingWindow;
import com.android.wm.shell.startingsurface.IStartingWindowListener;
import com.android.wm.shell.transition.IShellTransitions;
/** /**
* Holds the reference to SystemUI. * Holds the reference to SystemUI.
@@ -53,8 +58,13 @@ public class SystemUiProxy implements ISystemUiProxy,
new MainThreadInitializedObject<>(SystemUiProxy::new); new MainThreadInitializedObject<>(SystemUiProxy::new);
private ISystemUiProxy mSystemUiProxy; private ISystemUiProxy mSystemUiProxy;
private IPip mPip;
private ISplitScreen mSplitScreen;
private IOneHanded mOneHanded;
private IShellTransitions mShellTransitions;
private IStartingWindow mStartingWindow;
private final DeathRecipient mSystemUiProxyDeathRecipient = () -> { private final DeathRecipient mSystemUiProxyDeathRecipient = () -> {
MAIN_EXECUTOR.execute(() -> setProxy(null)); MAIN_EXECUTOR.execute(() -> clearProxy());
}; };
// Used to dedupe calls to SystemUI // Used to dedupe calls to SystemUI
@@ -83,12 +93,23 @@ public class SystemUiProxy implements ISystemUiProxy,
return null; return null;
} }
public void setProxy(ISystemUiProxy proxy) { public void setProxy(ISystemUiProxy proxy, IPip pip, ISplitScreen splitScreen,
IOneHanded oneHanded, IShellTransitions shellTransitions,
IStartingWindow startingWindow) {
unlinkToDeath(); unlinkToDeath();
mSystemUiProxy = proxy; mSystemUiProxy = proxy;
mPip = pip;
mSplitScreen = splitScreen;
mOneHanded = oneHanded;
mShellTransitions = shellTransitions;
mStartingWindow = startingWindow;
linkToDeath(); linkToDeath();
} }
public void clearProxy() {
setProxy(null, null, null, null, null, null);
}
// TODO(141886704): Find a way to remove this // TODO(141886704): Find a way to remove this
public void setLastSystemUiStateFlags(int stateFlags) { public void setLastSystemUiStateFlags(int stateFlags) {
mLastSystemUiStateFlags = stateFlags; mLastSystemUiStateFlags = stateFlags;
@@ -267,21 +288,6 @@ public class SystemUiProxy implements ISystemUiProxy,
} }
} }
@Override
public void setShelfHeight(boolean visible, int shelfHeight) {
boolean changed = visible != mLastShelfVisible || shelfHeight != mLastShelfHeight;
if (mSystemUiProxy != null && changed) {
mLastShelfVisible = visible;
mLastShelfHeight = shelfHeight;
try {
mSystemUiProxy.setShelfHeight(visible, shelfHeight);
} catch (RemoteException e) {
Log.w(TAG, "Failed call setShelfHeight visible: " + visible
+ " height: " + shelfHeight, e);
}
}
}
@Override @Override
public void handleImageAsScreenshot(Bitmap bitmap, Rect rect, Insets insets, int i) { public void handleImageAsScreenshot(Bitmap bitmap, Rect rect, Insets insets, int i) {
if (mSystemUiProxy != null) { if (mSystemUiProxy != null) {
@@ -318,20 +324,6 @@ public class SystemUiProxy implements ISystemUiProxy,
} }
} }
/**
* Sets listener to get pinned stack animation callbacks.
*/
@Override
public void setPinnedStackAnimationListener(IPinnedStackAnimationListener listener) {
if (mSystemUiProxy != null) {
try {
mSystemUiProxy.setPinnedStackAnimationListener(listener);
} catch (RemoteException e) {
Log.w(TAG, "Failed call setPinnedStackAnimationListener", e);
}
}
}
@Override @Override
public void onQuickSwitchToNewTask(int rotation) { public void onQuickSwitchToNewTask(int rotation) {
if (mSystemUiProxy != null) { if (mSystemUiProxy != null) {
@@ -356,28 +348,6 @@ public class SystemUiProxy implements ISystemUiProxy,
} }
} }
@Override
public void startOneHandedMode() {
if (mSystemUiProxy != null) {
try {
mSystemUiProxy.startOneHandedMode();
} catch (RemoteException e) {
Log.w(TAG, "Failed call startOneHandedMode", e);
}
}
}
@Override
public void stopOneHandedMode() {
if (mSystemUiProxy != null) {
try {
mSystemUiProxy.stopOneHandedMode();
} catch (RemoteException e) {
Log.w(TAG, "Failed call stopOneHandedMode", e);
}
}
}
@Override @Override
public void expandNotificationPanel() { public void expandNotificationPanel() {
if (mSystemUiProxy != null) { if (mSystemUiProxy != null) {
@@ -389,12 +359,45 @@ public class SystemUiProxy implements ISystemUiProxy,
} }
} }
@Override //
// Pip
//
/**
* Sets the shelf height.
*/
public void setShelfHeight(boolean visible, int shelfHeight) {
boolean changed = visible != mLastShelfVisible || shelfHeight != mLastShelfHeight;
if (mPip != null && changed) {
mLastShelfVisible = visible;
mLastShelfHeight = shelfHeight;
try {
mPip.setShelfHeight(visible, shelfHeight);
} catch (RemoteException e) {
Log.w(TAG, "Failed call setShelfHeight visible: " + visible
+ " height: " + shelfHeight, e);
}
}
}
/**
* Sets listener to get pinned stack animation callbacks.
*/
public void setPinnedStackAnimationListener(IPipAnimationListener listener) {
if (mPip != null) {
try {
mPip.setPinnedStackAnimationListener(listener);
} catch (RemoteException e) {
Log.w(TAG, "Failed call setPinnedStackAnimationListener", e);
}
}
}
public Rect startSwipePipToHome(ComponentName componentName, ActivityInfo activityInfo, public Rect startSwipePipToHome(ComponentName componentName, ActivityInfo activityInfo,
PictureInPictureParams pictureInPictureParams, int launcherRotation, int shelfHeight) { PictureInPictureParams pictureInPictureParams, int launcherRotation, int shelfHeight) {
if (mSystemUiProxy != null) { if (mPip != null) {
try { try {
return mSystemUiProxy.startSwipePipToHome(componentName, activityInfo, return mPip.startSwipePipToHome(componentName, activityInfo,
pictureInPictureParams, launcherRotation, shelfHeight); pictureInPictureParams, launcherRotation, shelfHeight);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, "Failed call startSwipePipToHome", e); Log.w(TAG, "Failed call startSwipePipToHome", e);
@@ -403,111 +406,85 @@ public class SystemUiProxy implements ISystemUiProxy,
return null; return null;
} }
@Override
public void stopSwipePipToHome(ComponentName componentName, Rect destinationBounds) { public void stopSwipePipToHome(ComponentName componentName, Rect destinationBounds) {
if (mSystemUiProxy != null) { if (mPip != null) {
try { try {
mSystemUiProxy.stopSwipePipToHome(componentName, destinationBounds); mPip.stopSwipePipToHome(componentName, destinationBounds);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, "Failed call stopSwipePipToHome"); Log.w(TAG, "Failed call stopSwipePipToHome");
} }
} }
} }
@Override //
public void registerRemoteTransition(RemoteTransitionCompat remoteTransition) { // Splitscreen
if (mSystemUiProxy != null) { //
try {
mSystemUiProxy.registerRemoteTransition(remoteTransition);
} catch (RemoteException e) {
Log.w(TAG, "Failed call registerRemoteTransition");
}
}
}
@Override
public void unregisterRemoteTransition(RemoteTransitionCompat remoteTransition) {
if (mSystemUiProxy != null) {
try {
mSystemUiProxy.unregisterRemoteTransition(remoteTransition);
} catch (RemoteException e) {
Log.w(TAG, "Failed call registerRemoteTransition");
}
}
}
@Override
public void registerSplitScreenListener(ISplitScreenListener listener) { public void registerSplitScreenListener(ISplitScreenListener listener) {
if (mSystemUiProxy != null) { if (mSplitScreen != null) {
try { try {
mSystemUiProxy.registerSplitScreenListener(listener); mSplitScreen.registerSplitScreenListener(listener);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, "Failed call registerSplitScreenListener"); Log.w(TAG, "Failed call registerSplitScreenListener");
} }
} }
} }
@Override
public void unregisterSplitScreenListener(ISplitScreenListener listener) { public void unregisterSplitScreenListener(ISplitScreenListener listener) {
if (mSystemUiProxy != null) { if (mSplitScreen != null) {
try { try {
mSystemUiProxy.unregisterSplitScreenListener(listener); mSplitScreen.unregisterSplitScreenListener(listener);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, "Failed call unregisterSplitScreenListener"); Log.w(TAG, "Failed call unregisterSplitScreenListener");
} }
} }
} }
@Override
public void setSideStageVisibility(boolean visible) { public void setSideStageVisibility(boolean visible) {
if (mSystemUiProxy != null) { if (mSplitScreen != null) {
try { try {
mSystemUiProxy.setSideStageVisibility(visible); mSplitScreen.setSideStageVisibility(visible);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, "Failed call setSideStageVisibility"); Log.w(TAG, "Failed call setSideStageVisibility");
} }
} }
} }
@Override
public void exitSplitScreen() { public void exitSplitScreen() {
if (mSystemUiProxy != null) { if (mSplitScreen != null) {
try { try {
mSystemUiProxy.exitSplitScreen(); mSplitScreen.exitSplitScreen();
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, "Failed call exitSplitScreen"); Log.w(TAG, "Failed call exitSplitScreen");
} }
} }
} }
@Override
public void exitSplitScreenOnHide(boolean exitSplitScreenOnHide) { public void exitSplitScreenOnHide(boolean exitSplitScreenOnHide) {
if (mSystemUiProxy != null) { if (mSplitScreen != null) {
try { try {
mSystemUiProxy.exitSplitScreenOnHide(exitSplitScreenOnHide); mSplitScreen.exitSplitScreenOnHide(exitSplitScreenOnHide);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, "Failed call exitSplitScreen"); Log.w(TAG, "Failed call exitSplitScreen");
} }
} }
} }
@Override
public void startTask(int taskId, int stage, int position, Bundle options) { public void startTask(int taskId, int stage, int position, Bundle options) {
if (mSystemUiProxy != null) { if (mSplitScreen != null) {
try { try {
mSystemUiProxy.startTask(taskId, stage, position, options); mSplitScreen.startTask(taskId, stage, position, options);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, "Failed call startTask"); Log.w(TAG, "Failed call startTask");
} }
} }
} }
@Override
public void startShortcut(String packageName, String shortcutId, int stage, int position, public void startShortcut(String packageName, String shortcutId, int stage, int position,
Bundle options, UserHandle user) { Bundle options, UserHandle user) {
if (mSystemUiProxy != null) { if (mSplitScreen != null) {
try { try {
mSystemUiProxy.startShortcut(packageName, shortcutId, stage, position, options, mSplitScreen.startShortcut(packageName, shortcutId, stage, position, options,
user); user);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, "Failed call startShortcut"); Log.w(TAG, "Failed call startShortcut");
@@ -515,38 +492,87 @@ public class SystemUiProxy implements ISystemUiProxy,
} }
} }
@Override public void startIntent(PendingIntent intent, Intent fillInIntent, int stage, int position,
public void startIntent(PendingIntent intent, Intent fillInIntent, int stage, Bundle options) {
int position, Bundle options) { if (mSplitScreen != null) {
if (mSystemUiProxy != null) {
try { try {
mSystemUiProxy.startIntent(intent, fillInIntent, stage, position, mSplitScreen.startIntent(intent, fillInIntent, stage, position, options);
options);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, "Failed call startIntent"); Log.w(TAG, "Failed call startIntent");
} }
} }
} }
@Override
public void removeFromSideStage(int taskId) { public void removeFromSideStage(int taskId) {
if (mSystemUiProxy != null) { if (mSplitScreen != null) {
try { try {
mSystemUiProxy.removeFromSideStage(taskId); mSplitScreen.removeFromSideStage(taskId);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, "Failed call removeFromSideStage"); Log.w(TAG, "Failed call removeFromSideStage");
} }
} }
} }
//
// One handed
//
public void startOneHandedMode() {
if (mOneHanded != null) {
try {
mOneHanded.startOneHanded();
} catch (RemoteException e) {
Log.w(TAG, "Failed call startOneHandedMode", e);
}
}
}
public void stopOneHandedMode() {
if (mOneHanded != null) {
try {
mOneHanded.stopOneHanded();
} catch (RemoteException e) {
Log.w(TAG, "Failed call stopOneHandedMode", e);
}
}
}
//
// Remote transitions
//
public void registerRemoteTransition(RemoteTransitionCompat remoteTransition) {
if (mShellTransitions != null) {
try {
mShellTransitions.registerRemote(remoteTransition.getFilter(),
remoteTransition.getTransition());
} catch (RemoteException e) {
Log.w(TAG, "Failed call registerRemoteTransition");
}
}
}
public void unregisterRemoteTransition(RemoteTransitionCompat remoteTransition) {
if (mShellTransitions != null) {
try {
mShellTransitions.unregisterRemote(remoteTransition.getTransition());
} catch (RemoteException e) {
Log.w(TAG, "Failed call registerRemoteTransition");
}
}
}
//
// Starting window
//
/** /**
* Sets listener to get callbacks when launching a task. * Sets listener to get callbacks when launching a task.
*/ */
@Override
public void setStartingWindowListener(IStartingWindowListener listener) { public void setStartingWindowListener(IStartingWindowListener listener) {
if (mSystemUiProxy != null) { if (mStartingWindow != null) {
try { try {
mSystemUiProxy.setStartingWindowListener(listener); mStartingWindow.setStartingWindowListener(listener);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, "Failed call setStartingWindowListener", e); Log.w(TAG, "Failed call setStartingWindowListener", e);
} }
@@ -25,6 +25,11 @@ import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.quickstep.GestureState.DEFAULT_STATE; import static com.android.quickstep.GestureState.DEFAULT_STATE;
import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE; import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS; import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_ONE_HANDED;
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SHELL_PIP;
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_SYSUI_PROXY; import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYSUI_PROXY;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_TRACING_ENABLED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_TRACING_ENABLED;
@@ -102,6 +107,11 @@ import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver;
import com.android.systemui.shared.system.InputConsumerController; import com.android.systemui.shared.system.InputConsumerController;
import com.android.systemui.shared.system.InputMonitorCompat; import com.android.systemui.shared.system.InputMonitorCompat;
import com.android.systemui.shared.tracing.ProtoTraceable; import com.android.systemui.shared.tracing.ProtoTraceable;
import com.android.wm.shell.onehanded.IOneHanded;
import com.android.wm.shell.pip.IPip;
import com.android.wm.shell.splitscreen.ISplitScreen;
import com.android.wm.shell.startingsurface.IStartingWindow;
import com.android.wm.shell.transition.IShellTransitions;
import java.io.FileDescriptor; import java.io.FileDescriptor;
import java.io.PrintWriter; import java.io.PrintWriter;
@@ -141,8 +151,18 @@ public class TouchInteractionService extends Service implements PluginListener<O
public void onInitialize(Bundle bundle) { public void onInitialize(Bundle bundle) {
ISystemUiProxy proxy = ISystemUiProxy.Stub.asInterface( ISystemUiProxy proxy = ISystemUiProxy.Stub.asInterface(
bundle.getBinder(KEY_EXTRA_SYSUI_PROXY)); bundle.getBinder(KEY_EXTRA_SYSUI_PROXY));
IPip pip = IPip.Stub.asInterface(bundle.getBinder(KEY_EXTRA_SHELL_PIP));
ISplitScreen splitscreen = ISplitScreen.Stub.asInterface(bundle.getBinder(
KEY_EXTRA_SHELL_SPLIT_SCREEN));
IOneHanded onehanded = IOneHanded.Stub.asInterface(
bundle.getBinder(KEY_EXTRA_SHELL_ONE_HANDED));
IShellTransitions shellTransitions = IShellTransitions.Stub.asInterface(
bundle.getBinder(KEY_EXTRA_SHELL_SHELL_TRANSITIONS));
IStartingWindow startingWindow = IStartingWindow.Stub.asInterface(
bundle.getBinder(KEY_EXTRA_SHELL_STARTING_WINDOW));
MAIN_EXECUTOR.execute(() -> { MAIN_EXECUTOR.execute(() -> {
SystemUiProxy.INSTANCE.get(TouchInteractionService.this).setProxy(proxy); SystemUiProxy.INSTANCE.get(TouchInteractionService.this).setProxy(proxy, pip,
splitscreen, onehanded, shellTransitions, startingWindow);
TouchInteractionService.this.initInputMonitor(); TouchInteractionService.this.initInputMonitor();
preloadOverview(true /* fromInit */); preloadOverview(true /* fromInit */);
mDeviceState.runOnUserUnlocked(() -> { mDeviceState.runOnUserUnlocked(() -> {
@@ -432,7 +452,7 @@ public class TouchInteractionService extends Service implements PluginListener<O
} }
disposeEventHandlers(); disposeEventHandlers();
mDeviceState.destroy(); mDeviceState.destroy();
SystemUiProxy.INSTANCE.get(this).setProxy(null); SystemUiProxy.INSTANCE.get(this).clearProxy();
ProtoTracer.INSTANCE.get(this).stop(); ProtoTracer.INSTANCE.get(this).stop();
ProtoTracer.INSTANCE.get(this).remove(this); ProtoTracer.INSTANCE.get(this).remove(this);
@@ -40,6 +40,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_DISMISS_SWIPE_UP; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_DISMISS_SWIPE_UP;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_SWIPE_DOWN; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_SWIPE_DOWN;
import static com.android.launcher3.statehandlers.DepthController.DEPTH; import static com.android.launcher3.statehandlers.DepthController.DEPTH;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW; import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW;
import static com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId; import static com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId;
@@ -136,13 +137,13 @@ import com.android.quickstep.util.SurfaceTransactionApplier;
import com.android.quickstep.util.TaskViewSimulator; import com.android.quickstep.util.TaskViewSimulator;
import com.android.quickstep.util.TransformParams; import com.android.quickstep.util.TransformParams;
import com.android.systemui.plugins.ResourceProvider; import com.android.systemui.plugins.ResourceProvider;
import com.android.systemui.shared.recents.IPinnedStackAnimationListener;
import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.Task.TaskKey; import com.android.systemui.shared.recents.model.Task.TaskKey;
import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.PackageManagerWrapper; import com.android.systemui.shared.system.PackageManagerWrapper;
import com.android.systemui.shared.system.TaskStackChangeListener; import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.wm.shell.pip.IPipAnimationListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.function.Consumer; import java.util.function.Consumer;
@@ -409,7 +410,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
} }
}; };
private final PinnedStackAnimationListener mIPinnedStackAnimationListener = private final PinnedStackAnimationListener mIPipAnimationListener =
new PinnedStackAnimationListener(); new PinnedStackAnimationListener();
// Used to keep track of the last requested task list id, so that we do not request to load the // Used to keep track of the last requested task list id, so that we do not request to load the
@@ -653,9 +654,9 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
mLiveTileParams.setSyncTransactionApplier(mSyncTransactionApplier); mLiveTileParams.setSyncTransactionApplier(mSyncTransactionApplier);
RecentsModel.INSTANCE.get(getContext()).addThumbnailChangeListener(this); RecentsModel.INSTANCE.get(getContext()).addThumbnailChangeListener(this);
mIdp.addOnChangeListener(this); mIdp.addOnChangeListener(this);
mIPinnedStackAnimationListener.setActivity(mActivity); mIPipAnimationListener.setActivity(mActivity);
SystemUiProxy.INSTANCE.get(getContext()).setPinnedStackAnimationListener( SystemUiProxy.INSTANCE.get(getContext()).setPinnedStackAnimationListener(
mIPinnedStackAnimationListener); mIPipAnimationListener);
mOrientationState.initListeners(); mOrientationState.initListeners();
SplitScreenBounds.INSTANCE.addOnChangeListener(this); SplitScreenBounds.INSTANCE.addOnChangeListener(this);
mTaskOverlayFactory.initListeners(); mTaskOverlayFactory.initListeners();
@@ -674,7 +675,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
mIdp.removeOnChangeListener(this); mIdp.removeOnChangeListener(this);
SystemUiProxy.INSTANCE.get(getContext()).setPinnedStackAnimationListener(null); SystemUiProxy.INSTANCE.get(getContext()).setPinnedStackAnimationListener(null);
SplitScreenBounds.INSTANCE.removeOnChangeListener(this); SplitScreenBounds.INSTANCE.removeOnChangeListener(this);
mIPinnedStackAnimationListener.setActivity(null); mIPipAnimationListener.setActivity(null);
mOrientationState.destroyListeners(); mOrientationState.destroyListeners();
mTaskOverlayFactory.removeListeners(); mTaskOverlayFactory.removeListeners();
} }
@@ -3133,7 +3134,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
} }
private static class PinnedStackAnimationListener<T extends BaseActivity> extends private static class PinnedStackAnimationListener<T extends BaseActivity> extends
IPinnedStackAnimationListener.Stub { IPipAnimationListener.Stub {
private T mActivity; private T mActivity;
public void setActivity(T activity) { public void setActivity(T activity) {
@@ -3141,10 +3142,12 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
} }
@Override @Override
public void onPinnedStackAnimationStarted() { public void onPipAnimationStarted() {
// Needed for activities that auto-enter PiP, which will not trigger a remote MAIN_EXECUTOR.execute(() -> {
// animation to be created // Needed for activities that auto-enter PiP, which will not trigger a remote
mActivity.clearForceInvisibleFlag(STATE_HANDLER_INVISIBILITY_FLAGS); // animation to be created
mActivity.clearForceInvisibleFlag(STATE_HANDLER_INVISIBILITY_FLAGS);
});
} }
} }
} }