summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tracy Zhou <tracyzhou@google.com> 2023-11-07 08:05:26 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-11-07 08:05:26 +0000
commit65d77e934cc0a3d8351c3633a7525e6c26d8fff9 (patch)
treebaab4ccb497cfbc73032399502f825d942f163b6
parent62813f609773fe812946949e66e5549eb08fe048 (diff)
parent0e351e46e0e5b158a7a5ee9ed0cbc14e12551342 (diff)
Merge "Alway create window context of TYPE_NAVIGATION_BAR_PANEL for FloatingRotationButton" into main
-rw-r--r--packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButton.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButton.java b/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButton.java
index b44bf395930e..fec96c675b22 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButton.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/rotation/FloatingRotationButton.java
@@ -16,6 +16,8 @@
package com.android.systemui.shared.rotation;
+import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
+
import android.annotation.DimenRes;
import android.annotation.IdRes;
import android.annotation.LayoutRes;
@@ -87,15 +89,15 @@ public class FloatingRotationButton implements RotationButton {
@DimenRes int roundedContentPadding, @DimenRes int taskbarLeftMargin,
@DimenRes int taskbarBottomMargin, @DimenRes int buttonDiameter,
@DimenRes int rippleMaxWidth, @BoolRes int floatingRotationBtnPositionLeftResource) {
- mWindowManager = context.getSystemService(WindowManager.class);
- mKeyButtonContainer = (ViewGroup) LayoutInflater.from(context).inflate(layout, null);
+ mContext = context.createWindowContext(context.getDisplay(), TYPE_NAVIGATION_BAR_PANEL,
+ null);
+ mWindowManager = mContext.getSystemService(WindowManager.class);
+ mKeyButtonContainer = (ViewGroup) LayoutInflater.from(mContext).inflate(layout, null);
mKeyButtonView = mKeyButtonContainer.findViewById(keyButtonId);
mKeyButtonView.setVisibility(View.VISIBLE);
- mKeyButtonView.setContentDescription(context.getString(contentDescriptionResource));
+ mKeyButtonView.setContentDescription(mContext.getString(contentDescriptionResource));
mKeyButtonView.setRipple(rippleMaxWidth);
- mContext = context;
-
mContentDescriptionResource = contentDescriptionResource;
mMinMarginResource = minMargin;
mRoundedContentPaddingResource = roundedContentPadding;