Merge "Fix crash on fallback recents Go activity" into ub-launcher3-master
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
index 90604ef..a9f6311 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -46,6 +46,7 @@
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;
@@ -81,6 +82,7 @@
private final Paint mBackgroundPaint = new Paint();
private final Paint mClearPaint = new Paint();
private final Paint mDimmingPaintAfterClearing = new Paint();
+ private final float mWindowCornerRadius;
private final Matrix mMatrix = new Matrix();
@@ -114,6 +116,7 @@
mDimmingPaintAfterClearing.setColor(Color.BLACK);
mActivity = BaseActivity.fromContext(context);
mIsDarkTextTheme = Themes.getAttrBoolean(mActivity, R.attr.isWorkspaceDarkText);
+ mWindowCornerRadius = RecentsModel.INSTANCE.get(context).getWindowCornerRadius();
}
public void bind(Task task) {
@@ -196,19 +199,22 @@
@Override
protected void onDraw(Canvas canvas) {
- float fullscreenProgress = ((TaskView) getParent()).getFullscreenProgress();
+ TaskView taskView = (TaskView) getParent();
+ float fullscreenProgress = taskView.getFullscreenProgress();
if (mIsRotated) {
// Don't show insets in the wrong orientation.
fullscreenProgress = 0;
}
if (fullscreenProgress > 0) {
// Draw the insets if we're being drawn fullscreen (we do this for quick switch).
+ float cornerRadius = Utilities.mapRange(fullscreenProgress, mCornerRadius,
+ mWindowCornerRadius);
drawOnCanvas(canvas,
-mScaledInsets.left * fullscreenProgress,
-mScaledInsets.top * fullscreenProgress,
getMeasuredWidth() + mScaledInsets.right * fullscreenProgress,
getMeasuredHeight() + mScaledInsets.bottom * fullscreenProgress,
- mCornerRadius);
+ cornerRadius / taskView.getRecentsView().getScaleX());
} else {
drawOnCanvas(canvas, 0, 0, getMeasuredWidth(), getMeasuredHeight(), mCornerRadius);
}
diff --git a/quickstep/src/com/android/quickstep/SysUINavigationMode.java b/quickstep/src/com/android/quickstep/SysUINavigationMode.java
index 3773143..1953ecb 100644
--- a/quickstep/src/com/android/quickstep/SysUINavigationMode.java
+++ b/quickstep/src/com/android/quickstep/SysUINavigationMode.java
@@ -35,14 +35,16 @@
public class SysUINavigationMode {
public enum Mode {
- THREE_BUTTONS(false),
- TWO_BUTTONS(true),
- NO_BUTTON(true);
+ THREE_BUTTONS(false, 0),
+ TWO_BUTTONS(true, 1),
+ NO_BUTTON(true, 2);
public final boolean hasGestures;
+ public final int resValue;
- Mode(boolean hasGestures) {
+ Mode(boolean hasGestures, int resValue) {
this.hasGestures = hasGestures;
+ this.resValue = resValue;
}
}
@@ -80,13 +82,10 @@
private void initializeMode() {
int modeInt = getSystemIntegerRes(mContext, NAV_BAR_INTERACTION_MODE_RES_NAME);
-
- if (QuickStepContract.isGesturalMode(modeInt)) {
- mMode = Mode.NO_BUTTON;
- } else if (QuickStepContract.isSwipeUpMode(modeInt)) {
- mMode = Mode.TWO_BUTTONS;
- } else {
- mMode = Mode.THREE_BUTTONS;
+ for(Mode m : Mode.values()) {
+ if (m.resValue == modeInt) {
+ mMode = m;
+ }
}
}
diff --git a/src/com/android/launcher3/FastBitmapDrawable.java b/src/com/android/launcher3/FastBitmapDrawable.java
index 964e8b6..7ab88a0 100644
--- a/src/com/android/launcher3/FastBitmapDrawable.java
+++ b/src/com/android/launcher3/FastBitmapDrawable.java
@@ -103,9 +103,14 @@
}
protected FastBitmapDrawable(Bitmap b, int iconColor) {
+ this(b, iconColor, false);
+ }
+
+ protected FastBitmapDrawable(Bitmap b, int iconColor, boolean isDisabled) {
mBitmap = b;
mIconColor = iconColor;
setFilterBitmap(true);
+ setIsDisabled(isDisabled);
}
@Override
@@ -249,6 +254,10 @@
}
}
+ protected boolean isDisabled() {
+ return mIsDisabled;
+ }
+
/**
* Sets the saturation of this icon, 0 [full color] -> 1 [desaturated]
*/
@@ -338,21 +347,23 @@
@Override
public ConstantState getConstantState() {
- return new MyConstantState(mBitmap, mIconColor);
+ return new MyConstantState(mBitmap, mIconColor, mIsDisabled);
}
protected static class MyConstantState extends ConstantState {
protected final Bitmap mBitmap;
protected final int mIconColor;
+ protected final boolean mIsDisabled;
- public MyConstantState(Bitmap bitmap, int color) {
+ public MyConstantState(Bitmap bitmap, int color, boolean isDisabled) {
mBitmap = bitmap;
mIconColor = color;
+ mIsDisabled = isDisabled;
}
@Override
public Drawable newDrawable() {
- return new FastBitmapDrawable(mBitmap, mIconColor);
+ return new FastBitmapDrawable(mBitmap, mIconColor, mIsDisabled);
}
@Override
diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java
index e4dced5..98fb07f 100644
--- a/tests/tapl/com/android/launcher3/tapl/AllApps.java
+++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java
@@ -64,7 +64,7 @@
"want to get app icon on all apps")) {
final UiObject2 allAppsContainer = verifyActiveContainer();
final UiObject2 navBar = mLauncher.waitForSystemUiObject("navigation_bar_frame");
- allAppsContainer.setGestureMargins(0, 0, 0, navBar.getVisibleBounds().height());
+ allAppsContainer.setGestureMargins(0, 0, 0, navBar.getVisibleBounds().height() + 1);
final BySelector appIconSelector = AppIcon.getAppIconSelector(appName, mLauncher);
if (!hasClickableIcon(allAppsContainer, appIconSelector)) {
scrollBackToBeginning();
@@ -141,8 +141,8 @@
* Flings forward (down) and waits the fling's end.
*/
public void flingForward() {
- try(LauncherInstrumentation.Closable c =
- mLauncher.addContextLayer("want to fling forward in all apps")) {
+ try (LauncherInstrumentation.Closable c =
+ mLauncher.addContextLayer("want to fling forward in all apps")) {
final UiObject2 allAppsContainer = verifyActiveContainer();
// Start the gesture in the center to avoid starting at elements near the top.
allAppsContainer.setGestureMargins(0, 0, 0, mHeight / 2);
@@ -156,8 +156,8 @@
* Flings backward (up) and waits the fling's end.
*/
public void flingBackward() {
- try(LauncherInstrumentation.Closable c =
- mLauncher.addContextLayer("want to fling backward in all apps")) {
+ try (LauncherInstrumentation.Closable c =
+ mLauncher.addContextLayer("want to fling backward in all apps")) {
final UiObject2 allAppsContainer = verifyActiveContainer();
// Start the gesture in the center, for symmetry with forward.
allAppsContainer.setGestureMargins(0, mHeight / 2, 0, 0);