Merge "Annotate obscuring opacity getter/setter w/ @FloatRange" into sc-dev am: 11687fae2c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13776558

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I74ef0548fc753900dfc64666405136feb0e1c352
This commit is contained in:
Bernardo Rufino
2021-03-09 14:28:24 +00:00
committed by Automerger Merge Worker
3 changed files with 10 additions and 6 deletions

View File

@@ -18782,7 +18782,7 @@ package android.hardware.input {
public final class InputManager {
method public android.view.InputDevice getInputDevice(int);
method public int[] getInputDeviceIds();
method public float getMaximumObscuringOpacityForTouch();
method @FloatRange(from=0, to=1) public float getMaximumObscuringOpacityForTouch();
method public void registerInputDeviceListener(android.hardware.input.InputManager.InputDeviceListener, android.os.Handler);
method public void unregisterInputDeviceListener(android.hardware.input.InputManager.InputDeviceListener);
method @Nullable public android.view.VerifiedInputEvent verifyInputEvent(@NonNull android.view.InputEvent);

View File

@@ -1128,7 +1128,7 @@ package android.hardware.input {
public final class InputManager {
method public int getBlockUntrustedTouchesMode(@NonNull android.content.Context);
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setBlockUntrustedTouchesMode(@NonNull android.content.Context, int);
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setMaximumObscuringOpacityForTouch(float);
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setMaximumObscuringOpacityForTouch(@FloatRange(from=0, to=1) float);
field public static final long BLOCK_UNTRUSTED_TOUCHES = 158002302L; // 0x96aec7eL
}

View File

@@ -17,6 +17,7 @@
package android.hardware.input;
import android.Manifest;
import android.annotation.FloatRange;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -922,8 +923,11 @@ public final class InputManager {
* opacity of the windows above the touch-consuming window, per UID. Check documentation of
* {@link LayoutParams#FLAG_NOT_TOUCHABLE} for more details.
*
* <p>The value returned is between 0 (inclusive) and 1 (inclusive).
*
* @see LayoutParams#FLAG_NOT_TOUCHABLE
*/
@FloatRange(from = 0, to = 1)
public float getMaximumObscuringOpacityForTouch() {
Context context = ActivityThread.currentApplication();
return Settings.Global.getFloat(context.getContentResolver(),
@@ -934,11 +938,11 @@ public final class InputManager {
/**
* Sets the maximum allowed obscuring opacity by UID to propagate touches.
*
* For certain window types (eg. SAWs), the decision of honoring {@link LayoutParams
* <p>For certain window types (eg. SAWs), the decision of honoring {@link LayoutParams
* #FLAG_NOT_TOUCHABLE} or not depends on the combined obscuring opacity of the windows
* above the touch-consuming window.
*
* For a certain UID:
* <p>For a certain UID:
* <ul>
* <li>If it's the same as the UID of the touch-consuming window, allow it to propagate
* the touch.
@@ -949,7 +953,7 @@ public final class InputManager {
* touch, allow the UID to propagate the touch.
* </ul>
*
* This value should be between 0 (inclusive) and 1 (inclusive).
* <p>This value should be between 0 (inclusive) and 1 (inclusive).
*
* @see #getMaximumObscuringOpacityForTouch()
*
@@ -957,7 +961,7 @@ public final class InputManager {
*/
@TestApi
@RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
public void setMaximumObscuringOpacityForTouch(float opacity) {
public void setMaximumObscuringOpacityForTouch(@FloatRange(from = 0, to = 1) float opacity) {
if (opacity < 0 || opacity > 1) {
throw new IllegalArgumentException(
"Maximum obscuring opacity for touch should be >= 0 and <= 1");