summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-03-21 23:10:11 (GMT)
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-03-21 23:10:11 (GMT)
commit6aa6412aba507dfd4429ff923549e6c4b8732ec8 (patch)
treea8017d75fcb20f5aaa820414d036d34c5ebb0712
parent083b42e8ce07b0d9884c95787cd2b3d06aa51c36 (diff)
parent3b5f2224c6b21d89d1962db2bee2d85efd406918 (diff)
downloadandroid_packages_apps_Trebuchet-6aa6412aba507dfd4429ff923549e6c4b8732ec8.zip
android_packages_apps_Trebuchet-6aa6412aba507dfd4429ff923549e6c4b8732ec8.tar.gz
android_packages_apps_Trebuchet-6aa6412aba507dfd4429ff923549e6c4b8732ec8.tar.bz2
Snap for 6320329 from 3b5f2224c6b21d89d1962db2bee2d85efd406918 to qt-qpr3-release
Change-Id: I95f3e93790631957ab12c190b0868e0985afbed0
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java3
-rw-r--r--res/values/config.xml3
-rw-r--r--src/com/android/launcher3/dragndrop/DragLayer.java2
-rw-r--r--src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java11
-rw-r--r--src/com/android/launcher3/views/BaseDragLayer.java65
5 files changed, 78 insertions, 6 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java
index 1820729..2b369e7 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/RecentsRootView.java
@@ -80,7 +80,8 @@ public class RecentsRootView extends BaseDragLayer<RecentsActivity> {
if (!insets.equals(mInsets)) {
super.setInsets(insets);
}
- setBackground(insets.top == 0 ? null
+ setBackground(insets.top == 0 || !mAllowSysuiScrims
+ ? null
: Themes.getAttrDrawable(getContext(), R.attr.workspaceStatusBarScrim));
}
diff --git a/res/values/config.xml b/res/values/config.xml
index 0387184..9d36ee4 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -118,4 +118,7 @@
<!-- Recents -->
<item type="id" name="overview_panel"/>
+
+ <string-array name="live_wallpapers_remove_sysui_scrims">
+ </string-array>
</resources>
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index cdc7061..0b6d8fb 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -556,7 +556,7 @@ public class DragLayer extends BaseDragLayer<Launcher> {
@Override
public void setInsets(Rect insets) {
super.setInsets(insets);
- mWorkspaceScrim.onInsetsChanged(insets);
+ mWorkspaceScrim.onInsetsChanged(insets, mAllowSysuiScrims);
mOverviewScrim.onInsetsChanged(insets);
}
diff --git a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java
index 6740fa1..15ff207 100644
--- a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java
+++ b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java
@@ -187,10 +187,13 @@ public class WorkspaceAndHotseatScrim extends Scrim {
anim.start();
}
- public void onInsetsChanged(Rect insets) {
- mDrawTopScrim = mTopScrim != null && insets.top > 0;
- mDrawBottomScrim = mBottomMask != null &&
- !mLauncher.getDeviceProfile().isVerticalBarLayout();
+ /**
+ * Determines whether to draw the top and/or bottom scrim based on new insets.
+ */
+ public void onInsetsChanged(Rect insets, boolean allowSysuiScrims) {
+ mDrawTopScrim = allowSysuiScrims && mTopScrim != null && insets.top > 0;
+ mDrawBottomScrim = allowSysuiScrims && mBottomMask != null
+ && !mLauncher.getDeviceProfile().isVerticalBarLayout();
}
@Override
diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java
index e43fc8a..a4f6a8e 100644
--- a/src/com/android/launcher3/views/BaseDragLayer.java
+++ b/src/com/android/launcher3/views/BaseDragLayer.java
@@ -23,7 +23,13 @@ import static android.view.MotionEvent.ACTION_UP;
import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs;
import android.annotation.TargetApi;
+import android.app.WallpaperInfo;
+import android.app.WallpaperManager;
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
import android.graphics.Insets;
import android.graphics.Rect;
import android.graphics.RectF;
@@ -39,8 +45,11 @@ import android.view.WindowInsets;
import android.view.accessibility.AccessibilityEvent;
import android.widget.FrameLayout;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.InsettableFrameLayout;
+import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.MultiValueAlpha;
@@ -100,6 +109,14 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext>
protected final T mActivity;
private final MultiValueAlpha mMultiValueAlpha;
+ private final WallpaperManager mWallpaperManager;
+ private final BroadcastReceiver mWallpaperChangeReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ onWallpaperChanged();
+ }
+ };
+ private final String[] mWallpapersWithoutSysuiScrims;
// All the touch controllers for the view
protected TouchController[] mControllers;
@@ -110,10 +127,15 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext>
private TouchCompleteListener mTouchCompleteListener;
+ protected boolean mAllowSysuiScrims = true;
+
public BaseDragLayer(Context context, AttributeSet attrs, int alphaChannelCount) {
super(context, attrs);
mActivity = (T) ActivityContext.lookupContext(context);
mMultiValueAlpha = new MultiValueAlpha(this, alphaChannelCount);
+ mWallpaperManager = context.getSystemService(WallpaperManager.class);
+ mWallpapersWithoutSysuiScrims = getResources().getStringArray(
+ R.array.live_wallpapers_remove_sysui_scrims);
}
/**
@@ -513,4 +535,47 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext>
}
return super.dispatchApplyWindowInsets(insets);
}
+
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ mActivity.registerReceiver(mWallpaperChangeReceiver,
+ new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED));
+ onWallpaperChanged();
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ mActivity.unregisterReceiver(mWallpaperChangeReceiver);
+ }
+
+ private void onWallpaperChanged() {
+ WallpaperInfo newWallpaperInfo = mWallpaperManager.getWallpaperInfo();
+ boolean oldAllowSysuiScrims = mAllowSysuiScrims;
+ mAllowSysuiScrims = computeAllowSysuiScrims(newWallpaperInfo);
+ if (mAllowSysuiScrims != oldAllowSysuiScrims) {
+ // Reapply insets so scrim can be removed or re-added if necessary.
+ setInsets(mInsets);
+ }
+ }
+
+ /**
+ * Determines whether we can scrim the status bar and nav bar for the given wallpaper by
+ * checking against a list of live wallpapers that we don't show the scrims on.
+ */
+ private boolean computeAllowSysuiScrims(@Nullable WallpaperInfo newWallpaperInfo) {
+ if (newWallpaperInfo == null) {
+ // New wallpaper is static, not live. Thus, blacklist isn't applicable.
+ return true;
+ }
+ ComponentName newWallpaper = newWallpaperInfo.getComponent();
+ for (String wallpaperWithoutScrim : mWallpapersWithoutSysuiScrims) {
+ if (newWallpaper.equals(ComponentName.unflattenFromString(wallpaperWithoutScrim))) {
+ // New wallpaper is blacklisted from showing a scrim.
+ return false;
+ }
+ }
+ return true;
+ }
}