Merge "Cap alpha to max if SAW + FLAG_NOT_TOUCHABLE" into tm-dev am: 53b1556921
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17182670 Change-Id: Iae1ecceb4368ab7ca2b228cb86add67a959f5bea
This commit is contained in:
@@ -936,6 +936,26 @@ public class DisplayPolicy {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (LayoutParams.isSystemAlertWindowType(attrs.type)) {
|
||||||
|
float maxOpacity = mService.mMaximumObscuringOpacityForTouch;
|
||||||
|
if (attrs.alpha > maxOpacity
|
||||||
|
&& (attrs.flags & FLAG_NOT_TOUCHABLE) != 0
|
||||||
|
&& (attrs.privateFlags & PRIVATE_FLAG_TRUSTED_OVERLAY) == 0) {
|
||||||
|
// The app is posting a SAW with the intent of letting touches pass through, but
|
||||||
|
// they are going to be deemed untrusted and will be blocked. Try to honor the
|
||||||
|
// intent of letting touches pass through at the cost of 0.2 opacity for app
|
||||||
|
// compatibility reasons. More details on b/218777508.
|
||||||
|
Slog.w(TAG, String.format(
|
||||||
|
"App %s has a system alert window (type = %d) with FLAG_NOT_TOUCHABLE and "
|
||||||
|
+ "LayoutParams.alpha = %.2f > %.2f, setting alpha to %.2f to "
|
||||||
|
+ "let touches pass through (if this is isn't desirable, remove "
|
||||||
|
+ "flag FLAG_NOT_TOUCHABLE).",
|
||||||
|
attrs.packageName, attrs.type, attrs.alpha, maxOpacity, maxOpacity));
|
||||||
|
attrs.alpha = maxOpacity;
|
||||||
|
win.mWinAnimator.mAlpha = maxOpacity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check if alternate bars positions were updated.
|
// Check if alternate bars positions were updated.
|
||||||
if (mStatusBarAlt == win) {
|
if (mStatusBarAlt == win) {
|
||||||
mStatusBarAltPosition = getAltBarPosition(attrs);
|
mStatusBarAltPosition = getAltBarPosition(attrs);
|
||||||
|
|||||||
@@ -745,6 +745,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
|
|
||||||
private final DisplayHashController mDisplayHashController;
|
private final DisplayHashController mDisplayHashController;
|
||||||
|
|
||||||
|
volatile float mMaximumObscuringOpacityForTouch =
|
||||||
|
InputManager.DEFAULT_MAXIMUM_OBSCURING_OPACITY_FOR_TOUCH;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
final WindowContextListenerController mWindowContextListenerController =
|
final WindowContextListenerController mWindowContextListenerController =
|
||||||
new WindowContextListenerController();
|
new WindowContextListenerController();
|
||||||
@@ -782,6 +785,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
DEVELOPMENT_RENDER_SHADOWS_IN_COMPOSITOR);
|
DEVELOPMENT_RENDER_SHADOWS_IN_COMPOSITOR);
|
||||||
private final Uri mDisplaySettingsPathUri = Settings.Global.getUriFor(
|
private final Uri mDisplaySettingsPathUri = Settings.Global.getUriFor(
|
||||||
DEVELOPMENT_WM_DISPLAY_SETTINGS_PATH);
|
DEVELOPMENT_WM_DISPLAY_SETTINGS_PATH);
|
||||||
|
private final Uri mMaximumObscuringOpacityForTouchUri = Settings.Global.getUriFor(
|
||||||
|
Settings.Global.MAXIMUM_OBSCURING_OPACITY_FOR_TOUCH);
|
||||||
|
|
||||||
public SettingsObserver() {
|
public SettingsObserver() {
|
||||||
super(new Handler());
|
super(new Handler());
|
||||||
@@ -806,6 +811,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
UserHandle.USER_ALL);
|
UserHandle.USER_ALL);
|
||||||
resolver.registerContentObserver(mDisplaySettingsPathUri, false, this,
|
resolver.registerContentObserver(mDisplaySettingsPathUri, false, this,
|
||||||
UserHandle.USER_ALL);
|
UserHandle.USER_ALL);
|
||||||
|
resolver.registerContentObserver(mMaximumObscuringOpacityForTouchUri, false, this,
|
||||||
|
UserHandle.USER_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -849,6 +856,11 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mMaximumObscuringOpacityForTouchUri.equals(uri)) {
|
||||||
|
updateMaximumObscuringOpacityForTouch();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
@UpdateAnimationScaleMode
|
@UpdateAnimationScaleMode
|
||||||
final int mode;
|
final int mode;
|
||||||
if (mWindowAnimationScaleUri.equals(uri)) {
|
if (mWindowAnimationScaleUri.equals(uri)) {
|
||||||
@@ -868,6 +880,14 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
void loadSettings() {
|
void loadSettings() {
|
||||||
updateSystemUiSettings(false /* handleChange */);
|
updateSystemUiSettings(false /* handleChange */);
|
||||||
updatePointerLocation();
|
updatePointerLocation();
|
||||||
|
updateMaximumObscuringOpacityForTouch();
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateMaximumObscuringOpacityForTouch() {
|
||||||
|
ContentResolver resolver = mContext.getContentResolver();
|
||||||
|
mMaximumObscuringOpacityForTouch = Settings.Global.getFloat(resolver,
|
||||||
|
Settings.Global.MAXIMUM_OBSCURING_OPACITY_FOR_TOUCH,
|
||||||
|
InputManager.DEFAULT_MAXIMUM_OBSCURING_OPACITY_FOR_TOUCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateSystemUiSettings(boolean handleChange) {
|
void updateSystemUiSettings(boolean handleChange) {
|
||||||
|
|||||||
Reference in New Issue
Block a user