Merging ub-launcher3-qt-dev, build 5456758

Test: Manual

Bug:111142970 Icon display blur in all apps page
Bug:114136250 Have a more spartan RecentsActivity on android go
Bug:122609330 Update PIP animation for swiping up to home
Bug:123985787 Respect dialogCornerRadius for all apps / widgets / settings / shortcut menu / dwb / task / overview (everything)
Bug:126587956 Create an app to use with Launcher testing
Bug:126606858 In multiwindow mode, not able to switch between recent apps.
Bug:127766994 Gray app icons disappeared after completing cable transfer for a while
Bug:127987071 Create a proper contract for specifying default Launcher Layout
Bug:129033091 [Q-Preview] I would like the ability to swipe up anywhere on my screen to open up the app li.
Bug:129297464 [Gesture Nav] Exclude edges from most Launcher / Overview states.
Bug:129434166 Lab-only flake: drag to workspace doesn't happen
Bug:129746879 [Q-Preview] Quick search bar overlaying other app
Bug:129874298 Show different string (Wallpaper vs Style & Wallpaper) on Settings depending on device type
Bug:129947426 nexus launcher crash observed randomly during device boot up(NPE:Attempt to invoke virtual method 'android.app.ActivityManager$RunningTaskInfo com.android.systemui.shared.system.ActivityManagerWrapper.getRunningTask(int)' on a null object reference)
Bug:129976669 Implement returning to home from Widgets in 0-button mode Bug:130027168 Can't tap in nav region on home screen
Bug:130151609 Some tests in MultiDisplaySystemDecorationTests.java failing in pre-submit
Bug:130182878 Pixel launcher crashes on secondary display
Bug:130225926 Cannot unpin app while in gesture nav
Bug:130245920 Icons disappear from launcher when selected
Bug:130272454 [C1/B1] Message app crash when opening a video MMS.
Change-Id: I18aa35d2c75deaf5149358d96d4e1d7f26de2f02
This commit is contained in:
Hyunyoung Song
2019-04-10 16:39:25 -07:00
72 changed files with 1048 additions and 297 deletions
@@ -75,12 +75,4 @@ public class BackgroundAppState extends OverviewState {
return new ScaleAndTranslation(scale, 0f, 0f);
}
@Override
public int getVisibleElements(Launcher launcher) {
if (SysUINavigationMode.getMode(launcher) == Mode.NO_BUTTON) {
return super.getVisibleElements(launcher);
}
// Hide shelf content (e.g. QSB) because we fade it in when swiping up.
return ALL_APPS_HEADER_EXTRA;
}
}
@@ -15,74 +15,131 @@
*/
package com.android.launcher3.uioverrides.touchcontrollers;
import static android.view.View.TRANSLATION_X;
import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
import static com.android.launcher3.AbstractFloatingView.TYPE_HIDE_BACK_BUTTON;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.allapps.AllAppsTransitionController.ALL_APPS_PROGRESS;
import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
import static com.android.launcher3.touch.AbstractStateChangeTouchController.SUCCESS_TRANSITION_PROGRESS;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.Interpolator;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.touch.AbstractStateChangeTouchController;
import com.android.launcher3.touch.SwipeDetector;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Command;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.util.TouchController;
import com.android.quickstep.views.RecentsView;
/**
* Handles swiping up on the nav bar to go home from overview or all apps.
* Handles swiping up on the nav bar to go home from launcher, e.g. overview or all apps.
*/
public class NavBarToHomeTouchController extends AbstractStateChangeTouchController {
public class NavBarToHomeTouchController implements TouchController, SwipeDetector.Listener {
private static final Interpolator PULLBACK_INTERPOLATOR = DEACCEL_3;
private final Launcher mLauncher;
private final SwipeDetector mSwipeDetector;
private final float mPullbackDistance;
private boolean mNoIntercept;
private LauncherState mStartState;
private LauncherState mEndState = NORMAL;
private AnimatorPlaybackController mCurrentAnimation;
public NavBarToHomeTouchController(Launcher launcher) {
super(launcher, SwipeDetector.VERTICAL);
mLauncher = launcher;
mSwipeDetector = new SwipeDetector(mLauncher, this, SwipeDetector.VERTICAL);
mPullbackDistance = mLauncher.getResources().getDimension(R.dimen.home_pullback_distance);
}
@Override
protected boolean canInterceptTouch(MotionEvent ev) {
boolean cameFromNavBar = (ev.getEdgeFlags() & Utilities.EDGE_NAV_BAR) != 0;
return cameFromNavBar && (mLauncher.isInState(OVERVIEW) || mLauncher.isInState(ALL_APPS));
}
@Override
protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) {
return isDragTowardPositive ? NORMAL : fromState;
}
@Override
protected float initCurrentAnimation(int animComponents) {
long accuracy = (long) (getShiftRange() * 2);
final AnimatorSet anim;
if (mFromState == OVERVIEW) {
anim = new AnimatorSet();
RecentsView recentsView = mLauncher.getOverviewPanel();
float pullbackDistance = recentsView.getPaddingStart() / 2;
if (!recentsView.isRtl()) {
pullbackDistance = -pullbackDistance;
public final boolean onControllerInterceptTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
mStartState = mLauncher.getStateManager().getState();
mNoIntercept = !canInterceptTouch(ev);
if (mNoIntercept) {
return false;
}
anim.play(ObjectAnimator.ofFloat(recentsView, View.TRANSLATION_X, pullbackDistance));
anim.setInterpolator(PULLBACK_INTERPOLATOR);
} else { // if (mFromState == ALL_APPS)
mSwipeDetector.setDetectableScrollConditions(SwipeDetector.DIRECTION_POSITIVE, false);
}
if (mNoIntercept) {
return false;
}
onControllerTouchEvent(ev);
return mSwipeDetector.isDraggingOrSettling();
}
private boolean canInterceptTouch(MotionEvent ev) {
boolean cameFromNavBar = (ev.getEdgeFlags() & Utilities.EDGE_NAV_BAR) != 0;
if (!cameFromNavBar) {
return false;
}
if (mStartState == OVERVIEW || mStartState == ALL_APPS) {
return true;
}
if (!mLauncher.hasWindowFocus()) {
return true;
}
if (AbstractFloatingView.getTopOpenView(mLauncher) != null) {
return true;
}
return false;
}
@Override
public final boolean onControllerTouchEvent(MotionEvent ev) {
return mSwipeDetector.onTouchEvent(ev);
}
private float getShiftRange() {
return mLauncher.getDeviceProfile().heightPx;
}
@Override
public void onDragStart(boolean start) {
initCurrentAnimation();
}
private void initCurrentAnimation() {
long accuracy = (long) (getShiftRange() * 2);
final AnimatorSet anim = new AnimatorSet();
if (mStartState == OVERVIEW) {
RecentsView recentsView = mLauncher.getOverviewPanel();
float pullbackDist = mPullbackDistance;
if (!recentsView.isRtl()) {
pullbackDist = -pullbackDist;
}
Animator pullback = ObjectAnimator.ofFloat(recentsView, TRANSLATION_X, pullbackDist);
pullback.setInterpolator(PULLBACK_INTERPOLATOR);
anim.play(pullback);
} else if (mStartState == ALL_APPS) {
AnimatorSetBuilder builder = new AnimatorSetBuilder();
AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
final float pullbackDistance = mLauncher.getDeviceProfile().allAppsIconSizePx / 2;
Animator allAppsProgress = ObjectAnimator.ofFloat(allAppsController, ALL_APPS_PROGRESS,
-pullbackDistance / allAppsController.getShiftRange());
-mPullbackDistance / allAppsController.getShiftRange());
allAppsProgress.setInterpolator(PULLBACK_INTERPOLATOR);
builder.play(allAppsProgress);
// Slightly fade out all apps content to further distinguish from scrolling.
@@ -90,52 +147,79 @@ public class NavBarToHomeTouchController extends AbstractStateChangeTouchControl
.mapToProgress(PULLBACK_INTERPOLATOR, 0, 0.5f));
AnimationConfig config = new AnimationConfig();
config.duration = accuracy;
allAppsController.setAlphas(mToState.getVisibleElements(mLauncher), config, builder);
anim = builder.build();
allAppsController.setAlphas(mEndState.getVisibleElements(mLauncher), config, builder);
anim.play(builder.build());
}
AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mLauncher);
if (topView != null) {
Animator hintCloseAnim = topView.createHintCloseAnim(mPullbackDistance);
if (hintCloseAnim != null) {
hintCloseAnim.setInterpolator(PULLBACK_INTERPOLATOR);
anim.play(hintCloseAnim);
}
}
anim.setDuration(accuracy);
mCurrentAnimation = AnimatorPlaybackController.wrap(anim, accuracy, this::clearState);
return -1 / getShiftRange();
}
private void clearState() {
mCurrentAnimation = null;
mSwipeDetector.finishedScrolling();
mSwipeDetector.setDetectableScrollConditions(0, false);
}
@Override
public void onDragStart(boolean start) {
super.onDragStart(start);
mStartContainerType = LauncherLogProto.ContainerType.NAVBAR;
public boolean onDrag(float displacement) {
// Only allow swipe up.
displacement = Math.min(0, displacement);
float progress = Utilities.getProgress(displacement, 0, getShiftRange());
mCurrentAnimation.setPlayFraction(progress);
return true;
}
@Override
public void onDragEnd(float velocity, boolean fling) {
final int logAction = fling ? Touch.FLING : Touch.SWIPE;
float interpolatedProgress = PULLBACK_INTERPOLATOR.getInterpolation(
mCurrentAnimation.getProgressFraction());
if (interpolatedProgress >= SUCCESS_TRANSITION_PROGRESS || velocity < 0 && fling) {
mLauncher.getStateManager().goToState(mToState, true,
() -> onSwipeInteractionCompleted(mToState, logAction));
float progress = mCurrentAnimation.getProgressFraction();
float interpolatedProgress = PULLBACK_INTERPOLATOR.getInterpolation(progress);
boolean success = interpolatedProgress >= SUCCESS_TRANSITION_PROGRESS
|| (velocity < 0 && fling);
if (success) {
mLauncher.getStateManager().goToState(mEndState, true,
() -> onSwipeInteractionCompleted(mEndState));
if (mStartState != mEndState) {
logStateChange(mStartState.containerType, logAction);
}
AbstractFloatingView topOpenView = AbstractFloatingView.getTopOpenView(mLauncher);
if (topOpenView != null) {
AbstractFloatingView.closeAllOpenViews(mLauncher);
logStateChange(topOpenView.getLogContainerType(), logAction);
}
} else {
// Quickly return to the state we came from (we didn't move far).
AnimatorPlaybackController anim = mLauncher.getStateManager()
.createAnimationToNewWorkspace(mFromState, 80);
anim.setEndAction(() -> onSwipeInteractionCompleted(mFromState, logAction));
anim.start();
ValueAnimator anim = mCurrentAnimation.getAnimationPlayer();
anim.setFloatValues(progress, 0);
anim.addListener(new AnimationSuccessListener() {
@Override
public void onAnimationSuccess(Animator animator) {
onSwipeInteractionCompleted(mStartState);
}
});
anim.setDuration(80).start();
}
mCurrentAnimation.dispatchOnCancel();
}
@Override
protected int getDirectionForLog() {
return LauncherLogProto.Action.Direction.UP;
private void onSwipeInteractionCompleted(LauncherState targetState) {
clearState();
mLauncher.getStateManager().goToState(targetState, false /* animated */);
}
@Override
protected boolean goingBetweenNormalAndOverview(LauncherState fromState,
LauncherState toState) {
// We don't want to create an atomic animation to/from overview.
return false;
}
@Override
protected int getLogContainerTypeForNormalState() {
return LauncherLogProto.ContainerType.NAVBAR;
private void logStateChange(int startContainerType, int logAction) {
mLauncher.getUserEventDispatcher().logStateChangeAction(logAction,
LauncherLogProto.Action.Direction.UP,
LauncherLogProto.ContainerType.NAVBAR,
startContainerType,
mEndState.containerType,
mLauncher.getWorkspace().getCurrentPage());
}
}
@@ -23,7 +23,6 @@ import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.allapps.AllAppsTransitionController.SPRING_DAMPING_RATIO;
import static com.android.launcher3.allapps.AllAppsTransitionController.SPRING_STIFFNESS;
import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import android.animation.Animator;
@@ -44,11 +43,8 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherInitListener;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.allapps.DiscoveryBounce;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.SpringObjectAnimator;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.userevent.nano.LauncherLogProto;
@@ -220,7 +216,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
: mShelfState == ShelfAnimState.PEEK
? shelfPeekingProgress
: shelfOverviewProgress;
mShelfAnim = createShelfProgressAnim(activity, toProgress);
mShelfAnim = createShelfAnim(activity, toProgress);
mShelfAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
@@ -238,10 +234,10 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
LauncherState fromState, long transitionLength,
Consumer<AnimatorPlaybackController> callback) {
LauncherState endState = OVERVIEW;
DeviceProfile dp = activity.getDeviceProfile();
long accuracy = 2 * Math.max(dp.widthPx, dp.heightPx);
if (wasVisible && fromState != BACKGROUND_APP) {
// If a translucent app was launched fom launcher, animate launcher states.
DeviceProfile dp = activity.getDeviceProfile();
long accuracy = 2 * Math.max(dp.widthPx, dp.heightPx);
callback.accept(activity.getStateManager()
.createAnimationToNewWorkspace(fromState, endState, accuracy));
return;
@@ -254,11 +250,10 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
if (!activity.getDeviceProfile().isVerticalBarLayout()
&& SysUINavigationMode.getMode(activity) != Mode.NO_BUTTON) {
// Don't animate the shelf when the mode is NO_BUTTON, because we update it atomically.
Animator shiftAnim = createShelfProgressAnim(activity,
Animator shiftAnim = createShelfAnim(activity,
fromState.getVerticalProgress(activity),
endState.getVerticalProgress(activity));
anim.play(shiftAnim);
anim.play(createShelfAlphaAnim(activity, endState, accuracy));
}
playScaleDownAnim(anim, activity, endState);
@@ -275,7 +270,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
callback.accept(controller);
}
private Animator createShelfProgressAnim(Launcher activity, float ... progressValues) {
private Animator createShelfAnim(Launcher activity, float ... progressValues) {
Animator shiftAnim = new SpringObjectAnimator<>(activity.getAllAppsController(),
"allAppsSpringFromACH", activity.getAllAppsController().getShiftRange(),
SPRING_DAMPING_RATIO, SPRING_STIFFNESS, progressValues);
@@ -283,19 +278,6 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
return shiftAnim;
}
/**
* Very quickly fade the alpha of shelf content.
*/
private Animator createShelfAlphaAnim(Launcher activity, LauncherState toState, long accuracy) {
AllAppsTransitionController allAppsController = activity.getAllAppsController();
AnimatorSetBuilder animBuilder = new AnimatorSetBuilder();
animBuilder.setInterpolator(AnimatorSetBuilder.ANIM_ALL_APPS_FADE, DEACCEL_3);
LauncherStateManager.AnimationConfig config = new LauncherStateManager.AnimationConfig();
config.duration = accuracy;
allAppsController.setAlphas(toState.getVisibleElements(activity), config, animBuilder);
return animBuilder.build();
}
/**
* Scale down recents from the center task being full screen to being in overview.
*/
@@ -136,17 +136,13 @@ public class OverviewInputConsumer<T extends BaseDraggingActivity>
}
private void sendEvent(MotionEvent ev) {
if (mInvalidated || !mTarget.verifyTouchDispatch(this, ev)) {
mInvalidated = true;
if (mInvalidated) {
return;
}
int flags = ev.getEdgeFlags();
ev.setEdgeFlags(flags | Utilities.EDGE_NAV_BAR);
ev.offsetLocation(-mLocationOnScreen[0], -mLocationOnScreen[1]);
if (ev.getAction() == ACTION_DOWN) {
mTarget.onInterceptTouchEvent(ev);
}
mTarget.onTouchEvent(ev);
mInvalidated = !mTarget.dispatchTouchEvent(this, ev);
ev.offsetLocation(mLocationOnScreen[0], mLocationOnScreen[1]);
ev.setEdgeFlags(flags);
}
@@ -290,6 +290,10 @@ public class TaskSystemShortcut<T extends SystemShortcut> extends SystemShortcut
if (sysUiProxy == null) {
return null;
}
if (SysUINavigationMode.getMode(activity) == SysUINavigationMode.Mode.NO_BUTTON) {
// TODO(b/130225926): Temporarily disable pinning while gesture nav is enabled
return null;
}
if (!ActivityManagerWrapper.getInstance().isScreenPinningEnabled()) {
return null;
}
@@ -101,7 +101,6 @@ public class TouchInteractionService extends Service implements
MAIN_THREAD_EXECUTOR.execute(TouchInteractionService.this::initInputMonitor);
runWhenUserUnlocked(() -> {
mRecentsModel.setSystemUiProxy(mISystemUiProxy);
mRecentsModel.onInitializeSystemUI(bundle);
mOverviewInteractionState.setSystemUiProxy(mISystemUiProxy);
});
}
@@ -426,7 +425,7 @@ public class TouchInteractionService extends Service implements
private InputConsumer newConsumer(boolean useSharedState, MotionEvent event) {
// TODO: this makes a binder call every touch down. we should move to a listener pattern.
if (mKM.isDeviceLocked()) {
if (!mIsUserUnlocked || mKM.isDeviceLocked()) {
// This handles apps launched in direct boot mode (e.g. dialer) as well as apps launched
// while device is locked even after exiting direct boot mode (e.g. camera).
return new DeviceLockedInputConsumer(this);
@@ -16,6 +16,8 @@
package com.android.quickstep.util;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius;
import static com.android.systemui.shared.system.QuickStepContract.supportsRoundedCornersOnWindows;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
@@ -33,6 +35,7 @@ import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.BaseDragLayer;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.views.RecentsView;
@@ -97,12 +100,9 @@ public class ClipAnimationHelper {
(t, a1) -> a1;
public ClipAnimationHelper(Context context) {
mWindowCornerRadius = RecentsModel.INSTANCE.get(context).getWindowCornerRadius();
mSupportsRoundedCornersOnWindows = RecentsModel.INSTANCE.get(context)
.supportsRoundedCornersOnWindows();
int taskCornerRadiusRes = mSupportsRoundedCornersOnWindows ?
R.dimen.task_corner_radius : R.dimen.task_corner_radius_small;
mTaskCornerRadius = context.getResources().getDimension(taskCornerRadiusRes);
mWindowCornerRadius = getWindowCornerRadius(context.getResources());
mSupportsRoundedCornersOnWindows = supportsRoundedCornersOnWindows(context.getResources());
mTaskCornerRadius = Themes.getDialogCornerRadius(context);
}
private void updateSourceStack(RemoteAnimationTargetCompat target) {
@@ -40,6 +40,7 @@ import com.android.launcher3.R;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.BaseDragLayer;
import com.android.quickstep.TaskSystemShortcut;
import com.android.quickstep.TaskUtils;
@@ -270,7 +271,7 @@ public class TaskMenuView extends AbstractFloatingView {
}
private RoundedRectRevealOutlineProvider createOpenCloseOutlineProvider() {
float radius = getResources().getDimension(R.dimen.task_corner_radius);
float radius = Themes.getDialogCornerRadius(getContext());
Rect fromRect = new Rect(0, 0, getWidth(), 0);
Rect toRect = new Rect(0, 0, getWidth(), getHeight());
return new RoundedRectRevealOutlineProvider(radius, radius, fromRect, toRect);
@@ -46,11 +46,11 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.SystemUiController;
import com.android.launcher3.util.Themes;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.TaskOverlayFactory;
import com.android.quickstep.TaskOverlayFactory.TaskOverlay;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.QuickStepContract;
/**
* A task in the Recents view.
@@ -108,7 +108,7 @@ public class TaskThumbnailView extends View {
public TaskThumbnailView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mCornerRadius = getResources().getDimension(R.dimen.task_corner_radius);
mCornerRadius = Themes.getDialogCornerRadius(context);
mOverlay = TaskOverlayFactory.INSTANCE.get(context).createOverlay(this);
mPaint.setFilterBitmap(true);
mBackgroundPaint.setColor(Color.WHITE);
@@ -116,7 +116,7 @@ public class TaskThumbnailView extends View {
mDimmingPaintAfterClearing.setColor(Color.BLACK);
mActivity = BaseActivity.fromContext(context);
mIsDarkTextTheme = Themes.getAttrBoolean(mActivity, R.attr.isWorkspaceDarkText);
mWindowCornerRadius = RecentsModel.INSTANCE.get(context).getWindowCornerRadius();
mWindowCornerRadius = QuickStepContract.getWindowCornerRadius(context.getResources());
}
public void bind(Task task) {
@@ -51,6 +51,7 @@ import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.util.PendingAnimation;
import com.android.launcher3.util.Themes;
import com.android.launcher3.util.ViewPool.Reusable;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.TaskIconCache;
@@ -195,7 +196,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
fromContext(context).getStatsLogManager().logTaskLaunch(getRecentsView(),
TaskUtils.getLaunchComponentKeyForTask(getTask().key));
});
setOutlineProvider(new TaskOutlineProvider(getResources()));
setOutlineProvider(new TaskOutlineProvider(context, getResources()));
}
@Override
@@ -513,9 +514,9 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
private final int mMarginTop;
private final float mRadius;
TaskOutlineProvider(Resources res) {
TaskOutlineProvider(Context context, Resources res) {
mMarginTop = res.getDimensionPixelSize(R.dimen.task_thumbnail_top_margin);
mRadius = res.getDimension(R.dimen.task_corner_radius);
mRadius = Themes.getDialogCornerRadius(context);
}
@Override
@@ -15,5 +15,5 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#E61A73E8" />
<corners android:radius="@dimen/task_corner_radius" />
<corners android:radius="?android:attr/dialogCornerRadius" />
</shape>
+2 -2
View File
@@ -28,8 +28,8 @@
<!-- Background -->
<shape>
<corners
android:topLeftRadius="@dimen/task_corner_radius"
android:topRightRadius="@dimen/task_corner_radius"
android:topLeftRadius="?android:attr/dialogCornerRadius"
android:topRightRadius="?android:attr/dialogCornerRadius"
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp" />
<solid android:color="?attr/popupColorPrimary" />
+4 -4
View File
@@ -19,9 +19,7 @@
<dimen name="task_thumbnail_top_margin">24dp</dimen>
<dimen name="task_thumbnail_half_top_margin">12dp</dimen>
<dimen name="task_thumbnail_icon_size">48dp</dimen>
<dimen name="task_corner_radius">8dp</dimen>
<!-- For screens without rounded corners -->
<dimen name="task_corner_radius_small">2dp</dimen>
<dimen name="recents_page_spacing">10dp</dimen>
<dimen name="recents_clear_all_deadzone_vertical_margin">70dp</dimen>
<dimen name="overview_peek_distance">32dp</dimen>
@@ -61,11 +59,13 @@
docked_stack_divider_thickness - 2 * docked_stack_divider_insets -->
<dimen name="multi_window_task_divider_size">10dp</dimen>
<dimen name="shelf_surface_radius">16dp</dimen>
<!-- same as vertical_drag_handle_size -->
<dimen name="shelf_surface_offset">24dp</dimen>
<!-- Assistant Gestures -->
<dimen name="gestures_assistant_size">28dp</dimen>
<dimen name="gestures_assistant_drag_threshold">70dp</dimen>
<!-- Distance to move elements when swiping up to go home from launcher -->
<dimen name="home_pullback_distance">28dp</dimen>
</resources>
@@ -31,6 +31,7 @@ import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_TRANSITIONS;
import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
import static com.android.quickstep.TaskUtils.taskIsATargetWithMode;
import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
@@ -63,12 +64,12 @@ import com.android.launcher3.shortcuts.DeepShortcutView;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.launcher3.views.FloatingIconView;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.util.MultiValueUpdateListener;
import com.android.quickstep.util.RemoteAnimationProvider;
import com.android.quickstep.util.RemoteAnimationTargetSet;
import com.android.systemui.shared.system.ActivityCompat;
import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.RemoteAnimationAdapterCompat;
import com.android.systemui.shared.system.RemoteAnimationDefinitionCompat;
import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;
@@ -473,6 +474,10 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
});
float shapeRevealDuration = APP_LAUNCH_DURATION * SHAPE_PROGRESS_DURATION;
final float windowRadius = mDeviceProfile.isMultiWindowMode
? 0 : getWindowCornerRadius(mLauncher.getResources());
appAnimator.addUpdateListener(new MultiValueUpdateListener() {
FloatProp mDx = new FloatProp(0, dX, 0, xDuration, AGGRESSIVE_EASE);
FloatProp mDy = new FloatProp(0, dY, 0, yDuration, AGGRESSIVE_EASE);
@@ -514,13 +519,6 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
float transX0 = temp.left - offsetX;
float transY0 = temp.top - offsetY;
float windowRadius = 0;
if (!mDeviceProfile.isMultiWindowMode &&
RecentsModel.INSTANCE.get(mLauncher).supportsRoundedCornersOnWindows()) {
windowRadius = RecentsModel.INSTANCE.get(mLauncher)
.getWindowCornerRadius();
}
SurfaceParams[] params = new SurfaceParams[targets.length];
for (int i = targets.length - 1; i >= 0; i--) {
RemoteAnimationTargetCompat target = targets[i];
@@ -651,7 +649,7 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
ValueAnimator unlockAnimator = ValueAnimator.ofFloat(0, 1);
unlockAnimator.setDuration(CLOSING_TRANSITION_DURATION_MS);
float cornerRadius = mDeviceProfile.isMultiWindowMode ? 0 :
RecentsModel.INSTANCE.get(mLauncher).getWindowCornerRadius();
QuickStepContract.getWindowCornerRadius(mLauncher.getResources());
unlockAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
@@ -677,8 +675,8 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
Matrix matrix = new Matrix();
ValueAnimator closingAnimator = ValueAnimator.ofFloat(0, 1);
int duration = CLOSING_TRANSITION_DURATION_MS;
float windowCornerRadius = mDeviceProfile.isMultiWindowMode ? 0 :
RecentsModel.INSTANCE.get(mLauncher).getWindowCornerRadius();
float windowCornerRadius = mDeviceProfile.isMultiWindowMode
? 0 : getWindowCornerRadius(mLauncher.getResources());
closingAnimator.setDuration(duration);
closingAnimator.addUpdateListener(new MultiValueUpdateListener() {
FloatProp mDy = new FloatProp(0, mClosingWindowTransY, 0, duration, DEACCEL_1_7);
@@ -42,7 +42,6 @@ import com.android.launcher3.LauncherStateManager;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.QuickstepAppTransitionManagerImpl;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.quickstep.OverviewInteractionState;
import com.android.quickstep.RecentsModel;
@@ -87,6 +86,9 @@ public class UiFactory extends RecentsUiFactory {
}
OverviewInteractionState.INSTANCE.get(launcher)
.setBackButtonAlpha(shouldBackButtonBeHidden ? 0 : 1, true /* animate */);
if (launcher != null && launcher.getDragLayer() != null) {
launcher.getDragLayer().setDisallowBackGesture(shouldBackButtonBeHidden);
}
}
public static void onCreate(Launcher launcher) {
@@ -44,7 +44,6 @@ import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.touch.AbstractStateChangeTouchController;
import com.android.launcher3.touch.SwipeDetector;
import com.android.launcher3.uioverrides.states.OverviewState;
import com.android.launcher3.uioverrides.touchcontrollers.PortraitOverviewStateTouchHelper;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.RecentsModel;
@@ -114,8 +113,10 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
return false;
}
} else {
// If we are swiping to all apps instead of overview, allow it from anywhere.
boolean interceptAnywhere = mLauncher.isInState(NORMAL) && !mAllowDragToOverview;
// For all other states, only listen if the event originated below the hotseat height
if (!isTouchOverHotseat(mLauncher, ev)) {
if (!interceptAnywhere && !isTouchOverHotseat(mLauncher, ev)) {
return false;
}
}
@@ -35,6 +35,7 @@ import com.android.systemui.shared.recents.ISystemUiProxy;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.TaskStackChangeListener;
import java.util.ArrayList;
@@ -62,9 +63,6 @@ public class RecentsModel extends TaskStackChangeListener {
private final TaskIconCache mIconCache;
private final TaskThumbnailCache mThumbnailCache;
private float mWindowCornerRadius = 0;
private boolean mSupportsRoundedCornersOnWindows;
private RecentsModel(Context context) {
mContext = context;
HandlerThread loaderThread = new HandlerThread("TaskThumbnailIconCache",
@@ -76,12 +74,6 @@ public class RecentsModel extends TaskStackChangeListener {
ActivityManagerWrapper.getInstance().registerTaskStackListener(this);
}
public void onInitializeSystemUI(Bundle params) {
mWindowCornerRadius = params.getFloat(KEY_EXTRA_WINDOW_CORNER_RADIUS, 0);
mSupportsRoundedCornersOnWindows =
params.getBoolean(KEY_EXTRA_SUPPORTS_WINDOW_CORNERS, false);
}
public TaskIconCache getIconCache() {
return mIconCache;
}
@@ -182,14 +174,6 @@ public class RecentsModel extends TaskStackChangeListener {
return mSystemUiProxy;
}
public float getWindowCornerRadius() {
return mWindowCornerRadius;
}
public boolean supportsRoundedCornersOnWindows() {
return mSupportsRoundedCornersOnWindows;
}
public void onTrimMemory(int level) {
if (level == ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) {
mThumbnailCache.getHighResLoadingState().setVisible(false);
@@ -27,8 +27,6 @@ import androidx.annotation.IntDef;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags;
import com.android.quickstep.SysUINavigationMode;
import com.android.quickstep.SysUINavigationMode.Mode;
import java.lang.annotation.Retention;
@@ -118,14 +116,10 @@ public class LayoutUtils {
}
public static int getShelfTrackingDistance(Context context, DeviceProfile dp) {
if (SysUINavigationMode.getMode(context) == Mode.NO_BUTTON) {
// Track the bottom of the window rather than the top of the shelf.
int shelfHeight = dp.hotseatBarSizePx + dp.getInsets().bottom;
int spaceBetweenShelfAndRecents = (int) context.getResources().getDimension(
R.dimen.task_card_vert_space);
return shelfHeight + spaceBetweenShelfAndRecents;
}
// Start from a third of bottom inset to provide some shelf overlap.
return dp.hotseatBarSizePx + dp.getInsets().bottom / 3 - dp.edgeMarginPx * 2;
// Track the bottom of the window.
int shelfHeight = dp.hotseatBarSizePx + dp.getInsets().bottom;
int spaceBetweenShelfAndRecents = (int) context.getResources().getDimension(
R.dimen.task_card_vert_space);
return shelfHeight + spaceBetweenShelfAndRecents;
}
}
@@ -53,6 +53,9 @@ public class ShelfScrimView extends ScrimView implements NavigationModeChangeLis
// cover the whole screen
private static final float SCRIM_CATCHUP_THRESHOLD = 0.2f;
// Temporarily needed until android.R.attr.bottomDialogCornerRadius becomes public
private static final float BOTTOM_CORNER_RADIUS_RATIO = 2f;
// In transposed layout, we simply draw a flat color.
private boolean mDrawingFlatColor;
@@ -87,7 +90,7 @@ public class ShelfScrimView extends ScrimView implements NavigationModeChangeLis
mMaxScrimAlpha = Math.round(OVERVIEW.getWorkspaceScrimAlpha(mLauncher) * 255);
mEndAlpha = Color.alpha(mEndScrim);
mRadius = mLauncher.getResources().getDimension(R.dimen.shelf_surface_radius);
mRadius = BOTTOM_CORNER_RADIUS_RATIO * Themes.getDialogCornerRadius(context);
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mShelfOffset = context.getResources().getDimension(R.dimen.shelf_surface_offset);
@@ -32,7 +32,6 @@ import androidx.test.uiautomator.UiDevice;
import com.android.launcher3.tapl.LauncherInstrumentation;
import com.android.launcher3.tapl.TestHelpers;
import com.android.systemui.shared.system.QuickStepContract;
import org.junit.Assert;
import org.junit.rules.TestRule;
@@ -78,9 +77,9 @@ public class NavigationModeSwitchRule implements TestRule {
@Override
public void evaluate() throws Throwable {
final Context context = getInstrumentation().getContext();
final String prevOverlayPkg = QuickStepContract.isGesturalMode(context)
final String prevOverlayPkg = LauncherInstrumentation.isGesturalMode(context)
? NAV_BAR_MODE_GESTURAL_OVERLAY
: QuickStepContract.isSwipeUpMode(context)
: LauncherInstrumentation.isSwipeUpMode(context)
? NAV_BAR_MODE_2BUTTON_OVERLAY
: NAV_BAR_MODE_3BUTTON_OVERLAY;
final LauncherInstrumentation.NavigationModel originalMode =
@@ -150,4 +149,4 @@ public class NavigationModeSwitchRule implements TestRule {
return base;
}
}
}
}