Support individual lock task features

- If screen pinning is enabled, disable gestures and wrap with input
  consumer to break out of screen pinning (existing logic)
- If Home & Overview are both disabled, disable gestures completely
- If only Home is disabled, then always launch the user into fallback
  recents (to simplify logic around breaking out of overview into Home)
- If only Overview is disabled, then prevent swiping from going into
  overview or from triggering overview from home
- Switch to using screen pinning flag check instead of binder call

Bug: 133113732
Bug: 131698989

Change-Id: Ie6f447520d4cc3fa1eaaf8427ee014851688bf37
This commit is contained in:
Winson Chung committed 2019-05-23 14:33:05 -07:00
1 parent 9e26fccacc
commit dd71ca0437
7 files changed
+96 -38

No files matched your search

@@ -26,6 +26,7 @@ import static com.android.launcher3.anim.Interpolators.ACCEL;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.config.FeatureFlags.QUICKSTEP_SPRINGS;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
@@ -46,9 +47,11 @@ import com.android.launcher3.touch.SwipeDetector;
import com.android.launcher3.uioverrides.states.OverviewState;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.OverviewInteractionState;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.TouchInteractionService;
import com.android.quickstep.util.LayoutUtils;
import com.android.systemui.shared.system.QuickStepContract;
/**
* Touch controller for handling various state transitions in portrait UI.
@@ -135,7 +138,10 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
} else if (fromState == OVERVIEW) {
return isDragTowardPositive ? ALL_APPS : NORMAL;
} else if (fromState == NORMAL && isDragTowardPositive) {
int stateFlags = OverviewInteractionState.INSTANCE.get(mLauncher)
.getSystemUiStateFlags();
return mAllowDragToOverview && TouchInteractionService.isConnected()
&& (stateFlags & SYSUI_STATE_OVERVIEW_DISABLED) == 0
? OVERVIEW : ALL_APPS;
}
return fromState;
@@ -22,6 +22,7 @@ import static android.content.Intent.ACTION_PACKAGE_REMOVED;
import static com.android.launcher3.util.PackageManagerHelper.getPackageFilter;
import static com.android.systemui.shared.system.PackageManagerWrapper.ACTION_PREFERRED_ACTIVITY_CHANGED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -32,6 +33,7 @@ import android.content.pm.ResolveInfo;
import com.android.systemui.shared.system.PackageManagerWrapper;
import com.android.systemui.shared.system.QuickStepContract;
import java.util.ArrayList;
/**
@@ -56,6 +58,7 @@ public final class OverviewComponentObserver {
private String mUpdateRegisteredPackage;
private ActivityControlHelper mActivityControlHelper;
private Intent mOverviewIntent;
private int mSystemUiStateFlags;
public OverviewComponentObserver(Context context) {
mContext = context;
@@ -71,6 +74,15 @@ public final class OverviewComponentObserver {
updateOverviewTargets();
}
public void onSystemUiStateChanged(int stateFlags) {
boolean homeDisabledChanged = (mSystemUiStateFlags & SYSUI_STATE_HOME_DISABLED)
!= (stateFlags & SYSUI_STATE_HOME_DISABLED);
mSystemUiStateFlags = stateFlags;
if (homeDisabledChanged) {
updateOverviewTargets();
}
}
/**
* Update overview intent and {@link ActivityControlHelper} based off the current launcher home
* component.
@@ -81,7 +93,8 @@ public final class OverviewComponentObserver {
final String overviewIntentCategory;
ComponentName overviewComponent;
if (defaultHome == null || mMyHomeComponent.equals(defaultHome)) {
if ((mSystemUiStateFlags & SYSUI_STATE_HOME_DISABLED) == 0 &&
(defaultHome == null || mMyHomeComponent.equals(defaultHome))) {
// User default home is same as out home app. Use Overview integrated in Launcher.
overviewComponent = mMyHomeComponent;
mActivityControlHelper = new LauncherActivityControllerHelper();
@@ -53,6 +53,8 @@ public class OverviewInteractionState {
private ISystemUiProxy mISystemUiProxy;
private float mBackButtonAlpha = 1;
private int mSystemUiStateFlags;
private OverviewInteractionState(Context context) {
mContext = context;
@@ -83,6 +85,14 @@ public class OverviewInteractionState {
mBgHandler.obtainMessage(MSG_SET_PROXY, proxy).sendToTarget();
}
public void setSystemUiStateFlags(int stateFlags) {
mSystemUiStateFlags = stateFlags;
}
public int getSystemUiStateFlags() {
return mSystemUiStateFlags;
}
private boolean handleUiMessage(Message msg) {
if (msg.what == MSG_SET_BACK_BUTTON_ALPHA) {
mBackButtonAlpha = (float) msg.obj;