diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index 63673e0c3e..883664e1b0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -699,7 +699,13 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT if (mBackButton == null) { return; } - if (predictiveBackThreeButtonNav()) { + boolean predictiveBackThreeButtonNav; + try { + predictiveBackThreeButtonNav = predictiveBackThreeButtonNav(); + } catch (Throwable t) { + predictiveBackThreeButtonNav = false; + } + if (predictiveBackThreeButtonNav) { setupBackButtonAccessibility(mBackButton, accessibilityDelegate); } else { mBackButton.setAccessibilityDelegate(accessibilityDelegate); @@ -894,7 +900,13 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT buttonView.setImageResource(drawableId); buttonView.setContentDescription(parent.getContext().getString( navButtonController.getButtonContentDescription(buttonType))); - if (predictiveBackThreeButtonNav() && buttonType == BUTTON_BACK) { + boolean predictiveBackThreeButtonNav; + try { + predictiveBackThreeButtonNav = predictiveBackThreeButtonNav(); + } catch (Throwable t) { + predictiveBackThreeButtonNav = false; + } + if (predictiveBackThreeButtonNav && buttonType == BUTTON_BACK) { // set up special touch listener for back button to support predictive back setupBackButtonAccessibility(buttonView, null); setBackButtonTouchListener(buttonView, navButtonController); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java index f52de63859..e3452a2945 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java @@ -142,7 +142,13 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa if (buttonType == BUTTON_SPACE) { return; } - if (predictiveBackThreeButtonNav() && mLastSentBackAction == ACTION_DOWN) { + boolean predictiveBackThreeButtonNav; + try { + predictiveBackThreeButtonNav = predictiveBackThreeButtonNav(); + } catch (Throwable t) { + predictiveBackThreeButtonNav = false; + } + if (predictiveBackThreeButtonNav && mLastSentBackAction == ACTION_DOWN) { Log.i(TAG, "Button click ignored while back button is pressed"); // prevent interactions with other buttons while back button is pressed return; @@ -184,7 +190,13 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa if (buttonType == BUTTON_SPACE) { return false; } - if (predictiveBackThreeButtonNav() && mLastSentBackAction == ACTION_DOWN + boolean predictiveBackThreeButtonNav; + try { + predictiveBackThreeButtonNav = predictiveBackThreeButtonNav(); + } catch (Throwable t) { + predictiveBackThreeButtonNav = false; + } + if (predictiveBackThreeButtonNav && mLastSentBackAction == ACTION_DOWN && buttonType != BUTTON_BACK && buttonType != BUTTON_RECENTS) { // prevent interactions with other buttons while back button is pressed (except back // and recents button for screen-unpin action). @@ -196,7 +208,7 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa // The haptic feedback from long pressing on the home button is handled by circle to search. // There are no haptics for long pressing the back button if predictive back is enabled if (buttonType != BUTTON_HOME - && (!predictiveBackThreeButtonNav() || buttonType != BUTTON_BACK)) { + && (!predictiveBackThreeButtonNav || buttonType != BUTTON_BACK)) { view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } switch (buttonType) { diff --git a/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java b/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java index 6102187c93..261ad9fb7c 100644 --- a/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java +++ b/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java @@ -357,8 +357,14 @@ public class LauncherBackAnimationController { .setAnimationTransaction(); mStartRect.set(mBackTarget.windowConfiguration.getMaxBounds()); + boolean predictiveBackThreeButtonNav; + try { + predictiveBackThreeButtonNav = predictiveBackThreeButtonNav(); + } catch (Throwable t) { + predictiveBackThreeButtonNav = false; + } // inset bottom in case of taskbar being present - if (!predictiveBackThreeButtonNav() || mLauncher.getDeviceProfile().isTaskbarPresent + if (!predictiveBackThreeButtonNav || mLauncher.getDeviceProfile().isTaskbarPresent || DisplayController.getNavigationMode(mLauncher) == NavigationMode.NO_BUTTON) { mStartRect.inset(0, 0, 0, mBackTarget.contentInsets.bottom); } diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 7321f5f7e2..9461ced6c0 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2760,12 +2760,16 @@ public class Launcher extends StatefulActivity } private void updateDisallowBack() { - if (BuildCompat.isAtLeastV() + try { + if (BuildCompat.isAtLeastV() && Flags.enableDesktopWindowingMode() && !Flags.enableDesktopWindowingWallpaperActivity() && mDeviceProfile.isTablet) { - // TODO(b/333533253): Clean up after desktop wallpaper activity flag is rolled out - return; + // TODO(b/333533253): Clean up after desktop wallpaper activity flag is rolled out + return; + } + } catch (Throwable t) { + // LC-Ignored } LauncherRootView rv = getRootView(); if (rv != null) { diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index ba2c050e9a..f05d47ba29 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -1408,11 +1408,15 @@ public class ActivityAllAppsContainerView @Override public void setScaleY(float scaleY) { super.setScaleY(scaleY); - if (predictiveBackThreeButtonNav() && mNavBarScrimHeight > 0) { - // Call invalidate to prevent navbar scrim from scaling. The navbar scrim is drawn - // directly onto the canvas. To prevent it from being scaled with the canvas, there's a - // counter scale applied in dispatchDraw. - invalidate(20, getHeight() - mNavBarScrimHeight, getWidth(), getHeight()); + try { + if (predictiveBackThreeButtonNav() && mNavBarScrimHeight > 0) { + // Call invalidate to prevent navbar scrim from scaling. The navbar scrim is drawn + // directly onto the canvas. To prevent it from being scaled with the canvas, there's a + // counter scale applied in dispatchDraw. + invalidate(20, getHeight() - mNavBarScrimHeight, getWidth(), getHeight()); + } + } catch (Throwable t) { + // LC-Ignored } } diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java index 8b678505b4..ce208717d1 100644 --- a/src/com/android/launcher3/widget/BaseWidgetSheet.java +++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java @@ -137,11 +137,15 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView @Override public void setScaleY(float scaleY) { super.setScaleY(scaleY); - if (predictiveBackThreeButtonNav() && mNavBarScrimHeight > 0) { - // Call invalidate to prevent navbar scrim from scaling. The navbar scrim is drawn - // directly onto the canvas. To prevent it from being scaled with the canvas, there's a - // counter scale applied in dispatchDraw. - invalidate(); + try { + if (predictiveBackThreeButtonNav() && mNavBarScrimHeight > 0) { + // Call invalidate to prevent navbar scrim from scaling. The navbar scrim is drawn + // directly onto the canvas. To prevent it from being scaled with the canvas, there's a + // counter scale applied in dispatchDraw. + invalidate(); + } + } catch (Throwable t) { + // LC-Ignored } } diff --git a/systemUI/anim/src/com/android/systemui/animation/back/FlingOnBackAnimationCallback.kt b/systemUI/anim/src/com/android/systemui/animation/back/FlingOnBackAnimationCallback.kt index 4b1b063cf3..18454333c8 100644 --- a/systemUI/anim/src/com/android/systemui/animation/back/FlingOnBackAnimationCallback.kt +++ b/systemUI/anim/src/com/android/systemui/animation/back/FlingOnBackAnimationCallback.kt @@ -87,17 +87,26 @@ abstract class FlingOnBackAnimationCallback( onBackInvokedCompat() } reset() - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) { + try { if (predictiveBackTimestampApi()) { downTime = backEvent.frameTimeMillis } + } catch (t: Throwable) { + // LC-Ignored } onBackStartedCompat(backEvent) } final override fun onBackProgressed(backEvent: BackEvent) { val interpolatedProgress = progressInterpolator.getInterpolation(backEvent.progress) - if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) && predictiveBackTimestampApi()) { + val predictiveBackTimestampApi = try { + predictiveBackTimestampApi() + } catch (t: Throwable) { + // LC-Ignored + false + } + + if (predictiveBackTimestampApi) { downTime?.let { downTime -> velocityTracker.addMovement( MotionEvent.obtain( @@ -131,7 +140,13 @@ abstract class FlingOnBackAnimationCallback( } final override fun onBackInvoked() { - if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) && predictiveBackTimestampApi() && lastBackEvent != null) { + val predictiveBackTimestampApi = try { + predictiveBackTimestampApi() + } catch (t: Throwable) { + // LC-Ignored + false + } + if (predictiveBackTimestampApi && lastBackEvent != null) { velocityTracker.computeCurrentVelocity(1000) backInvokedFlingAnim = FlingAnimation(FloatValueHolder())