diff options
Diffstat (limited to 'quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java')
-rw-r--r-- | quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java | 269 |
1 files changed, 135 insertions, 134 deletions
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 3139e4d91a..5a46b8d8e9 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -20,23 +20,20 @@ import static android.os.Trace.TRACE_TAG_APP; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_OPTIMIZE_MEASURE; import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED; +import static com.android.app.animation.Interpolators.EMPHASIZED; import static com.android.launcher3.LauncherSettings.Animation.DEFAULT_NO_ICON; import static com.android.launcher3.LauncherSettings.Animation.VIEW_BACKGROUND; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT; -import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.NO_OFFSET; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK; import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT; -import static com.android.launcher3.anim.Interpolators.EMPHASIZED; import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent; -import static com.android.launcher3.config.FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE; import static com.android.launcher3.config.FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE; -import static com.android.launcher3.config.FeatureFlags.RECEIVE_UNFOLD_EVENTS_FROM_SYSUI; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP; import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID; import static com.android.launcher3.popup.QuickstepSystemShortcut.getSplitSelectShortcutByPosition; @@ -60,8 +57,6 @@ import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SY import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; -import android.animation.ValueAnimator; -import android.app.ActivityManager; import android.app.ActivityOptions; import android.content.Context; import android.content.Intent; @@ -71,20 +66,20 @@ import android.content.res.Configuration; import android.graphics.Color; import android.graphics.Rect; import android.graphics.RectF; -import android.hardware.SensorManager; -import android.hardware.devicestate.DeviceStateManager; import android.hardware.display.DisplayManager; import android.media.permission.SafeCloseable; import android.os.Build; import android.os.Bundle; -import android.os.CancellationSignal; import android.os.IBinder; import android.os.SystemProperties; import android.os.Trace; +import android.util.AttributeSet; +import android.util.Log; import android.view.Display; import android.view.HapticFeedbackConstants; -import android.view.RemoteAnimationTarget; import android.view.View; +import android.widget.AnalogClock; +import android.widget.TextClock; import android.window.BackEvent; import android.window.OnBackAnimationCallback; import android.window.OnBackInvokedDispatcher; @@ -111,7 +106,6 @@ import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.appprediction.PredictionRowView; import com.android.launcher3.config.FeatureFlags; -import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.hybridhotseat.HotseatPredictionController; import com.android.launcher3.logging.InstanceId; import com.android.launcher3.logging.StatsLogManager; @@ -119,9 +113,9 @@ import com.android.launcher3.logging.StatsLogManager.StatsLogger; import com.android.launcher3.model.BgDataModel.FixedContainerItems; import com.android.launcher3.model.WellbeingModel; import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.proxy.ProxyActivityStarter; -import com.android.launcher3.proxy.StartActivityParams; import com.android.launcher3.statehandlers.DepthController; import com.android.launcher3.statehandlers.DesktopVisibilityController; import com.android.launcher3.statemanager.StateManager.AtomicAnimationFactory; @@ -153,6 +147,7 @@ import com.android.launcher3.util.RunnableList; import com.android.launcher3.util.SplitConfigurationOptions; import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption; import com.android.launcher3.util.SplitConfigurationOptions.SplitSelectSource; +import com.android.launcher3.util.StartActivityParams; import com.android.launcher3.util.TouchController; import com.android.launcher3.widget.LauncherWidgetHolder; import com.android.quickstep.OverviewCommandHelper; @@ -160,12 +155,10 @@ import com.android.quickstep.RecentsModel; import com.android.quickstep.SystemUiProxy; import com.android.quickstep.TaskUtils; import com.android.quickstep.TouchInteractionService.TISBinder; +import com.android.quickstep.util.AsyncClockEventDelegate; import com.android.quickstep.util.GroupTask; import com.android.quickstep.util.LauncherUnfoldAnimationController; -import com.android.quickstep.util.ProxyScreenStatusProvider; import com.android.quickstep.util.QuickstepOnboardingPrefs; -import com.android.quickstep.util.RemoteAnimationProvider; -import com.android.quickstep.util.RemoteFadeOutAnimationListener; import com.android.quickstep.util.SplitSelectStateController; import com.android.quickstep.util.SplitToWorkspaceController; import com.android.quickstep.util.SplitWithKeyboardShortcutController; @@ -175,16 +168,14 @@ import com.android.quickstep.views.FloatingTaskView; import com.android.quickstep.views.OverviewActionsView; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; +import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.unfold.RemoteUnfoldSharedComponent; -import com.android.systemui.unfold.UnfoldSharedComponent; import com.android.systemui.unfold.UnfoldTransitionFactory; import com.android.systemui.unfold.UnfoldTransitionProgressProvider; import com.android.systemui.unfold.config.ResourceUnfoldTransitionConfig; import com.android.systemui.unfold.config.UnfoldTransitionConfig; import com.android.systemui.unfold.progress.RemoteUnfoldTransitionReceiver; -import com.android.systemui.unfold.system.ActivityManagerActivityTypeProvider; -import com.android.systemui.unfold.system.DeviceStateManagerFoldProvider; import com.android.systemui.unfold.updates.RotationChangeProvider; import java.io.FileDescriptor; @@ -194,16 +185,22 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Objects; +import java.util.function.Consumer; import java.util.function.Predicate; import java.util.stream.Stream; public class QuickstepLauncher extends Launcher { + private static final boolean TRACE_LAYOUTS = + 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 ENABLE_PIP_KEEP_CLEAR_ALGORITHM = - SystemProperties.getBoolean("persist.wm.debug.enable_pip_keep_clear_algorithm", true); + private static final String TAG = "QuickstepLauncher"; public static final boolean GO_LOW_RAM_RECENTS_ENABLED = false; + protected static final String RING_APPEAR_ANIMATION_PREFIX = "RingAppearAnimation\t"; + private FixedContainerItems mAllAppsPredictions; private HotseatPredictionController mHotseatPredictionController; private DepthController mDepthController; @@ -211,11 +208,8 @@ public class QuickstepLauncher extends Launcher { private QuickstepTransitionManager mAppTransitionManager; private OverviewActionsView mActionsView; private TISBindHelper mTISBindHelper; - private @Nullable TaskbarManager mTaskbarManager; - private @Nullable OverviewCommandHelper mOverviewCommandHelper; private @Nullable LauncherTaskbarUIController mTaskbarUIController; // Will be updated when dragging from taskbar. - private @Nullable DragOptions mNextWorkspaceDragOptions = null; private @Nullable UnfoldTransitionProgressProvider mUnfoldTransitionProgressProvider; private @Nullable LauncherUnfoldAnimationController mLauncherUnfoldAnimationController; @@ -223,6 +217,8 @@ public class QuickstepLauncher extends Launcher { private SplitWithKeyboardShortcutController mSplitWithKeyboardShortcutController; private SplitToWorkspaceController mSplitToWorkspaceController; + private AsyncClockEventDelegate mAsyncClockEventDelegate; + /** * If Launcher restarted while in the middle of an Overview split select, it needs this data to * recover. In all other cases this will remain null. @@ -258,6 +254,10 @@ public class QuickstepLauncher extends Launcher { mTISBindHelper = new TISBindHelper(this, this::onTISConnected); mDepthController = new DepthController(this); mDesktopVisibilityController = new DesktopVisibilityController(this); + if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { + mDesktopVisibilityController.registerSystemUiListener(); + mSplitSelectStateController.initSplitFromDesktopController(this); + } mHotseatPredictionController = new HotseatPredictionController(this); mEnableWidgetDepth = SystemProperties.getBoolean("ro.launcher.depth.widget", true); @@ -279,7 +279,6 @@ public class QuickstepLauncher extends Launcher { if (mAllAppsPredictions != null && (info.itemType == ITEM_TYPE_APPLICATION - || info.itemType == ITEM_TYPE_SHORTCUT || info.itemType == ITEM_TYPE_DEEP_SHORTCUT)) { int count = mAllAppsPredictions.items.size(); for (int i = 0; i < count; i++) { @@ -349,9 +348,7 @@ public class QuickstepLauncher extends Launcher { mHotseatPredictionController.setPauseUIUpdate(getTaskbarUIController() == null); RunnableList result = super.startActivitySafely(v, intent, item); if (result == null) { - if (getTaskbarUIController() == null) { - mHotseatPredictionController.setPauseUIUpdate(false); - } + mHotseatPredictionController.setPauseUIUpdate(false); } else { result.add(() -> mHotseatPredictionController.setPauseUIUpdate(false)); } @@ -406,8 +403,7 @@ public class QuickstepLauncher extends Launcher { } private List<SystemShortcut.Factory<QuickstepLauncher>> getSplitShortcuts() { - - if (!ENABLE_SPLIT_FROM_WORKSPACE.get() || !mDeviceProfile.isTablet) { + if (!mDeviceProfile.isTablet || mSplitSelectStateController.isSplitSelectActive()) { return Collections.emptyList(); } RecentsView recentsView = getOverviewPanel(); @@ -435,12 +431,8 @@ public class QuickstepLauncher extends Launcher { boolean visible = (state == NORMAL || state == OVERVIEW) && (willUserBeActive || isUserActive()) && !profile.isVerticalBarLayout(); - if (ENABLE_PIP_KEEP_CLEAR_ALGORITHM) { - SystemUiProxy.INSTANCE.get(this) - .setLauncherKeepClearAreaHeight(visible, profile.hotseatBarSizePx); - } else { - SystemUiProxy.INSTANCE.get(this).setShelfHeight(visible, profile.hotseatBarSizePx); - } + SystemUiProxy.INSTANCE.get(this) + .setLauncherKeepClearAreaHeight(visible, profile.hotseatBarSizePx); } if (state == NORMAL && !inTransition) { ((RecentsView) getOverviewPanel()).setSwipeDownShouldLaunchApp(false); @@ -449,6 +441,7 @@ public class QuickstepLauncher extends Launcher { @Override public void bindExtraContainerItems(FixedContainerItems item) { + Log.d(TAG, "Bind extra container items"); if (item.containerId == Favorites.CONTAINER_PREDICTION) { mAllAppsPredictions = item; PredictionRowView<?> predictionRowView = @@ -456,6 +449,7 @@ public class QuickstepLauncher extends Launcher { PredictionRowView.class); predictionRowView.setPredictedApps(item.items); } else if (item.containerId == Favorites.CONTAINER_HOTSEAT_PREDICTION) { + Log.d(TAG, "Bind extra container item is hotseat prediction"); mHotseatPredictionController.setPredictedItems(item); } else if (item.containerId == Favorites.CONTAINER_WIDGETS_PREDICTION) { getPopupDataProvider().setRecommendedWidgets(item.items); @@ -472,22 +466,28 @@ public class QuickstepLauncher extends Launcher { public void onDestroy() { mAppTransitionManager.onActivityDestroyed(); if (mUnfoldTransitionProgressProvider != null) { - if (FeatureFlags.RECEIVE_UNFOLD_EVENTS_FROM_SYSUI.get()) { - SystemUiProxy.INSTANCE.get(this).setUnfoldAnimationListener(null); - } - + SystemUiProxy.INSTANCE.get(this).setUnfoldAnimationListener(null); mUnfoldTransitionProgressProvider.destroy(); } mTISBindHelper.onDestroy(); - if (mTaskbarManager != null) { - mTaskbarManager.clearActivity(this); - } if (mLauncherUnfoldAnimationController != null) { mLauncherUnfoldAnimationController.onDestroy(); } + if (mDesktopVisibilityController != null) { + mDesktopVisibilityController.unregisterSystemUiListener(); + } + + if (mSplitSelectStateController != null) { + mSplitSelectStateController.onDestroy(); + } + + if (mAsyncClockEventDelegate != null) { + mAsyncClockEventDelegate.onDestroy(); + } + super.onDestroy(); mHotseatPredictionController.destroy(); mSplitWithKeyboardShortcutController.onDestroy(); @@ -521,7 +521,7 @@ public class QuickstepLauncher extends Launcher { } case QUICK_SWITCH_STATE_ORDINAL: { RecentsView rv = getOverviewPanel(); - TaskView tasktolaunch = rv.getTaskViewAt(0); + TaskView tasktolaunch = rv.getCurrentPageTaskView(); if (tasktolaunch != null) { tasktolaunch.launchTask(success -> { if (!success) { @@ -545,11 +545,14 @@ public class QuickstepLauncher extends Launcher { ArrayList<TouchController> list = new ArrayList<>(); list.add(getDragController()); + Consumer<AnimatorSet> splitAnimator = animatorSet -> + animatorSet.play(mSplitSelectStateController.getSplitAnimationController() + .createPlaceholderDismissAnim(this)); switch (mode) { case NO_BUTTON: list.add(new NoButtonQuickSwitchTouchController(this)); - list.add(new NavBarToHomeTouchController(this)); - list.add(new NoButtonNavbarToOverviewTouchController(this)); + list.add(new NavBarToHomeTouchController(this, splitAnimator)); + list.add(new NoButtonNavbarToOverviewTouchController(this, splitAnimator)); break; case TWO_BUTTONS: list.add(new TwoButtonNavbarTouchController(this)); @@ -559,8 +562,14 @@ public class QuickstepLauncher extends Launcher { list.add(new PortraitStatesTouchController(this)); break; case THREE_BUTTONS: + list.add(new NoButtonQuickSwitchTouchController(this)); + list.add(new NavBarToHomeTouchController(this, splitAnimator)); + list.add(new NoButtonNavbarToOverviewTouchController(this, splitAnimator)); + list.add(new PortraitStatesTouchController(this)); + break; default: list.add(new PortraitStatesTouchController(this)); + break; } if (!getDeviceProfile().isMultiWindowMode) { @@ -601,6 +610,8 @@ public class QuickstepLauncher extends Launcher { mViewCapture = SettingsAwareViewCapture.getInstance(this).startCapture(getWindow()); } getWindow().addPrivateFlags(PRIVATE_FLAG_OPTIMIZE_MEASURE); + View.setTraceLayoutSteps(TRACE_LAYOUTS); + View.setTracedRequestLayoutClassClass(TRACE_RELAYOUT_CLASS); } @Override @@ -608,12 +619,14 @@ public class QuickstepLauncher extends Launcher { RecentsView recentsView = getOverviewPanel(); // Check if there is already an instance of this app running, if so, initiate the split // using that. - mSplitSelectStateController.findLastActiveTaskAndRunCallback( - splitSelectSource.itemInfo.getComponentKey(), - foundTask -> { - splitSelectSource.alreadyRunningTaskId = foundTask == null - ? INVALID_TASK_ID - : foundTask.key.id; + mSplitSelectStateController.findLastActiveTasksAndRunCallback( + Collections.singletonList(splitSelectSource.itemInfo.getComponentKey()), + foundTasks -> { + @Nullable Task foundTask = foundTasks.get(0); + boolean taskWasFound = foundTask != null; + splitSelectSource.alreadyRunningTaskId = taskWasFound + ? foundTask.key.id + : INVALID_TASK_ID; if (ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get()) { startSplitToHome(splitSelectSource); } else { @@ -653,9 +666,13 @@ public class QuickstepLauncher extends Launcher { @Override public void onAnimationCancel(Animator animation) { getDragLayer().removeView(floatingTaskView); + mSplitSelectStateController.getSplitAnimationController() + .removeSplitInstructionsView(QuickstepLauncher.this); mSplitSelectStateController.resetState(); } }); + anim.add(mSplitSelectStateController.getSplitAnimationController() + .getShowSplitInstructionsAnim(this).buildAnim()); anim.buildAnim().start(); } @@ -681,9 +698,9 @@ public class QuickstepLauncher extends Launcher { @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); - - if (mOverviewCommandHelper != null) { - mOverviewCommandHelper.clearPendingCommands(); + OverviewCommandHelper overviewCommandHelper = mTISBindHelper.getOverviewCommandHelper(); + if (overviewCommandHelper != null) { + overviewCommandHelper.clearPendingCommands(); } } @@ -806,8 +823,9 @@ public class QuickstepLauncher extends Launcher { } private void onTaskbarInAppDisplayProgressUpdate(float progress, int flag) { - if (mTaskbarManager == null - || mTaskbarManager.getCurrentActivityContext() == null + TaskbarManager taskbarManager = mTISBindHelper.getTaskbarManager(); + if (taskbarManager == null + || taskbarManager.getCurrentActivityContext() == null || mTaskbarUIController == null) { return; } @@ -851,7 +869,7 @@ public class QuickstepLauncher extends Launcher { if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { DesktopVisibilityController controller = mDesktopVisibilityController; if (controller != null && controller.areFreeformTasksVisible() - && !controller.isGestureInProgress()) { + && !controller.isRecentsGestureInProgress()) { // Return early to skip setting activity to appear as resumed // TODO(b/255649902): shouldn't be needed when we have a separate launcher state // for desktop that we can use to control other parts of launcher @@ -879,11 +897,10 @@ public class QuickstepLauncher extends Launcher { } private void onTISConnected(TISBinder binder) { - mTaskbarManager = binder.getTaskbarManager(); - if (mTaskbarManager != null) { - mTaskbarManager.setActivity(this); + TaskbarManager taskbarManager = mTISBindHelper.getTaskbarManager(); + if (taskbarManager != null) { + taskbarManager.setActivity(this); } - mOverviewCommandHelper = binder.getOverviewCommandHelper(); } @Override @@ -894,43 +911,10 @@ public class QuickstepLauncher extends Launcher { private void initUnfoldTransitionProgressProvider() { final UnfoldTransitionConfig config = new ResourceUnfoldTransitionConfig(); if (config.isEnabled()) { - if (RECEIVE_UNFOLD_EVENTS_FROM_SYSUI.get()) { - initRemotelyCalculatedUnfoldAnimation(config); - } else { - initLocallyCalculatedUnfoldAnimation(config); - } - + initRemotelyCalculatedUnfoldAnimation(config); } } - /** Registers hinge angle listener and calculates the animation progress in this process. */ - private void initLocallyCalculatedUnfoldAnimation(UnfoldTransitionConfig config) { - UnfoldSharedComponent unfoldComponent = - UnfoldTransitionFactory.createUnfoldSharedComponent( - /* context= */ this, - config, - ProxyScreenStatusProvider.INSTANCE, - new DeviceStateManagerFoldProvider( - getSystemService(DeviceStateManager.class), /* context= */ this), - new ActivityManagerActivityTypeProvider( - getSystemService(ActivityManager.class)), - getSystemService(SensorManager.class), - getMainThreadHandler(), - getMainExecutor(), - /* backgroundExecutor= */ UI_HELPER_EXECUTOR, - /* tracingTagPrefix= */ "launcher", - getSystemService(DisplayManager.class) - ); - - mUnfoldTransitionProgressProvider = unfoldComponent.getUnfoldTransitionProvider() - .orElseThrow(() -> new IllegalStateException( - "Trying to create UnfoldTransitionProgressProvider when the " - + "transition is disabled")); - - initUnfoldAnimationController(mUnfoldTransitionProgressProvider, - unfoldComponent.getRotationChangeProvider()); - } - /** Receives animation progress from sysui process. */ private void initRemotelyCalculatedUnfoldAnimation(UnfoldTransitionConfig config) { RemoteUnfoldSharedComponent unfoldComponent = @@ -980,6 +964,13 @@ public class QuickstepLauncher extends Launcher { return mSplitToWorkspaceController; } + @Override + protected void handleSplitAnimationGoingToHome() { + super.handleSplitAnimationGoingToHome(); + mSplitSelectStateController.getSplitAnimationController() + .playPlaceholderDismissAnim(this); + } + public <T extends OverviewActionsView> T getActionsView() { return (T) mActionsView; } @@ -1016,41 +1007,6 @@ public class QuickstepLauncher extends Launcher { } @Override - public DragOptions getDefaultWorkspaceDragOptions() { - if (mNextWorkspaceDragOptions != null) { - DragOptions options = mNextWorkspaceDragOptions; - mNextWorkspaceDragOptions = null; - return options; - } - return super.getDefaultWorkspaceDragOptions(); - } - - public void setNextWorkspaceDragOptions(DragOptions dragOptions) { - mNextWorkspaceDragOptions = dragOptions; - } - - @Override - public void useFadeOutAnimationForLauncherStart(CancellationSignal signal) { - QuickstepTransitionManager appTransitionManager = getAppTransitionManager(); - appTransitionManager.setRemoteAnimationProvider(new RemoteAnimationProvider() { - @Override - public AnimatorSet createWindowAnimation(RemoteAnimationTarget[] appTargets, - RemoteAnimationTarget[] wallpaperTargets) { - - // On the first call clear the reference. - signal.cancel(); - - ValueAnimator fadeAnimation = ValueAnimator.ofFloat(1, 0); - fadeAnimation.addUpdateListener(new RemoteFadeOutAnimationListener(appTargets, - wallpaperTargets)); - AnimatorSet anim = new AnimatorSet(); - anim.play(fadeAnimation); - return anim; - } - }, signal); - } - - @Override public float[] getNormalOverviewScaleAndOffset() { return DisplayController.getNavigationMode(this).hasGestures ? new float[] {1, 1} : new float[] {1.1f, NO_OFFSET}; @@ -1100,6 +1056,8 @@ public class QuickstepLauncher extends Launcher { activityOptions.options.setLaunchDisplayId( (v != null && v.getDisplay() != null) ? v.getDisplay().getDisplayId() : Display.DEFAULT_DISPLAY); + activityOptions.options.setPendingIntentBackgroundActivityStartMode( + ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED); addLaunchCookie(item, activityOptions.options); return activityOptions; } @@ -1112,6 +1070,8 @@ public class QuickstepLauncher extends Launcher { Executors.MAIN_EXECUTOR.getHandler(), null, elapsedRealTime -> callbacks.executeAllAndDestroy()); options.setSplashScreenStyle(splashScreenStyle); + options.setPendingIntentBackgroundActivityStartMode( + ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED); return new ActivityOptionsWrapper(options, callbacks); } @@ -1159,7 +1119,6 @@ public class QuickstepLauncher extends Launcher { } switch (info.itemType) { case Favorites.ITEM_TYPE_APPLICATION: - case Favorites.ITEM_TYPE_SHORTCUT: case Favorites.ITEM_TYPE_DEEP_SHORTCUT: case Favorites.ITEM_TYPE_APPWIDGET: // Fall through and continue if it's an app, shortcut, or widget @@ -1268,8 +1227,9 @@ public class QuickstepLauncher extends Launcher { Trace.instantForTrack(TRACE_TAG_APP, "QuickstepLauncher#DeviceProfileChanged", getDeviceProfile().toSmallString()); SystemUiProxy.INSTANCE.get(this).setLauncherAppIconSize(mDeviceProfile.iconSizePx); - if (mTaskbarManager != null) { - mTaskbarManager.debugWhyTaskbarNotDestroyed("QuickstepLauncher#onDeviceProfileChanged"); + TaskbarManager taskbarManager = mTISBindHelper.getTaskbarManager(); + if (taskbarManager != null) { + taskbarManager.debugWhyTaskbarNotDestroyed("QuickstepLauncher#onDeviceProfileChanged"); } } @@ -1291,7 +1251,7 @@ public class QuickstepLauncher extends Launcher { groupTask.task1.key.id, groupTask.task2.key.id, SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT, - /* callback= */ success -> {}, + /* callback= */ success -> mSplitSelectStateController.resetState(), /* freezeTaskList= */ true, groupTask.mSplitBounds == null ? DEFAULT_SPLIT_RATIO @@ -1300,6 +1260,18 @@ public class QuickstepLauncher extends Launcher { : groupTask.mSplitBounds.leftTaskPercent); } + /** + * Launches two apps as an app pair. + */ + public void launchAppPair(WorkspaceItemInfo app1, WorkspaceItemInfo app2) { + mSplitSelectStateController.getAppPairsController().launchAppPair(app1, app2); + } + + public boolean canStartHomeSafely() { + OverviewCommandHelper overviewCommandHelper = mTISBindHelper.getOverviewCommandHelper(); + return overviewCommandHelper == null || overviewCommandHelper.canStartHomeSafely(); + } + private static final class LauncherTaskViewController extends TaskViewTouchController<Launcher> { @@ -1336,5 +1308,34 @@ public class QuickstepLauncher extends Launcher { if (recentsView != null) { recentsView.getSplitSelectController().dump(prefix, writer); } + if (mAppTransitionManager != null) { + mAppTransitionManager.dump(prefix + "\t" + RING_APPEAR_ANIMATION_PREFIX, writer); + } + if (mHotseatPredictionController != null) { + mHotseatPredictionController.dump(prefix, writer); + } + } + + @Override + public View onCreateView(View parent, String name, Context context, AttributeSet attrs) { + switch (name) { + case "TextClock", "android.widget.TextClock" -> { + TextClock tc = new TextClock(context, attrs); + if (mAsyncClockEventDelegate == null) { + mAsyncClockEventDelegate = new AsyncClockEventDelegate(this); + } + tc.setClockEventDelegate(mAsyncClockEventDelegate); + return tc; + } + case "AnalogClock", "android.widget.AnalogClock" -> { + AnalogClock ac = new AnalogClock(context, attrs); + if (mAsyncClockEventDelegate == null) { + mAsyncClockEventDelegate = new AsyncClockEventDelegate(this); + } + ac.setClockEventDelegate(mAsyncClockEventDelegate); + return ac; + } + } + return super.onCreateView(parent, name, context, attrs); } } |