Merge "Adding more checks around unlocking the phone" into ub-launcher3-master
diff --git a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java
index 3fb2bf6..7b7ab5e 100644
--- a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java
+++ b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java
@@ -40,12 +40,14 @@
import android.util.DisplayMetrics;
import android.util.FloatProperty;
import android.view.View;
+import android.view.WindowInsets;
import androidx.core.graphics.ColorUtils;
import com.android.launcher3.CellLayout;
import com.android.launcher3.R;
import com.android.launcher3.ResourceUtils;
+import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.uioverrides.WallpaperColorInfo;
import com.android.launcher3.util.Themes;
@@ -198,9 +200,22 @@
* 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();
+ mDrawTopScrim = allowSysuiScrims
+ && mTopScrim != null
+ && insets.top > 0;
+ mDrawBottomScrim = allowSysuiScrims
+ && mBottomMask != null
+ && !mLauncher.getDeviceProfile().isVerticalBarLayout()
+ && hasBottomNavButtons();
+ }
+
+ private boolean hasBottomNavButtons() {
+ if (Utilities.ATLEAST_Q && mLauncher.getRootView() != null
+ && mLauncher.getRootView().getRootWindowInsets() != null) {
+ WindowInsets windowInsets = mLauncher.getRootView().getRootWindowInsets();
+ return windowInsets.getTappableElementInsets().bottom > 0;
+ }
+ return true;
}
@Override
diff --git a/tests/src/com/android/launcher3/ui/WorkTabTest.java b/tests/src/com/android/launcher3/ui/WorkTabTest.java
index 7e80e5d..8d571ff 100644
--- a/tests/src/com/android/launcher3/ui/WorkTabTest.java
+++ b/tests/src/com/android/launcher3/ui/WorkTabTest.java
@@ -16,6 +16,7 @@
package com.android.launcher3.ui;
import static com.android.launcher3.LauncherState.ALL_APPS;
+import static com.android.launcher3.LauncherState.NORMAL;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -158,9 +159,11 @@
// dismiss personal edu
mDevice.pressHome();
+ waitForState("Launcher did not go home", () -> NORMAL);
// open work tab
executeOnLauncher(launcher -> launcher.getStateManager().goToState(ALL_APPS));
+ waitForState("Launcher did not switch to all apps", () -> ALL_APPS);
executeOnLauncher(launcher -> {
AllAppsPagedView pagedView = (AllAppsPagedView) launcher.getAppsView().getContentView();
pagedView.setCurrentPage(WORK_PAGE);