Merge cherrypicks of ['googleplex-android-review.googlesource.com/30987057', 'googleplex-android-review.googlesource.com/31260536'] into 25Q1-release.
Change-Id: I150a0a8bb529aa384002fb706d6d421e6ef5f8eb
This commit is contained in:
@@ -28,7 +28,6 @@ import com.android.launcher3.statemanager.StateManager;
|
||||
import com.android.launcher3.statemanager.StatefulContainer;
|
||||
import com.android.quickstep.TopTaskTracker;
|
||||
import com.android.quickstep.fallback.RecentsState;
|
||||
import com.android.quickstep.util.TISBindHelper;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
import com.android.quickstep.views.RecentsViewContainer;
|
||||
|
||||
@@ -139,12 +138,6 @@ public class FallbackTaskbarUIController
|
||||
return topTask.isHomeTask() || topTask.isRecentsTask();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected TISBindHelper getTISBindHelper() {
|
||||
return mRecentsContainer.getTISBindHelper();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTaskbarUIControllerName() {
|
||||
return "FallbackTaskbarUIController<" + mRecentsContainer.getClass().getSimpleName() + ">";
|
||||
|
||||
@@ -49,7 +49,6 @@ import com.android.quickstep.HomeVisibilityState;
|
||||
import com.android.quickstep.RecentsAnimationCallbacks;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
import com.android.quickstep.util.TISBindHelper;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
|
||||
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
|
||||
@@ -483,12 +482,6 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
mTaskbarLauncherStateController.resetIconAlignment();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected TISBindHelper getTISBindHelper() {
|
||||
return mLauncher.getTISBindHelper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dumpLogs(String prefix, PrintWriter pw) {
|
||||
super.dumpLogs(prefix, pw);
|
||||
|
||||
@@ -344,6 +344,10 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
|
||||
mCallbacks.onToggleOverview();
|
||||
}
|
||||
|
||||
public void hideOverview() {
|
||||
mCallbacks.onHideOverview();
|
||||
}
|
||||
|
||||
void sendBackKeyEvent(int action, boolean cancelled) {
|
||||
if (action == mLastSentBackAction) {
|
||||
// There must always be an alternating sequence of ACTION_DOWN and ACTION_UP events
|
||||
@@ -411,5 +415,8 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
|
||||
|
||||
/** Callback invoked when the overview button is pressed. */
|
||||
default void onToggleOverview() {}
|
||||
|
||||
/** Callback invoken when a visible overview needs to be hidden. */
|
||||
default void onHideOverview() { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,10 +39,7 @@ import com.android.launcher3.popup.SystemShortcut;
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarController;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.quickstep.OverviewCommandHelper;
|
||||
import com.android.quickstep.OverviewCommandHelper.CommandType;
|
||||
import com.android.quickstep.util.GroupTask;
|
||||
import com.android.quickstep.util.TISBindHelper;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
import com.android.quickstep.views.TaskContainer;
|
||||
import com.android.quickstep.views.TaskView;
|
||||
@@ -389,26 +386,13 @@ public class TaskbarUIController implements BubbleBarController.BubbleBarLocatio
|
||||
/** Adjusts the hotseat for the bubble bar. */
|
||||
public void adjustHotseatForBubbleBar(boolean isBubbleBarVisible) {}
|
||||
|
||||
@Nullable
|
||||
protected TISBindHelper getTISBindHelper() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches the focused task in the Keyboard Quick Switch view through the OverviewCommandHelper
|
||||
* <p>
|
||||
* Use this helper method when the focused task may be the overview task.
|
||||
*/
|
||||
public void launchKeyboardFocusedTask() {
|
||||
TISBindHelper tisBindHelper = getTISBindHelper();
|
||||
if (tisBindHelper == null) {
|
||||
return;
|
||||
}
|
||||
OverviewCommandHelper overviewCommandHelper = tisBindHelper.getOverviewCommandHelper();
|
||||
if (overviewCommandHelper == null) {
|
||||
return;
|
||||
}
|
||||
overviewCommandHelper.addCommand(CommandType.HIDE);
|
||||
mControllers.navButtonController.hideOverview();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -169,6 +169,7 @@ import com.android.launcher3.util.TouchController;
|
||||
import com.android.launcher3.widget.LauncherWidgetHolder;
|
||||
import com.android.quickstep.OverviewCommandHelper;
|
||||
import com.android.quickstep.OverviewComponentObserver;
|
||||
import com.android.quickstep.OverviewComponentObserver.OverviewChangeListener;
|
||||
import com.android.quickstep.RecentsAnimationDeviceState;
|
||||
import com.android.quickstep.RecentsModel;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
@@ -224,7 +225,6 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
SystemProperties.getBoolean("persist.debug.trace_layouts", false);
|
||||
private static final String TRACE_RELAYOUT_CLASS =
|
||||
SystemProperties.get("persist.debug.trace_request_layout_class", null);
|
||||
public static final boolean GO_LOW_RAM_RECENTS_ENABLED = false;
|
||||
|
||||
protected static final String RING_APPEAR_ANIMATION_PREFIX = "RingAppearAnimation\t";
|
||||
|
||||
@@ -264,7 +264,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
|
||||
private boolean mIsOverlayVisible;
|
||||
|
||||
private final Runnable mOverviewTargetChangeRunnable = this::onOverviewTargetChanged;
|
||||
private final OverviewChangeListener mOverviewChangeListener = this::onOverviewTargetChanged;
|
||||
|
||||
public static QuickstepLauncher getLauncher(Context context) {
|
||||
return fromContext(context);
|
||||
@@ -283,9 +283,6 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
systemUiProxy, RecentsModel.INSTANCE.get(this),
|
||||
() -> onStateBack());
|
||||
RecentsAnimationDeviceState deviceState = new RecentsAnimationDeviceState(asContext());
|
||||
// TODO(b/337863494): Explore use of the same OverviewComponentObserver across launcher
|
||||
OverviewComponentObserver overviewComponentObserver = new OverviewComponentObserver(
|
||||
asContext(), deviceState);
|
||||
if (DesktopModeStatus.canEnterDesktopMode(this)) {
|
||||
mDesktopRecentsTransitionController = new DesktopRecentsTransitionController(
|
||||
getStateManager(), systemUiProxy, getIApplicationThread(),
|
||||
@@ -294,7 +291,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
overviewPanel.init(mActionsView, mSplitSelectStateController,
|
||||
mDesktopRecentsTransitionController);
|
||||
mSplitWithKeyboardShortcutController = new SplitWithKeyboardShortcutController(this,
|
||||
mSplitSelectStateController, overviewComponentObserver, deviceState);
|
||||
mSplitSelectStateController, deviceState);
|
||||
mSplitToWorkspaceController = new SplitToWorkspaceController(this,
|
||||
mSplitSelectStateController);
|
||||
mActionsView.updateDimension(getDeviceProfile(), overviewPanel.getLastComputedTaskSize());
|
||||
@@ -307,8 +304,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
mTISBindHelper = new TISBindHelper(this, this::onTISConnected);
|
||||
mDepthController = new DepthController(this);
|
||||
if (DesktopModeStatus.canEnterDesktopModeOrShowAppHandle(this)) {
|
||||
mSplitSelectStateController.initSplitFromDesktopController(this,
|
||||
overviewComponentObserver);
|
||||
mSplitSelectStateController.initSplitFromDesktopController(this);
|
||||
}
|
||||
mHotseatPredictionController = new HotseatPredictionController(this);
|
||||
|
||||
@@ -552,10 +548,8 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
mUnfoldTransitionProgressProvider.destroy();
|
||||
}
|
||||
|
||||
TISBinder binder = mTISBindHelper.getBinder();
|
||||
if (binder != null) {
|
||||
binder.unregisterOverviewTargetChangeListener(mOverviewTargetChangeRunnable);
|
||||
}
|
||||
OverviewComponentObserver.INSTANCE.get(this)
|
||||
.removeOverviewChangeListener(mOverviewChangeListener);
|
||||
mTISBindHelper.onDestroy();
|
||||
|
||||
if (mLauncherUnfoldAnimationController != null) {
|
||||
@@ -697,6 +691,8 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
QuickstepOnboardingPrefs.setup(this);
|
||||
View.setTraceLayoutSteps(TRACE_LAYOUTS);
|
||||
View.setTracedRequestLayoutClassClass(TRACE_RELAYOUT_CLASS);
|
||||
OverviewComponentObserver.INSTANCE.get(this)
|
||||
.addOverviewChangeListener(mOverviewChangeListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1047,7 +1043,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
}
|
||||
}
|
||||
|
||||
private void onOverviewTargetChanged() {
|
||||
private void onOverviewTargetChanged(boolean isHomeAndOverviewSame) {
|
||||
QuickstepTransitionManager transitionManager = getAppTransitionManager();
|
||||
if (transitionManager != null) {
|
||||
transitionManager.onOverviewTargetChange();
|
||||
@@ -1060,7 +1056,6 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
taskbarManager.setActivity(this);
|
||||
}
|
||||
mTISBindHelper.setPredictiveBackToHomeInProgress(mIsPredictiveBackToHomeInProgress);
|
||||
binder.registerOverviewTargetChangeListener(mOverviewTargetChangeRunnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1432,12 +1427,6 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
return (mTaskbarUIController != null && mTaskbarUIController.hasBubbles());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public TISBindHelper getTISBindHelper() {
|
||||
return mTISBindHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleIncorrectSplitTargetSelection() {
|
||||
if (!enableSplitContextually() || !mSplitSelectStateController.isSplitSelectActive()) {
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.quickstep;
|
||||
import static android.content.Intent.ACTION_PACKAGE_ADDED;
|
||||
import static android.content.Intent.ACTION_PACKAGE_CHANGED;
|
||||
import static android.content.Intent.ACTION_PACKAGE_REMOVED;
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
|
||||
import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVITY;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
@@ -41,22 +42,34 @@ import androidx.annotation.UiThread;
|
||||
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.dagger.ApplicationContext;
|
||||
import com.android.launcher3.dagger.LauncherAppComponent;
|
||||
import com.android.launcher3.dagger.LauncherAppSingleton;
|
||||
import com.android.launcher3.util.DaggerSingletonObject;
|
||||
import com.android.launcher3.util.DaggerSingletonTracker;
|
||||
import com.android.launcher3.util.SimpleBroadcastReceiver;
|
||||
import com.android.quickstep.util.ActiveGestureProtoLogProxy;
|
||||
import com.android.systemui.shared.system.PackageManagerWrapper;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Class to keep track of the current overview component based off user preferences and app updates
|
||||
* and provide callers the relevant classes.
|
||||
*/
|
||||
@LauncherAppSingleton
|
||||
public final class OverviewComponentObserver {
|
||||
private static final String TAG = "OverviewComponentObserver";
|
||||
|
||||
public static final DaggerSingletonObject<OverviewComponentObserver> INSTANCE =
|
||||
new DaggerSingletonObject<>(LauncherAppComponent::getOverviewComponentObserver);
|
||||
|
||||
// We register broadcast receivers on main thread to avoid missing updates.
|
||||
private final SimpleBroadcastReceiver mUserPreferenceChangeReceiver =
|
||||
new SimpleBroadcastReceiver(MAIN_EXECUTOR, this::updateOverviewTargets);
|
||||
@@ -64,14 +77,16 @@ public final class OverviewComponentObserver {
|
||||
new SimpleBroadcastReceiver(MAIN_EXECUTOR, this::updateOverviewTargets);
|
||||
|
||||
private final Context mContext;
|
||||
private final RecentsAnimationDeviceState mDeviceState;
|
||||
private final RecentsDisplayModel mRecentsDisplayModel;
|
||||
|
||||
private final Intent mCurrentHomeIntent;
|
||||
private final Intent mMyHomeIntent;
|
||||
private final Intent mFallbackIntent;
|
||||
private final SparseIntArray mConfigChangesMap = new SparseIntArray();
|
||||
private final String mSetupWizardPkg;
|
||||
|
||||
private Consumer<Boolean> mOverviewChangeListener = b -> { };
|
||||
private final List<OverviewChangeListener> mOverviewChangeListeners =
|
||||
new CopyOnWriteArrayList<>();
|
||||
|
||||
private String mUpdateRegisteredPackage;
|
||||
private BaseContainerInterface mContainerInterface;
|
||||
@@ -80,10 +95,13 @@ public final class OverviewComponentObserver {
|
||||
private boolean mIsDefaultHome;
|
||||
private boolean mIsHomeDisabled;
|
||||
|
||||
|
||||
public OverviewComponentObserver(Context context, RecentsAnimationDeviceState deviceState) {
|
||||
@Inject
|
||||
public OverviewComponentObserver(
|
||||
@ApplicationContext Context context,
|
||||
RecentsDisplayModel recentsDisplayModel,
|
||||
DaggerSingletonTracker lifecycleTracker) {
|
||||
mContext = context;
|
||||
mDeviceState = deviceState;
|
||||
mRecentsDisplayModel = recentsDisplayModel;
|
||||
mCurrentHomeIntent = createHomeIntent();
|
||||
mMyHomeIntent = new Intent(mCurrentHomeIntent).setPackage(mContext.getPackageName());
|
||||
ResolveInfo info = context.getPackageManager().resolveActivity(mMyHomeIntent, 0);
|
||||
@@ -107,21 +125,27 @@ public final class OverviewComponentObserver {
|
||||
|
||||
mUserPreferenceChangeReceiver.register(mContext, ACTION_PREFERRED_ACTIVITY_CHANGED);
|
||||
updateOverviewTargets();
|
||||
|
||||
lifecycleTracker.addCloseable(this::onDestroy);
|
||||
}
|
||||
|
||||
/** Adds a listener for changes in {@link #isHomeAndOverviewSame()} */
|
||||
public void addOverviewChangeListener(OverviewChangeListener overviewChangeListener) {
|
||||
mOverviewChangeListeners.add(overviewChangeListener);
|
||||
}
|
||||
|
||||
/** Removes a previously added listener */
|
||||
public void removeOverviewChangeListener(OverviewChangeListener overviewChangeListener) {
|
||||
mOverviewChangeListeners.remove(overviewChangeListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a listener for changes in {@link #isHomeAndOverviewSame()}
|
||||
* Called to set home enabled/disabled state via systemUI
|
||||
* @param isHomeDisabled
|
||||
*/
|
||||
public void setOverviewChangeListener(Consumer<Boolean> overviewChangeListener) {
|
||||
// TODO(b/337861962): This method should be able to support multiple listeners instead of
|
||||
// one so that we can reuse the same instance of this class across multiple places
|
||||
mOverviewChangeListener = overviewChangeListener;
|
||||
}
|
||||
|
||||
/** Called on {@link TouchInteractionService#onSystemUiFlagsChanged} */
|
||||
@UiThread
|
||||
public void onSystemUiStateChanged() {
|
||||
if (mDeviceState.isHomeDisabled() != mIsHomeDisabled) {
|
||||
public void setHomeDisabled(boolean isHomeDisabled) {
|
||||
if (isHomeDisabled != mIsHomeDisabled) {
|
||||
mIsHomeDisabled = isHomeDisabled;
|
||||
updateOverviewTargets();
|
||||
}
|
||||
}
|
||||
@@ -145,7 +169,6 @@ public final class OverviewComponentObserver {
|
||||
defaultHome = null;
|
||||
}
|
||||
|
||||
mIsHomeDisabled = mDeviceState.isHomeDisabled();
|
||||
mIsDefaultHome = Objects.equals(mMyHomeIntent.getComponent(), defaultHome);
|
||||
|
||||
// Set assistant visibility to 0 from launcher's perspective, ensures any elements that
|
||||
@@ -203,13 +226,13 @@ public final class OverviewComponentObserver {
|
||||
ACTION_PACKAGE_CHANGED, ACTION_PACKAGE_REMOVED);
|
||||
}
|
||||
}
|
||||
mOverviewChangeListener.accept(mIsHomeAndOverviewSame);
|
||||
mOverviewChangeListeners.forEach(l -> l.onOverviewTargetChange(mIsHomeAndOverviewSame));
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up any registered receivers.
|
||||
*/
|
||||
public void onDestroy() {
|
||||
private void onDestroy() {
|
||||
mUserPreferenceChangeReceiver.unregisterReceiverSafely(mContext);
|
||||
unregisterOtherHomeAppUpdateReceiver();
|
||||
}
|
||||
@@ -293,11 +316,7 @@ public final class OverviewComponentObserver {
|
||||
*/
|
||||
public static void startHomeIntentSafely(@NonNull Context context, @Nullable Bundle options,
|
||||
@NonNull String reason) {
|
||||
RecentsAnimationDeviceState deviceState = new RecentsAnimationDeviceState(context);
|
||||
OverviewComponentObserver observer = new OverviewComponentObserver(context, deviceState);
|
||||
Intent intent = observer.getHomeIntent();
|
||||
observer.onDestroy();
|
||||
deviceState.destroy();
|
||||
Intent intent = OverviewComponentObserver.INSTANCE.get(context).getHomeIntent();
|
||||
startHomeIntentSafely(context, intent, options, reason);
|
||||
}
|
||||
|
||||
@@ -317,6 +336,17 @@ public final class OverviewComponentObserver {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for listening to overview changes
|
||||
*/
|
||||
public interface OverviewChangeListener {
|
||||
|
||||
/**
|
||||
* Called when the overview target changes
|
||||
*/
|
||||
void onOverviewTargetChange(boolean isHomeAndOverviewSame);
|
||||
}
|
||||
|
||||
private static Intent createHomeIntent() {
|
||||
return new Intent(Intent.ACTION_MAIN)
|
||||
.addCategory(Intent.CATEGORY_HOME)
|
||||
|
||||
@@ -204,27 +204,13 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
|
||||
|
||||
@Override
|
||||
protected WindowInsets getWindowInsets() {
|
||||
RecentsAnimationDeviceState rads = new RecentsAnimationDeviceState(mContext);
|
||||
OverviewComponentObserver observer = new OverviewComponentObserver(mContext, rads);
|
||||
try {
|
||||
RecentsViewContainer container = observer.getContainerInterface().getCreatedContainer();
|
||||
|
||||
return container == null ? null : container.getRootView().getRootWindowInsets();
|
||||
} finally {
|
||||
observer.onDestroy();
|
||||
rads.destroy();
|
||||
}
|
||||
RecentsViewContainer container = getRecentsViewContainer();
|
||||
return container == null ? null : container.getRootView().getRootWindowInsets();
|
||||
}
|
||||
|
||||
private RecentsViewContainer getRecentsViewContainer() {
|
||||
RecentsAnimationDeviceState rads = new RecentsAnimationDeviceState(mContext);
|
||||
OverviewComponentObserver observer = new OverviewComponentObserver(mContext, rads);
|
||||
try {
|
||||
return observer.getContainerInterface().getCreatedContainer();
|
||||
} finally {
|
||||
observer.onDestroy();
|
||||
rads.destroy();
|
||||
}
|
||||
return OverviewComponentObserver.INSTANCE.get(mContext)
|
||||
.getContainerInterface().getCreatedContainer();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -546,12 +546,6 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> implem
|
||||
return overviewCommandHelper == null || overviewCommandHelper.canStartHomeSafely();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public TISBindHelper getTISBindHelper() {
|
||||
return mTISBindHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecentsViewVisible() {
|
||||
return getStateManager().getState().isRecentsViewVisible();
|
||||
|
||||
@@ -90,6 +90,7 @@ import com.android.launcher3.util.ScreenOnTracker;
|
||||
import com.android.launcher3.util.TraceHelper;
|
||||
import com.android.quickstep.OverviewCommandHelper.CommandType;
|
||||
import com.android.quickstep.fallback.window.RecentsWindowManager;
|
||||
import com.android.quickstep.OverviewComponentObserver.OverviewChangeListener;
|
||||
import com.android.quickstep.fallback.window.RecentsWindowSwipeHandler;
|
||||
import com.android.quickstep.inputconsumers.BubbleBarInputConsumer;
|
||||
import com.android.quickstep.inputconsumers.OneHandedModeInputConsumer;
|
||||
@@ -103,7 +104,6 @@ import com.android.quickstep.views.RecentsViewContainer;
|
||||
import com.android.systemui.shared.recents.IOverviewProxy;
|
||||
import com.android.systemui.shared.recents.ISystemUiProxy;
|
||||
import com.android.systemui.shared.statusbar.phone.BarTransitions;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver;
|
||||
import com.android.systemui.shared.system.InputConsumerController;
|
||||
import com.android.systemui.shared.system.InputMonitorCompat;
|
||||
@@ -124,7 +124,6 @@ import com.android.wm.shell.startingsurface.IStartingWindow;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
@@ -150,8 +149,6 @@ public class TouchInteractionService extends Service {
|
||||
|
||||
private final WeakReference<TouchInteractionService> mTis;
|
||||
|
||||
private final Set<Runnable> mOnOverviewTargetChangeListeners = new HashSet<>();
|
||||
|
||||
private TISBinder(TouchInteractionService tis) {
|
||||
mTis = new WeakReference<>(tis);
|
||||
}
|
||||
@@ -498,28 +495,11 @@ public class TouchInteractionService extends Service {
|
||||
tis -> tis.mDeviceState.setGestureBlockingTaskId(taskId));
|
||||
}
|
||||
|
||||
/** Registers a listener to be run on Overview Target updates. */
|
||||
public void registerOverviewTargetChangeListener(@NonNull Runnable listener) {
|
||||
mOnOverviewTargetChangeListeners.add(listener);
|
||||
}
|
||||
|
||||
/** Unregisters an OverviewTargetChange listener. */
|
||||
public void unregisterOverviewTargetChangeListener(@NonNull Runnable listener) {
|
||||
mOnOverviewTargetChangeListeners.remove(listener);
|
||||
}
|
||||
|
||||
protected void onOverviewTargetChange() {
|
||||
Set<Runnable> listeners = new HashSet<>(mOnOverviewTargetChangeListeners);
|
||||
for (Runnable listener : listeners) {
|
||||
listener.run();
|
||||
}
|
||||
}
|
||||
|
||||
/** Refreshes the current overview target. */
|
||||
public void refreshOverviewTarget() {
|
||||
executeForTouchInteractionService(tis -> {
|
||||
tis.mAllAppsActionManager.onDestroy();
|
||||
tis.onOverviewTargetChange(tis.mOverviewComponentObserver.isHomeAndOverviewSame());
|
||||
tis.onOverviewTargetChanged(tis.mOverviewComponentObserver.isHomeAndOverviewSame());
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -601,6 +581,7 @@ public class TouchInteractionService extends Service {
|
||||
private final Runnable mUserUnlockedRunnable = this::onUserUnlocked;
|
||||
|
||||
private final ScreenOnTracker.ScreenOnListener mScreenOnListener = this::onScreenOnChanged;
|
||||
private final OverviewChangeListener mOverviewChangeListener = this::onOverviewTargetChanged;
|
||||
|
||||
private final TaskbarNavButtonCallbacks mNavCallbacks = new TaskbarNavButtonCallbacks() {
|
||||
@Override
|
||||
@@ -612,9 +593,13 @@ public class TouchInteractionService extends Service {
|
||||
public void onToggleOverview() {
|
||||
mOverviewCommandHelper.addCommand(CommandType.TOGGLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHideOverview() {
|
||||
mOverviewCommandHelper.addCommand(CommandType.HIDE);
|
||||
}
|
||||
};
|
||||
|
||||
private ActivityManagerWrapper mAM;
|
||||
private OverviewCommandHelper mOverviewCommandHelper;
|
||||
private OverviewComponentObserver mOverviewComponentObserver;
|
||||
private InputConsumerController mInputConsumer;
|
||||
@@ -650,7 +635,6 @@ public class TouchInteractionService extends Service {
|
||||
// Initialize anything here that is needed in direct boot mode.
|
||||
// Everything else should be initialized in onUserUnlocked() below.
|
||||
mMainChoreographer = Choreographer.getInstance();
|
||||
mAM = ActivityManagerWrapper.getInstance();
|
||||
mDeviceState = new RecentsAnimationDeviceState(this, true);
|
||||
mRotationTouchHelper = mDeviceState.getRotationTouchHelper();
|
||||
mAllAppsActionManager = new AllAppsActionManager(
|
||||
@@ -723,7 +707,7 @@ public class TouchInteractionService extends Service {
|
||||
Log.d(TAG, "onUserUnlocked: userId=" + getUserId()
|
||||
+ " instance=" + System.identityHashCode(this));
|
||||
mTaskAnimationManager = new TaskAnimationManager(this, mRecentsWindowManager);
|
||||
mOverviewComponentObserver = new OverviewComponentObserver(this, mDeviceState);
|
||||
mOverviewComponentObserver = OverviewComponentObserver.INSTANCE.get(this);
|
||||
mOverviewCommandHelper = new OverviewCommandHelper(this,
|
||||
mOverviewComponentObserver, mTaskAnimationManager);
|
||||
mResetGestureInputConsumer = new ResetGestureInputConsumer(
|
||||
@@ -739,8 +723,8 @@ public class TouchInteractionService extends Service {
|
||||
// new ModelPreload().start(this);
|
||||
resetHomeBounceSeenOnQuickstepEnabledFirstTime();
|
||||
|
||||
mOverviewComponentObserver.setOverviewChangeListener(this::onOverviewTargetChange);
|
||||
onOverviewTargetChange(mOverviewComponentObserver.isHomeAndOverviewSame());
|
||||
mOverviewComponentObserver.addOverviewChangeListener(mOverviewChangeListener);
|
||||
onOverviewTargetChanged(mOverviewComponentObserver.isHomeAndOverviewSame());
|
||||
|
||||
mTaskbarManager.onUserUnlocked();
|
||||
}
|
||||
@@ -765,7 +749,7 @@ public class TouchInteractionService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
private void onOverviewTargetChange(boolean isHomeAndOverviewSame) {
|
||||
private void onOverviewTargetChanged(boolean isHomeAndOverviewSame) {
|
||||
mAllAppsActionManager.setHomeAndOverviewSame(isHomeAndOverviewSame);
|
||||
RecentsViewContainer newOverviewContainer =
|
||||
mOverviewComponentObserver.getContainerInterface().getCreatedContainer();
|
||||
@@ -777,7 +761,6 @@ public class TouchInteractionService extends Service {
|
||||
mTaskbarManager.setRecentsViewContainer(newOverviewContainer);
|
||||
}
|
||||
}
|
||||
mTISBinder.onOverviewTargetChange();
|
||||
}
|
||||
|
||||
private PendingIntent createAllAppsPendingIntent() {
|
||||
@@ -796,7 +779,7 @@ public class TouchInteractionService extends Service {
|
||||
if (LockedUserState.get(this).isUserUnlocked()) {
|
||||
long systemUiStateFlags = mDeviceState.getSystemUiStateFlags();
|
||||
SystemUiProxy.INSTANCE.get(this).setLastSystemUiStateFlags(systemUiStateFlags);
|
||||
mOverviewComponentObserver.onSystemUiStateChanged();
|
||||
mOverviewComponentObserver.setHomeDisabled(mDeviceState.isHomeDisabled());
|
||||
mTaskbarManager.onSystemUiFlagsChanged(systemUiStateFlags);
|
||||
mTaskAnimationManager.onSystemUiFlagsChanged(lastSysUIFlags, systemUiStateFlags);
|
||||
}
|
||||
@@ -817,7 +800,8 @@ public class TouchInteractionService extends Service {
|
||||
sIsInitialized = false;
|
||||
if (LockedUserState.get(this).isUserUnlocked()) {
|
||||
mInputConsumer.unregisterInputConsumer();
|
||||
mOverviewComponentObserver.onDestroy();
|
||||
mOverviewComponentObserver.setHomeDisabled(false);
|
||||
mOverviewComponentObserver.removeOverviewChangeListener(mOverviewChangeListener);
|
||||
}
|
||||
disposeEventHandlers("TouchInteractionService onDestroy()");
|
||||
mDeviceState.destroy();
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.quickstep.dagger;
|
||||
import com.android.launcher3.dagger.LauncherAppComponent;
|
||||
import com.android.launcher3.dagger.LauncherBaseAppComponent;
|
||||
import com.android.launcher3.model.WellbeingModel;
|
||||
import com.android.quickstep.OverviewComponentObserver;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.util.AsyncClockEventDelegate;
|
||||
|
||||
@@ -37,4 +38,6 @@ public interface QuickstepBaseAppComponent extends LauncherBaseAppComponent {
|
||||
AsyncClockEventDelegate getAsyncClockEventDelegate();
|
||||
|
||||
SystemUiProxy getSystemUiProxy();
|
||||
|
||||
OverviewComponentObserver getOverviewComponentObserver();
|
||||
}
|
||||
|
||||
@@ -321,10 +321,6 @@ class RecentsWindowManager(context: Context) :
|
||||
return taskbarUIController
|
||||
}
|
||||
|
||||
override fun getTISBindHelper(): TISBindHelper {
|
||||
return tisBindHelper
|
||||
}
|
||||
|
||||
fun registerInitListener(onInitListener: Predicate<Boolean>) {
|
||||
this.onInitListener = onInitListener
|
||||
}
|
||||
|
||||
@@ -70,6 +70,8 @@ import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||
import com.android.launcher3.taskbar.TaskbarManager;
|
||||
import com.android.launcher3.util.Executors;
|
||||
import com.android.quickstep.GestureState;
|
||||
import com.android.quickstep.OverviewComponentObserver;
|
||||
import com.android.quickstep.OverviewComponentObserver.OverviewChangeListener;
|
||||
import com.android.quickstep.TouchInteractionService.TISBinder;
|
||||
import com.android.quickstep.util.LottieAnimationColorUtils;
|
||||
import com.android.quickstep.util.TISBindHelper;
|
||||
@@ -121,7 +123,7 @@ public class AllSetActivity extends Activity {
|
||||
|
||||
private TextView mHintView;
|
||||
|
||||
private final Runnable mOverviewTargetChangeRunnable = this::onOverviewTargetChanged;
|
||||
private final OverviewChangeListener mOverviewChangeListener = this::onOverviewTargetChange;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@@ -197,6 +199,9 @@ public class AllSetActivity extends Activity {
|
||||
|
||||
setUpBackgroundAnimation(getDP().isTablet);
|
||||
getIDP().addOnChangeListener(mOnIDPChangeListener);
|
||||
|
||||
OverviewComponentObserver.INSTANCE.get(this)
|
||||
.addOverviewChangeListener(mOverviewChangeListener);
|
||||
}
|
||||
|
||||
private InvariantDeviceProfile getIDP() {
|
||||
@@ -286,7 +291,6 @@ public class AllSetActivity extends Activity {
|
||||
private void onTISConnected(TISBinder binder) {
|
||||
setSetupUIVisible(isResumed());
|
||||
binder.setSwipeUpProxy(isResumed() ? this::createSwipeUpProxy : null);
|
||||
binder.registerOverviewTargetChangeListener(mOverviewTargetChangeRunnable);
|
||||
binder.preloadOverviewForSUWAllSet();
|
||||
TaskbarManager taskbarManager = binder.getTaskbarManager();
|
||||
if (taskbarManager != null) {
|
||||
@@ -294,11 +298,10 @@ public class AllSetActivity extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
private void onOverviewTargetChanged() {
|
||||
private void onOverviewTargetChange(boolean isHomeAndOverviewSame) {
|
||||
TISBinder binder = mTISBindHelper.getBinder();
|
||||
if (binder != null) {
|
||||
binder.preloadOverviewForSUWAllSet();
|
||||
binder.unregisterOverviewTargetChangeListener(mOverviewTargetChangeRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,7 +321,6 @@ public class AllSetActivity extends Activity {
|
||||
if (binder != null) {
|
||||
setSetupUIVisible(false);
|
||||
binder.setSwipeUpProxy(null);
|
||||
binder.unregisterOverviewTargetChangeListener(mOverviewTargetChangeRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,6 +348,8 @@ public class AllSetActivity extends Activity {
|
||||
if (!isChangingConfigurations()) {
|
||||
dispatchLauncherAnimStartEnd();
|
||||
}
|
||||
OverviewComponentObserver.INSTANCE.get(this)
|
||||
.removeOverviewChangeListener(mOverviewChangeListener);
|
||||
}
|
||||
|
||||
private AnimatedFloat createSwipeUpProxy(GestureState state) {
|
||||
|
||||
+1
-3
@@ -86,10 +86,8 @@ abstract class SwipeUpGestureTutorialController extends TutorialController {
|
||||
SwipeUpGestureTutorialController(TutorialFragment tutorialFragment, TutorialType tutorialType) {
|
||||
super(tutorialFragment, tutorialType);
|
||||
RecentsAnimationDeviceState deviceState = new RecentsAnimationDeviceState(mContext);
|
||||
OverviewComponentObserver observer = new OverviewComponentObserver(mContext, deviceState);
|
||||
mTaskViewSwipeUpAnimation = new ViewSwipeUpAnimation(mContext, deviceState,
|
||||
new GestureState(observer, -1));
|
||||
observer.onDestroy();
|
||||
new GestureState(OverviewComponentObserver.INSTANCE.get(mContext), -1));
|
||||
deviceState.destroy();
|
||||
|
||||
DeviceProfile dp = InvariantDeviceProfile.INSTANCE.get(mContext)
|
||||
|
||||
@@ -34,7 +34,6 @@ import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_LAUN
|
||||
import com.android.quickstep.BaseContainerInterface
|
||||
import com.android.quickstep.DeviceConfigWrapper
|
||||
import com.android.quickstep.OverviewComponentObserver
|
||||
import com.android.quickstep.RecentsAnimationDeviceState
|
||||
import com.android.quickstep.SystemUiProxy
|
||||
import com.android.quickstep.TopTaskTracker
|
||||
import com.android.quickstep.views.RecentsView
|
||||
@@ -223,14 +222,7 @@ internal constructor(
|
||||
|
||||
@VisibleForTesting
|
||||
fun getRecentsContainerInterface(): BaseContainerInterface<*, *>? {
|
||||
val rads = RecentsAnimationDeviceState(context)
|
||||
val observer = OverviewComponentObserver(context, rads)
|
||||
try {
|
||||
return observer.containerInterface
|
||||
} finally {
|
||||
observer.onDestroy()
|
||||
rads.destroy()
|
||||
}
|
||||
return OverviewComponentObserver.INSTANCE.get(context).containerInterface
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -583,10 +583,8 @@ public class SplitSelectStateController {
|
||||
/**
|
||||
* Init {@code SplitFromDesktopController}
|
||||
*/
|
||||
public void initSplitFromDesktopController(QuickstepLauncher launcher,
|
||||
OverviewComponentObserver overviewComponentObserver) {
|
||||
initSplitFromDesktopController(
|
||||
new SplitFromDesktopController(launcher, overviewComponentObserver));
|
||||
public void initSplitFromDesktopController(QuickstepLauncher launcher) {
|
||||
initSplitFromDesktopController(new SplitFromDesktopController(launcher));
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -853,10 +851,9 @@ public class SplitSelectStateController {
|
||||
private DesktopSplitSelectListenerImpl mSplitSelectListener;
|
||||
private Drawable mAppIcon;
|
||||
|
||||
public SplitFromDesktopController(QuickstepLauncher launcher,
|
||||
OverviewComponentObserver overviewComponentObserver) {
|
||||
public SplitFromDesktopController(QuickstepLauncher launcher) {
|
||||
mLauncher = launcher;
|
||||
mOverviewComponentObserver = overviewComponentObserver;
|
||||
mOverviewComponentObserver = OverviewComponentObserver.INSTANCE.get(launcher);
|
||||
mSplitPlaceholderSize = mLauncher.getResources().getDimensionPixelSize(
|
||||
R.dimen.split_placeholder_size);
|
||||
mSplitPlaceholderInset = mLauncher.getResources().getDimensionPixelSize(
|
||||
|
||||
@@ -63,12 +63,11 @@ public class SplitWithKeyboardShortcutController {
|
||||
|
||||
public SplitWithKeyboardShortcutController(QuickstepLauncher launcher,
|
||||
SplitSelectStateController controller,
|
||||
OverviewComponentObserver overviewComponentObserver,
|
||||
RecentsAnimationDeviceState deviceState) {
|
||||
mLauncher = launcher;
|
||||
mController = controller;
|
||||
mDeviceState = deviceState;
|
||||
mOverviewComponentObserver = overviewComponentObserver;
|
||||
mOverviewComponentObserver = OverviewComponentObserver.INSTANCE.get(launcher);
|
||||
|
||||
mSplitPlaceholderSize = mLauncher.getResources().getDimensionPixelSize(
|
||||
R.dimen.split_placeholder_size);
|
||||
@@ -106,7 +105,6 @@ public class SplitWithKeyboardShortcutController {
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
mOverviewComponentObserver.onDestroy();
|
||||
mDeviceState.destroy();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.BaseActivity;
|
||||
@@ -34,7 +33,6 @@ import com.android.launcher3.statehandlers.DesktopVisibilityController;
|
||||
import com.android.launcher3.taskbar.TaskbarUIController;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
import com.android.launcher3.views.ScrimView;
|
||||
import com.android.quickstep.util.TISBindHelper;
|
||||
|
||||
/**
|
||||
* Interface to be implemented by the parent view of RecentsView
|
||||
@@ -217,6 +215,4 @@ public interface RecentsViewContainer extends ActivityContext {
|
||||
void setTaskbarUIController(@Nullable TaskbarUIController taskbarUIController);
|
||||
|
||||
@Nullable TaskbarUIController getTaskbarUIController();
|
||||
|
||||
@NonNull TISBindHelper getTISBindHelper();
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ class LauncherSwipeHandlerV2Test {
|
||||
)
|
||||
val deviceState = mock(RecentsAnimationDeviceState::class.java)
|
||||
whenever(deviceState.rotationTouchHelper).thenReturn(mock(RotationTouchHelper::class.java))
|
||||
gestureState = spy(GestureState(OverviewComponentObserver(sandboxContext, deviceState), 0))
|
||||
gestureState = spy(GestureState(OverviewComponentObserver.INSTANCE.get(sandboxContext), 0))
|
||||
|
||||
underTest =
|
||||
LauncherSwipeHandlerV2(
|
||||
|
||||
@@ -64,6 +64,7 @@ import com.android.launcher3.util.rule.ScreenRecordRule;
|
||||
import com.android.launcher3.util.rule.TestIsolationRule;
|
||||
import com.android.launcher3.util.rule.TestStabilityRule;
|
||||
import com.android.launcher3.util.rule.ViewCaptureRule;
|
||||
import com.android.quickstep.OverviewComponentObserver.OverviewChangeListener;
|
||||
import com.android.quickstep.fallback.window.RecentsWindowManager;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
import com.android.quickstep.views.RecentsViewContainer;
|
||||
@@ -330,7 +331,7 @@ public class FallbackRecentsTest {
|
||||
return recentsViewContainer.<RecentsView>getOverviewPanel().getTaskViewCount();
|
||||
}
|
||||
|
||||
private class OverviewUpdateHandler {
|
||||
private class OverviewUpdateHandler implements OverviewChangeListener {
|
||||
|
||||
final RecentsAnimationDeviceState mRads;
|
||||
final OverviewComponentObserver mObserver;
|
||||
@@ -339,19 +340,24 @@ public class FallbackRecentsTest {
|
||||
OverviewUpdateHandler() {
|
||||
Context ctx = getInstrumentation().getTargetContext();
|
||||
mRads = new RecentsAnimationDeviceState(ctx);
|
||||
mObserver = new OverviewComponentObserver(ctx, mRads);
|
||||
mObserver = OverviewComponentObserver.INSTANCE.get(ctx);
|
||||
mChangeCounter = new CountDownLatch(1);
|
||||
if (mObserver.getHomeIntent().getComponent()
|
||||
.getPackageName().equals(mOtherLauncherActivity.packageName)) {
|
||||
// Home already same
|
||||
mChangeCounter.countDown();
|
||||
} else {
|
||||
mObserver.setOverviewChangeListener(b -> mChangeCounter.countDown());
|
||||
mObserver.addOverviewChangeListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOverviewTargetChange(boolean isHomeAndOverviewSame) {
|
||||
mChangeCounter.countDown();
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
mObserver.onDestroy();
|
||||
mObserver.removeOverviewChangeListener(this);
|
||||
mRads.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user