summaryrefslogtreecommitdiffstats
path: root/quickstep/src
diff options
context:
space:
mode:
authorMatthew Ng <ngmatthew@google.com>2019-04-24 11:54:44 -0700
committerMatthew Ng <ngmatthew@google.com>2019-04-25 23:01:12 +0000
commitb60dce726884227e75b5b7788d9068bb3d736c32 (patch)
treec617a59befa26f1c47cd9376d7653bb5cf0dc362 /quickstep/src
parentefe84750930e369763d73a76c647695d7e600bee (diff)
downloadandroid_packages_apps_Trebuchet-b60dce726884227e75b5b7788d9068bb3d736c32.tar.gz
android_packages_apps_Trebuchet-b60dce726884227e75b5b7788d9068bb3d736c32.tar.bz2
android_packages_apps_Trebuchet-b60dce726884227e75b5b7788d9068bb3d736c32.zip
Remove interaction flag code replaced by QuickStepContract (1/2)
Test: manual Bug: 112934365 Fixes: 129497226 Change-Id: Id128eee4eaa620f0b9c461ef5adf0a16e9ea9a2c
Diffstat (limited to 'quickstep/src')
-rw-r--r--quickstep/src/com/android/quickstep/OverviewInteractionState.java60
1 files changed, 3 insertions, 57 deletions
diff --git a/quickstep/src/com/android/quickstep/OverviewInteractionState.java b/quickstep/src/com/android/quickstep/OverviewInteractionState.java
index 286ddc043..6c7bc776c 100644
--- a/quickstep/src/com/android/quickstep/OverviewInteractionState.java
+++ b/quickstep/src/com/android/quickstep/OverviewInteractionState.java
@@ -15,46 +15,32 @@
*/
package com.android.quickstep;
-import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_QUICK_SCRUB;
-import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_SWIPE_UP;
-import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_SHOW_OVERVIEW_BUTTON;
-
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
import android.util.Log;
-import com.android.launcher3.Utilities;
-import com.android.launcher3.allapps.DiscoveryBounce;
import com.android.launcher3.util.MainThreadInitializedObject;
import com.android.launcher3.util.UiThreadHelper;
import com.android.systemui.shared.recents.ISystemUiProxy;
import androidx.annotation.WorkerThread;
+import com.android.systemui.shared.system.QuickStepContract;
/**
- * Sets overview interaction flags, such as:
- *
- * - FLAG_DISABLE_QUICK_SCRUB
- * - FLAG_DISABLE_SWIPE_UP
- * - FLAG_SHOW_OVERVIEW_BUTTON
- *
- * @see com.android.systemui.shared.system.NavigationBarCompat.InteractionType and associated flags.
+ * Sets alpha for the back button
*/
public class OverviewInteractionState {
private static final String TAG = "OverviewFlags";
- private static final String HAS_ENABLED_QUICKSTEP_ONCE = "launcher.has_enabled_quickstep_once";
-
// We do not need any synchronization for this variable as its only written on UI thread.
public static final MainThreadInitializedObject<OverviewInteractionState> INSTANCE =
new MainThreadInitializedObject<>((c) -> new OverviewInteractionState(c));
private static final int MSG_SET_PROXY = 200;
private static final int MSG_SET_BACK_BUTTON_ALPHA = 201;
- private static final int MSG_APPLY_FLAGS = 202;
private final Context mContext;
private final Handler mUiHandler;
@@ -62,7 +48,6 @@ public class OverviewInteractionState {
// These are updated on the background thread
private ISystemUiProxy mISystemUiProxy;
- private boolean mSwipeUpEnabled;
private float mBackButtonAlpha = 1;
private OverviewInteractionState(Context context) {
@@ -73,9 +58,6 @@ public class OverviewInteractionState {
// For example, send back alpha on uihandler to avoid flickering when setting its visibility
mUiHandler = new Handler(this::handleUiMessage);
mBgHandler = new Handler(UiThreadHelper.getBackgroundLooper(), this::handleBgMessage);
-
- onNavigationModeChanged(SysUINavigationMode.INSTANCE.get(context)
- .addModeChangeListener(this::onNavigationModeChanged));
}
public float getBackButtonAlpha() {
@@ -83,7 +65,7 @@ public class OverviewInteractionState {
}
public void setBackButtonAlpha(float alpha, boolean animate) {
- if (!mSwipeUpEnabled) {
+ if (QuickStepContract.isLegacyMode(SysUINavigationMode.getMode(mContext).resValue)) {
alpha = 1;
}
mUiHandler.removeMessages(MSG_SET_BACK_BUTTON_ALPHA);
@@ -111,31 +93,11 @@ public class OverviewInteractionState {
case MSG_SET_BACK_BUTTON_ALPHA:
applyBackButtonAlpha((float) msg.obj, msg.arg1 == 1);
return true;
- case MSG_APPLY_FLAGS:
- break;
}
- applyFlags();
return true;
}
@WorkerThread
- private void applyFlags() {
- if (mISystemUiProxy == null) {
- return;
- }
-
- int flags = FLAG_DISABLE_QUICK_SCRUB;
- if (!mSwipeUpEnabled) {
- flags = FLAG_DISABLE_SWIPE_UP | FLAG_DISABLE_QUICK_SCRUB | FLAG_SHOW_OVERVIEW_BUTTON;
- }
- try {
- mISystemUiProxy.setInteractionState(flags);
- } catch (RemoteException e) {
- Log.w(TAG, "Unable to update overview interaction flags", e);
- }
- }
-
- @WorkerThread
private void applyBackButtonAlpha(float alpha, boolean animate) {
if (mISystemUiProxy == null) {
return;
@@ -146,20 +108,4 @@ public class OverviewInteractionState {
Log.w(TAG, "Unable to update overview back button alpha", e);
}
}
-
- private void onNavigationModeChanged(SysUINavigationMode.Mode mode) {
- mSwipeUpEnabled = mode.hasGestures;
- resetHomeBounceSeenOnQuickstepEnabledFirstTime();
- mBgHandler.obtainMessage(MSG_APPLY_FLAGS).sendToTarget();
- }
-
- private void resetHomeBounceSeenOnQuickstepEnabledFirstTime() {
- if (mSwipeUpEnabled && !Utilities.getPrefs(mContext).getBoolean(
- HAS_ENABLED_QUICKSTEP_ONCE, true)) {
- Utilities.getPrefs(mContext).edit()
- .putBoolean(HAS_ENABLED_QUICKSTEP_ONCE, true)
- .putBoolean(DiscoveryBounce.HOME_BOUNCE_SEEN, false)
- .apply();
- }
- }
}