Merge "Disable chips in qt_dev" into ub-launcher3-qt-dev
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
index a662d74..8436fe5 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
@@ -32,7 +32,8 @@
public class BackgroundAppState extends OverviewState {
private static final int STATE_FLAGS =
- FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_DISABLE_ACCESSIBILITY;
+ FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_DISABLE_ACCESSIBILITY
+ | FLAG_DISABLE_INTERACTION;
public BackgroundAppState(int id) {
this(id, LauncherLogProto.ContainerType.TASKSWITCHER);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
index cc4a1e0..c7aaa9b 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -647,6 +647,9 @@
}
private void buildAnimationController() {
+ if (mStateCallback.hasStates(STATE_GESTURE_COMPLETED)) {
+ return;
+ }
initTransitionEndpoints(mActivity.getDeviceProfile());
mAnimationFactory.createActivityController(mTransitionDragLength);
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java
index bf276e1..837423a 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java
@@ -62,6 +62,10 @@
private static final String TAG = "AssistantTouchConsumer";
private static final long RETRACT_ANIMATION_DURATION_MS = 300;
+ // From //java/com/google/android/apps/gsa/search/shared/util/OpaContract.java.
+ private static final String OPA_BUNDLE_TRIGGER = "triggered_by";
+ // From //java/com/google/android/apps/gsa/assistant/shared/proto/opa_trigger.proto.
+ private static final int OPA_BUNDLE_TRIGGER_DIAG_SWIPE_GESTURE = 83;
private static final String INVOCATION_TYPE_KEY = "invocation_type";
private static final int INVOCATION_TYPE_GESTURE = 1;
private static final int INVOCATION_TYPE_FLING = 6;
@@ -230,6 +234,7 @@
startAssistantInternal(SWIPE);
Bundle args = new Bundle();
+ args.putInt(OPA_BUNDLE_TRIGGER, OPA_BUNDLE_TRIGGER_DIAG_SWIPE_GESTURE);
args.putInt(INVOCATION_TYPE_KEY, INVOCATION_TYPE_GESTURE);
mSysUiProxy.startAssistant(args);
mLaunchedAssistant = true;
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index ed0b90f..855535b 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -277,6 +277,7 @@
final Handler mHandler = new Handler();
private final Runnable mHandleDeferredResume = this::handleDeferredResume;
+ private boolean mDeferredResumePending;
private float mCurrentAssistantVisibility = 0f;
@@ -889,26 +890,40 @@
}
private void handleDeferredResume() {
- if (hasBeenResumed()) {
+ if (hasBeenResumed() && !mStateManager.getState().disableInteraction) {
getUserEventDispatcher().logActionCommand(Action.Command.RESUME,
mStateManager.getState().containerType, -1);
getUserEventDispatcher().startSession();
UiFactory.onLauncherStateOrResumeChanged(this);
AppLaunchTracker.INSTANCE.get(this).onReturnedToHome();
- resetPendingActivityResultIfNeeded();
- }
- }
- private void resetPendingActivityResultIfNeeded() {
- if (hasBeenResumed() && mPendingActivityRequestCode != -1 && isInState(NORMAL)) {
- UiFactory.resetPendingActivityResults(this, mPendingActivityRequestCode);
+ // Process any items that were added while Launcher was away.
+ InstallShortcutReceiver.disableAndFlushInstallQueue(
+ InstallShortcutReceiver.FLAG_ACTIVITY_PAUSED, this);
+
+ // Refresh shortcuts if the permission changed.
+ mModel.refreshShortcutsIfRequired();
+
+ DiscoveryBounce.showForHomeIfNeeded(this);
+
+ if (mPendingActivityRequestCode != -1 && isInState(NORMAL)) {
+ UiFactory.resetPendingActivityResults(this, mPendingActivityRequestCode);
+ }
+ mDeferredResumePending = false;
+ } else {
+ mDeferredResumePending = true;
}
}
protected void onStateSet(LauncherState state) {
getAppWidgetHost().setResumed(state == LauncherState.NORMAL);
- resetPendingActivityResultIfNeeded();
+ if (mDeferredResumePending) {
+ handleDeferredResume();
+ }
+ if (mLauncherCallbacks != null) {
+ mLauncherCallbacks.onStateChanged();
+ }
}
@Override
@@ -922,14 +937,7 @@
Utilities.postAsyncCallback(mHandler, mHandleDeferredResume);
setOnResumeCallback(null);
- // Process any items that were added while Launcher was away.
- InstallShortcutReceiver.disableAndFlushInstallQueue(
- InstallShortcutReceiver.FLAG_ACTIVITY_PAUSED, this);
- // Refresh shortcuts if the permission changed.
- mModel.refreshShortcutsIfRequired();
-
- DiscoveryBounce.showForHomeIfNeeded(this);
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onResume();
}
diff --git a/src/com/android/launcher3/LauncherCallbacks.java b/src/com/android/launcher3/LauncherCallbacks.java
index edac516..dfe75ec 100644
--- a/src/com/android/launcher3/LauncherCallbacks.java
+++ b/src/com/android/launcher3/LauncherCallbacks.java
@@ -21,7 +21,6 @@
import java.io.FileDescriptor;
import java.io.PrintWriter;
-import java.util.ArrayList;
/**
* LauncherCallbacks is an interface used to extend the Launcher activity. It includes many hooks
@@ -53,6 +52,11 @@
boolean handleBackPressed();
void onTrimMemory(int level);
+ /**
+ * Called when the launcher state changed
+ */
+ default void onStateChanged() { }
+
/*
* Extension points for providing custom behavior on certain user interactions.
*/
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java
index 3edd838..fe6b522 100644
--- a/src/com/android/launcher3/LauncherStateManager.java
+++ b/src/com/android/launcher3/LauncherStateManager.java
@@ -40,6 +40,7 @@
import android.animation.AnimatorSet;
import android.os.Handler;
import android.os.Looper;
+import android.util.Log;
import androidx.annotation.IntDef;
@@ -474,6 +475,11 @@
// Only change the stable states after the transitions have finished
if (state != mCurrentStableState) {
mLastStableState = state.getHistoryForState(mCurrentStableState);
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG,
+ "mCurrentStableState = " + state.getClass().getSimpleName() + " @ " +
+ android.util.Log.getStackTraceString(new Throwable()));
+ }
mCurrentStableState = state;
}
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index a7f89d9..c62fc3d 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -14,6 +14,7 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
+import android.util.Log;
import android.util.Property;
import android.view.animation.Interpolator;
@@ -29,6 +30,7 @@
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.SpringObjectAnimator;
import com.android.launcher3.anim.PropertySetter;
+import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ScrimView;
@@ -162,6 +164,10 @@
@Override
public void setStateWithAnimation(LauncherState toState,
AnimatorSetBuilder builder, AnimationConfig config) {
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG,
+ "setStateWithAnimation " + toState.getClass().getSimpleName());
+ }
float targetProgress = toState.getVerticalProgress(mLauncher);
if (Float.compare(mProgress, targetProgress) == 0) {
setAlphas(toState, config, builder);
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index b35e23c..6ba015b 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -130,16 +130,6 @@
return mDragController.dispatchKeyEvent(event) || super.dispatchKeyEvent(event);
}
- @Override
- protected boolean findActiveController(MotionEvent ev) {
- if (mActivity.getStateManager().getState().disableInteraction) {
- // You Shall Not Pass!!!
- mActiveController = null;
- return true;
- }
- return super.findActiveController(ev);
- }
-
private boolean isEventOverAccessibleDropTargetBar(MotionEvent ev) {
return isInAccessibleDrag() && isEventOverView(mActivity.getDropTargetBar(), ev);
}
diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
index 9703aa6..4e5f7a5 100644
--- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
+++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
@@ -31,6 +31,7 @@
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.os.SystemClock;
+import android.util.Log;
import android.view.HapticFeedbackConstants;
import android.view.MotionEvent;
@@ -118,6 +119,9 @@
@Override
public final boolean onControllerInterceptTouchEvent(MotionEvent ev) {
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "onControllerInterceptTouchEvent 1 " + ev);
+ }
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
mNoIntercept = !canInterceptTouch(ev);
if (mNoIntercept) {
@@ -147,6 +151,9 @@
return false;
}
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "onControllerInterceptTouchEvent 2 ");
+ }
onControllerTouchEvent(ev);
return mDetector.isDraggingOrSettling();
}
@@ -234,6 +241,9 @@
@Override
public void onDragStart(boolean start) {
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "onDragStart 1 " + start);
+ }
mStartState = mLauncher.getStateManager().getState();
if (mStartState == ALL_APPS) {
mStartContainerType = LauncherLogProto.ContainerType.ALLAPPS;
@@ -243,6 +253,9 @@
mStartContainerType = LauncherLogProto.ContainerType.TASKSWITCHER;
}
if (mCurrentAnimation == null) {
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "onDragStart 2");
+ }
mFromState = mStartState;
mToState = null;
cancelAnimationControllers();
@@ -552,6 +565,9 @@
}
private void cancelAnimationControllers() {
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "cancelAnimationControllers");
+ }
mCurrentAnimation = null;
cancelAtomicComponentsController();
mDetector.finishedScrolling();
diff --git a/src/com/android/launcher3/touch/SwipeDetector.java b/src/com/android/launcher3/touch/SwipeDetector.java
index 4616e58..3d45404 100644
--- a/src/com/android/launcher3/touch/SwipeDetector.java
+++ b/src/com/android/launcher3/touch/SwipeDetector.java
@@ -158,6 +158,9 @@
// SETTLING -> (View settled) -> IDLE
private void setState(ScrollState newState) {
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "setState -- start: " + newState);
+ }
if (DBG) {
Log.d(TAG, "setState:" + mState + "->" + newState);
}
@@ -165,6 +168,9 @@
if (newState == ScrollState.DRAGGING) {
initializeDragging();
if (mState == ScrollState.IDLE) {
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "setState -- 1: " + newState);
+ }
reportDragStart(false /* recatch */);
} else if (mState == ScrollState.SETTLING) {
reportDragStart(true /* recatch */);
@@ -318,9 +324,15 @@
break;
}
mDisplacement = mDir.getDisplacement(ev, pointerIndex, mDownPos, mIsRtl);
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "onTouchEvent 1");
+ }
// handle state and listener calls.
if (mState != ScrollState.DRAGGING && shouldScrollStart(ev, pointerIndex)) {
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.NO_ALLAPPS_EVENT_TAG, "onTouchEvent 2");
+ }
setState(ScrollState.DRAGGING);
}
if (mState == ScrollState.DRAGGING) {
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 443bc1a..e45fca8 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -257,6 +257,7 @@
}
private void fail(String message) {
+ log("Hierarchy dump for: " + getContextDescription() + message);
dumpViewHierarchy();
Assert.fail("http://go/tapl : " + getContextDescription() + message);
}