Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e45e3a1 authored by Bernardo Rufino's avatar Bernardo Rufino
Browse files

Adjust docs around obscured flags and filter touches API

Only one of FLAG_WINDOW_IS_OBSCURED or FLAG_WINDOW_IS_PARTIALLY_OBSCURED
is ever applied (not both). Updated docs around
setFilterTouchesWhenObscured() to clarify that touches on the view whose
window is obscured *at the touched location* are filtered.

Change-Id: Icaac3373c27d8a79bb0ba0c303d9b61d9e79c6a3
Fix: 185132725
Fix: 162501914
Test: TH passes
parent 4086d6aa
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -434,8 +434,8 @@ public final class MotionEvent extends InputEvent implements Parcelable {

    /**
     * This flag indicates that the window that received this motion event is partly
     * or wholly obscured by another visible window above it. This flag is set to true
     * if the event directly passed through the obscured area.
     * or wholly obscured by another visible window above it and the event directly passed through
     * the obscured area.
     *
     * A security sensitive application can check this flag to identify situations in which
     * a malicious application may have covered up part of its content for the purpose
@@ -447,8 +447,8 @@ public final class MotionEvent extends InputEvent implements Parcelable {

    /**
     * This flag indicates that the window that received this motion event is partly
     * or wholly obscured by another visible window above it. This flag is set to true
     * even if the event did not directly pass through the obscured area.
     * or wholly obscured by another visible window above it and the event did not directly pass
     * through the obscured area.
     *
     * A security sensitive application can check this flag to identify situations in which
     * a malicious application may have covered up part of its content for the purpose
@@ -456,7 +456,7 @@ public final class MotionEvent extends InputEvent implements Parcelable {
     * to drop the suspect touches or to take additional precautions to confirm the user's
     * actual intent.
     *
     * Unlike FLAG_WINDOW_IS_OBSCURED, this is true even if the window that received this event is
     * Unlike FLAG_WINDOW_IS_OBSCURED, this is only true if the window that received this event is
     * obstructed in areas other than the touched location.
     */
    public static final int FLAG_WINDOW_IS_PARTIALLY_OBSCURED = 0x2;
+5 −4
Original line number Diff line number Diff line
@@ -744,8 +744,9 @@ import java.util.function.Predicate;
 * To enable touch filtering, call {@link #setFilterTouchesWhenObscured(boolean)} or set the
 * android:filterTouchesWhenObscured layout attribute to true.  When enabled, the framework
 * will discard touches that are received whenever the view's window is obscured by
 * another visible window.  As a result, the view will not receive touches whenever a
 * toast, dialog or other window appears above the view's window.
 * another visible window at the touched location.  As a result, the view will not receive touches
 * whenever the touch passed through a toast, dialog or other window that appears above the view's
 * window.
 * </p><p>
 * For more fine-grained control over security, consider overriding the
 * {@link #onFilterTouchEventForSecurity(MotionEvent)} method to implement your own
@@ -12671,7 +12672,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    /**
     * Gets whether the framework should discard touches when the view's
     * window is obscured by another visible window.
     * window is obscured by another visible window at the touched location.
     * Refer to the {@link View} security documentation for more details.
     *
     * @return True if touch filtering is enabled.
@@ -12687,7 +12688,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    /**
     * Sets whether the framework should discard touches when the view's
     * window is obscured by another visible window.
     * window is obscured by another visible window at the touched location.
     * Refer to the {@link View} security documentation for more details.
     *
     * @param enabled True if touch filtering should be enabled.