summaryrefslogtreecommitdiffstats
path: root/quickstep/recents_ui_overrides
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2019-07-29 11:10:04 -0700
committerSunny Goyal <sunnygoyal@google.com>2019-07-29 11:55:11 -0700
commitc302baced05a39ac908a106998d300b9989df750 (patch)
treeb997e51f50c658f0b4d4668624940352ce9b3af1 /quickstep/recents_ui_overrides
parentfa652a8a4f91482ea066388e935944846847f582 (diff)
downloadandroid_packages_apps_Trebuchet-c302baced05a39ac908a106998d300b9989df750.tar.gz
android_packages_apps_Trebuchet-c302baced05a39ac908a106998d300b9989df750.tar.bz2
android_packages_apps_Trebuchet-c302baced05a39ac908a106998d300b9989df750.zip
Notifying the geature guide app when back gesture is performed
so that user onboarding can the updated accordingly Bug: 138403212 Change-Id: Ib4e1cde0b2c746f955d5a58251c8ab653dadbc67
Diffstat (limited to 'quickstep/recents_ui_overrides')
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java28
1 files changed, 28 insertions, 0 deletions
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 e1daea5e7..98c550293 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -69,6 +69,7 @@ import android.view.WindowManager;
import androidx.annotation.BinderThread;
import androidx.annotation.UiThread;
+import androidx.annotation.WorkerThread;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.MainThreadExecutor;
@@ -146,6 +147,11 @@ public class TouchInteractionService extends Service implements
private static final String TAG = "TouchInteractionService";
+ private static final String KEY_BACK_NOTIFICATION_COUNT = "backNotificationCount";
+ private static final String NOTIFY_ACTION_BACK = "com.android.quickstep.action.BACK_GESTURE";
+ private static final int MAX_BACK_NOTIFICATION_COUNT = 3;
+ private int mBackGestureNotificationCounter = -1;
+
private final IBinder mMyBinder = new IOverviewProxy.Stub() {
public void onActiveNavBarRegionChanges(Region region) {
@@ -206,6 +212,10 @@ public class TouchInteractionService extends Service implements
mOverviewComponentObserver.getActivityControlHelper();
UserEventDispatcher.newInstance(getBaseContext()).logActionBack(completed, downX, downY,
isButton, gestureSwipeLeft, activityControl.getContainerType());
+
+ if (completed && !isButton && shouldNotifyBackGesture()) {
+ BACKGROUND_EXECUTOR.execute(TouchInteractionService.this::tryNotifyBackGesture);
+ }
}
public void onSystemUiStateChanged(int stateFlags) {
@@ -480,6 +490,8 @@ public class TouchInteractionService extends Service implements
// Temporarily disable model preload
// new ModelPreload().start(this);
+ mBackGestureNotificationCounter = Math.max(0, Utilities.getDevicePrefs(this)
+ .getInt(KEY_BACK_NOTIFICATION_COUNT, MAX_BACK_NOTIFICATION_COUNT));
Utilities.unregisterReceiverSafely(this, mUserUnlockedReceiver);
}
@@ -866,6 +878,22 @@ public class TouchInteractionService extends Service implements
mRecentsModel, mInputConsumer, isLikelyToStartNewTask, continuingLastGesture);
}
+ protected boolean shouldNotifyBackGesture() {
+ return mBackGestureNotificationCounter > 0 &&
+ mGestureBlockingActivity != null;
+ }
+
+ @WorkerThread
+ protected void tryNotifyBackGesture() {
+ if (shouldNotifyBackGesture()) {
+ mBackGestureNotificationCounter--;
+ Utilities.getDevicePrefs(this).edit()
+ .putInt(KEY_BACK_NOTIFICATION_COUNT, mBackGestureNotificationCounter).apply();
+ sendBroadcast(new Intent(NOTIFY_ACTION_BACK).setPackage(
+ mGestureBlockingActivity.getPackageName()));
+ }
+ }
+
public static void startRecentsActivityAsync(Intent intent, RecentsAnimationListener listener) {
BACKGROUND_EXECUTOR.execute(() -> ActivityManagerWrapper.getInstance()
.startRecentsActivity(intent, null, listener, null, null));