Instantly share code, notes, and snippets.
Created
December 4, 2020 18:31
-
Star
0
(0)
You must be signed in to star a gist -
Fork
0
(0)
You must be signed in to fork a gist
-
Save Dil3mm4/592166c2b4d3eb66b0542bdcb407fdb0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 47d6c816c632e9c71763bdec1d93def08ffd5201 Mon Sep 17 00:00:00 2001 | |
From: Dil3mm4 <[email protected]> | |
Date: Fri, 4 Dec 2020 17:01:10 +0000 | |
Subject: [PATCH] GlobalActionsDialog: address FOD on-top of powermenu | |
Due to FOD window type being TYPE_DISPLAY_OVERLAY, when spawning GlobalActions dialogs, FOD would always be on top. | |
Fix this behaviour assigning FOD window type to any GlobalActions windows. | |
Tests: | |
- trigger FODCircleView to show, launch GlobalActions, observe FOD stays in background | |
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java | |
index 39a8c1ce31a3..1a05c8919999 100644 | |
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java | |
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java | |
@@ -48,6 +48,7 @@ import android.content.DialogInterface; | |
import android.content.Intent; | |
import android.content.IntentFilter; | |
import android.content.SharedPreferences; | |
+import android.content.pm.PackageManager; | |
import android.content.pm.UserInfo; | |
import android.content.res.ColorStateList; | |
import android.content.res.Resources; | |
@@ -2186,7 +2187,6 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, | |
mSysUiState = sysuiState; | |
mOnRotateCallback = onRotateCallback; | |
mKeyguardShowing = keyguardShowing; | |
- | |
// Window initialization | |
Window window = getWindow(); | |
window.requestFeature(Window.FEATURE_NO_TITLE); | |
@@ -2204,7 +2204,9 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, | |
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | |
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | |
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); | |
- window.setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY); | |
+ window.setType(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT) | |
+ ? WindowManager.LayoutParams.TYPE_DISPLAY_OVERLAY | |
+ : WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY); | |
window.getAttributes().setFitInsetsTypes(0 /* types */); | |
setTitle(R.string.global_actions); | |
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java | |
index b55b29a80410..76ace4f0317d 100644 | |
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java | |
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java | |
@@ -21,6 +21,7 @@ import android.annotation.Nullable; | |
import android.annotation.StringRes; | |
import android.app.Dialog; | |
import android.content.Context; | |
+import android.content.pm.PackageManager; | |
import android.os.PowerManager; | |
import android.view.View; | |
import android.view.ViewGroup; | |
@@ -124,7 +125,9 @@ public class GlobalActionsImpl implements GlobalActions, CommandQueue.Callbacks | |
window.getAttributes().width = ViewGroup.LayoutParams.MATCH_PARENT; | |
window.getAttributes().height = ViewGroup.LayoutParams.MATCH_PARENT; | |
window.getAttributes().layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; | |
- window.setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY); | |
+ window.setType(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT) | |
+ ? WindowManager.LayoutParams.TYPE_DISPLAY_OVERLAY | |
+ : WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY); | |
window.getAttributes().setFitInsetsTypes(0 /* types */); | |
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); | |
window.addFlags( | |
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsPopupMenu.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsPopupMenu.java | |
index ac4fc62bf1c9..6f4954527674 100644 | |
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsPopupMenu.java | |
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsPopupMenu.java | |
@@ -18,6 +18,7 @@ package com.android.systemui.globalactions; | |
import android.annotation.NonNull; | |
import android.annotation.Nullable; | |
import android.content.Context; | |
+import android.content.pm.PackageManager; | |
import android.content.res.Resources; | |
import android.util.LayoutDirection; | |
import android.view.View; | |
@@ -53,7 +54,9 @@ public class GlobalActionsPopupMenu extends ListPopupWindow { | |
mIsDropDownMode = isDropDownMode; | |
// required to show above the global actions dialog | |
- setWindowLayoutType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY); | |
+ setWindowLayoutType(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT) | |
+ ? WindowManager.LayoutParams.TYPE_DISPLAY_OVERLAY | |
+ : WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY); | |
setInputMethodMode(INPUT_METHOD_NOT_NEEDED); | |
setModal(true); | |
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsPowerDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsPowerDialog.java | |
index caa88a372036..3331d86ccd22 100644 | |
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsPowerDialog.java | |
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsPowerDialog.java | |
@@ -18,6 +18,7 @@ package com.android.systemui.globalactions; | |
import android.annotation.NonNull; | |
import android.app.Dialog; | |
import android.content.Context; | |
+import android.content.pm.PackageManager; | |
import android.content.res.Resources; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
@@ -50,7 +51,9 @@ public class GlobalActionsPowerDialog { | |
dialog.setContentView(listView); | |
Window window = dialog.getWindow(); | |
- window.setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY); | |
+ window.setType(context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT) | |
+ ? WindowManager.LayoutParams.TYPE_DISPLAY_OVERLAY | |
+ : WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY); | |
window.setTitle(""); // prevent Talkback from speaking first item name twice | |
window.setBackgroundDrawable(res.getDrawable( | |
com.android.systemui.R.drawable.control_background, context.getTheme())); | |
-- | |
2.20.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment