diff options
author | Kevin F. Haggerty <haggertk@lineageos.org> | 2020-06-06 10:04:42 -0600 |
---|---|---|
committer | Kevin F. Haggerty <haggertk@lineageos.org> | 2020-06-06 10:05:30 -0600 |
commit | 0c062179a89e047d778925412632473005a2ec43 (patch) | |
tree | 639916800e76ccf6b5e9b371d3a1c0cb083486d0 /src/com/android/launcher3/views/BaseDragLayer.java | |
parent | b0838b261a6fb447fe9c4cf2513236a0736be209 (diff) | |
parent | 09bdbebdd2c93123a5d418de56053cc1c279afee (diff) | |
download | android_packages_apps_Trebuchet-0c062179a89e047d778925412632473005a2ec43.tar.gz android_packages_apps_Trebuchet-0c062179a89e047d778925412632473005a2ec43.tar.bz2 android_packages_apps_Trebuchet-0c062179a89e047d778925412632473005a2ec43.zip |
Merge tag 'android-10.0.0_r37' into staging/lineage-17.1_merge-android-10.0.0_r37lineage-17.1
Android 10.0.0 Release 37 (QQ3A.200605.001)
* tag 'android-10.0.0_r37':
[DO NOT MERGE] Enable APP_SEARCH_IMPROVEMENTS flag.
Ensure current animation is cancelled before building new folder animation.
Fixes ag/10573640 on qt-future-dev branch.
[DO NOT MERGE] Adds basic smart-folder logging.
[DO NOT MERGE] Support blacklisting live wallpapers from showing sysui scrims
Import translations. DO NOT MERGE
Revert "[DO NOT MERGE] Turn off FOLDER_NAME_SUGGEST feature flag"
[DO NOT MERGE] Initiailize APP_SEARCH_IMRPOVEMENT flag outside DEBUG builds.
[DO NOT MERGE] Adds fling gesture suppression to Launcher
Dismisses system overlays for Home intent.
[DO NOT MERGE] Fix some visual jumps when swiping home
[DO NOT MERGE] Turn off FOLDER_NAME_SUGGEST feature flag Bug: 150788630
[DO NOT MERGE] Prevent hotseat touch hijack
Change-Id: I2316620bda33d83d668c8727e728af09db3e3e4c
Diffstat (limited to 'src/com/android/launcher3/views/BaseDragLayer.java')
-rw-r--r-- | src/com/android/launcher3/views/BaseDragLayer.java | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java index e43fc8a01..a4f6a8ef5 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; + } } |