Merge "Ignore null notifications" into ub-launcher3-master
diff --git a/quickstep/libs/sysui_shared.jar b/quickstep/libs/sysui_shared.jar
index fec7317..41f5bb8 100644
--- a/quickstep/libs/sysui_shared.jar
+++ b/quickstep/libs/sysui_shared.jar
Binary files differ
diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml
index 7ba91b3..bafa294 100644
--- a/quickstep/res/values/strings.xml
+++ b/quickstep/res/values/strings.xml
@@ -27,9 +27,6 @@
<!-- Title for an option to keep an app pinned to the screen until it is unpinned -->
<string name="recent_task_option_pin">Pin</string>
- <!-- Text that shows above the navigation bar after launching a few apps -->
- <string name="recents_swipe_up_onboarding">Swipe up from the bottom to switch apps</string>
-
<!-- Content description for the recent apps panel (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_desc_recent_apps">Overview</string>
diff --git a/quickstep/src/com/android/launcher3/uioverrides/LandscapeStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/OverviewToAllAppsTouchController.java
similarity index 89%
rename from quickstep/src/com/android/launcher3/uioverrides/LandscapeStatesTouchController.java
rename to quickstep/src/com/android/launcher3/uioverrides/OverviewToAllAppsTouchController.java
index 30ceb43..e7816be 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/LandscapeStatesTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/OverviewToAllAppsTouchController.java
@@ -28,11 +28,13 @@
import com.android.quickstep.views.RecentsView;
/**
- * Touch controller from going from OVERVIEW to ALL_APPS
+ * Touch controller from going from OVERVIEW to ALL_APPS.
+ *
+ * This is used in landscape mode. It is also used in portrait mode for the fallback recents.
*/
-public class LandscapeStatesTouchController extends PortraitStatesTouchController {
+public class OverviewToAllAppsTouchController extends PortraitStatesTouchController {
- public LandscapeStatesTouchController(Launcher l) {
+ public OverviewToAllAppsTouchController(Launcher l) {
super(l);
}
@@ -69,4 +71,5 @@
}
return fromState;
}
+
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
index 9507a36..01e2bf3 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
@@ -16,6 +16,8 @@
package com.android.launcher3.uioverrides;
+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;
@@ -41,13 +43,13 @@
if (!swipeUpEnabled) {
return new TouchController[] {
launcher.getDragController(),
- new LandscapeStatesTouchController(launcher),
+ new OverviewToAllAppsTouchController(launcher),
new LauncherTaskViewcontroller(launcher)};
}
if (launcher.getDeviceProfile().isVerticalBarLayout()) {
return new TouchController[] {
launcher.getDragController(),
- new LandscapeStatesTouchController(launcher),
+ new OverviewToAllAppsTouchController(launcher),
new LandscapeEdgeSwipeController(launcher),
new LauncherTaskViewcontroller(launcher)};
} else {
@@ -74,7 +76,8 @@
&& launcher.hasWindowFocus();
if (shouldBackButtonBeHidden) {
// Show the back button if there is a floating view visible.
- shouldBackButtonBeHidden = AbstractFloatingView.getTopOpenView(launcher) == null;
+ shouldBackButtonBeHidden = AbstractFloatingView.getTopOpenViewWithType(launcher,
+ TYPE_ALL & ~TYPE_HIDE_BACK_BUTTON) == null;
}
OverviewInteractionState.getInstance(launcher)
.setBackButtonVisible(!shouldBackButtonBeHidden);
diff --git a/quickstep/src/com/android/quickstep/OverviewInteractionState.java b/quickstep/src/com/android/quickstep/OverviewInteractionState.java
index 0c24e22..8923608 100644
--- a/quickstep/src/com/android/quickstep/OverviewInteractionState.java
+++ b/quickstep/src/com/android/quickstep/OverviewInteractionState.java
@@ -19,6 +19,7 @@
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_SWIPE_UP;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_HIDE_BACK_BUTTON;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_SHOW_OVERVIEW_BUTTON;
+import static com.android.systemui.shared.system.SettingsCompat.SWIPE_UP_SETTING_NAME;
import android.content.ContentResolver;
import android.content.Context;
@@ -74,7 +75,6 @@
private static final int MSG_SET_BACK_BUTTON_VISIBLE = 201;
private static final int MSG_SET_SWIPE_UP_ENABLED = 202;
- private static final String SWIPE_UP_SETTING_NAME = "swipe_up_to_switch_apps_enabled";
private final SwipeUpGestureEnabledSettingObserver mSwipeUpSettingObserver;
private final Handler mUiHandler;
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index 33b922d..4f0187c 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -99,8 +99,6 @@
public void onBind(ISystemUiProxy iSystemUiProxy) {
mISystemUiProxy = iSystemUiProxy;
mRecentsModel.setSystemUiProxy(mISystemUiProxy);
- RemoteRunnable.executeSafely(() -> mISystemUiProxy.setRecentsOnboardingText(
- getResources().getString(R.string.recents_swipe_up_onboarding)));
mOverviewInteractionState.setSystemUiProxy(mISystemUiProxy);
}
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index d214b13..a3f10f0 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -79,7 +79,6 @@
import com.android.systemui.shared.system.TaskStackChangeListener;
import java.util.ArrayList;
-import java.util.function.Consumer;
/**
* A list of recent tasks.
@@ -324,6 +323,9 @@
@Override
public boolean onTouchEvent(MotionEvent ev) {
super.onTouchEvent(ev);
+ if (ev.getAction() == MotionEvent.ACTION_UP && mShowEmptyMessage) {
+ onAllTasksRemoved();
+ }
// Do not let touch escape to siblings below this view.
return true;
}
@@ -948,8 +950,13 @@
protected void maybeDrawEmptyMessage(Canvas canvas) {
if (mShowEmptyMessage && mEmptyTextLayout != null) {
- mEmptyIcon.draw(canvas);
+ // Offset to center in the visible (non-padded) part of RecentsView
+ mTempRect.set(mInsets.left + getPaddingLeft(), mInsets.top + getPaddingTop(),
+ mInsets.right + getPaddingRight(), mInsets.bottom + getPaddingBottom());
canvas.save();
+ canvas.translate((mTempRect.left - mTempRect.right) / 2,
+ (mTempRect.top - mTempRect.bottom) / 2);
+ mEmptyIcon.draw(canvas);
canvas.translate(mEmptyMessagePadding,
mEmptyIcon.getBounds().bottom + mEmptyMessagePadding);
mEmptyTextLayout.draw(canvas);
diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
index 58b7db7..326eb9f 100644
--- a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -167,9 +167,9 @@
if (mBitmapShader != null && mThumbnailData != null) {
float scale = mThumbnailData.scale;
Rect thumbnailInsets = mThumbnailData.insets;
- float thumbnailWidth = mThumbnailData.thumbnail.getWidth() -
+ final float thumbnailWidth = mThumbnailData.thumbnail.getWidth() -
(thumbnailInsets.left + thumbnailInsets.right) * scale;
- float thumbnailHeight = mThumbnailData.thumbnail.getHeight() -
+ final float thumbnailHeight = mThumbnailData.thumbnail.getHeight() -
(thumbnailInsets.top + thumbnailInsets.bottom) * scale;
final float thumbnailScale;
@@ -216,7 +216,8 @@
mMatrix.postScale(thumbnailScale, thumbnailScale);
mBitmapShader.setLocalMatrix(mMatrix);
- float bitmapHeight = Math.max(thumbnailHeight * thumbnailScale, 0);
+ float bitmapHeight = Math.max((rotate ? thumbnailWidth : thumbnailHeight)
+ * thumbnailScale, 0);
if (Math.round(bitmapHeight) < getMeasuredHeight()) {
mClipBottom = bitmapHeight;
}
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java
index b0c5baf..693cf31 100644
--- a/src/com/android/launcher3/AbstractFloatingView.java
+++ b/src/com/android/launcher3/AbstractFloatingView.java
@@ -70,6 +70,9 @@
public static final int TYPE_REBIND_SAFE = TYPE_WIDGETS_FULL_SHEET
| TYPE_QUICKSTEP_PREVIEW | TYPE_ON_BOARD_POPUP;
+ // Usually we show the back button when a floating view is open. Instead, hide for these types.
+ public static final int TYPE_HIDE_BACK_BUTTON = TYPE_ON_BOARD_POPUP;
+
protected boolean mIsOpen;
public AbstractFloatingView(Context context, AttributeSet attrs) {
@@ -170,6 +173,11 @@
}
public static AbstractFloatingView getTopOpenView(BaseDraggingActivity activity) {
- return getOpenView(activity, TYPE_ALL);
+ return getTopOpenViewWithType(activity, TYPE_ALL);
+ }
+
+ public static AbstractFloatingView getTopOpenViewWithType(BaseDraggingActivity activity,
+ @FloatingViewType int type) {
+ return getOpenView(activity, type);
}
}
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java
index 01166a1..e611af7 100644
--- a/src/com/android/launcher3/LauncherStateManager.java
+++ b/src/com/android/launcher3/LauncherStateManager.java
@@ -173,7 +173,7 @@
onCompleteRunnable.run();
}
return;
- } else if (!mConfig.userControlled && animated) {
+ } else if (!mConfig.userControlled && animated && mConfig.mTargetState == state) {
// We are running the same animation as requested
if (onCompleteRunnable != null) {
mConfig.mCurrentAnimation.addListener(new AnimationSuccessListener() {
@@ -280,7 +280,7 @@
onStateTransitionEnd(state);
}
});
- mConfig.setAnimation(animation);
+ mConfig.setAnimation(animation, state);
return mConfig.mCurrentAnimation;
}
@@ -370,7 +370,7 @@
if (reapplyNeeded) {
reapplyState();
}
- mConfig.setAnimation(anim);
+ mConfig.setAnimation(anim, null);
}
private class StartAnimRunnable implements Runnable {
@@ -401,11 +401,13 @@
private PropertySetter mProperSetter;
private AnimatorSet mCurrentAnimation;
+ private LauncherState mTargetState;
public void reset() {
duration = 0;
userControlled = false;
mProperSetter = null;
+ mTargetState = null;
if (mCurrentAnimation != null) {
mCurrentAnimation.setDuration(0);
@@ -429,8 +431,9 @@
}
}
- public void setAnimation(AnimatorSet animation) {
+ public void setAnimation(AnimatorSet animation, LauncherState targetState) {
mCurrentAnimation = animation;
+ mTargetState = targetState;
mCurrentAnimation.addListener(this);
}
}