Merge "Checking for success of interactions with Wellbeing" into ub-launcher3-rvc-dev
diff --git a/protos/launcher_atom.proto b/protos/launcher_atom.proto
index 5f5fab0..d552daf 100644
--- a/protos/launcher_atom.proto
+++ b/protos/launcher_atom.proto
@@ -51,6 +51,7 @@
WidgetsContainer widgets_container = 5;
PredictionContainer prediction_container = 6;
SearchResultContainer search_result_container = 7;
+ ShortcutsContainer shortcuts_container = 8;
}
}
@@ -69,6 +70,11 @@
message SearchResultContainer {
}
+// Container for package specific shortcuts to deep links and notifications.
+// Typically shown as popup window by longpressing on an icon.
+message ShortcutsContainer {
+}
+
enum Origin {
UNKNOWN = 0;
DEFAULT_LAYOUT = 1; // icon automatically placed in workspace, folder, hotseat
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
index 2ae90a5..39bbfb9 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
@@ -116,7 +116,7 @@
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.PAUSE_NOT_DETECTED,
"NavBarToHomeTouchController.canInterceptTouch true 2 "
- + AbstractFloatingView.getTopOpenView(mLauncher));
+ + AbstractFloatingView.getTopOpenView(mLauncher), new Exception());
}
return true;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java
index 46799ff..92e10b1 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java
@@ -29,6 +29,7 @@
import static com.android.quickstep.GestureState.GestureEndTarget.NEW_TASK;
import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS;
import static com.android.quickstep.GestureState.STATE_END_TARGET_ANIMATION_FINISHED;
+import static com.android.quickstep.GestureState.STATE_END_TARGET_SET;
import static com.android.quickstep.GestureState.STATE_RECENTS_SCROLLING_FINISHED;
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS;
@@ -253,6 +254,10 @@
mStateCallback.runOnceAtState(STATE_HANDLER_INVALIDATED | STATE_RESUME_LAST_TASK,
this::notifyTransitionCancelled);
+ mGestureState.runOnceAtState(STATE_END_TARGET_SET,
+ () -> mDeviceState.onEndTargetCalculated(mGestureState.getEndTarget(),
+ mActivityInterface));
+
if (!ENABLE_QUICKSTEP_LIVE_TILE.get()) {
mStateCallback.addChangeListener(STATE_APP_CONTROLLER_RECEIVED | STATE_LAUNCHER_PRESENT
| STATE_SCREENSHOT_VIEW_SHOWN | STATE_CAPTURE_SCREENSHOT,
@@ -1035,7 +1040,7 @@
}
// Make sure recents is in its final state
maybeUpdateRecentsAttachedState(false);
- mActivityInterface.onSwipeUpToHomeComplete();
+ mActivityInterface.onSwipeUpToHomeComplete(mDeviceState);
}
});
return anim;
@@ -1232,7 +1237,6 @@
}
ActiveGestureLog.INSTANCE.addLog("finishRecentsAnimation", true);
doLogGesture(HOME);
- mDeviceState.enableMultipleRegions(false);
}
protected abstract void finishRecentsControllerToHome(Runnable callback);
@@ -1248,7 +1252,6 @@
SystemUiProxy.INSTANCE.get(mContext).onOverviewShown(false, TAG);
doLogGesture(RECENTS);
- mDeviceState.onSwipeUpToOverview(mActivityInterface);
reset();
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java
index c9ff884..70be3ab 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java
@@ -69,7 +69,7 @@
/** 4 */
@Override
- public void onSwipeUpToHomeComplete() {
+ public void onSwipeUpToHomeComplete(RecentsAnimationDeviceState deviceState) {
onSwipeUpToRecentsComplete();
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java
index 13b84e0..62eb235 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java
@@ -96,7 +96,7 @@
}
@Override
- public void onSwipeUpToHomeComplete() {
+ public void onSwipeUpToHomeComplete(RecentsAnimationDeviceState deviceState) {
Launcher launcher = getCreatedActivity();
if (launcher == null) {
return;
@@ -105,6 +105,7 @@
// recents, we assume the first task is invisible, making translation off by one task.
launcher.getStateManager().reapplyState();
launcher.getRootView().setForceHideBackArrow(false);
+ notifyRecentsOfOrientation(deviceState);
}
@Override
@@ -235,17 +236,20 @@
// Are we going from Recents to Workspace?
if (toState == LauncherState.NORMAL) {
exitRunnable.run();
-
- // reset layout on swipe to home
- RecentsView recentsView = getCreatedActivity().getOverviewPanel();
- recentsView.setLayoutRotation(deviceState.getCurrentActiveRotation(),
- deviceState.getDisplayRotation());
+ notifyRecentsOfOrientation(deviceState);
stateManager.removeStateListener(this);
}
}
});
}
+ private void notifyRecentsOfOrientation(RecentsAnimationDeviceState deviceState) {
+ // reset layout on swipe to home
+ RecentsView recentsView = getCreatedActivity().getOverviewPanel();
+ recentsView.setLayoutRotation(deviceState.getCurrentActiveRotation(),
+ deviceState.getDisplayRotation());
+ }
+
@Override
public Rect getOverviewWindowBounds(Rect homeBounds, RemoteAnimationTargetCompat target) {
return homeBounds;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java
index 0d49b2b..a28dabc 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java
@@ -79,12 +79,13 @@
@Override
protected Activity getCurrentActivity() {
- OverviewComponentObserver observer = new OverviewComponentObserver(mContext,
- new RecentsAnimationDeviceState(mContext));
+ RecentsAnimationDeviceState rads = new RecentsAnimationDeviceState(mContext);
+ OverviewComponentObserver observer = new OverviewComponentObserver(mContext, rads);
try {
return observer.getActivityInterface().getCreatedActivity();
} finally {
observer.onDestroy();
+ rads.destroy();
}
}
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 4954588..22e689f 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -81,6 +81,7 @@
import com.android.quickstep.inputconsumers.OverviewWithoutFocusInputConsumer;
import com.android.quickstep.inputconsumers.ResetGestureInputConsumer;
import com.android.quickstep.inputconsumers.ScreenPinnedInputConsumer;
+import com.android.quickstep.inputconsumers.SysUiOverlayInputConsumer;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.util.AssistantUtilities;
import com.android.quickstep.util.ProtoTracer;
@@ -588,6 +589,13 @@
}
}
+ // If Bubbles is expanded, use the overlay input consumer, which will close Bubbles
+ // instead of going all the way home when a swipe up is detected.
+ if (mDeviceState.isBubblesExpanded()) {
+ base = new SysUiOverlayInputConsumer(
+ getBaseContext(), mDeviceState, mInputMonitorCompat);
+ }
+
if (mDeviceState.isScreenPinningActive()) {
// Note: we only allow accessibility to wrap this, and it replaces the previous
// base input consumer (which should be NO_OP anyway since topTaskLocked == true).
@@ -613,7 +621,7 @@
if (!isFixedRotationTransformEnabled()) {
return;
}
- mDeviceState.enableMultipleRegions(baseInputConsumer instanceof OtherActivityInputConsumer);
+ baseInputConsumer.notifyOrientationSetup();
}
private InputConsumer newBaseConsumer(GestureState previousGestureState,
@@ -725,12 +733,13 @@
if (!mDeviceState.isUserUnlocked()) {
return;
}
+
if (mDeviceState.isButtonNavMode() && !mOverviewComponentObserver.isHomeAndOverviewSame()) {
// Prevent the overview from being started before the real home on first boot.
return;
}
- if (RestoreDbTask.isPending(this)) {
+ if (RestoreDbTask.isPending(this) || !mDeviceState.isUserSetupComplete()) {
// Preloading while a restore is pending may cause launcher to start the restore
// too early.
return;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
index 8b08ea7..14215a1 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
@@ -404,6 +404,11 @@
}
@Override
+ public void notifyOrientationSetup() {
+ mDeviceState.onStartGesture();
+ }
+
+ @Override
public void onConsumerAboutToBeSwitched() {
Preconditions.assertUIThread();
mMainThreadHandler.removeCallbacks(mCancelRecentsAnimationRunnable);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/SysUiOverlayInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/SysUiOverlayInputConsumer.java
new file mode 100644
index 0000000..3f833c0
--- /dev/null
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/SysUiOverlayInputConsumer.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2020 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.quickstep.inputconsumers;
+
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.PointF;
+import android.view.MotionEvent;
+
+import com.android.launcher3.testing.TestLogging;
+import com.android.launcher3.testing.TestProtocol;
+import com.android.quickstep.InputConsumer;
+import com.android.quickstep.RecentsAnimationDeviceState;
+import com.android.quickstep.util.TriggerSwipeUpTouchTracker;
+import com.android.systemui.shared.system.InputMonitorCompat;
+
+/**
+ * Input consumer used when a fullscreen System UI overlay is showing (such as the expanded Bubbles
+ * UI).
+ *
+ * This responds to swipes up by sending a closeSystemDialogs broadcast (causing overlays to close)
+ * rather than closing the app behind the overlay and sending the user all the way home.
+ */
+public class SysUiOverlayInputConsumer implements InputConsumer,
+ TriggerSwipeUpTouchTracker.OnSwipeUpListener {
+
+ private final Context mContext;
+ private final InputMonitorCompat mInputMonitor;
+ private final TriggerSwipeUpTouchTracker mTriggerSwipeUpTracker;
+
+ public SysUiOverlayInputConsumer(
+ Context context,
+ RecentsAnimationDeviceState deviceState,
+ InputMonitorCompat inputMonitor) {
+ mContext = context;
+ mInputMonitor = inputMonitor;
+ mTriggerSwipeUpTracker = new TriggerSwipeUpTouchTracker(context, true,
+ deviceState.getNavBarPosition(), this::onInterceptTouch, this);
+ }
+
+ @Override
+ public int getType() {
+ return TYPE_SYSUI_OVERLAY;
+ }
+
+ @Override
+ public boolean allowInterceptByParent() {
+ return !mTriggerSwipeUpTracker.interceptedTouch();
+ }
+
+ @Override
+ public void onMotionEvent(MotionEvent ev) {
+ mTriggerSwipeUpTracker.onMotionEvent(ev);
+ }
+
+ private void onInterceptTouch() {
+ if (mInputMonitor != null) {
+ TestLogging.recordEvent(TestProtocol.SEQUENCE_PILFER, "pilferPointers");
+ mInputMonitor.pilferPointers();
+ }
+ }
+
+ @Override
+ public void onSwipeUp(boolean wasFling, PointF finalVelocity) {
+ // Close system dialogs when a swipe up is detected.
+ mContext.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
+ }
+
+ @Override
+ public void onSwipeUpCancelled() {
+
+ }
+}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index a506b7e..324aaec 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -1039,6 +1039,11 @@
}
private void animateRecentsRotationInPlace(int newRotation) {
+ if (mOrientationState.canLauncherRotate()) {
+ // Update the rotation but let system take care of the rotation animation
+ setLayoutRotation(newRotation, mOrientationState.getDisplayRotation());
+ return;
+ }
AnimatorSet pa = setRecentsChangedOrientation(true);
pa.addListener(AnimationSuccessListener.forRunnable(() -> {
setLayoutRotation(newRotation, mOrientationState.getDisplayRotation());
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index 9124925..7122647 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -101,7 +101,7 @@
activity.getStateManager().reapplyState();
}
- public abstract void onSwipeUpToHomeComplete();
+ public abstract void onSwipeUpToHomeComplete(RecentsAnimationDeviceState deviceState);
public abstract void onAssistantVisibilityChanged(float visibility);
diff --git a/quickstep/src/com/android/quickstep/InputConsumer.java b/quickstep/src/com/android/quickstep/InputConsumer.java
index a4861dc..ec720d5 100644
--- a/quickstep/src/com/android/quickstep/InputConsumer.java
+++ b/quickstep/src/com/android/quickstep/InputConsumer.java
@@ -34,6 +34,7 @@
int TYPE_OVERVIEW_WITHOUT_FOCUS = 1 << 7;
int TYPE_RESET_GESTURE = 1 << 8;
int TYPE_OVERSCROLL = 1 << 9;
+ int TYPE_SYSUI_OVERLAY = 1 << 10;
String[] NAMES = new String[] {
"TYPE_NO_OP", // 0
@@ -46,6 +47,7 @@
"TYPE_OVERVIEW_WITHOUT_FOCUS", // 7
"TYPE_RESET_GESTURE", // 8
"TYPE_OVERSCROLL", // 9
+ "TYPE_SYSUI_OVERLAY" // 10
};
InputConsumer NO_OP = () -> TYPE_NO_OP;
@@ -70,6 +72,11 @@
}
/**
+ * Handle and specific setup necessary based on the orientation of the device
+ */
+ default void notifyOrientationSetup() {}
+
+ /**
* Returns the active input consumer is in the hierarchy of this input consumer.
*/
default InputConsumer getActiveConsumerInHierarchy() {
diff --git a/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java b/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java
index 4cf7aab..a976126 100644
--- a/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java
+++ b/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java
@@ -37,7 +37,6 @@
import com.android.launcher3.R;
import com.android.launcher3.ResourceUtils;
import com.android.launcher3.util.DefaultDisplay;
-import com.android.quickstep.util.RecentsOrientedState.SurfaceRotation;
import java.io.PrintWriter;
@@ -67,6 +66,14 @@
private boolean mEnableMultipleRegions;
private Resources mResources;
private OrientationRectF mLastRectTouched;
+ /**
+ * The rotation of the last touched nav bar. Derived from {@link #mLastRectTouched}, but has a
+ * longer lifetime than the rect. Note this is different than {@link #mQuickStepStartingRotation}
+ * as it always updates its value on every touch whereas mQuickstepStartingRotation only
+ * updates when device rotation matches touch rotation. Maybe this will be only one necessary
+ * after TODO(b/154580671) is in. TBD.
+ */
+ private int mLastRectRotation;
private SysUINavigationMode.Mode mMode;
private QuickStepContractInfo mContractInfo;
@@ -143,15 +150,18 @@
* ALSO, you BETTER call this with {@param enableMultipleRegions} set to false once you're done.
*
* @param enableMultipleRegions Set to true to start tracking multiple nav bar regions
- * @param info The current displayInfo
+ * @param info The current displayInfo which will be the start of the quickswitch gesture
*/
void enableMultipleRegions(boolean enableMultipleRegions, DefaultDisplay.Info info) {
mEnableMultipleRegions = enableMultipleRegions &&
mMode != SysUINavigationMode.Mode.TWO_BUTTONS;
- if (!enableMultipleRegions) {
+ if (mEnableMultipleRegions) {
+ mQuickStepStartingRotation = info.rotation;
+ } else {
+ mLastRectRotation = 0;
mQuickStepStartingRotation = QUICKSTEP_ROTATION_UNINITIALIZED;
- resetSwipeRegions(info);
}
+ resetSwipeRegions(info);
}
/**
@@ -243,11 +253,7 @@
}
int getCurrentActiveRotation() {
- if (mLastRectTouched == null) {
- return 0;
- } else {
- return mLastRectTouched.mRotation;
- }
+ return mLastRectRotation;
}
int getQuickStepStartingRotation() {
@@ -286,7 +292,9 @@
}
if (rect.applyTransform(event, false)) {
mLastRectTouched = rect;
- if (mCurrentDisplayRotation == mLastRectTouched.mRotation) {
+ mLastRectRotation = rect.mRotation;
+ if (mEnableMultipleRegions && mCurrentDisplayRotation == mLastRectRotation) {
+ // TODO(b/154580671) might make this block unnecessary
// Start a touch session for the default nav region for the display
mQuickStepStartingRotation = mLastRectTouched.mRotation;
resetSwipeRegions();
diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java
index 2d9c56f..70b4f20 100644
--- a/quickstep/src/com/android/quickstep/RecentTasksList.java
+++ b/quickstep/src/com/android/quickstep/RecentTasksList.java
@@ -40,21 +40,20 @@
/**
* Manages the recent task list from the system, caching it as necessary.
*/
-@TargetApi(Build.VERSION_CODES.P)
+@TargetApi(Build.VERSION_CODES.R)
public class RecentTasksList extends TaskStackChangeListener {
+ private static final TaskLoadResult INVALID_RESULT = new TaskLoadResult(-1, false, 0);
+
private final KeyguardManagerCompat mKeyguardManager;
private final LooperExecutor mMainThreadExecutor;
private final ActivityManagerWrapper mActivityManagerWrapper;
// The list change id, increments as the task list changes in the system
private int mChangeId;
- // The last change id when the list was last loaded completely, must be <= the list change id
- private int mLastLoadedId;
- // The last change id was loaded with keysOnly = true
- private boolean mLastLoadHadKeysOnly;
- ArrayList<Task> mTasks = new ArrayList<>();
+ private TaskLoadResult mResultsBg = INVALID_RESULT;
+ private TaskLoadResult mResultsUi = INVALID_RESULT;
public RecentTasksList(LooperExecutor mainThreadExecutor,
KeyguardManagerCompat keyguardManager, ActivityManagerWrapper activityManagerWrapper) {
@@ -71,7 +70,7 @@
public void getTaskKeys(int numTasks, Consumer<ArrayList<Task>> callback) {
// Kick off task loading in the background
UI_HELPER_EXECUTOR.execute(() -> {
- ArrayList<Task> tasks = loadTasksInBackground(numTasks, true /* loadKeysOnly */);
+ ArrayList<Task> tasks = loadTasksInBackground(numTasks, -1, true /* loadKeysOnly */);
mMainThreadExecutor.execute(() -> callback.accept(tasks));
});
}
@@ -85,26 +84,30 @@
*/
public synchronized int getTasks(boolean loadKeysOnly, Consumer<ArrayList<Task>> callback) {
final int requestLoadId = mChangeId;
- Runnable resultCallback = callback == null
- ? () -> { }
- : () -> callback.accept(copyOf(mTasks));
-
- if (mLastLoadedId == mChangeId && (!mLastLoadHadKeysOnly || loadKeysOnly)) {
+ if (mResultsUi.isValidForRequest(requestLoadId, loadKeysOnly)) {
// The list is up to date, send the callback on the next frame,
// so that requestID can be returned first.
- mMainThreadExecutor.post(resultCallback);
+ if (callback != null) {
+ // Copy synchronously as the changeId might change by next frame
+ ArrayList<Task> result = copyOf(mResultsUi);
+ mMainThreadExecutor.post(() -> callback.accept(result));
+ }
+
return requestLoadId;
}
// Kick off task loading in the background
UI_HELPER_EXECUTOR.execute(() -> {
- ArrayList<Task> tasks = loadTasksInBackground(Integer.MAX_VALUE, loadKeysOnly);
-
+ if (!mResultsBg.isValidForRequest(requestLoadId, loadKeysOnly)) {
+ mResultsBg = loadTasksInBackground(Integer.MAX_VALUE, requestLoadId, loadKeysOnly);
+ }
+ TaskLoadResult loadResult = mResultsBg;
mMainThreadExecutor.execute(() -> {
- mTasks = tasks;
- mLastLoadedId = requestLoadId;
- mLastLoadHadKeysOnly = loadKeysOnly;
- resultCallback.run();
+ mResultsUi = loadResult;
+ if (callback != null) {
+ ArrayList<Task> result = copyOf(mResultsUi);
+ callback.accept(result);
+ }
});
});
@@ -119,8 +122,8 @@
}
@Override
- public synchronized void onTaskStackChanged() {
- mChangeId++;
+ public void onTaskStackChanged() {
+ invalidateLoadedTasks();
}
@Override
@@ -131,22 +134,28 @@
// callback (those are for changes to the active tasks), but the task list is still updated,
// so we should also invalidate the change id to ensure we load a new list instead of
// reusing a stale list.
- mChangeId++;
+ invalidateLoadedTasks();
}
@Override
public void onTaskRemoved(int taskId) {
- mTasks = loadTasksInBackground(Integer.MAX_VALUE, false);
+ invalidateLoadedTasks();
}
+
@Override
- public synchronized void onActivityPinned(String packageName, int userId, int taskId,
- int stackId) {
- mChangeId++;
+ public void onActivityPinned(String packageName, int userId, int taskId, int stackId) {
+ invalidateLoadedTasks();
}
@Override
public synchronized void onActivityUnpinned() {
+ invalidateLoadedTasks();
+ }
+
+ private synchronized void invalidateLoadedTasks() {
+ UI_HELPER_EXECUTOR.execute(() -> mResultsBg = INVALID_RESULT);
+ mResultsUi = INVALID_RESULT;
mChangeId++;
}
@@ -154,9 +163,8 @@
* Loads and creates a list of all the recent tasks.
*/
@VisibleForTesting
- ArrayList<Task> loadTasksInBackground(int numTasks, boolean loadKeysOnly) {
+ TaskLoadResult loadTasksInBackground(int numTasks, int requestId, boolean loadKeysOnly) {
int currentUserId = Process.myUserHandle().getIdentifier();
- ArrayList<Task> allTasks = new ArrayList<>();
List<ActivityManager.RecentTaskInfo> rawTasks =
mActivityManagerWrapper.getRecentTasks(numTasks, currentUserId);
// The raw tasks are given in most-recent to least-recent order, we need to reverse it
@@ -173,6 +181,7 @@
}
};
+ TaskLoadResult allTasks = new TaskLoadResult(requestId, loadKeysOnly, rawTasks.size());
for (ActivityManager.RecentTaskInfo rawTask : rawTasks) {
Task.TaskKey taskKey = new Task.TaskKey(rawTask);
Task task;
@@ -197,4 +206,22 @@
}
return newTasks;
}
+
+ private static class TaskLoadResult extends ArrayList<Task> {
+
+ final int mId;
+
+ // If the result was loaded with keysOnly = true
+ final boolean mKeysOnly;
+
+ TaskLoadResult(int id, boolean keysOnly, int size) {
+ super(size);
+ mId = id;
+ mKeysOnly = keysOnly;
+ }
+
+ boolean isValidForRequest(int requestId, boolean loadKeysOnly) {
+ return mId == requestId && (!mKeysOnly || loadKeysOnly);
+ }
+ }
}
\ No newline at end of file
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
index 6e7c423..7f9a8bd 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
@@ -18,6 +18,7 @@
import static android.content.Intent.ACTION_USER_UNLOCKED;
import static com.android.launcher3.util.DefaultDisplay.CHANGE_ALL;
+import static com.android.launcher3.util.DefaultDisplay.CHANGE_FRAME_DELAY;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
import static com.android.quickstep.SysUINavigationMode.Mode.THREE_BUTTONS;
@@ -44,6 +45,7 @@
import android.graphics.Region;
import android.os.Process;
import android.os.UserManager;
+import android.provider.Settings;
import android.text.TextUtils;
import android.view.MotionEvent;
@@ -52,6 +54,7 @@
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.DefaultDisplay;
+import com.android.launcher3.util.SecureSettingsObserver;
import com.android.quickstep.SysUINavigationMode.NavigationModeChangeListener;
import com.android.quickstep.util.NavBarPosition;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -103,7 +106,8 @@
private TaskStackChangeListener mFrozenTaskListener = new TaskStackChangeListener() {
@Override
public void onRecentTaskListFrozenChanged(boolean frozen) {
- if (frozen) {
+ mTaskListFrozen = frozen;
+ if (frozen || mInOverview) {
return;
}
enableMultipleRegions(false);
@@ -124,6 +128,9 @@
* TODO: (b/156984037) For when user rotates after entering overview
*/
private boolean mInOverview;
+ private boolean mTaskListFrozen;
+
+ private boolean mIsUserSetupComplete;
public RecentsAnimationDeviceState(Context context) {
mContext = context;
@@ -175,6 +182,17 @@
ComponentName.unflattenFromString(blockingActivity));
}
}
+
+ SecureSettingsObserver userSetupObserver = new SecureSettingsObserver(
+ context.getContentResolver(),
+ e -> mIsUserSetupComplete = e,
+ Settings.Secure.USER_SETUP_COMPLETE,
+ 0);
+ mIsUserSetupComplete = userSetupObserver.getValue();
+ if (!mIsUserSetupComplete) {
+ userSetupObserver.register();
+ runOnDestroy(userSetupObserver::unregister);
+ }
}
private void setupOrientationSwipeHandler() {
@@ -243,7 +261,8 @@
@Override
public void onDisplayInfoChanged(DefaultDisplay.Info info, int flags) {
- if (info.id != getDisplayId()) {
+ if (info.id != getDisplayId() || (flags & CHANGE_FRAME_DELAY) == CHANGE_FRAME_DELAY) {
+ // ignore displays that aren't running launcher and frame refresh rate changes
return;
}
@@ -314,6 +333,13 @@
return mIsUserUnlocked;
}
+ /**
+ * @return whether the user has completed setup wizard
+ */
+ public boolean isUserSetupComplete() {
+ return mIsUserSetupComplete;
+ }
+
private void notifyUserUnlocked() {
for (Runnable action : mUserUnlockedActions) {
action.run();
@@ -360,7 +386,6 @@
return (mSystemUiStateFlags & SYSUI_STATE_NAV_BAR_HIDDEN) == 0
&& (mSystemUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) == 0
&& (mSystemUiStateFlags & SYSUI_STATE_QUICK_SETTINGS_EXPANDED) == 0
- && (mSystemUiStateFlags & SYSUI_STATE_BUBBLES_EXPANDED) == 0
&& ((mSystemUiStateFlags & SYSUI_STATE_HOME_DISABLED) == 0
|| (mSystemUiStateFlags & SYSUI_STATE_OVERVIEW_DISABLED) == 0);
}
@@ -381,6 +406,13 @@
}
/**
+ * @return whether the bubble stack is expanded
+ */
+ public boolean isBubblesExpanded() {
+ return (mSystemUiStateFlags & SYSUI_STATE_BUBBLES_EXPANDED) != 0;
+ }
+
+ /**
* @return whether lock-task mode is active
*/
public boolean isLockToAppActive() {
@@ -506,7 +538,7 @@
* *May* apply a transform on the motion event if it lies in the nav bar region for another
* orientation that is currently being tracked as a part of quickstep
*/
- public void setOrientationTransformIfNeeded(MotionEvent event) {
+ void setOrientationTransformIfNeeded(MotionEvent event) {
// negative coordinates bug b/143901881
if (event.getX() < 0 || event.getY() < 0) {
event.setLocation(Math.max(0, event.getX()), Math.max(0, event.getY()));
@@ -514,25 +546,54 @@
mOrientationTouchTransformer.transform(event);
}
- void onSwipeUpToOverview(BaseActivityInterface activityInterface) {
- mInOverview = true;
- activityInterface.onExitOverview(this, () -> {
- mInOverview = false;
- enableMultipleRegions(false);
- });
+ void enableMultipleRegions(boolean enable) {
+ mOrientationTouchTransformer.enableMultipleRegions(enable, mDefaultDisplay.getInfo());
+ notifySysuiForRotation(mOrientationTouchTransformer.getQuickStepStartingRotation());
}
- void enableMultipleRegions(boolean enable) {
- if (mInOverview) {
- return;
+ private void notifySysuiForRotation(int rotation) {
+ UI_HELPER_EXECUTOR.execute(() ->
+ SystemUiProxy.INSTANCE.get(mContext).onQuickSwitchToNewTask(rotation));
+ }
+
+ public void onStartGesture() {
+ if (mTaskListFrozen) {
+ // Prioritize whatever nav bar user touches once in quickstep
+ // This case is specifically when user changes what nav bar they are using mid
+ // quickswitch session before tasks list is unfrozen
+ notifySysuiForRotation(mOrientationTouchTransformer.getCurrentActiveRotation());
}
- mOrientationTouchTransformer.enableMultipleRegions(enable, mDefaultDisplay.getInfo());
- UI_HELPER_EXECUTOR.execute(() -> {
- int quickStepStartingRotation =
- mOrientationTouchTransformer.getQuickStepStartingRotation();
- SystemUiProxy.INSTANCE.get(mContext)
- .onQuickSwitchToNewTask(quickStepStartingRotation);
- });
+ }
+
+
+ void onEndTargetCalculated(GestureState.GestureEndTarget endTarget,
+ BaseActivityInterface activityInterface) {
+ if (endTarget == GestureState.GestureEndTarget.RECENTS) {
+ mInOverview = true;
+ if (!mTaskListFrozen) {
+ // If we're in landscape w/o ever quickswitching, show the navbar in landscape
+ enableMultipleRegions(true);
+ }
+ activityInterface.onExitOverview(this, () -> {
+ mInOverview = false;
+ enableMultipleRegions(false);
+ });
+ } else if (endTarget == GestureState.GestureEndTarget.HOME) {
+ enableMultipleRegions(false);
+ } else if (endTarget == GestureState.GestureEndTarget.NEW_TASK) {
+ if (mOrientationTouchTransformer.getQuickStepStartingRotation() == -1) {
+ // First gesture to start quickswitch
+ enableMultipleRegions(true);
+ } else {
+ notifySysuiForRotation(mOrientationTouchTransformer.getCurrentActiveRotation());
+ }
+ } else if (endTarget == GestureState.GestureEndTarget.LAST_TASK) {
+ if (!mTaskListFrozen) {
+ // touched nav bar but didn't go anywhere and not quickswitching, do nothing
+ return;
+ }
+ notifySysuiForRotation(mOrientationTouchTransformer.getCurrentActiveRotation());
+ }
}
public int getCurrentActiveRotation() {
diff --git a/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java
index 1113bc2..65f41a4 100644
--- a/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java
@@ -78,6 +78,7 @@
mViewSwipeUpAnimation = new ViewSwipeUpAnimation(mContext, deviceState,
new GestureState(observer, -1));
observer.onDestroy();
+ deviceState.destroy();
DeviceProfile dp = InvariantDeviceProfile.INSTANCE.get(mContext)
.getDeviceProfile(mContext)
diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
index 69812b6..d4d46fb 100644
--- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
+++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
@@ -65,10 +65,10 @@
}
/**
- * Logs a {@link LauncherEvent}.
+ * Logs a {@link EventEnum}.
*/
@Override
- public void log(LauncherEvent event) {
+ public void log(EventEnum event) {
log(event, DEFAULT_INSTANCE_ID, LauncherAtom.ItemInfo.getDefaultInstance());
}
@@ -76,7 +76,7 @@
* Logs an event and accompanying {@link InstanceId}.
*/
@Override
- public void log(LauncherEvent event, InstanceId instanceId) {
+ public void log(EventEnum event, InstanceId instanceId) {
log(event, instanceId, LauncherAtom.ItemInfo.getDefaultInstance());
}
@@ -84,7 +84,7 @@
* Logs an event and accompanying {@link ItemInfo}.
*/
@Override
- public void log(LauncherEvent event, @Nullable LauncherAtom.ItemInfo info) {
+ public void log(EventEnum event, @Nullable LauncherAtom.ItemInfo info) {
log(event, DEFAULT_INSTANCE_ID, info);
}
@@ -92,7 +92,7 @@
* Logs an event and accompanying {@link InstanceId} and {@link LauncherAtom.ItemInfo}.
*/
@Override
- public void log(LauncherEvent event, InstanceId instanceId,
+ public void log(EventEnum event, InstanceId instanceId,
@Nullable LauncherAtom.ItemInfo info) {
logInternal(event, instanceId, info,
LAUNCHER_UICHANGED__DST_STATE__HOME,
@@ -102,14 +102,17 @@
/**
* Logs an event and accompanying {@link InstanceId} and {@link LauncherAtom.ItemInfo}.
*/
- private void logInternal(LauncherEvent event, InstanceId instanceId,
+ private void logInternal(EventEnum event, InstanceId instanceId,
@Nullable LauncherAtom.ItemInfo info, int startState, int endState) {
info = info == null ? LauncherAtom.ItemInfo.getDefaultInstance() : info;
if (IS_VERBOSE) {
+ String name = (event instanceof LauncherEvent) ? ((LauncherEvent) event).name() :
+ event.getId() + "";
+
Log.d(TAG, instanceId == DEFAULT_INSTANCE_ID
- ? String.format("\n%s\n%s", event.name(), info)
- : String.format("%s(InstanceId:%s)\n%s", event.name(), instanceId, info));
+ ? String.format("\n%s\n%s", name, info)
+ : String.format("%s(InstanceId:%s)\n%s", name, instanceId, info));
}
if (!Utilities.ATLEAST_R) {
diff --git a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
index 5745990..498c232 100644
--- a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
+++ b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
@@ -208,7 +208,7 @@
mDisplayRotation = displayRotation;
mTouchRotation = touchRotation;
- if (mLauncherRotation == mTouchRotation) {
+ if (mLauncherRotation == mTouchRotation || canLauncherRotate()) {
mOrientationHandler = PagedOrientationHandler.HOME_ROTATED;
if (DEBUG) {
Log.d(TAG, "current RecentsOrientedState: " + this);
@@ -240,7 +240,7 @@
private void setFlag(int mask, boolean enabled) {
boolean wasRotationEnabled = !TestProtocol.sDisableSensorRotation
- && mFlags == VALUE_ROTATION_WATCHER_ENABLED;
+ && (mFlags & VALUE_ROTATION_WATCHER_ENABLED) == VALUE_ROTATION_WATCHER_ENABLED;
if (enabled) {
mFlags |= mask;
} else {
@@ -248,7 +248,7 @@
}
boolean isRotationEnabled = !TestProtocol.sDisableSensorRotation
- && mFlags == VALUE_ROTATION_WATCHER_ENABLED;
+ && (mFlags & VALUE_ROTATION_WATCHER_ENABLED) == VALUE_ROTATION_WATCHER_ENABLED;
if (wasRotationEnabled != isRotationEnabled) {
UI_HELPER_EXECUTOR.execute(() -> {
if (isRotationEnabled) {
diff --git a/quickstep/tests/src/com/android/quickstep/RecentTasksListTest.java b/quickstep/tests/src/com/android/quickstep/RecentTasksListTest.java
index 34eb7f8..79ddf7a 100644
--- a/quickstep/tests/src/com/android/quickstep/RecentTasksListTest.java
+++ b/quickstep/tests/src/com/android/quickstep/RecentTasksListTest.java
@@ -58,9 +58,9 @@
}
@Test
- public void onTaskRemoved_reloadsAllTasks() {
+ public void onTaskRemoved_doesNotFetchTasks() {
mRecentTasksList.onTaskRemoved(0);
- verify(mockActivityManagerWrapper, times(1))
+ verify(mockActivityManagerWrapper, times(0))
.getRecentTasks(anyInt(), anyInt());
}
@@ -77,7 +77,7 @@
when(mockActivityManagerWrapper.getRecentTasks(anyInt(), anyInt()))
.thenReturn(Collections.singletonList(recentTaskInfo));
- List<Task> taskList = mRecentTasksList.loadTasksInBackground(Integer.MAX_VALUE, true);
+ List<Task> taskList = mRecentTasksList.loadTasksInBackground(Integer.MAX_VALUE, -1, true);
assertEquals(1, taskList.size());
assertNull(taskList.get(0).taskDescription.getLabel());
@@ -91,7 +91,7 @@
when(mockActivityManagerWrapper.getRecentTasks(anyInt(), anyInt()))
.thenReturn(Collections.singletonList(recentTaskInfo));
- List<Task> taskList = mRecentTasksList.loadTasksInBackground(Integer.MAX_VALUE, false);
+ List<Task> taskList = mRecentTasksList.loadTasksInBackground(Integer.MAX_VALUE, -1, false);
assertEquals(1, taskList.size());
assertEquals(taskDescription, taskList.get(0).taskDescription.getLabel());
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 8951674..60abc66 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -200,7 +200,7 @@
DefaultDisplay.INSTANCE.get(context).getInfo(),
getPredefinedDeviceProfiles(context, gridName));
- Info myInfo = new Info(display);
+ Info myInfo = new Info(context, display);
DisplayOption myDisplayOption = invDistWeightedInterpolate(
myInfo, getPredefinedDeviceProfiles(context, gridName));
diff --git a/src/com/android/launcher3/LauncherSettings.java b/src/com/android/launcher3/LauncherSettings.java
index 6789072..2cb3910 100644
--- a/src/com/android/launcher3/LauncherSettings.java
+++ b/src/com/android/launcher3/LauncherSettings.java
@@ -154,9 +154,9 @@
public static final int CONTAINER_HOTSEAT_PREDICTION = -103;
public static final int CONTAINER_ALL_APPS = -104;
public static final int CONTAINER_WIDGETS_TRAY = -105;
-
// Represents search results view.
public static final int CONTAINER_SEARCH_RESULTS = -106;
+ public static final int CONTAINER_SHORTCUTS = -107;
public static final String containerToString(int container) {
switch (container) {
@@ -166,6 +166,7 @@
case CONTAINER_ALL_APPS: return "all_apps";
case CONTAINER_WIDGETS_TRAY: return "widgets_tray";
case CONTAINER_SEARCH_RESULTS: return "search_result";
+ case CONTAINER_SHORTCUTS: return "shortcuts";
default: return String.valueOf(container);
}
}
diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java
index 4c2c79d..dda39e8 100644
--- a/src/com/android/launcher3/logging/StatsLogManager.java
+++ b/src/com/android/launcher3/logging/StatsLogManager.java
@@ -32,7 +32,7 @@
*/
public class StatsLogManager implements ResourceBasedOverride {
- interface EventEnum {
+ public interface EventEnum {
int getId();
}
@@ -63,6 +63,18 @@
+ "new/same value.")
LAUNCHER_FOLDER_LABEL_UPDATED(460),
+ @UiEvent(doc = "User long pressed on the workspace empty space.")
+ LAUNCHER_WORKSPACE_LONGPRESS(461),
+
+ @UiEvent(doc = "User tapped or long pressed on a wallpaper icon inside launcher settings.")
+ LAUNCHER_WALLPAPER_BUTTON_TAP_OR_LONGPRESS(462),
+
+ @UiEvent(doc = "User tapped or long pressed on settings icon inside launcher settings.")
+ LAUNCHER_SETTINGS_BUTTON_TAP_OR_LONGPRESS(463),
+
+ @UiEvent(doc = "User tapped or long pressed on widget tray icon inside launcher settings.")
+ LAUNCHER_WIDGETSTRAY_BUTTON_TAP_OR_LONGPRESS(464),
+
@UiEvent(doc = "A dragged item is dropped on 'Remove' button in the target bar")
LAUNCHER_ITEM_DROPPED_ON_REMOVE(465),
@@ -82,7 +94,15 @@
@UiEvent(doc = "User cancelled uninstalling the package after dropping on "
+ "the icon onto 'Uninstall' button in the target bar")
- LAUNCHER_ITEM_UNINSTALL_CANCELLED(470);
+ LAUNCHER_ITEM_UNINSTALL_CANCELLED(470),
+
+ @UiEvent(doc = "User opened package specific widgets list by tapping on widgets system "
+ + "shortcut within longpress popup window.")
+ LAUNCHER_SYSTEM_SHORTCUT_WIDGETS_TAP(514),
+
+ @UiEvent(doc = "User opened app info of the package by tapping on appinfo system shortcut "
+ + "within longpress popup window.")
+ LAUNCHER_SYSTEM_SHORTCUT_APP_INFO_TAP(515);
// ADD MORE
private final int mId;
@@ -113,27 +133,27 @@
}
/**
- * Logs a {@link LauncherEvent}.
+ * Logs a {@link EventEnum}.
*/
- public void log(LauncherEvent event) {
+ public void log(EventEnum event) {
}
/**
* Logs an event and accompanying {@link InstanceId}.
*/
- public void log(LauncherEvent event, InstanceId instanceId) {
+ public void log(EventEnum event, InstanceId instanceId) {
}
/**
* Logs an event and accompanying {@link ItemInfo}.
*/
- public void log(LauncherEvent event, @Nullable ItemInfo info) {
+ public void log(EventEnum event, @Nullable ItemInfo itemInfo) {
}
/**
* Logs an event and accompanying {@link InstanceId} and {@link ItemInfo}.
*/
- public void log(LauncherEvent event, InstanceId instanceId, @Nullable ItemInfo info) {
+ public void log(EventEnum event, InstanceId instanceId, @Nullable ItemInfo itemInfo) {
}
/**
diff --git a/src/com/android/launcher3/model/data/ItemInfo.java b/src/com/android/launcher3/model/data/ItemInfo.java
index 3a89236..0c815d1 100644
--- a/src/com/android/launcher3/model/data/ItemInfo.java
+++ b/src/com/android/launcher3/model/data/ItemInfo.java
@@ -22,6 +22,7 @@
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICTION;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SEARCH_RESULTS;
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SHORTCUTS;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_TRAY;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET;
@@ -45,6 +46,7 @@
import com.android.launcher3.logger.LauncherAtom.ContainerInfo;
import com.android.launcher3.logger.LauncherAtom.PredictionContainer;
import com.android.launcher3.logger.LauncherAtom.SearchResultContainer;
+import com.android.launcher3.logger.LauncherAtom.ShortcutsContainer;
import com.android.launcher3.util.ContentWriter;
import java.util.Optional;
@@ -363,6 +365,10 @@
return ContainerInfo.newBuilder()
.setSearchResultContainer(SearchResultContainer.getDefaultInstance())
.build();
+ case CONTAINER_SHORTCUTS:
+ return ContainerInfo.newBuilder()
+ .setShortcutsContainer(ShortcutsContainer.getDefaultInstance())
+ .build();
}
return ContainerInfo.getDefaultInstance();
}
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index 331298f..614cf14 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -16,6 +16,7 @@
package com.android.launcher3.popup;
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SHORTCUTS;
import static com.android.launcher3.Utilities.squaredHypot;
import static com.android.launcher3.Utilities.squaredTouchSlop;
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
@@ -61,6 +62,7 @@
import com.android.launcher3.dragndrop.DraggableView;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.ItemInfoWithIcon;
+import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.notification.NotificationInfo;
import com.android.launcher3.notification.NotificationItemView;
import com.android.launcher3.notification.NotificationKeyData;
@@ -675,8 +677,10 @@
iconShift.y = mIconLastTouchPos.y - mLauncher.getDeviceProfile().iconSizePx;
DraggableView draggableView = DraggableView.ofType(DraggableView.DRAGGABLE_ICON);
+ WorkspaceItemInfo itemInfo = sv.getFinalInfo();
+ itemInfo.container = CONTAINER_SHORTCUTS;
DragView dv = mLauncher.getWorkspace().beginDragShared(sv.getIconView(), draggableView,
- mContainer, sv.getFinalInfo(),
+ mContainer, itemInfo,
new ShortcutDragPreviewProvider(sv.getIconView(), iconShift),
new DragOptions());
dv.animateShift(-iconShift.x, -iconShift.y);
diff --git a/src/com/android/launcher3/popup/PopupPopulator.java b/src/com/android/launcher3/popup/PopupPopulator.java
index 7da86cc..6d3bc14 100644
--- a/src/com/android/launcher3/popup/PopupPopulator.java
+++ b/src/com/android/launcher3/popup/PopupPopulator.java
@@ -16,6 +16,8 @@
package com.android.launcher3.popup;
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SHORTCUTS;
+
import android.content.ComponentName;
import android.content.pm.ShortcutInfo;
import android.os.Handler;
@@ -160,6 +162,7 @@
final WorkspaceItemInfo si = new WorkspaceItemInfo(shortcut, launcher);
cache.getUnbadgedShortcutIcon(si, shortcut);
si.rank = i;
+ si.container = CONTAINER_SHORTCUTS;
final DeepShortcutView view = shortcutViews.get(i);
uiHandler.post(() -> view.applyShortcutInfo(si, shortcut, container));
diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java
index ae35d4c..58ed5e8 100644
--- a/src/com/android/launcher3/popup/SystemShortcut.java
+++ b/src/com/android/launcher3/popup/SystemShortcut.java
@@ -1,5 +1,7 @@
package com.android.launcher3.popup;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_APP_INFO_TAP;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_WIDGETS_TAP;
import android.app.ActivityOptions;
import android.content.Context;
@@ -103,7 +105,6 @@
};
public static class Widgets extends SystemShortcut<Launcher> {
-
public Widgets(Launcher target, ItemInfo itemInfo) {
super(R.drawable.ic_widget, R.string.widget_button_text, target, itemInfo);
}
@@ -117,6 +118,9 @@
widgetsBottomSheet.populateAndShow(mItemInfo);
mTarget.getUserEventDispatcher().logActionOnControl(Action.Touch.TAP,
ControlType.WIDGETS_BUTTON, view);
+ // TODO(thiruram): Fix missing container info when item is inside folder.
+ mTarget.getStatsLogManager().log(LAUNCHER_SYSTEM_SHORTCUT_WIDGETS_TAP,
+ mItemInfo.buildProto());
}
}
@@ -137,6 +141,9 @@
mItemInfo, sourceBounds, ActivityOptions.makeBasic().toBundle());
mTarget.getUserEventDispatcher().logActionOnControl(Action.Touch.TAP,
ControlType.APPINFO_TARGET, view);
+ // TODO(thiruram): Fix missing container info when item is inside folder.
+ mTarget.getStatsLogManager().log(LAUNCHER_SYSTEM_SHORTCUT_APP_INFO_TAP,
+ mItemInfo.buildProto());
}
}
diff --git a/src/com/android/launcher3/touch/WorkspaceTouchListener.java b/src/com/android/launcher3/touch/WorkspaceTouchListener.java
index e6de06d..7270ce2 100644
--- a/src/com/android/launcher3/touch/WorkspaceTouchListener.java
+++ b/src/com/android/launcher3/touch/WorkspaceTouchListener.java
@@ -22,6 +22,7 @@
import static android.view.MotionEvent.ACTION_UP;
import static com.android.launcher3.LauncherState.NORMAL;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WORKSPACE_LONGPRESS;
import android.graphics.PointF;
import android.graphics.Rect;
@@ -41,8 +42,6 @@
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.views.OptionsPopupView;
-import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
-import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
/**
* Helper class to handle touch on empty space in workspace and show options popup on long press
@@ -175,9 +174,7 @@
mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
- mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.LONGPRESS,
- Action.Direction.NONE, ContainerType.WORKSPACE,
- mWorkspace.getCurrentPage());
+ mLauncher.getStatsLogManager().log(LAUNCHER_WORKSPACE_LONGPRESS);
OptionsPopupView.showDefaultOptions(mLauncher, mTouchDownPoint.x, mTouchDownPoint.y);
} else {
cancelLongPress();
diff --git a/src/com/android/launcher3/util/DefaultDisplay.java b/src/com/android/launcher3/util/DefaultDisplay.java
index fabdb4e..150fb5b 100644
--- a/src/com/android/launcher3/util/DefaultDisplay.java
+++ b/src/com/android/launcher3/util/DefaultDisplay.java
@@ -145,10 +145,11 @@
}
private Info(Context context) {
- this(context.getSystemService(DisplayManager.class).getDisplay(DEFAULT_DISPLAY));
+ this(context, context.getSystemService(DisplayManager.class)
+ .getDisplay(DEFAULT_DISPLAY));
}
- public Info(Display display) {
+ public Info(Context context, Display display) {
id = display.getDisplayId();
rotation = display.getRotation();
@@ -161,8 +162,8 @@
display.getRealSize(realSize);
display.getCurrentSizeRange(smallestSize, largestSize);
- metrics = new DisplayMetrics();
- display.getMetrics(metrics);
+ Context defaultDisplayContext = context.createDisplayContext(display);
+ metrics = defaultDisplayContext.getResources().getDisplayMetrics();
}
private boolean hasDifferentSize(Info info) {
diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java
index 6915953..c37c47c 100644
--- a/src/com/android/launcher3/views/BaseDragLayer.java
+++ b/src/com/android/launcher3/views/BaseDragLayer.java
@@ -181,6 +181,11 @@
}
private TouchController findControllerToHandleTouch(MotionEvent ev) {
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.PAUSE_NOT_DETECTED, "findControllerToHandleTouch ev=" + ev
+ + ", isEventInLauncher=" + isEventInLauncher(ev)
+ + ", topOpenView=" + AbstractFloatingView.getTopOpenView(mActivity));
+ }
if (isEventInLauncher(ev)) {
AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity);
if (topView != null && topView.onControllerInterceptTouchEvent(ev)) {
diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java
index d5c3c1d..7467186 100644
--- a/src/com/android/launcher3/views/OptionsPopupView.java
+++ b/src/com/android/launcher3/views/OptionsPopupView.java
@@ -17,6 +17,9 @@
import static com.android.launcher3.Utilities.EXTRA_WALLPAPER_FLAVOR;
import static com.android.launcher3.Utilities.EXTRA_WALLPAPER_OFFSET;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SETTINGS_BUTTON_TAP_OR_LONGPRESS;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WALLPAPER_BUTTON_TAP_OR_LONGPRESS;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGETSTRAY_BUTTON_TAP_OR_LONGPRESS;
import android.content.Context;
import android.content.Intent;
@@ -37,13 +40,12 @@
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
+import com.android.launcher3.logging.StatsLogManager.EventEnum;
import com.android.launcher3.model.WidgetsModel;
import com.android.launcher3.popup.ArrowPopup;
import com.android.launcher3.shortcuts.DeepShortcutView;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.TestProtocol;
-import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
-import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
import com.android.launcher3.widget.WidgetsFullSheet;
import java.util.ArrayList;
@@ -68,21 +70,21 @@
@Override
public void onClick(View view) {
- handleViewClick(view, Action.Touch.TAP);
+ handleViewClick(view);
}
@Override
public boolean onLongClick(View view) {
- return handleViewClick(view, Action.Touch.LONGPRESS);
+ return handleViewClick(view);
}
- private boolean handleViewClick(View view, int action) {
+ private boolean handleViewClick(View view) {
OptionItem item = mItemMap.get(view);
if (item == null) {
return false;
}
- if (item.mControlTypeForLog > 0) {
- logTap(action, item.mControlTypeForLog);
+ if (item.mEventId.getId() > 0) {
+ mLauncher.getStatsLogManager().log(item.mEventId);
}
if (item.mClickListener.onLongClick(view)) {
close(true);
@@ -91,10 +93,6 @@
return false;
}
- private void logTap(int action, int controlType) {
- mLauncher.getUserEventDispatcher().logActionOnControl(action, controlType);
- }
-
@Override
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
if (ev.getAction() != MotionEvent.ACTION_DOWN) {
@@ -159,13 +157,16 @@
int resDrawable = Utilities.existsStyleWallpapers(launcher) ?
R.drawable.ic_palette : R.drawable.ic_wallpaper;
options.add(new OptionItem(resString, resDrawable,
- ControlType.WALLPAPER_BUTTON, OptionsPopupView::startWallpaperPicker));
+ LAUNCHER_WALLPAPER_BUTTON_TAP_OR_LONGPRESS,
+ OptionsPopupView::startWallpaperPicker));
if (!WidgetsModel.GO_DISABLE_WIDGETS) {
options.add(new OptionItem(R.string.widget_button_text, R.drawable.ic_widget,
- ControlType.WIDGETS_BUTTON, OptionsPopupView::onWidgetsClicked));
+ LAUNCHER_WIDGETSTRAY_BUTTON_TAP_OR_LONGPRESS,
+ OptionsPopupView::onWidgetsClicked));
}
options.add(new OptionItem(R.string.settings_button_text, R.drawable.ic_setting,
- ControlType.SETTINGS_BUTTON, OptionsPopupView::startSettings));
+ LAUNCHER_SETTINGS_BUTTON_TAP_OR_LONGPRESS,
+ OptionsPopupView::startSettings));
show(launcher, target, options);
}
@@ -224,14 +225,14 @@
private final int mLabelRes;
private final int mIconRes;
- private final int mControlTypeForLog;
+ private final EventEnum mEventId;
private final OnLongClickListener mClickListener;
- public OptionItem(int labelRes, int iconRes, int controlTypeForLog,
+ public OptionItem(int labelRes, int iconRes, EventEnum eventId,
OnLongClickListener clickListener) {
mLabelRes = labelRes;
mIconRes = iconRes;
- mControlTypeForLog = controlTypeForLog;
+ mEventId = eventId;
mClickListener = clickListener;
}
}