summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2018-05-11 21:55:21 +0000
committerWinson Chung <winsonc@google.com>2018-05-11 21:55:21 +0000
commita0f09f94b58988ed28666183aaa3917fc78eca6d (patch)
treef26e2c8f3b82f470fc8f92e79ac202bf5b382075
parentf5d5b6f00fcf64dc7d4a0df5dad683ba8d8921f6 (diff)
downloadandroid_packages_apps_Trebuchet-a0f09f94b58988ed28666183aaa3917fc78eca6d.tar.gz
android_packages_apps_Trebuchet-a0f09f94b58988ed28666183aaa3917fc78eca6d.tar.bz2
android_packages_apps_Trebuchet-a0f09f94b58988ed28666183aaa3917fc78eca6d.zip
Revert "Revert "Update sysui flags on swipe, skip task backgrounds on opaque apps""
This reverts commit f5d5b6f00fcf64dc7d4a0df5dad683ba8d8921f6. Reason for revert: Can be submitted once a build with ag/4040557 is available for flashing Change-Id: Id94440a1dc9b765bb9758af81b0567628befa283
-rw-r--r--quickstep/libs/sysui_shared.jarbin128480 -> 128394 bytes
-rw-r--r--quickstep/src/com/android/quickstep/views/RecentsView.java12
-rw-r--r--quickstep/src/com/android/quickstep/views/TaskThumbnailView.java45
-rw-r--r--src/com/android/launcher3/BaseActivity.java7
-rw-r--r--src/com/android/launcher3/util/SystemUiController.java3
5 files changed, 53 insertions, 14 deletions
diff --git a/quickstep/libs/sysui_shared.jar b/quickstep/libs/sysui_shared.jar
index f16e4d0df..b343cc205 100644
--- a/quickstep/libs/sysui_shared.jar
+++ b/quickstep/libs/sysui_shared.jar
Binary files differ
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 503572181..a8e38a1ab 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -22,6 +22,7 @@ import static com.android.launcher3.anim.Interpolators.ACCEL_2;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId;
+import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW;
import android.animation.Animator;
import android.animation.AnimatorSet;
@@ -106,6 +107,8 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
};
public static final boolean FLIP_RECENTS = true;
private static final int DISMISS_TASK_DURATION = 300;
+ // The threshold at which we update the SystemUI flags when animating from the task into the app
+ private static final float UPDATE_SYSUI_FLAGS_THRESHOLD = 0.6f;
private static final float[] sTempFloatArray = new float[3];
@@ -1152,12 +1155,21 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
}
tv.setVisibility(INVISIBLE);
+ int targetSysUiFlags = tv.getThumbnail().getSysUiStatusNavFlags();
TaskViewDrawable drawable = new TaskViewDrawable(tv, this);
getOverlay().add(drawable);
ObjectAnimator drawableAnim =
ObjectAnimator.ofFloat(drawable, TaskViewDrawable.PROGRESS, 1, 0);
drawableAnim.setInterpolator(LINEAR);
+ drawableAnim.addUpdateListener((animator) -> {
+ // Once we pass a certain threshold, update the sysui flags to match the target tasks'
+ // flags
+ mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW,
+ animator.getAnimatedFraction() > UPDATE_SYSUI_FLAGS_THRESHOLD
+ ? targetSysUiFlags
+ : 0);
+ });
AnimatorSet anim = createAdjacentPageAnimForTaskLaunch(tv,
drawable.getClipAnimationHelper());
diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
index c72493084..af7a735f5 100644
--- a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -16,6 +16,7 @@
package com.android.quickstep.views;
+import static android.view.View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
import static com.android.systemui.shared.system.WindowManagerWrapper.WINDOWING_MODE_FULLSCREEN;
import android.content.Context;
@@ -38,6 +39,7 @@ import com.android.launcher3.BaseActivity;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.util.SystemUiController;
import com.android.quickstep.TaskOverlayFactory;
import com.android.quickstep.TaskOverlayFactory.TaskOverlay;
import com.android.systemui.shared.recents.model.Task;
@@ -143,6 +145,20 @@ public class TaskThumbnailView extends View {
return new Rect();
}
+ public int getSysUiStatusNavFlags() {
+ if (mThumbnailData != null) {
+ int flags = 0;
+ flags |= (mThumbnailData.systemUiVisibility & SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) != 0
+ ? SystemUiController.FLAG_LIGHT_STATUS
+ : SystemUiController.FLAG_DARK_STATUS;
+ flags |= (mThumbnailData.systemUiVisibility & SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR) != 0
+ ? SystemUiController.FLAG_LIGHT_NAV
+ : SystemUiController.FLAG_DARK_NAV;
+ return flags;
+ }
+ return 0;
+ }
+
@Override
protected void onDraw(Canvas canvas) {
drawOnCanvas(canvas, 0, 0, getMeasuredWidth(), getMeasuredHeight(), mCornerRadius);
@@ -154,21 +170,24 @@ public class TaskThumbnailView extends View {
public void drawOnCanvas(Canvas canvas, float x, float y, float width, float height,
float cornerRadius) {
- // Always draw the background since the snapshots may be translucent
- canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mBackgroundPaint);
- if (mTask == null) {
- return;
- }
- if (!mTask.isLocked) {
- if (mClipBottom > 0) {
- canvas.save();
- canvas.clipRect(x, y, width, mClipBottom);
- canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mPaint);
- canvas.restore();
- } else {
- canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mPaint);
+ // Draw the background in all cases, except when the thumbnail data is opaque
+ final boolean drawBackgroundOnly = mTask == null || mTask.isLocked || mBitmapShader == null
+ || mThumbnailData == null;
+ if (drawBackgroundOnly || mClipBottom > 0 || mThumbnailData.isTranslucent) {
+ canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mBackgroundPaint);
+ if (drawBackgroundOnly) {
+ return;
}
}
+
+ if (mClipBottom > 0) {
+ canvas.save();
+ canvas.clipRect(x, y, width, mClipBottom);
+ canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mPaint);
+ canvas.restore();
+ } else {
+ canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mPaint);
+ }
}
private void updateThumbnailPaintFilter() {
diff --git a/src/com/android/launcher3/BaseActivity.java b/src/com/android/launcher3/BaseActivity.java
index bd38bf00d..1f70cfaa1 100644
--- a/src/com/android/launcher3/BaseActivity.java
+++ b/src/com/android/launcher3/BaseActivity.java
@@ -16,6 +16,7 @@
package com.android.launcher3;
+import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW;
import static java.lang.annotation.RetentionPolicy.SOURCE;
import android.app.Activity;
@@ -153,6 +154,12 @@ public abstract class BaseActivity extends Activity {
protected void onPause() {
mActivityFlags &= ~ACTIVITY_STATE_RESUMED;
super.onPause();
+
+ // Reset the overridden sysui flags used for the task-swipe launch animation, we do this
+ // here instead of at the end of the animation because the start of the new activity does
+ // not happen immediately, which would cause us to reset to launcher's sysui flags and then
+ // back to the new app (causing a flash)
+ getSystemUiController().updateUiState(UI_STATE_OVERVIEW, 0);
}
public boolean isStarted() {
diff --git a/src/com/android/launcher3/util/SystemUiController.java b/src/com/android/launcher3/util/SystemUiController.java
index edbf05a7c..7ef53a97d 100644
--- a/src/com/android/launcher3/util/SystemUiController.java
+++ b/src/com/android/launcher3/util/SystemUiController.java
@@ -31,6 +31,7 @@ public class SystemUiController {
public static final int UI_STATE_ALL_APPS = 1;
public static final int UI_STATE_WIDGET_BOTTOM_SHEET = 2;
public static final int UI_STATE_ROOT_VIEW = 3;
+ public static final int UI_STATE_OVERVIEW = 4;
public static final int FLAG_LIGHT_NAV = 1 << 0;
public static final int FLAG_DARK_NAV = 1 << 1;
@@ -38,7 +39,7 @@ public class SystemUiController {
public static final int FLAG_DARK_STATUS = 1 << 3;
private final Window mWindow;
- private final int[] mStates = new int[4];
+ private final int[] mStates = new int[5];
public SystemUiController(Window window) {
mWindow = window;