diff --git a/go/quickstep/res/values/config.xml b/go/quickstep/res/values/config.xml index 402bf9ad13..796d14db16 100644 --- a/go/quickstep/res/values/config.xml +++ b/go/quickstep/res/values/config.xml @@ -16,8 +16,6 @@ - - true diff --git a/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java b/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java index 65cdcf06ba..3a6e9b57cc 100644 --- a/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java +++ b/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java @@ -21,6 +21,7 @@ import static com.android.quickstep.views.OverviewActionsView.DISABLED_ROTATED; import android.annotation.SuppressLint; import android.app.assist.AssistContent; +import android.content.ActivityNotFoundException; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; @@ -29,10 +30,10 @@ import android.os.SystemClock; import android.os.UserManager; import android.provider.Settings; import android.text.TextUtils; +import android.util.Log; import androidx.annotation.VisibleForTesting; -import com.android.launcher3.R; import com.android.quickstep.util.AssistContentRequester; import com.android.quickstep.views.OverviewActionsView; import com.android.quickstep.views.TaskThumbnailView; @@ -90,9 +91,7 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { public void initOverlay(Task task, ThumbnailData thumbnail, Matrix matrix, boolean rotated) { getActionsView().updateDisabledFlags(DISABLED_NO_THUMBNAIL, thumbnail == null); - mNIUPackageName = - mApplicationContext.getString(R.string.niu_actions_package); - + checkSettings(); if (thumbnail == null || TextUtils.isEmpty(mNIUPackageName)) { return; } @@ -105,7 +104,6 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { getActionsView().setCallbacks(new OverlayUICallbacksGoImpl(isAllowedByPolicy, task)); mTaskPackageName = task.key.getPackageName(); - checkPermissions(); if (!mAssistPermissionsEnabled) { return; } @@ -137,7 +135,11 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { mImageApi.shareAsDataWithExplicitIntent(/* crop */ null, intent); } else { intent.putExtra(ACTIONS_ERROR_CODE, ERROR_PERMISSIONS); - mApplicationContext.startActivity(intent); + try { + mApplicationContext.startActivity(intent); + } catch (ActivityNotFoundException e) { + Log.e(TAG, "No activity found to receive permission error intent"); + } } } @@ -160,13 +162,17 @@ public final class TaskOverlayFactoryGo extends TaskOverlayFactory { * Checks whether the Assistant has screen context permissions */ @VisibleForTesting - public void checkPermissions() { + public void checkSettings() { ContentResolver contentResolver = mApplicationContext.getContentResolver(); boolean structureEnabled = Settings.Secure.getInt(contentResolver, Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1) != 0; boolean screenshotEnabled = Settings.Secure.getInt(contentResolver, Settings.Secure.ASSIST_SCREENSHOT_ENABLED, 1) != 0; mAssistPermissionsEnabled = structureEnabled && screenshotEnabled; + + String assistantPackage = + Settings.Secure.getString(contentResolver, Settings.Secure.ASSISTANT); + mNIUPackageName = assistantPackage.split("/", 2)[0]; } protected class OverlayUICallbacksGoImpl extends OverlayUICallbacksImpl diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 52f34d90e0..8f42993b62 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -117,6 +117,7 @@ import com.android.systemui.shared.system.LatencyTrackerCompat; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.shared.system.TaskInfoCompat; import com.android.systemui.shared.system.TaskStackChangeListener; +import com.android.systemui.shared.system.TaskStackChangeListeners; import java.util.ArrayList; import java.util.function.Consumer; @@ -1072,7 +1073,7 @@ public abstract class AbsSwipeUpHandler, protected abstract HomeAnimationFactory createHomeAnimationFactory( ArrayList launchCookies, long duration, boolean isTargetTranslucent, - RemoteAnimationTargetCompat runningTaskTarget); + boolean appCanEnterPip, RemoteAnimationTargetCompat runningTaskTarget); private final TaskStackChangeListener mActivityRestartListener = new TaskStackChangeListener() { @Override @@ -1083,7 +1084,7 @@ public abstract class AbsSwipeUpHandler, // Since this is an edge case, just cancel and relaunch with default activity // options (since we don't know if there's an associated app icon to launch from) endRunningWindowAnim(true /* cancel */); - ActivityManagerWrapper.getInstance().unregisterTaskStackListener( + TaskStackChangeListeners.getInstance().unregisterTaskStackListener( mActivityRestartListener); ActivityManagerWrapper.getInstance().startActivityFromRecents(task.taskId, null); } @@ -1098,7 +1099,7 @@ public abstract class AbsSwipeUpHandler, // If we are transitioning to launcher, then listen for the activity to be restarted while // the transition is in progress if (mGestureState.getEndTarget().isLauncher) { - ActivityManagerWrapper.getInstance().registerTaskStackListener( + TaskStackChangeListeners.getInstance().registerTaskStackListener( mActivityRestartListener); mParallelRunningAnim = mActivityInterface.getParallelAnimationToLauncher( @@ -1117,13 +1118,15 @@ public abstract class AbsSwipeUpHandler, ? runningTaskTarget.taskInfo.launchCookies : new ArrayList<>(); boolean isTranslucent = runningTaskTarget != null && runningTaskTarget.isTranslucent; - HomeAnimationFactory homeAnimFactory = - createHomeAnimationFactory(cookies, duration, isTranslucent, runningTaskTarget); - mIsSwipingPipToHome = homeAnimFactory.supportSwipePipToHome() + boolean appCanEnterPip = !mDeviceState.isPipActive() && runningTaskTarget != null && runningTaskTarget.taskInfo.pictureInPictureParams != null && TaskInfoCompat.isAutoEnterPipEnabled( runningTaskTarget.taskInfo.pictureInPictureParams); + HomeAnimationFactory homeAnimFactory = + createHomeAnimationFactory(cookies, duration, isTranslucent, appCanEnterPip, + runningTaskTarget); + mIsSwipingPipToHome = homeAnimFactory.supportSwipePipToHome() && appCanEnterPip; if (mIsSwipingPipToHome) { mSwipePipToHomeAnimator = getSwipePipToHomeAnimator( homeAnimFactory, runningTaskTarget, start); @@ -1399,7 +1402,8 @@ public abstract class AbsSwipeUpHandler, } mActivityInitListener.unregister(); - ActivityManagerWrapper.getInstance().unregisterTaskStackListener(mActivityRestartListener); + TaskStackChangeListeners.getInstance().unregisterTaskStackListener( + mActivityRestartListener); mTaskSnapshot = null; } diff --git a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java index 7290ff6a41..fd44e023a7 100644 --- a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java +++ b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java @@ -129,7 +129,7 @@ public class FallbackSwipeHandler extends @Override protected HomeAnimationFactory createHomeAnimationFactory(ArrayList launchCookies, - long duration, boolean isTargetTranslucent, + long duration, boolean isTargetTranslucent, boolean appCanEnterPip, RemoteAnimationTargetCompat runningTaskTarget) { mActiveAnimationFactory = new FallbackHomeAnimationFactory(duration); ActivityOptions options = ActivityOptions.makeCustomAnimation(mContext, 0, 0); diff --git a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java index 40741e4945..47d94ba2ad 100644 --- a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java +++ b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java @@ -88,7 +88,7 @@ public class LauncherSwipeHandlerV2 extends @Override protected HomeAnimationFactory createHomeAnimationFactory(ArrayList launchCookies, - long duration, boolean isTargetTranslucent, + long duration, boolean isTargetTranslucent, boolean appCanEnterPip, RemoteAnimationTargetCompat runningTaskTarget) { if (mActivity == null) { mStateCallback.addChangeListener(STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED, @@ -108,7 +108,7 @@ public class LauncherSwipeHandlerV2 extends mActivity.getRootView().setForceHideBackArrow(true); mActivity.setHintUserWillBeActive(); - if (!canUseWorkspaceView) { + if (!canUseWorkspaceView || appCanEnterPip) { return new LauncherHomeAnimationFactory(); } if (workspaceView instanceof LauncherAppWidgetHostView) { diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java index 3302da0f77..3080f040ac 100644 --- a/quickstep/src/com/android/quickstep/RecentTasksList.java +++ b/quickstep/src/com/android/quickstep/RecentTasksList.java @@ -33,6 +33,7 @@ import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.KeyguardManagerCompat; import com.android.systemui.shared.system.TaskStackChangeListener; +import com.android.systemui.shared.system.TaskStackChangeListeners; import java.util.ArrayList; import java.util.Collections; @@ -66,7 +67,7 @@ public class RecentTasksList extends TaskStackChangeListener { mKeyguardManager = keyguardManager; mChangeId = 1; mActivityManagerWrapper = activityManagerWrapper; - mActivityManagerWrapper.registerTaskStackListener(this); + TaskStackChangeListeners.getInstance().registerTaskStackListener(this); } @VisibleForTesting diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index 68526420ef..0e85ec3760 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -353,7 +353,8 @@ public final class RecentsActivity extends StatefulActivity { public void startHome() { if (LIVE_TILE.get()) { RecentsView recentsView = getOverviewPanel(); - recentsView.switchToScreenshotAndFinishAnimationToRecents(this::startHomeInternal); + recentsView.switchToScreenshot(() -> recentsView.finishRecentsAnimation(true, + this::startHomeInternal)); } else { startHomeInternal(); } diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java index fa37901f27..444d77a612 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java @@ -15,6 +15,8 @@ */ package com.android.quickstep; +import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED; +import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.content.Intent.ACTION_USER_UNLOCKED; import static com.android.launcher3.util.DisplayController.CHANGE_ALL; @@ -41,6 +43,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_S import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED; import android.app.ActivityManager; +import android.app.ActivityTaskManager; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; @@ -50,6 +53,7 @@ import android.content.res.Resources; import android.graphics.Region; import android.net.Uri; import android.os.Process; +import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserManager; import android.provider.Settings; @@ -75,6 +79,8 @@ import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags; import com.android.systemui.shared.system.SystemGestureExclusionListenerCompat; +import com.android.systemui.shared.system.TaskStackChangeListener; +import com.android.systemui.shared.system.TaskStackChangeListeners; import java.io.PrintWriter; import java.util.ArrayList; @@ -96,6 +102,8 @@ public class RecentsAnimationDeviceState implements private final DisplayController mDisplayController; private final int mDisplayId; private final RotationTouchHelper mRotationTouchHelper; + private final TaskStackChangeListener mPipListener; + private final List mGestureBlockedActivities; private final ArrayList mOnDestroyActions = new ArrayList<>(); @@ -106,9 +114,11 @@ public class RecentsAnimationDeviceState implements private final Region mDeferredGestureRegion = new Region(); private boolean mAssistantAvailable; private float mAssistantVisibility; + private boolean mIsUserSetupComplete; private boolean mIsOneHandedModeEnabled; private boolean mIsSwipeToNotificationEnabled; private final boolean mIsOneHandedModeSupported; + private boolean mPipIsActive; private boolean mIsUserUnlocked; private final ArrayList mUserUnlockedActions = new ArrayList<>(); @@ -125,10 +135,6 @@ public class RecentsAnimationDeviceState implements private Region mExclusionRegion; private SystemGestureExclusionListenerCompat mExclusionListener; - private final List mGestureBlockedActivities; - - private boolean mIsUserSetupComplete; - public RecentsAnimationDeviceState(Context context) { this(context, false); } @@ -204,7 +210,6 @@ public class RecentsAnimationDeviceState implements mIsOneHandedModeEnabled = false; } - Uri swipeBottomNotificationUri = Settings.Secure.getUriFor(ONE_HANDED_SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED); SettingsCache.OnChangeListener onChangeListener = @@ -220,6 +225,27 @@ public class RecentsAnimationDeviceState implements settingsCache.register(setupCompleteUri, userSetupChangeListener); runOnDestroy(() -> settingsCache.unregister(setupCompleteUri, userSetupChangeListener)); } + + try { + mPipIsActive = ActivityTaskManager.getService().getRootTaskInfo( + WINDOWING_MODE_PINNED, ACTIVITY_TYPE_UNDEFINED) != null; + } catch (RemoteException e) { + // Do nothing + } + mPipListener = new TaskStackChangeListener() { + @Override + public void onActivityPinned(String packageName, int userId, int taskId, int stackId) { + mPipIsActive = true; + } + + @Override + public void onActivityUnpinned() { + mPipIsActive = false; + } + }; + TaskStackChangeListeners.getInstance().registerTaskStackListener(mPipListener); + runOnDestroy(() -> + TaskStackChangeListeners.getInstance().unregisterTaskStackListener(mPipListener)); } private void runOnDestroy(Runnable action) { @@ -579,6 +605,10 @@ public class RecentsAnimationDeviceState implements return mIsSwipeToNotificationEnabled; } + public boolean isPipActive() { + return mPipIsActive; + } + public RotationTouchHelper getRotationTouchHelper() { return mRotationTouchHelper; } @@ -596,6 +626,7 @@ public class RecentsAnimationDeviceState implements pw.println(" isOneHandedModeEnabled=" + mIsOneHandedModeEnabled); pw.println(" isSwipeToNotificationEnabled=" + mIsSwipeToNotificationEnabled); pw.println(" deferredGestureRegion=" + mDeferredGestureRegion); + pw.println(" pipIsActive=" + mPipIsActive); mRotationTouchHelper.dump(pw); } } diff --git a/quickstep/src/com/android/quickstep/RecentsModel.java b/quickstep/src/com/android/quickstep/RecentsModel.java index 2eb9dd84eb..1e82c8cbfa 100644 --- a/quickstep/src/com/android/quickstep/RecentsModel.java +++ b/quickstep/src/com/android/quickstep/RecentsModel.java @@ -39,6 +39,7 @@ import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.KeyguardManagerCompat; import com.android.systemui.shared.system.TaskStackChangeListener; +import com.android.systemui.shared.system.TaskStackChangeListeners; import java.util.ArrayList; import java.util.List; @@ -75,7 +76,7 @@ public class RecentsModel extends TaskStackChangeListener implements IconChangeL mIconCache = new TaskIconCache(context, RECENTS_MODEL_EXECUTOR, iconProvider); mThumbnailCache = new TaskThumbnailCache(context, RECENTS_MODEL_EXECUTOR); - ActivityManagerWrapper.getInstance().registerTaskStackListener(this); + TaskStackChangeListeners.getInstance().registerTaskStackListener(this); iconProvider.registerIconChangeListener(this, MAIN_EXECUTOR.getHandler()); } diff --git a/quickstep/src/com/android/quickstep/RotationTouchHelper.java b/quickstep/src/com/android/quickstep/RotationTouchHelper.java index fc7a3dfde3..678b176151 100644 --- a/quickstep/src/com/android/quickstep/RotationTouchHelper.java +++ b/quickstep/src/com/android/quickstep/RotationTouchHelper.java @@ -38,6 +38,7 @@ import com.android.quickstep.util.RecentsOrientedState; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.TaskStackChangeListener; +import com.android.systemui.shared.system.TaskStackChangeListeners; import java.io.PrintWriter; import java.util.ArrayList; @@ -178,14 +179,14 @@ public class RotationTouchHelper implements } private void setupOrientationSwipeHandler() { - ActivityManagerWrapper.getInstance().registerTaskStackListener(mFrozenTaskListener); - mOnDestroyFrozenTaskRunnable = () -> ActivityManagerWrapper.getInstance() + TaskStackChangeListeners.getInstance().registerTaskStackListener(mFrozenTaskListener); + mOnDestroyFrozenTaskRunnable = () -> TaskStackChangeListeners.getInstance() .unregisterTaskStackListener(mFrozenTaskListener); runOnDestroy(mOnDestroyFrozenTaskRunnable); } private void destroyOrientationSwipeHandlerCallback() { - ActivityManagerWrapper.getInstance().unregisterTaskStackListener(mFrozenTaskListener); + TaskStackChangeListeners.getInstance().unregisterTaskStackListener(mFrozenTaskListener); mOnDestroyActions.remove(mOnDestroyFrozenTaskRunnable); } diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java index 29ddde0c99..9731bf187e 100644 --- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java +++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java @@ -39,6 +39,7 @@ import com.android.systemui.shared.system.ActivityOptionsCompat; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.shared.system.RemoteTransitionCompat; import com.android.systemui.shared.system.TaskStackChangeListener; +import com.android.systemui.shared.system.TaskStackChangeListeners; public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAnimationListener { public static final boolean ENABLE_SHELL_TRANSITIONS = @@ -58,7 +59,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn public void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task, boolean homeTaskVisible, boolean clearedTask, boolean wasVisible) { if (mLastGestureState == null) { - ActivityManagerWrapper.getInstance().unregisterTaskStackListener( + TaskStackChangeListeners.getInstance().unregisterTaskStackListener( mLiveTileRestartListener); return; } @@ -68,7 +69,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn RecentsView recentsView = activityInterface.getCreatedActivity().getOverviewPanel(); if (recentsView != null) { recentsView.launchSideTaskInLiveTileModeForRestartedApp(task.taskId); - ActivityManagerWrapper.getInstance().unregisterTaskStackListener( + TaskStackChangeListeners.getInstance().unregisterTaskStackListener( mLiveTileRestartListener); } } @@ -197,7 +198,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn } public void enableLiveTileRestartListener() { - ActivityManagerWrapper.getInstance().registerTaskStackListener(mLiveTileRestartListener); + TaskStackChangeListeners.getInstance().registerTaskStackListener(mLiveTileRestartListener); } /** @@ -241,7 +242,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn mLiveTileCleanUpHandler.run(); mLiveTileCleanUpHandler = null; } - ActivityManagerWrapper.getInstance().unregisterTaskStackListener(mLiveTileRestartListener); + TaskStackChangeListeners.getInstance().unregisterTaskStackListener(mLiveTileRestartListener); // Release all the target leashes if (mTargets != null) { diff --git a/quickstep/src/com/android/quickstep/util/ImageActionUtils.java b/quickstep/src/com/android/quickstep/util/ImageActionUtils.java index 2285d74d73..de7dbd64f5 100644 --- a/quickstep/src/com/android/quickstep/util/ImageActionUtils.java +++ b/quickstep/src/com/android/quickstep/util/ImageActionUtils.java @@ -26,6 +26,7 @@ import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import android.app.Activity; import android.app.ActivityOptions; import android.app.prediction.AppTarget; +import android.content.ActivityNotFoundException; import android.content.ClipData; import android.content.ClipDescription; import android.content.ComponentName; @@ -68,6 +69,7 @@ public class ImageActionUtils { private static final long FILE_LIFE = 1000L /*ms*/ * 60L /*s*/ * 60L /*m*/ * 24L /*h*/; private static final String SUB_FOLDER = "Overview"; private static final String BASE_NAME = "overview_image_"; + private static final String TAG = "ImageActionUtils"; /** * Saves screenshot to location determine by SystemUiProxy @@ -154,11 +156,15 @@ public class ImageActionUtils { Intent intent, BiFunction uriToIntentMap, String tag) { Intent[] intents = uriToIntentMap.apply(getImageUri(bitmap, crop, context, tag), intent); - // Work around b/159412574 - if (intents.length == 1) { - context.startActivity(intents[0]); - } else { - context.startActivities(intents); + try { + // Work around b/159412574 + if (intents.length == 1) { + context.startActivity(intents[0]); + } else { + context.startActivities(intents); + } + } catch (ActivityNotFoundException e) { + Log.e(TAG, "No activity found to receive image intent"); } } diff --git a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java index 8151d412ab..1ed2da3051 100644 --- a/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java +++ b/quickstep/src/com/android/quickstep/util/MotionPauseDetector.java @@ -121,7 +121,7 @@ public class MotionPauseDetector { mForcePauseTimeout.setAlarm(mMakePauseHarderToTrigger ? HARDER_TRIGGER_TIMEOUT : FORCE_PAUSE_TIMEOUT); - float newVelocity = mVelocityProvider.addMotionEvent(ev, pointerIndex); + float newVelocity = mVelocityProvider.addMotionEvent(ev, ev.getPointerId(pointerIndex)); if (mPreviousVelocity != null) { checkMotionPaused(newVelocity, mPreviousVelocity, ev.getEventTime()); } diff --git a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java index 36311302bf..1062652ed4 100644 --- a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java +++ b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java @@ -121,6 +121,15 @@ public class SwipePipToHomeAnimator extends ValueAnimator { mDestinationBoundsAnimation.set(mDestinationBounds); mSurfaceTransactionHelper = new PipSurfaceTransactionHelper(cornerRadius); + if (sourceRectHint != null && (sourceRectHint.width() < destinationBounds.width() + || sourceRectHint.height() < destinationBounds.height())) { + // This is a situation in which the source hint rect on at least one axis is smaller + // than the destination bounds, which presents a problem because we would have to scale + // up that axis to fit the bounds. So instead, just fallback to the non-source hint + // animation in this case. + sourceRectHint = null; + } + if (sourceRectHint == null) { mSourceHintRectInsets = null; diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 7991614abb..df7f8b5a2a 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -2357,7 +2357,8 @@ public abstract class RecentsView onEnd(success)); + finishRecentsAnimation(true /* toRecents */, false /* shouldPip */, + () -> onEnd(success)); } else { onEnd(success); } @@ -2368,7 +2369,8 @@ public abstract class RecentsView { + finishRecentsAnimation(true /* toRecents */, false /* shouldPip */, + () -> { UI_HELPER_EXECUTOR.getHandler().postDelayed(() -> ActivityManagerWrapper.getInstance().removeTask( taskView.getTask().key.id), @@ -2478,7 +2480,7 @@ public abstract class RecentsView { if (isSuccess) { // Remove all the task views now - switchToScreenshotAndFinishAnimationToRecents(() -> { + finishRecentsAnimation(true /* toRecents */, false /* shouldPip */, () -> { UI_HELPER_EXECUTOR.getHandler().postDelayed( ActivityManagerWrapper.getInstance()::removeAllRecentTasks, REMOVE_TASK_WAIT_FOR_APP_STOP_MS); @@ -2639,7 +2641,9 @@ public abstract class RecentsView finishRecentsAnimation(true /* toRecents */, false /* showPip */, + this::updateRecentsRotation)); mEnableDrawingLiveTile = false; } else { updateRecentsRotation(); @@ -3632,10 +3636,6 @@ public abstract class RecentsView finishRecentsAnimation(true /* toRecents */, onFinishRunnable)); - } - /** * Switch the current running task view to static snapshot mode, * capturing the snapshot at the same time. diff --git a/res/color-night-v31/all_apps_tab_background_selected.xml b/res/color-night-v31/all_apps_tab_background_selected.xml new file mode 100644 index 0000000000..b7c9ff64f2 --- /dev/null +++ b/res/color-night-v31/all_apps_tab_background_selected.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/res/color-night-v31/all_apps_tab_text.xml b/res/color-night-v31/all_apps_tab_text.xml new file mode 100644 index 0000000000..83237b49e5 --- /dev/null +++ b/res/color-night-v31/all_apps_tab_text.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/res/color-night-v31/all_apps_tabs_background.xml b/res/color-night-v31/all_apps_tabs_background.xml new file mode 100644 index 0000000000..b396f3377e --- /dev/null +++ b/res/color-night-v31/all_apps_tabs_background.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/res/color-night/all_apps_tab_background_selected.xml b/res/color-night/all_apps_tab_background_selected.xml new file mode 100644 index 0000000000..b22bc8b673 --- /dev/null +++ b/res/color-night/all_apps_tab_background_selected.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/res/color-night/all_apps_tab_text.xml b/res/color-night/all_apps_tab_text.xml new file mode 100644 index 0000000000..183af01f42 --- /dev/null +++ b/res/color-night/all_apps_tab_text.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/res/color-night/all_apps_tabs_background.xml b/res/color-night/all_apps_tabs_background.xml new file mode 100644 index 0000000000..c0c1621d17 --- /dev/null +++ b/res/color-night/all_apps_tabs_background.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/res/color-v31/all_apps_tab_background_selected.xml b/res/color-v31/all_apps_tab_background_selected.xml new file mode 100644 index 0000000000..dac8fa2994 --- /dev/null +++ b/res/color-v31/all_apps_tab_background_selected.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/res/color-v31/all_apps_tab_text.xml b/res/color-v31/all_apps_tab_text.xml new file mode 100644 index 0000000000..c3520a7ab5 --- /dev/null +++ b/res/color-v31/all_apps_tab_text.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/res/color-v31/all_apps_tabs_background.xml b/res/color-v31/all_apps_tabs_background.xml new file mode 100644 index 0000000000..30757b0b3c --- /dev/null +++ b/res/color-v31/all_apps_tabs_background.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/res/color/all_apps_tab_bg.xml b/res/color/all_apps_tab_background_selected.xml similarity index 82% rename from res/color/all_apps_tab_bg.xml rename to res/color/all_apps_tab_background_selected.xml index e59e8d2198..5cb9bd8928 100644 --- a/res/color/all_apps_tab_bg.xml +++ b/res/color/all_apps_tab_background_selected.xml @@ -13,7 +13,6 @@ See the License for the specific language governing permissions and limitations under the License. --> - - + + \ No newline at end of file diff --git a/res/color/all_apps_tab_text.xml b/res/color/all_apps_tab_text.xml index 2db0fb5d74..dace3800cd 100644 --- a/res/color/all_apps_tab_text.xml +++ b/res/color/all_apps_tab_text.xml @@ -14,6 +14,6 @@ limitations under the License. --> - - + + \ No newline at end of file diff --git a/res/color/all_apps_tabs_background.xml b/res/color/all_apps_tabs_background.xml new file mode 100644 index 0000000000..a4b7d1f216 --- /dev/null +++ b/res/color/all_apps_tabs_background.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/res/drawable/all_apps_tabs_background.xml b/res/drawable/all_apps_tabs_background.xml index a345dd3afc..4e953152d0 100644 --- a/res/drawable/all_apps_tabs_background.xml +++ b/res/drawable/all_apps_tabs_background.xml @@ -13,14 +13,12 @@ See the License for the specific language governing permissions and limitations under the License. --> - + + android:bottom="@dimen/all_apps_tabs_vertical_padding"> - + diff --git a/res/drawable/work_apps_toggle_background.xml b/res/drawable/work_apps_toggle_background.xml new file mode 100644 index 0000000000..a04d269875 --- /dev/null +++ b/res/drawable/work_apps_toggle_background.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + diff --git a/res/layout/work_mode_fab.xml b/res/layout/work_mode_fab.xml new file mode 100644 index 0000000000..21f269fed6 --- /dev/null +++ b/res/layout/work_mode_fab.xml @@ -0,0 +1,33 @@ + + + \ No newline at end of file diff --git a/res/layout/work_mode_switch.xml b/res/layout/work_mode_switch.xml index 31953c72aa..538a180992 100644 --- a/res/layout/work_mode_switch.xml +++ b/res/layout/work_mode_switch.xml @@ -1,5 +1,4 @@ - - - + android:paddingTop="@dimen/work_profile_footer_padding" /> diff --git a/res/layout/work_profile_edu.xml b/res/layout/work_profile_edu.xml deleted file mode 100644 index c3c7010f7e..0000000000 --- a/res/layout/work_profile_edu.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - -