From 69300227c4e6ec7009f1949af15a7a880fbf7de1 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 2 May 2019 11:11:42 -0700 Subject: [PATCH] Adding support for blocking gesture nav on a particular activity Bug: 129796627 Change-Id: I939598f62924fb113e913e0309247d8a2088bf8a --- .../android/quickstep/TouchInteractionService.java | 13 ++++++++++++- quickstep/res/values/config.xml | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index 09a1f3b233..b25865e640 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -30,6 +30,7 @@ import android.app.ActivityManager.RunningTaskInfo; import android.app.KeyguardManager; import android.app.Service; import android.content.BroadcastReceiver; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; @@ -45,6 +46,7 @@ import android.os.IBinder; import android.os.Looper; import android.os.Process; import android.os.RemoteException; +import android.text.TextUtils; import android.util.Log; import android.view.Choreographer; import android.view.Display; @@ -54,6 +56,7 @@ import android.view.Surface; import android.view.WindowManager; import com.android.launcher3.MainThreadExecutor; +import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.compat.UserManagerCompat; import com.android.launcher3.logging.EventLogArray; @@ -78,7 +81,7 @@ import java.util.List; /** * Service connected by system-UI for handling touch interaction. */ -@TargetApi(Build.VERSION_CODES.O) +@TargetApi(Build.VERSION_CODES.Q) public class TouchInteractionService extends Service implements NavigationModeChangeListener, DisplayListener { @@ -229,6 +232,7 @@ public class TouchInteractionService extends Service implements private Mode mMode = Mode.THREE_BUTTONS; private int mDefaultDisplayId; private final RectF mSwipeTouchRegion = new RectF(); + private ComponentName mGestureBlockingActivity; @Override public void onCreate() { @@ -250,6 +254,10 @@ public class TouchInteractionService extends Service implements mDefaultDisplayId = getSystemService(WindowManager.class).getDefaultDisplay() .getDisplayId(); + + String blockingActivity = getString(R.string.gesture_blocking_activity); + mGestureBlockingActivity = TextUtils.isEmpty(blockingActivity) ? null : + ComponentName.unflattenFromString(blockingActivity); sConnected = true; } @@ -464,6 +472,9 @@ public class TouchInteractionService extends Service implements } else if (ENABLE_QUICKSTEP_LIVE_TILE.get() && activityControl.isInLiveTileMode()) { base = OverviewInputConsumer.newInstance(activityControl, mInputMonitorCompat, false); + } else if (mGestureBlockingActivity != null && runningTaskInfo != null + && mGestureBlockingActivity.equals(runningTaskInfo.topActivity)) { + base = InputConsumer.NO_OP; } else { base = createOtherActivityInputConsumer(event, runningTaskInfo); } diff --git a/quickstep/res/values/config.xml b/quickstep/res/values/config.xml index 95aea43aec..e84543b378 100644 --- a/quickstep/res/values/config.xml +++ b/quickstep/res/values/config.xml @@ -18,6 +18,9 @@ + + + com.android.quickstep.logging.UserEventDispatcherExtension com.android.quickstep.logging.StatsLogCompatManager