Loading services/core/java/com/android/server/wm/AppCompatReachabilityPolicy.java +47 −14 Original line number Diff line number Diff line Loading @@ -27,14 +27,16 @@ import static com.android.internal.util.FrameworkStatsLog.LETTERBOX_POSITION_CHA import static com.android.server.wm.AppCompatConfiguration.LETTERBOX_HORIZONTAL_REACHABILITY_POSITION_CENTER; import static com.android.server.wm.AppCompatConfiguration.LETTERBOX_VERTICAL_REACHABILITY_POSITION_CENTER; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.graphics.Rect; import com.android.internal.annotations.VisibleForTesting; import com.android.window.flags.Flags; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.function.Supplier; /** Loading @@ -50,6 +52,26 @@ class AppCompatReachabilityPolicy { @VisibleForTesting Supplier<Rect> mLetterboxInnerBoundsSupplier; /** @hide */ @IntDef(prefix = { "REACHABILITY_SOURCE_" }, value = { REACHABILITY_SOURCE_CORE, REACHABILITY_SOURCE_SHELL, }) @Retention(RetentionPolicy.SOURCE) public @interface ReachabilitySource {} /** * This is the value used when the double tap is coming from the Letterbox surfaces in Core. * @hide */ public static final int REACHABILITY_SOURCE_CORE = 0; /** * This is the value used when the double tap is coming from the Letterbox surfaces in Shell. * @hide */ public static final int REACHABILITY_SOURCE_SHELL = 1; AppCompatReachabilityPolicy(@NonNull ActivityRecord activityRecord, @NonNull AppCompatConfiguration appCompatConfiguration) { mActivityRecord = activityRecord; Loading @@ -66,14 +88,25 @@ class AppCompatReachabilityPolicy { } /** * Handles double tap events for reachability. * Handles double tap events for reachability from Core. * <p/> * @param x Double tap x coordinate. * @param y Double tap y coordinate. */ void handleDoubleTap(int x, int y) { handleHorizontalDoubleTap(x); handleVerticalDoubleTap(y); handleDoubleTap(x, y, REACHABILITY_SOURCE_CORE); } /** * Handles double tap events for reachability. * <p/> * @param x Double tap x coordinate. * @param y Double tap y coordinate. * @param source The Source of the double-tap event. */ void handleDoubleTap(int x, int y, @ReachabilitySource int source) { handleHorizontalDoubleTap(x, source); handleVerticalDoubleTap(y, source); } void dump(@NonNull PrintWriter pw, @NonNull String prefix) { Loading @@ -95,14 +128,14 @@ class AppCompatReachabilityPolicy { mActivityRecord.getParent().getConfiguration())); } private void handleHorizontalDoubleTap(int x) { private void handleHorizontalDoubleTap(int x, @ReachabilitySource int source) { final AppCompatReachabilityOverrides reachabilityOverrides = mActivityRecord.mAppCompatController.getReachabilityOverrides(); // We don't return early when the Shell letterbox implementation is enabled because // double tap is always sent via transitions. final boolean isInTransition = !Flags.appCompatRefactoring() // The check on the transition state only makes sense if the event is coming from core. // In case the event is coming from Shell, the transition should not be considered. final boolean skipWhenOnTransition = source == REACHABILITY_SOURCE_CORE && mActivityRecord.isInTransition(); if (!reachabilityOverrides.isHorizontalReachabilityEnabled() || isInTransition) { if (!reachabilityOverrides.isHorizontalReachabilityEnabled() || skipWhenOnTransition) { return; } final Rect letterboxInnerFrame = getLetterboxInnerFrame(); Loading Loading @@ -144,14 +177,14 @@ class AppCompatReachabilityPolicy { mActivityRecord.recomputeConfiguration(); } private void handleVerticalDoubleTap(int y) { private void handleVerticalDoubleTap(int y, @ReachabilitySource int source) { final AppCompatReachabilityOverrides reachabilityOverrides = mActivityRecord.mAppCompatController.getReachabilityOverrides(); // We don't return early when the Shell letterbox implementation is enabled because // double tap is always sent via transitions. final boolean isInTransition = !Flags.appCompatRefactoring() // The check on the transition state only makes sense if the event is coming from core. // In case the event is coming from Shell, the transition should not be considered. final boolean skipWhenOnTransition = source == REACHABILITY_SOURCE_CORE && mActivityRecord.isInTransition(); if (!reachabilityOverrides.isVerticalReachabilityEnabled() || isInTransition) { if (!reachabilityOverrides.isVerticalReachabilityEnabled() || skipWhenOnTransition) { return; } final Rect letterboxInnerFrame = getLetterboxInnerFrame(); Loading services/core/java/com/android/server/wm/WindowOrganizerController.java +3 −1 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ import static com.android.server.wm.ActivityRecord.State.RESUMED; import static com.android.server.wm.ActivityTaskManagerService.enforceTaskPermission; import static com.android.server.wm.ActivityTaskManagerService.isPip2ExperimentEnabled; import static com.android.server.wm.ActivityTaskSupervisor.REMOVE_FROM_RECENTS; import static com.android.server.wm.AppCompatReachabilityPolicy.REACHABILITY_SOURCE_SHELL; import static com.android.server.wm.Task.FLAG_FORCE_HIDDEN_FOR_PINNED_TASK; import static com.android.server.wm.Task.FLAG_FORCE_HIDDEN_FOR_TASK_ORG; import static com.android.server.wm.TaskFragment.EMBEDDED_DIM_AREA_PARENT_TASK; Loading Loading @@ -1253,7 +1254,8 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub final int doubleTapX = bundle.getInt(REACHABILITY_EVENT_X); final int doubleTapY = bundle.getInt(REACHABILITY_EVENT_Y); topOpaqueActivity.mAppCompatController.getReachabilityPolicy() .handleDoubleTap(doubleTapX, doubleTapY); .handleDoubleTap(doubleTapX, doubleTapY, REACHABILITY_SOURCE_SHELL); } } } Loading Loading
services/core/java/com/android/server/wm/AppCompatReachabilityPolicy.java +47 −14 Original line number Diff line number Diff line Loading @@ -27,14 +27,16 @@ import static com.android.internal.util.FrameworkStatsLog.LETTERBOX_POSITION_CHA import static com.android.server.wm.AppCompatConfiguration.LETTERBOX_HORIZONTAL_REACHABILITY_POSITION_CENTER; import static com.android.server.wm.AppCompatConfiguration.LETTERBOX_VERTICAL_REACHABILITY_POSITION_CENTER; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.graphics.Rect; import com.android.internal.annotations.VisibleForTesting; import com.android.window.flags.Flags; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.function.Supplier; /** Loading @@ -50,6 +52,26 @@ class AppCompatReachabilityPolicy { @VisibleForTesting Supplier<Rect> mLetterboxInnerBoundsSupplier; /** @hide */ @IntDef(prefix = { "REACHABILITY_SOURCE_" }, value = { REACHABILITY_SOURCE_CORE, REACHABILITY_SOURCE_SHELL, }) @Retention(RetentionPolicy.SOURCE) public @interface ReachabilitySource {} /** * This is the value used when the double tap is coming from the Letterbox surfaces in Core. * @hide */ public static final int REACHABILITY_SOURCE_CORE = 0; /** * This is the value used when the double tap is coming from the Letterbox surfaces in Shell. * @hide */ public static final int REACHABILITY_SOURCE_SHELL = 1; AppCompatReachabilityPolicy(@NonNull ActivityRecord activityRecord, @NonNull AppCompatConfiguration appCompatConfiguration) { mActivityRecord = activityRecord; Loading @@ -66,14 +88,25 @@ class AppCompatReachabilityPolicy { } /** * Handles double tap events for reachability. * Handles double tap events for reachability from Core. * <p/> * @param x Double tap x coordinate. * @param y Double tap y coordinate. */ void handleDoubleTap(int x, int y) { handleHorizontalDoubleTap(x); handleVerticalDoubleTap(y); handleDoubleTap(x, y, REACHABILITY_SOURCE_CORE); } /** * Handles double tap events for reachability. * <p/> * @param x Double tap x coordinate. * @param y Double tap y coordinate. * @param source The Source of the double-tap event. */ void handleDoubleTap(int x, int y, @ReachabilitySource int source) { handleHorizontalDoubleTap(x, source); handleVerticalDoubleTap(y, source); } void dump(@NonNull PrintWriter pw, @NonNull String prefix) { Loading @@ -95,14 +128,14 @@ class AppCompatReachabilityPolicy { mActivityRecord.getParent().getConfiguration())); } private void handleHorizontalDoubleTap(int x) { private void handleHorizontalDoubleTap(int x, @ReachabilitySource int source) { final AppCompatReachabilityOverrides reachabilityOverrides = mActivityRecord.mAppCompatController.getReachabilityOverrides(); // We don't return early when the Shell letterbox implementation is enabled because // double tap is always sent via transitions. final boolean isInTransition = !Flags.appCompatRefactoring() // The check on the transition state only makes sense if the event is coming from core. // In case the event is coming from Shell, the transition should not be considered. final boolean skipWhenOnTransition = source == REACHABILITY_SOURCE_CORE && mActivityRecord.isInTransition(); if (!reachabilityOverrides.isHorizontalReachabilityEnabled() || isInTransition) { if (!reachabilityOverrides.isHorizontalReachabilityEnabled() || skipWhenOnTransition) { return; } final Rect letterboxInnerFrame = getLetterboxInnerFrame(); Loading Loading @@ -144,14 +177,14 @@ class AppCompatReachabilityPolicy { mActivityRecord.recomputeConfiguration(); } private void handleVerticalDoubleTap(int y) { private void handleVerticalDoubleTap(int y, @ReachabilitySource int source) { final AppCompatReachabilityOverrides reachabilityOverrides = mActivityRecord.mAppCompatController.getReachabilityOverrides(); // We don't return early when the Shell letterbox implementation is enabled because // double tap is always sent via transitions. final boolean isInTransition = !Flags.appCompatRefactoring() // The check on the transition state only makes sense if the event is coming from core. // In case the event is coming from Shell, the transition should not be considered. final boolean skipWhenOnTransition = source == REACHABILITY_SOURCE_CORE && mActivityRecord.isInTransition(); if (!reachabilityOverrides.isVerticalReachabilityEnabled() || isInTransition) { if (!reachabilityOverrides.isVerticalReachabilityEnabled() || skipWhenOnTransition) { return; } final Rect letterboxInnerFrame = getLetterboxInnerFrame(); Loading
services/core/java/com/android/server/wm/WindowOrganizerController.java +3 −1 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ import static com.android.server.wm.ActivityRecord.State.RESUMED; import static com.android.server.wm.ActivityTaskManagerService.enforceTaskPermission; import static com.android.server.wm.ActivityTaskManagerService.isPip2ExperimentEnabled; import static com.android.server.wm.ActivityTaskSupervisor.REMOVE_FROM_RECENTS; import static com.android.server.wm.AppCompatReachabilityPolicy.REACHABILITY_SOURCE_SHELL; import static com.android.server.wm.Task.FLAG_FORCE_HIDDEN_FOR_PINNED_TASK; import static com.android.server.wm.Task.FLAG_FORCE_HIDDEN_FOR_TASK_ORG; import static com.android.server.wm.TaskFragment.EMBEDDED_DIM_AREA_PARENT_TASK; Loading Loading @@ -1253,7 +1254,8 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub final int doubleTapX = bundle.getInt(REACHABILITY_EVENT_X); final int doubleTapY = bundle.getInt(REACHABILITY_EVENT_Y); topOpaqueActivity.mAppCompatController.getReachabilityPolicy() .handleDoubleTap(doubleTapX, doubleTapY); .handleDoubleTap(doubleTapX, doubleTapY, REACHABILITY_SOURCE_SHELL); } } } Loading