diff --git a/SecondaryDisplayLauncher/res/values-zh-rTW/strings.xml b/SecondaryDisplayLauncher/res/values-zh-rTW/strings.xml index bf76f29dec..c02fe2cdce 100644 --- a/SecondaryDisplayLauncher/res/values-zh-rTW/strings.xml +++ b/SecondaryDisplayLauncher/res/values-zh-rTW/strings.xml @@ -21,5 +21,5 @@ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> "無法啟動活動" "新增應用程式捷徑" - "設定桌布" + "套用桌布" diff --git a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java index fe159b5f02..92900f2168 100644 --- a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java +++ b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java @@ -25,6 +25,7 @@ import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MOD import android.animation.AnimatorSet; import android.animation.ValueAnimator; import android.app.ActivityOptions; +import android.content.Context; import android.os.Handler; import android.util.Log; @@ -151,7 +152,7 @@ final class AppToOverviewAnimationProvider imple } @Override - public ActivityOptions toActivityOptions(Handler handler, long duration) { + public ActivityOptions toActivityOptions(Handler handler, long duration, Context context) { LauncherAnimationRunner runner = new LauncherAnimationRunner(handler, false /* startAtFrontOfQueue */) { @@ -165,7 +166,7 @@ final class AppToOverviewAnimationProvider imple ); return; } - result.setAnimation(createWindowAnimation(targetCompats)); + result.setAnimation(createWindowAnimation(targetCompats), context); } }; return ActivityOptionsCompat.makeRemoteAnimation( diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java index 820a8df521..596bc4f44c 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java @@ -165,8 +165,7 @@ public abstract class RecentsUiFactory { } if (FeatureFlags.PULL_DOWN_STATUS_BAR - && !launcher.getDeviceProfile().isMultiWindowMode - && !launcher.getDeviceProfile().isVerticalBarLayout()) { + && !launcher.getDeviceProfile().isMultiWindowMode) { list.add(new StatusBarTouchController(launcher)); } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java index 5ee08c12d2..50cfac8e43 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java @@ -19,6 +19,7 @@ import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.Launcher; +import com.android.launcher3.Utilities; import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.quickstep.util.LayoutUtils; @@ -68,8 +69,8 @@ public class BackgroundAppState extends OverviewState { if (taskCount == 0) { return super.getOverviewScaleAndTranslation(launcher); } - TaskView dummyTask = recentsView.getTaskViewAt(Math.max(taskCount - 1, - recentsView.getCurrentPage())); + TaskView dummyTask = recentsView.getTaskViewAt(Utilities.boundToRange( + recentsView.getCurrentPage(), 0, taskCount - 1)); return recentsView.getTempClipAnimationHelper().updateForFullscreenOverview(dummyTask) .getScaleAndTranslation(); } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java index 8e32bb370e..00e4f58e92 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java @@ -16,10 +16,10 @@ package com.android.launcher3.uioverrides.touchcontrollers; import static com.android.launcher3.AbstractFloatingView.TYPE_ACCESSIBLE; -import static com.android.launcher3.Utilities.SINGLE_FRAME_MS; import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.config.FeatureFlags.QUICKSTEP_SPRINGS; +import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -266,8 +266,8 @@ public abstract class TaskViewTouchController animationDuration *= LauncherAnimUtils.blockedFlingDurationFactor(velocity); } - float nextFrameProgress = Utilities.boundToRange( - progress + velocity * SINGLE_FRAME_MS / Math.abs(mEndDisplacement), 0f, 1f); + float nextFrameProgress = Utilities.boundToRange(progress + + velocity * getSingleFrameMs(mActivity) / Math.abs(mEndDisplacement), 0f, 1f); mCurrentAnimation.setEndAction(() -> onCurrentAnimationEnd(goingToEnd, logAction)); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java index c43155b73a..8c5a78823a 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java @@ -80,7 +80,9 @@ public final class FallbackActivityControllerHelper implements @Override public void onAssistantVisibilityChanged(float visibility) { - // TODO: + // This class becomes active when the screen is locked. + // Rather than having it handle assistant visibility changes, the assistant visibility is + // set to zero prior to this class becoming active. } @NonNull diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java index 60e7b12ec4..f08ae4a827 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java @@ -155,7 +155,7 @@ public final class RecentsActivity extends BaseRecentsActivity { mFallbackRecentsView.resetViewUI(); } }); - result.setAnimation(anim); + result.setAnimation(anim, RecentsActivity.this); } }; return ActivityOptionsCompat.makeRemoteAnimation(new RemoteAnimationAdapterCompat( diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index 6f36b05d3a..5afc73cc1c 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -335,6 +335,9 @@ public class TouchInteractionService extends Service implements if (mInputEventReceiver != null) { mInputEventReceiver.dispose(); mInputEventReceiver = null; + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.NO_BACKGROUND_TO_OVERVIEW_TAG, "disposeEventHandlers"); + } } if (mInputMonitorCompat != null) { mInputMonitorCompat.dispose(); @@ -723,7 +726,7 @@ public class TouchInteractionService extends Service implements return new OverviewInputConsumer(activity, mInputMonitorCompat, false /* startingInActivityBounds */); } else { - return new OverviewWithoutFocusInputConsumer(this, mInputMonitorCompat, + return new OverviewWithoutFocusInputConsumer(activity, mInputMonitorCompat, disableHorizontalSwipe(event)); } } @@ -816,8 +819,9 @@ public class TouchInteractionService extends Service implements pw.println(" assistantAvailable=" + mAssistantAvailable); pw.println(" assistantDisabled=" + QuickStepContract.isAssistantGestureDisabled(mSystemUiStateFlags)); - pw.println(" resumed=" - + mOverviewComponentObserver.getActivityControlHelper().isResumed()); + boolean resumed = mOverviewComponentObserver != null + && mOverviewComponentObserver.getActivityControlHelper().isResumed(); + pw.println(" resumed=" + resumed); pw.println(" useSharedState=" + mConsumer.useSharedSwipeState()); if (mConsumer.useSharedSwipeState()) { sSwipeSharedState.dump(" ", pw); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java index cc9719b418..363e4cc6be 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -17,12 +17,12 @@ package com.android.quickstep; import static com.android.launcher3.BaseActivity.INVISIBLE_BY_STATE_HANDLER; import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS; -import static com.android.launcher3.Utilities.SINGLE_FRAME_MS; import static com.android.launcher3.anim.Interpolators.DEACCEL; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.config.FeatureFlags.QUICKSTEP_SPRINGS; +import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs; import static com.android.launcher3.util.RaceConditionTracker.ENTER; import static com.android.launcher3.util.RaceConditionTracker.EXIT; import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW; @@ -780,14 +780,14 @@ public class WindowTransformSwipeHandler interpolator = endTarget == RECENTS ? OVERSHOOT_1_2 : DEACCEL; } else { startShift = Utilities.boundToRange(currentShift - velocityPxPerMs.y - * SINGLE_FRAME_MS / mTransitionDragLength, 0, mDragLengthFactor); + * getSingleFrameMs(mContext) / mTransitionDragLength, 0, mDragLengthFactor); float minFlingVelocity = mContext.getResources() .getDimension(R.dimen.quickstep_fling_min_velocity); if (Math.abs(endVelocity) > minFlingVelocity && mTransitionDragLength > 0) { if (endTarget == RECENTS && mMode != Mode.NO_BUTTON) { Interpolators.OvershootParams overshoot = new Interpolators.OvershootParams( startShift, endShift, endShift, endVelocity / 1000, - mTransitionDragLength); + mTransitionDragLength, mContext); endShift = overshoot.end; interpolator = overshoot.interpolator; duration = Utilities.boundToRange(overshoot.duration, MIN_OVERSHOOT_DURATION, diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java index 425b8b6b0b..05cbb789d9 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java @@ -30,7 +30,13 @@ import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.ViewConfiguration; +import com.android.launcher3.BaseActivity; +import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.Utilities; +import com.android.launcher3.logging.StatsLogUtils; +import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; +import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; +import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.quickstep.OverviewCallbacks; import com.android.quickstep.util.NavBarPosition; import com.android.systemui.shared.system.ActivityManagerWrapper; @@ -131,12 +137,14 @@ public class OverviewWithoutFocusInputConsumer implements InputConsumer { ? -velocityX : (mNavBarPosition.isLeftEdge() ? velocityX : -velocityY); final boolean triggerQuickstep; + int touch = Touch.FLING; if (Math.abs(velocity) >= ViewConfiguration.get(mContext).getScaledMinimumFlingVelocity()) { triggerQuickstep = velocity > 0; } else { float displacementX = mDisableHorizontalSwipe ? 0 : (ev.getX() - mDownPos.x); float displacementY = ev.getY() - mDownPos.y; triggerQuickstep = squaredHypot(displacementX, displacementY) >= mSquaredTouchSlop; + touch = Touch.SWIPE; } if (triggerQuickstep) { @@ -144,6 +152,13 @@ public class OverviewWithoutFocusInputConsumer implements InputConsumer { ActivityManagerWrapper.getInstance() .closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS); TOUCH_INTERACTION_LOG.addLog("startQuickstep"); + BaseActivity activity = BaseDraggingActivity.fromContext(mContext); + int pageIndex = -1; // This number doesn't reflect workspace page index. + // It only indicates that launcher client screen was shown. + int containerType = StatsLogUtils.getContainerTypeFromState(activity.getCurrentState()); + activity.getUserEventDispatcher().logActionOnContainer( + touch, Direction.UP, containerType, pageIndex); + activity.getUserEventDispatcher().setPreviousHomeGesture(true); } else { // ignore } diff --git a/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java b/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java index 78f6ffa88c..a8e29569b1 100644 --- a/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java +++ b/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java @@ -15,8 +15,8 @@ */ package com.android.launcher3; -import static com.android.launcher3.Utilities.SINGLE_FRAME_MS; import static com.android.launcher3.Utilities.postAsyncCallback; +import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs; import static com.android.systemui.shared.recents.utilities.Utilities .postAtFrontOfQueueAsynchronously; @@ -24,6 +24,7 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.annotation.TargetApi; +import android.content.Context; import android.os.Build; import android.os.Handler; @@ -66,7 +67,7 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo /** * Called on the UI thread when the animation targets are received. The implementation must - * call {@link AnimationResult#setAnimation(AnimatorSet)} with the target animation to be run. + * call {@link AnimationResult#setAnimation} with the target animation to be run. */ @UiThread public abstract void onCreateAnimation( @@ -110,7 +111,7 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo } @UiThread - public void setAnimation(AnimatorSet animation) { + public void setAnimation(AnimatorSet animation, Context context) { if (mInitialized) { throw new IllegalStateException("Animation already initialized"); } @@ -134,7 +135,7 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo // Because t=0 has the app icon in its original spot, we can skip the // first frame and have the same movement one frame earlier. - mAnimator.setCurrentPlayTime(SINGLE_FRAME_MS); + mAnimator.setCurrentPlayTime(getSingleFrameMs(context)); } } } diff --git a/quickstep/src/com/android/launcher3/LauncherInitListener.java b/quickstep/src/com/android/launcher3/LauncherInitListener.java index c5c5323ec5..b9ce1ceee5 100644 --- a/quickstep/src/com/android/launcher3/LauncherInitListener.java +++ b/quickstep/src/com/android/launcher3/LauncherInitListener.java @@ -85,7 +85,7 @@ public class LauncherInitListener extends InternalStateHandler implements Activi register(); - Bundle options = animProvider.toActivityOptions(handler, duration).toBundle(); + Bundle options = animProvider.toActivityOptions(handler, duration, context).toBundle(); context.startActivity(addToIntent(new Intent((intent))), options); } } diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java index b60a017dd8..991408c649 100644 --- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java +++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java @@ -219,7 +219,7 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans anim.addListener(mForceInvisibleListener); } - result.setAnimation(anim); + result.setAnimation(anim, mLauncher); } }; @@ -822,7 +822,7 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans } mLauncher.clearForceInvisibleFlag(INVISIBLE_ALL); - result.setAnimation(anim); + result.setAnimation(anim, mLauncher); } } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java index f5ba3725df..11a804356d 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java @@ -33,6 +33,9 @@ import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; +import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; +import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; +import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.util.TouchController; import com.android.quickstep.RecentsModel; import com.android.systemui.shared.recents.ISystemUiProxy; @@ -132,8 +135,12 @@ public class StatusBarTouchController implements TouchController { @Override public final boolean onControllerTouchEvent(MotionEvent ev) { - if (ev.getAction() == ACTION_UP || ev.getAction() == ACTION_CANCEL) { + int action = ev.getAction(); + if (action == ACTION_UP || action == ACTION_CANCEL) { dispatchTouchEvent(ev); + mLauncher.getUserEventDispatcher().logActionOnContainer(action == ACTION_UP ? + Touch.FLING : Touch.SWIPE, Direction.DOWN, ContainerType.WORKSPACE, + mLauncher.getWorkspace().getCurrentPage()); setWindowSlippery(false); return true; } diff --git a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java index 4a2ed3a3d1..88a4eb6d11 100644 --- a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java +++ b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java @@ -116,6 +116,14 @@ public final class OverviewComponentObserver { .getHomeActivities(new ArrayList<>()); mIsDefaultHome = Objects.equals(mMyHomeIntent.getComponent(), defaultHome); + + // Set assistant visibility to 0 from launcher's perspective, ensures any elements that + // launcher made invisible become visible again before the new activity control helper + // becomes active. + if (mActivityControlHelper != null) { + mActivityControlHelper.onAssistantVisibilityChanged(0.f); + } + if ((mSystemUiStateFlags & SYSUI_STATE_HOME_DISABLED) == 0 && (defaultHome == null || mIsDefaultHome)) { // User default home is same as out home app. Use Overview integrated in Launcher. @@ -131,6 +139,7 @@ public final class OverviewComponentObserver { } } else { // The default home app is a different launcher. Use the fallback Overview instead. + mActivityControlHelper = new FallbackActivityControllerHelper(); mIsHomeAndOverviewSame = false; mOverviewIntent = mFallbackIntent; diff --git a/quickstep/src/com/android/quickstep/RecentsActivityTracker.java b/quickstep/src/com/android/quickstep/RecentsActivityTracker.java index 0822e6199b..f9d2f11cba 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivityTracker.java +++ b/quickstep/src/com/android/quickstep/RecentsActivityTracker.java @@ -68,7 +68,7 @@ public class RecentsActivityTracker implements Ac Context context, Handler handler, long duration) { register(); - Bundle options = animProvider.toActivityOptions(handler, duration).toBundle(); + Bundle options = animProvider.toActivityOptions(handler, duration, context).toBundle(); context.startActivity(intent, options); } diff --git a/quickstep/src/com/android/quickstep/util/RemoteAnimationProvider.java b/quickstep/src/com/android/quickstep/util/RemoteAnimationProvider.java index a7e6d74f02..4503a43542 100644 --- a/quickstep/src/com/android/quickstep/util/RemoteAnimationProvider.java +++ b/quickstep/src/com/android/quickstep/util/RemoteAnimationProvider.java @@ -17,6 +17,7 @@ package com.android.quickstep.util; import android.animation.AnimatorSet; import android.app.ActivityOptions; +import android.content.Context; import android.os.Handler; import com.android.launcher3.LauncherAnimationRunner; @@ -32,14 +33,14 @@ public interface RemoteAnimationProvider { AnimatorSet createWindowAnimation(RemoteAnimationTargetCompat[] targets); - default ActivityOptions toActivityOptions(Handler handler, long duration) { + default ActivityOptions toActivityOptions(Handler handler, long duration, Context context) { LauncherAnimationRunner runner = new LauncherAnimationRunner(handler, false /* startAtFrontOfQueue */) { @Override public void onCreateAnimation(RemoteAnimationTargetCompat[] targetCompats, AnimationResult result) { - result.setAnimation(createWindowAnimation(targetCompats)); + result.setAnimation(createWindowAnimation(targetCompats), context); } }; return ActivityOptionsCompat.makeRemoteAnimation( diff --git a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java index 63c8023f6d..5a2f5c162a 100644 --- a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java +++ b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java @@ -74,6 +74,9 @@ public class ShelfScrimView extends ScrimView implements NavigationModeChangeLis private int mMidAlpha; private float mMidProgress; + // The progress at which the drag handle starts moving up with the shelf. + private float mDragHandleProgress; + private Interpolator mBeforeMidProgressColorInterpolator = ACCEL; private Interpolator mAfterMidProgressColorInterpolator = ACCEL; @@ -150,15 +153,16 @@ public class ShelfScrimView extends ScrimView implements NavigationModeChangeLis if ((OVERVIEW.getVisibleElements(mLauncher) & ALL_APPS_HEADER_EXTRA) == 0) { mMidProgress = 1; + mDragHandleProgress = 1; mMidAlpha = 0; } else { mMidAlpha = Themes.getAttrInteger(getContext(), R.attr.allAppsInterimScrimAlpha); + mMidProgress = OVERVIEW.getVerticalProgress(mLauncher); Rect hotseatPadding = dp.getHotseatLayoutPadding(); int hotseatSize = dp.hotseatBarSizePx + dp.getInsets().bottom - hotseatPadding.bottom - hotseatPadding.top; - float arrowTop = Math.min(hotseatSize, OverviewState.getDefaultSwipeHeight(dp)); - mMidProgress = 1 - (arrowTop / mShiftRange); - + float dragHandleTop = Math.min(hotseatSize, OverviewState.getDefaultSwipeHeight(dp)); + mDragHandleProgress = 1 - (dragHandleTop / mShiftRange); } mTopOffset = dp.getInsets().top - mShelfOffset; mShelfTopAtThreshold = mShiftRange * SCRIM_CATCHUP_THRESHOLD + mTopOffset; @@ -199,8 +203,6 @@ public class ShelfScrimView extends ScrimView implements NavigationModeChangeLis mProgress, mMidProgress, 1, mMidAlpha, 0, mBeforeMidProgressColorInterpolator)); mShelfColor = setColorAlphaBound(mEndScrim, alpha); } else { - mDragHandleOffset += mShiftRange * (mMidProgress - mProgress); - // Note that these ranges and interpolators are inverted because progress goes 1 to 0. int alpha = Math.round( Utilities.mapToRange(mProgress, (float) 0, mMidProgress, (float) mEndAlpha, @@ -212,6 +214,10 @@ public class ShelfScrimView extends ScrimView implements NavigationModeChangeLis (float) 0, LINEAR)); mRemainingScreenColor = setColorAlphaBound(mScrimColor, remainingScrimAlpha); } + + if (mProgress < mDragHandleProgress) { + mDragHandleOffset += mShiftRange * (mDragHandleProgress - mProgress); + } } @Override diff --git a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java index b6cd1bec3c..f27f400884 100644 --- a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java +++ b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java @@ -27,6 +27,7 @@ import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_ import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_GESTURAL_OVERLAY; import android.content.Context; +import android.content.pm.PackageManager; import android.util.Log; import androidx.test.uiautomator.UiDevice; @@ -102,36 +103,55 @@ public class NavigationModeSwitchRule implements TestRule { if (mode == THREE_BUTTON || mode == ALL) { evaluateWithThreeButtons(); } + } catch (Exception e) { + Log.e(TAG, "Exception", e); + throw e; } finally { - setActiveOverlay(prevOverlayPkg, originalMode); + Assert.assertTrue(setActiveOverlay(prevOverlayPkg, originalMode)); } mLauncher.disableDebugTracing(); } - public void evaluateWithoutChangingSetting(Statement base) throws Throwable { - base.evaluate(); - } - private void evaluateWithThreeButtons() throws Throwable { - setActiveOverlay(NAV_BAR_MODE_3BUTTON_OVERLAY, - LauncherInstrumentation.NavigationModel.THREE_BUTTON); - evaluateWithoutChangingSetting(base); + if (setActiveOverlay(NAV_BAR_MODE_3BUTTON_OVERLAY, + LauncherInstrumentation.NavigationModel.THREE_BUTTON)) { + base.evaluate(); + } } private void evaluateWithTwoButtons() throws Throwable { - setActiveOverlay(NAV_BAR_MODE_2BUTTON_OVERLAY, - LauncherInstrumentation.NavigationModel.TWO_BUTTON); - base.evaluate(); + if (setActiveOverlay(NAV_BAR_MODE_2BUTTON_OVERLAY, + LauncherInstrumentation.NavigationModel.TWO_BUTTON)) { + base.evaluate(); + } } private void evaluateWithZeroButtons() throws Throwable { - setActiveOverlay(NAV_BAR_MODE_GESTURAL_OVERLAY, - LauncherInstrumentation.NavigationModel.ZERO_BUTTON); - base.evaluate(); + if (setActiveOverlay(NAV_BAR_MODE_GESTURAL_OVERLAY, + LauncherInstrumentation.NavigationModel.ZERO_BUTTON)) { + base.evaluate(); + } } - private void setActiveOverlay(String overlayPackage, + private boolean packageExists(String packageName) { + try { + PackageManager pm = getInstrumentation().getContext().getPackageManager(); + if (pm.getApplicationInfo(packageName, 0 /* flags */) == null) { + return false; + } + } catch (PackageManager.NameNotFoundException e) { + return false; + } + return true; + } + + private boolean setActiveOverlay(String overlayPackage, LauncherInstrumentation.NavigationModel expectedMode) throws Exception { + if (!packageExists(overlayPackage)) { + Log.d(TAG, "setActiveOverlay: " + overlayPackage + " pkg does not exist"); + return false; + } + setOverlayPackageEnabled(NAV_BAR_MODE_3BUTTON_OVERLAY, overlayPackage == NAV_BAR_MODE_3BUTTON_OVERLAY); setOverlayPackageEnabled(NAV_BAR_MODE_2BUTTON_OVERLAY, @@ -175,6 +195,7 @@ public class NavigationModeSwitchRule implements TestRule { Assert.assertTrue("Switching nav mode: " + error, error == null); Thread.sleep(5000); + return true; } private void setOverlayPackageEnabled(String overlayPackage, boolean enable) diff --git a/res/values-hi/strings.xml b/res/values-hi/strings.xml index b796140e5e..3b0432ee4a 100644 --- a/res/values-hi/strings.xml +++ b/res/values-hi/strings.xml @@ -88,7 +88,7 @@ "नई सूचनाएं बताने वाला गोल निशान" "चालू" "चालू" - "सूचना के एक्सेस की ज़रूरत है" + "सूचना के ऐक्सेस की ज़रूरत है" "सूचना बिंदु दिखाने के लिए, %1$s के ऐप्लिकेशन सूचना चालू करें" "सेटिंग बदलें" "नई सूचनाएं बताने वाला गोल निशान दिखाएं" diff --git a/res/values-ta/strings.xml b/res/values-ta/strings.xml index 672665e430..c926bc185b 100644 --- a/res/values-ta/strings.xml +++ b/res/values-ta/strings.xml @@ -89,7 +89,7 @@ "ஆன்" "ஆஃப்" "அறிவிப்பிற்கான அணுகல் தேவை" - "அறிவிப்புப் புள்ளிகளைக் காட்ட, %1$s இன் பயன்பாட்டு அறிவிப்புகளை இயக்கவும்" + "அறிவிப்புப் புள்ளிகளைக் காட்ட, %1$s இன் ஆப்ஸ் அறிவிப்புகளை இயக்கவும்" "அமைப்புகளை மாற்று" "அறிவிப்புப் புள்ளிகளைக் காட்டு" "முகப்புத் திரையில் ஐகானைச் சேர்" diff --git a/res/values/styles.xml b/res/values/styles.xml index 881f65d276..339aef5b60 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -104,6 +104,7 @@