summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorIdo Ben-Hur <idoybh2@gmail.com>2022-03-19 21:34:20 +0200
committeralk3pInjection <webmaster@raspii.tech>2022-06-03 03:12:30 +0800
commitb5b00b1b7e25589c1262686226e0356009215425 (patch)
treee659dc0a44209c9d3114b5c92e287970e28c6a91 /packages
parent5223a3c4a8c96f1aeef231566e9f22f4cabf7f3b (diff)
SystemUI: Nuke oriented navbar handle
Change-Id: I39e0dd89b53244e1458c87648af50439348fa150
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/res/values/ids.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java167
-rw-r--r--packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java21
-rw-r--r--packages/SystemUI/src/com/android/systemui/navigationbar/gestural/NavigationHandle.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/navigationbar/gestural/QuickswitchOrientedNavHandle.java80
5 files changed, 3 insertions, 273 deletions
diff --git a/packages/SystemUI/res/values/ids.xml b/packages/SystemUI/res/values/ids.xml
index 926734c2749f..16ed1d7acd64 100644
--- a/packages/SystemUI/res/values/ids.xml
+++ b/packages/SystemUI/res/values/ids.xml
@@ -86,8 +86,6 @@
<item type="id" name="requires_remeasuring"/>
- <item type="id" name="secondary_home_handle" />
-
<!-- Whether the icon is from a notification for which targetSdk < L -->
<item type="id" name="icon_is_pre_L"/>
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
index d4acdd05f218..57d3ccc3477c 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
@@ -33,7 +33,6 @@ import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_NAVIGATION_B
import static android.view.WindowInsetsController.APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS;
import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
-import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
@@ -119,7 +118,6 @@ import com.android.systemui.model.SysUiState;
import com.android.systemui.navigationbar.buttons.ButtonDispatcher;
import com.android.systemui.navigationbar.buttons.KeyButtonView;
import com.android.systemui.navigationbar.buttons.RotationContextButton;
-import com.android.systemui.navigationbar.gestural.QuickswitchOrientedNavHandle;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.recents.OverviewProxyService;
import com.android.systemui.recents.Recents;
@@ -244,24 +242,6 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
private boolean mIsOnDefaultDisplay;
public boolean mHomeBlockedThisTouch;
- /**
- * When user is QuickSwitching between apps of different orientations, we'll draw a fake
- * home handle on the orientation they originally touched down to start their swipe
- * gesture to indicate to them that they can continue in that orientation without having to
- * rotate the phone
- * The secondary handle will show when we get
- * {@link OverviewProxyListener#notifyPrioritizedRotation(int)} callback with the
- * original handle hidden and we'll flip the visibilities once the
- * {@link #mTasksFrozenListener} fires
- */
- private QuickswitchOrientedNavHandle mOrientationHandle;
- private WindowManager.LayoutParams mOrientationParams;
- private int mStartingQuickSwitchRotation = -1;
- private int mCurrentRotation;
- private ViewTreeObserver.OnGlobalLayoutListener mOrientationHandleGlobalLayoutListener;
- private boolean mShowOrientedHandleForImmersiveMode;
-
-
@com.android.internal.annotations.VisibleForTesting
public enum NavBarActionEvent implements UiEventLogger.UiEventEnum {
@@ -339,15 +319,6 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
}
@Override
- public void onPrioritizedRotation(@Surface.Rotation int rotation) {
- mStartingQuickSwitchRotation = rotation;
- if (rotation == -1) {
- mShowOrientedHandleForImmersiveMode = false;
- }
- orientSecondaryHomeHandle();
- }
-
- @Override
public void startAssistant(Bundle bundle) {
mAssistManagerLazy.get().startAssist(bundle);
}
@@ -410,14 +381,6 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
}
};
- private NavigationBarTransitions.DarkIntensityListener mOrientationHandleIntensityListener =
- new NavigationBarTransitions.DarkIntensityListener() {
- @Override
- public void onDarkIntensity(float darkIntensity) {
- mOrientationHandle.setDarkIntensity(darkIntensity);
- }
- };
-
private final Runnable mAutoDim = () -> getBarTransitions().setAutoDim(true);
private final Runnable mEnableLayoutTransitions = () ->
mNavigationBarView.setLayoutTransitionsEnabled(true);
@@ -660,8 +623,6 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
}
setDisabled2Flags(mDisabledFlags2);
- initSecondaryHomeHandleForRotation();
-
// Unfortunately, we still need it because status bar needs LightBarController
// before notifications creation. We cannot directly use getLightBarController()
// from NavigationBarFragment directly.
@@ -689,13 +650,6 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
mNavigationBarView.getLightTransitionsController().destroy(mContext);
mOverviewProxyService.removeCallback(mOverviewProxyListener);
mBroadcastDispatcher.unregisterReceiver(mBroadcastReceiver);
- if (mOrientationHandle != null) {
- resetSecondaryHandle();
- getBarTransitions().removeDarkIntensityListener(mOrientationHandleIntensityListener);
- mWindowManager.removeView(mOrientationHandle);
- mOrientationHandle.getViewTreeObserver().removeOnGlobalLayoutListener(
- mOrientationHandleGlobalLayoutListener);
- }
mHandler.removeCallbacks(mAutoDim);
mHandler.removeCallbacks(mOnVariableDurationHomeLongClick);
mHandler.removeCallbacks(mEnableLayoutTransitions);
@@ -703,7 +657,6 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
mPipOptional.ifPresent(mNavigationBarView::removePipExclusionBoundsChangeListener);
mFrame = null;
mNavigationBarView = null;
- mOrientationHandle = null;
}
// TODO: Remove this when we update nav bar recreation
@@ -735,111 +688,6 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
}
repositionNavigationBar(rotation);
- if (canShowSecondaryHandle()) {
- if (rotation != mCurrentRotation) {
- mCurrentRotation = rotation;
- orientSecondaryHomeHandle();
- }
- }
- }
-
- private void initSecondaryHomeHandleForRotation() {
- if (mNavBarMode != NAV_BAR_MODE_GESTURAL) {
- return;
- }
-
- mOrientationHandle = new QuickswitchOrientedNavHandle(mContext);
- mOrientationHandle.setId(R.id.secondary_home_handle);
-
- getBarTransitions().addDarkIntensityListener(mOrientationHandleIntensityListener);
- mOrientationParams = new WindowManager.LayoutParams(0, 0,
- WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL,
- WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
- | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
- | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
- | WindowManager.LayoutParams.FLAG_SLIPPERY,
- PixelFormat.TRANSLUCENT);
- mOrientationParams.setTitle("SecondaryHomeHandle" + mContext.getDisplayId());
- mOrientationParams.privateFlags |= PRIVATE_FLAG_NO_MOVE_ANIMATION;
- mWindowManager.addView(mOrientationHandle, mOrientationParams);
- mOrientationHandle.setVisibility(View.GONE);
- mOrientationParams.setFitInsetsTypes(0 /* types*/);
- mOrientationHandleGlobalLayoutListener =
- () -> {
- if (mStartingQuickSwitchRotation == -1) {
- return;
- }
-
- RectF boundsOnScreen = mOrientationHandle.computeHomeHandleBounds();
- mOrientationHandle.mapRectFromViewToScreenCoords(boundsOnScreen, true);
- Rect boundsRounded = new Rect();
- boundsOnScreen.roundOut(boundsRounded);
- mNavigationBarView.setOrientedHandleSamplingRegion(boundsRounded);
- };
- mOrientationHandle.getViewTreeObserver().addOnGlobalLayoutListener(
- mOrientationHandleGlobalLayoutListener);
- }
-
- private void orientSecondaryHomeHandle() {
- if (!canShowSecondaryHandle()) {
- return;
- }
-
- if (mStartingQuickSwitchRotation == -1 || mSplitScreenOptional
- .map(LegacySplitScreen::isDividerVisible).orElse(false)) {
- // Hide the secondary home handle if we are in multiwindow since apps in multiwindow
- // aren't allowed to set the display orientation
- resetSecondaryHandle();
- } else {
- int deltaRotation = deltaRotation(mCurrentRotation, mStartingQuickSwitchRotation);
- if (mStartingQuickSwitchRotation == -1 || deltaRotation == -1) {
- // Curious if starting quickswitch can change between the if check and our delta
- Log.d(TAG, "secondary nav delta rotation: " + deltaRotation
- + " current: " + mCurrentRotation
- + " starting: " + mStartingQuickSwitchRotation);
- }
- int height = 0;
- int width = 0;
- Rect dispSize = mWindowManager.getCurrentWindowMetrics().getBounds();
- mOrientationHandle.setDeltaRotation(deltaRotation);
- switch (deltaRotation) {
- case Surface.ROTATION_90:
- case Surface.ROTATION_270:
- height = dispSize.height();
- width = mNavigationBarView.getHeight();
- break;
- case Surface.ROTATION_180:
- case Surface.ROTATION_0:
- // TODO(b/152683657): Need to determine best UX for this
- if (!mShowOrientedHandleForImmersiveMode) {
- resetSecondaryHandle();
- return;
- }
- width = dispSize.width();
- height = mNavigationBarView.getHeight();
- break;
- }
-
- mOrientationParams.gravity =
- deltaRotation == Surface.ROTATION_0 ? Gravity.BOTTOM :
- (deltaRotation == Surface.ROTATION_90 ? Gravity.LEFT : Gravity.RIGHT);
- mOrientationParams.height = height;
- mOrientationParams.width = width;
- mWindowManager.updateViewLayout(mOrientationHandle, mOrientationParams);
- mNavigationBarView.setVisibility(View.GONE);
- mOrientationHandle.setVisibility(View.VISIBLE);
- }
- }
-
- private void resetSecondaryHandle() {
- if (mOrientationHandle != null) {
- // Case where nav mode is changed w/o ever invoking a quickstep
- // mOrientedHandle is initialized lazily
- mOrientationHandle.setVisibility(View.GONE);
- }
- mNavigationBarView.setVisibility(View.VISIBLE);
- mNavigationBarView.setOrientedHandleSamplingRegion(null);
}
private void reconfigureHomeLongClick() {
@@ -865,8 +713,6 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
public void dump(PrintWriter pw) {
pw.println("NavigationBar (displayId=" + mDisplayId + "):");
- pw.println(" mStartingQuickSwitchRotation=" + mStartingQuickSwitchRotation);
- pw.println(" mCurrentRotation=" + mCurrentRotation);
pw.println(" mHomeButtonLongPressDurationMs=" + mHomeButtonLongPressDurationMs);
pw.println(" mLongPressHomeEnabled=" + mLongPressHomeEnabled);
pw.println(" mNavigationBarWindowState="
@@ -911,11 +757,6 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
&& mNavigationBarWindowState != state) {
mNavigationBarWindowState = state;
updateSystemUiStateFlags(-1);
- mShowOrientedHandleForImmersiveMode = state == WINDOW_STATE_HIDDEN;
- if (mOrientationHandle != null
- && mStartingQuickSwitchRotation != -1) {
- orientSecondaryHomeHandle();
- }
if (DEBUG_WINDOW_STATE) Log.d(TAG, "Navigation bar " + windowStateToString(state));
mNavigationBarView.setWindowVisible(isNavBarWindowVisible());
}
@@ -1504,10 +1345,6 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
}
}
updateScreenPinningGestures();
-
- if (!canShowSecondaryHandle()) {
- resetSecondaryHandle();
- }
}
public void disableAnimationsDuringHide(long delay) {
@@ -1614,10 +1451,6 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
return lp;
}
- private boolean canShowSecondaryHandle() {
- return mNavBarMode == NAV_BAR_MODE_GESTURAL && mOrientationHandle != null;
- }
-
private final Consumer<Integer> mRotationWatcher = rotation -> {
if (mNavigationBarView != null
&& mNavigationBarView.needsReorient(rotation)) {
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
index 5fbdd88b9f66..e8e9ba2b3e51 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
@@ -33,7 +33,6 @@ import android.animation.PropertyValuesHolder;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.annotation.DrawableRes;
-import android.annotation.Nullable;
import android.app.StatusBarManager;
import android.content.Context;
import android.content.res.Configuration;
@@ -176,14 +175,6 @@ public class NavigationBarView extends FrameLayout implements
*/
private ScreenPinningNotify mScreenPinningNotify;
private Rect mSamplingBounds = new Rect();
- /**
- * When quickswitching between apps of different orientations, we draw a secondary home handle
- * in the position of the first app's orientation. This rect represents the region of that
- * home handle so we can apply the correct light/dark luma on that.
- * @see {@link NavigationBar#mOrientationHandle}
- */
- @Nullable
- private Rect mOrientedHandleSamplingRegion;
private class NavTransitionListener implements TransitionListener {
private boolean mBackTransitioning;
@@ -377,10 +368,6 @@ public class NavigationBarView extends FrameLayout implements
@Override
public Rect getSampledRegion(View sampledView) {
- if (mOrientedHandleSamplingRegion != null) {
- return mOrientedHandleSamplingRegion;
- }
-
updateSamplingRect();
return mSamplingBounds;
}
@@ -997,11 +984,6 @@ public class NavigationBarView extends FrameLayout implements
}
}
- void setOrientedHandleSamplingRegion(Rect orientedHandleSamplingRegion) {
- mOrientedHandleSamplingRegion = orientedHandleSamplingRegion;
- mRegionSamplingHelper.updateSamplingRect();
- }
-
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
@@ -1346,11 +1328,8 @@ public class NavigationBarView extends FrameLayout implements
mIsVertical ? "true" : "false",
getLightTransitionsController().getCurrentDarkIntensity()));
- pw.println(" mOrientedHandleSamplingRegion: " + mOrientedHandleSamplingRegion);
pw.println(" mScreenOn: " + mScreenOn);
-
- dumpButton(pw, "back", getBackButton());
dumpButton(pw, "home", getHomeButton());
dumpButton(pw, "handle", getHomeHandle());
dumpButton(pw, "rcnt", getRecentsButton());
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/NavigationHandle.java b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/NavigationHandle.java
index 33e6aa46724b..f01448b6ff22 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/NavigationHandle.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/NavigationHandle.java
@@ -33,11 +33,11 @@ import com.android.systemui.navigationbar.buttons.ButtonInterface;
public class NavigationHandle extends View implements ButtonInterface {
- protected final Paint mPaint = new Paint();
+ private final Paint mPaint = new Paint();
private @ColorInt final int mLightColor;
private @ColorInt final int mDarkColor;
- protected final int mRadius;
- protected final int mBottom;
+ private final int mRadius;
+ private final int mBottom;
private boolean mRequiresInvalidate;
public NavigationHandle(Context context) {
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/QuickswitchOrientedNavHandle.java b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/QuickswitchOrientedNavHandle.java
deleted file mode 100644
index 71c8a2c1e6ca..000000000000
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/QuickswitchOrientedNavHandle.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.navigationbar.gestural;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.RectF;
-import android.view.Surface;
-
-import com.android.systemui.R;
-
-/** Temporarily shown view when using QuickSwitch to switch between apps of different rotations */
-public class QuickswitchOrientedNavHandle extends NavigationHandle {
- private final int mWidth;
- private final RectF mTmpBoundsRectF = new RectF();
- private @Surface.Rotation int mDeltaRotation;
-
- public QuickswitchOrientedNavHandle(Context context) {
- super(context);
- mWidth = context.getResources().getDimensionPixelSize(R.dimen.navigation_home_handle_width);
- }
-
- public void setDeltaRotation(@Surface.Rotation int rotation) {
- mDeltaRotation = rotation;
- }
-
- @Override
- protected void onDraw(Canvas canvas) {
- canvas.drawRoundRect(computeHomeHandleBounds(), mRadius, mRadius, mPaint);
- }
-
- public RectF computeHomeHandleBounds() {
- int left;
- int top;
- int bottom;
- int right;
- int radiusOffset = mRadius * 2;
- int topStart = getLocationOnScreen()[1];
-
- switch (mDeltaRotation) {
- default:
- case Surface.ROTATION_0:
- case Surface.ROTATION_180:
- int height = mRadius * 2;
- left = getWidth() / 2 - mWidth / 2;
- top = (getHeight() - mBottom - height);
- right = getWidth() / 2 + mWidth / 2;
- bottom = top + height;
- break;
- case Surface.ROTATION_90:
- left = mBottom;
- right = left + radiusOffset;
- top = getHeight() / 2 - (mWidth / 2) - (topStart / 2);
- bottom = top + mWidth;
- break;
- case Surface.ROTATION_270:
- right = getWidth() - mBottom;
- left = right - radiusOffset;
- top = getHeight() / 2 - (mWidth / 2) - (topStart / 2);
- bottom = top + mWidth;
- break;
- }
- mTmpBoundsRectF.set(left, top, right, bottom);
- return mTmpBoundsRectF;
- }
-}