diff --git a/lawnchair/src/app/lawnchair/LawnchairApp.kt b/lawnchair/src/app/lawnchair/LawnchairApp.kt index 3fe7ab8b64..bfbbcf98cb 100644 --- a/lawnchair/src/app/lawnchair/LawnchairApp.kt +++ b/lawnchair/src/app/lawnchair/LawnchairApp.kt @@ -85,6 +85,12 @@ class LawnchairApp : LauncherApplication() { FeatureFlagsImpl.sAllAppsSheetForHandheldSupplier = java.util.function.BooleanSupplier { pref2.allAppsSheetForHandheld.firstCached(pref2) } + // Device profiles built before this point (the process starts for TouchInteractionService + // before unlock) saw the flag as false. Rebuild them when the sheet is on, or All Apps + // keeps the full-screen shift range and padding under a sheet layout. + if (pref2.allAppsSheetForHandheld.firstCached(pref2)) { + InvariantDeviceProfile.INSTANCE.get(this).onPreferencesChanged(this) + } ExpressiveUpdateScheduler.ensureScheduled(this) } diff --git a/lawnchair/src/app/lawnchair/preferences2/PreferenceManager2.kt b/lawnchair/src/app/lawnchair/preferences2/PreferenceManager2.kt index 039cedf6b5..4d1acdb083 100644 --- a/lawnchair/src/app/lawnchair/preferences2/PreferenceManager2.kt +++ b/lawnchair/src/app/lawnchair/preferences2/PreferenceManager2.kt @@ -480,7 +480,11 @@ class PreferenceManager2 @Inject constructor( val allAppsSheetForHandheld = preference( key = booleanPreferencesKey(name = "all_apps_sheet_for_handheld"), defaultValue = false, - onSet = { reloadHelper.recreate() }, + // The sheet changes DeviceProfile (allAppsShiftRange, allAppsPadding, the bottom sheet + // profile), so the profiles must be rebuilt, not just the activity. With a stale profile + // the closed drawer parks at the full-screen shift (300 dp) and its sheet stays painted + // on the scrim a third of the way down the home screen. + onSet = { reloadHelper.restart() }, ) val appDrawerHapticFeedback = preference( diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index 9f62bd66c3..572f2a8e9c 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -378,6 +378,16 @@ public void setStateWithAnimation(LauncherState toState, ALL_APPS_PULL_BACK_ALPHA.set(this, ALL_APPS_PULL_BACK_ALPHA_DEFAULT); mAllAppScale.updateValue(1f); + + // setAlphas ran while the state was still ALL_APPS, so it kept the scrim's + // drawing controller for header protection during the close. Once the drawer + // has settled closed, stop drawing its sheet on the scrim: with a shift range + // shorter than the screen (sheet flag flipped after the device profile was + // built) the sheet would otherwise stay painted over the home screen until the + // next state change. + if (success && !mLauncher.isInState(ALL_APPS)) { + mScrimView.setDrawingController(null); + } }); }