Remove interaction flag code replaced by QuickStepContract (1/2)

Test: manual
Bug: 112934365
Bug: 131419978
Fixes: 129497226
Change-Id: Iee5f5f99a1bea84fc69c8291e3f982ed68b875c5
This commit is contained in:
Matthew Ng
2019-04-24 11:40:12 -07:00
parent 5a8ef91d16
commit b2f89d3ee8
7 changed files with 6 additions and 137 deletions

View File

@@ -37,11 +37,6 @@ interface ISystemUiProxy {
*/
void startScreenPinning(int taskId) = 1;
/**
* Enables/disables launcher/overview interaction features {@link InteractionType}.
*/
void setInteractionState(int flags) = 4;
/**
* Notifies SystemUI that split screen has been invoked.
*/

View File

@@ -1,60 +0,0 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package com.android.systemui.shared.system;
import android.annotation.IntDef;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
public class NavigationBarCompat extends QuickStepContract {
@Retention(RetentionPolicy.SOURCE)
@IntDef({HIT_TARGET_NONE, HIT_TARGET_BACK, HIT_TARGET_HOME, HIT_TARGET_OVERVIEW})
public @interface HitTarget{}
public static final int HIT_TARGET_NONE = 0;
public static final int HIT_TARGET_BACK = 1;
public static final int HIT_TARGET_HOME = 2;
public static final int HIT_TARGET_OVERVIEW = 3;
public static final int HIT_TARGET_ROTATION = 4;
public static final int HIT_TARGET_DEAD_ZONE = 5;
@Retention(RetentionPolicy.SOURCE)
@IntDef({FLAG_DISABLE_SWIPE_UP,
FLAG_DISABLE_QUICK_SCRUB,
FLAG_SHOW_OVERVIEW_BUTTON
})
public @interface InteractionType {}
/**
* Interaction type: whether the gesture to swipe up from the navigation bar will trigger
* launcher to show overview
*/
public static final int FLAG_DISABLE_SWIPE_UP = 0x1;
/**
* Interaction type: enable quick scrub interaction on the home button
*/
public static final int FLAG_DISABLE_QUICK_SCRUB = 0x2;
/**
* Interaction type: show/hide the overview button while this service is connected to launcher
*/
public static final int FLAG_SHOW_OVERVIEW_BUTTON = 0x4;
}

View File

@@ -57,7 +57,6 @@ public final class Prefs {
Key.SEEN_RINGER_GUIDANCE_COUNT,
Key.QS_HAS_TURNED_OFF_MOBILE_DATA,
Key.TOUCHED_RINGER_TOGGLE,
Key.QUICK_STEP_INTERACTION_FLAGS,
Key.HAS_SEEN_ODI_CAPTIONS_TOOLTIP
})
public @interface Key {
@@ -103,7 +102,6 @@ public final class Prefs {
String QS_TILE_SPECS_REVEALED = "QsTileSpecsRevealed";
String QS_HAS_TURNED_OFF_MOBILE_DATA = "QsHasTurnedOffMobileData";
String TOUCHED_RINGER_TOGGLE = "TouchedRingerToggle";
String QUICK_STEP_INTERACTION_FLAGS = "QuickStepInteractionFlags";
String HAS_SEEN_ODI_CAPTIONS_TOOLTIP = "HasSeenODICaptionsTooltip";
}

View File

@@ -22,9 +22,6 @@ import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_UP;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
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 static com.android.systemui.shared.system.NavigationBarCompat.InteractionType;
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_INPUT_MONITOR;
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SUPPORTS_WINDOW_CORNERS;
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYSUI_PROXY;
@@ -60,7 +57,6 @@ import android.view.accessibility.AccessibilityManager;
import com.android.internal.policy.ScreenDecorationsUtils;
import com.android.systemui.Dependency;
import com.android.systemui.Dumpable;
import com.android.systemui.Prefs;
import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.recents.OverviewProxyService.OverviewProxyListener;
import com.android.systemui.shared.recents.IOverviewProxy;
@@ -102,10 +98,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
// Max backoff caps at 5 mins
private static final long MAX_BACKOFF_MILLIS = 10 * 60 * 1000;
// Default interaction flags if swipe up is disabled before connecting to launcher
private static final int DEFAULT_DISABLE_SWIPE_UP_STATE = FLAG_DISABLE_SWIPE_UP
| FLAG_SHOW_OVERVIEW_BUTTON;
private final Context mContext;
private final Handler mHandler;
private final Runnable mConnectionRunnable = this::internalConnectToCurrentUser;
@@ -118,7 +110,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
private IOverviewProxy mOverviewProxy;
private int mConnectionBackoffAttempts;
private @InteractionType int mInteractionFlags;
private @SystemUiStateFlags int mSysUiStateFlags;
private boolean mBound;
private boolean mIsEnabled;
@@ -212,27 +203,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
}
}
@Override
public void setInteractionState(@InteractionType int flags) {
if (!verifyCaller("setInteractionState")) {
return;
}
long token = Binder.clearCallingIdentity();
try {
if (mInteractionFlags != flags) {
mInteractionFlags = flags;
mHandler.post(() -> {
for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
mConnectionCallbacks.get(i).onInteractionFlagsChanged(flags);
}
});
}
} finally {
Prefs.putInt(mContext, Prefs.Key.QUICK_STEP_INTERACTION_FLAGS, mInteractionFlags);
Binder.restoreCallingIdentity(token);
}
}
@Override
public Rect getNonMinimizedSplitScreenSecondaryBounds() {
if (!verifyCaller("getNonMinimizedSplitScreenSecondaryBounds")) {
@@ -360,12 +330,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
public void onReceive(Context context, Intent intent) {
updateEnabledState();
// When launcher service is disabled, reset interaction flags because it is inactive
if (!isEnabled()) {
mInteractionFlags = getDefaultInteractionFlags();
Prefs.remove(mContext, Prefs.Key.QUICK_STEP_INTERACTION_FLAGS);
}
// Reconnect immediately, instead of waiting for resume to arrive.
startConnectionToCurrentUser();
}
@@ -459,8 +423,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
com.android.internal.R.string.config_recentsComponentName));
mQuickStepIntent = new Intent(ACTION_QUICKSTEP)
.setPackage(mRecentsComponentName.getPackageName());
mInteractionFlags = Prefs.getInt(mContext, Prefs.Key.QUICK_STEP_INTERACTION_FLAGS,
getDefaultInteractionFlags());
mWindowCornerRadius = ScreenDecorationsUtils.getWindowCornerRadius(mContext.getResources());
mSupportsRoundedCornersOnWindows = ScreenDecorationsUtils
.supportsRoundedCornersOnWindows(mContext.getResources());
@@ -633,7 +595,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
public void addCallback(OverviewProxyListener listener) {
mConnectionCallbacks.add(listener);
listener.onConnectionChanged(mOverviewProxy != null);
listener.onInteractionFlagsChanged(mInteractionFlags);
listener.onBackButtonAlphaChanged(mBackButtonAlpha, false);
}
@@ -643,7 +604,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
}
public boolean shouldShowSwipeUpUI() {
return isEnabled() && ((mInteractionFlags & FLAG_DISABLE_SWIPE_UP) == 0);
return isEnabled() && !QuickStepContract.isLegacyMode(mNavBarMode);
}
public boolean isEnabled() {
@@ -654,10 +615,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
return mOverviewProxy;
}
public int getInteractionFlags() {
return mInteractionFlags;
}
private void disconnectFromLauncherService() {
if (mBound) {
// Always unbind the service (ie. if called through onNullBinding or onBindingDied)
@@ -673,13 +630,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
}
}
private int getDefaultInteractionFlags() {
// If there is no settings available use device default or get it from settings
return QuickStepContract.isLegacyMode(mNavBarMode)
? DEFAULT_DISABLE_SWIPE_UP_STATE
: 0;
}
private void notifyBackButtonAlphaChanged(float alpha, boolean animate) {
for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
mConnectionCallbacks.get(i).onBackButtonAlphaChanged(alpha, animate);
@@ -745,7 +695,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
pw.print(" isCurrentUserSetup="); pw.println(mDeviceProvisionedController
.isCurrentUserSetup());
pw.print(" connectionBackoffAttempts="); pw.println(mConnectionBackoffAttempts);
pw.print(" interactionFlags="); pw.println(mInteractionFlags);
pw.print(" quickStepIntent="); pw.println(mQuickStepIntent);
pw.print(" quickStepIntentResolved="); pw.println(isEnabled());
@@ -755,7 +704,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
public interface OverviewProxyListener {
default void onConnectionChanged(boolean isConnected) {}
default void onQuickStepStarted() {}
default void onInteractionFlagsChanged(@InteractionType int flags) {}
default void onOverviewShown(boolean fromHome) {}
default void onQuickScrubStarted() {}
default void onBackButtonAlphaChanged(float alpha, boolean animate) {}

View File

@@ -24,7 +24,6 @@ import static android.app.StatusBarManager.windowStateToString;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
import static com.android.systemui.recents.OverviewProxyService.OverviewProxyListener;
import static com.android.systemui.shared.system.NavigationBarCompat.InteractionType;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_CLICKABLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN;
@@ -196,12 +195,6 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback
mStatusBar.collapsePanel(true /* animate */);
}
@Override
public void onInteractionFlagsChanged(@InteractionType int flags) {
mNavigationBarView.updateStates();
updateScreenPinningGestures();
}
@Override
public void startAssistant(Bundle bundle) {
mAssistManager.startAssist(bundle);

View File

@@ -19,7 +19,6 @@ package com.android.systemui.statusbar.phone;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_INVALID;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_SHOW_OVERVIEW_BUTTON;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED;
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_OPAQUE;
@@ -587,10 +586,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
// as they are used for exiting.
final boolean pinningActive = ActivityManagerWrapper.getInstance().isScreenPinningActive();
if (mOverviewProxyService.isEnabled()) {
// Use interaction flags to show/hide navigation buttons but will be shown if required
// to exit screen pinning.
final int flags = mOverviewProxyService.getInteractionFlags();
disableRecent |= (flags & FLAG_SHOW_OVERVIEW_BUTTON) == 0;
if (pinningActive) {
disableBack = disableHome = false;
}

View File

@@ -56,7 +56,7 @@ import com.android.systemui.R;
import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.plugins.statusbar.phone.NavBarButtonProvider.ButtonInterface;
import com.android.systemui.recents.OverviewProxyService;
import com.android.systemui.shared.system.NavigationBarCompat;
import com.android.systemui.shared.system.QuickStepContract;
public class KeyButtonView extends ImageView implements ButtonInterface {
private static final String TAG = KeyButtonView.class.getSimpleName();
@@ -244,11 +244,11 @@ public class KeyButtonView extends ImageView implements ButtonInterface {
y = (int)ev.getRawY();
boolean exceededTouchSlopX = Math.abs(x - mTouchDownX) > (mIsVertical
? NavigationBarCompat.getQuickScrubTouchSlopPx()
: NavigationBarCompat.getQuickStepTouchSlopPx());
? QuickStepContract.getQuickScrubTouchSlopPx()
: QuickStepContract.getQuickStepTouchSlopPx());
boolean exceededTouchSlopY = Math.abs(y - mTouchDownY) > (mIsVertical
? NavigationBarCompat.getQuickStepTouchSlopPx()
: NavigationBarCompat.getQuickScrubTouchSlopPx());
? QuickStepContract.getQuickStepTouchSlopPx()
: QuickStepContract.getQuickScrubTouchSlopPx());
if (exceededTouchSlopX || exceededTouchSlopY) {
// When quick step is enabled, prevent animating the ripple triggered by
// setPressed and decide to run it on touch up