Merge "Removing unnecessary search header duplication" into tm-qpr-dev
diff --git a/quickstep/res/layout/task_desktop.xml b/quickstep/res/layout/task_desktop.xml
index 2a9674f..96aabb4 100644
--- a/quickstep/res/layout/task_desktop.xml
+++ b/quickstep/res/layout/task_desktop.xml
@@ -24,6 +24,11 @@
android:defaultFocusHighlightEnabled="false"
android:focusable="true">
+ <View
+ android:id="@+id/background"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
<!--
TODO(b249371338): DesktopTaskView extends from TaskView. TaskView expects TaskThumbnailView
and IconView with these ids to be present. Need to refactor RecentsView to accept child
@@ -38,10 +43,9 @@
<com.android.quickstep.views.IconView
android:id="@+id/icon"
- android:layout_width="0dp"
- android:layout_height="0dp"
+ android:layout_width="@dimen/task_thumbnail_icon_size"
+ android:layout_height="@dimen/task_thumbnail_icon_size"
android:focusable="false"
- android:importantForAccessibility="no"
- android:visibility="gone" />
+ android:importantForAccessibility="no" />
</com.android.quickstep.views.DesktopTaskView>
diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
index b880a7e..347c492 100644
--- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
@@ -213,9 +213,9 @@
private static final int WIDGET_CROSSFADE_DURATION_MILLIS = 125;
protected final QuickstepLauncher mLauncher;
- private final DragLayer mDragLayer;
+ protected final DragLayer mDragLayer;
- final Handler mHandler;
+ protected final Handler mHandler;
private final float mClosingWindowTransY;
private final float mMaxShadowRadius;
@@ -1097,32 +1097,38 @@
return;
}
if (hasControlRemoteAppTransitionPermission()) {
- mWallpaperOpenRunner = createWallpaperOpenRunner(false /* fromUnlock */);
-
RemoteAnimationDefinition definition = new RemoteAnimationDefinition();
- definition.addRemoteAnimation(WindowManager.TRANSIT_OLD_WALLPAPER_OPEN,
- WindowConfiguration.ACTIVITY_TYPE_STANDARD,
- new RemoteAnimationAdapter(
- new LauncherAnimationRunner(mHandler, mWallpaperOpenRunner,
- false /* startAtFrontOfQueue */),
- CLOSING_TRANSITION_DURATION_MS, 0 /* statusBarTransitionDelay */));
-
- if (KEYGUARD_ANIMATION.get()) {
- mKeyguardGoingAwayRunner = createWallpaperOpenRunner(true /* fromUnlock */);
- definition.addRemoteAnimation(
- WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
- new RemoteAnimationAdapter(
- new LauncherAnimationRunner(
- mHandler, mKeyguardGoingAwayRunner,
- true /* startAtFrontOfQueue */),
- CLOSING_TRANSITION_DURATION_MS, 0 /* statusBarTransitionDelay */));
- }
-
+ addRemoteAnimations(definition);
mLauncher.registerRemoteAnimations(definition);
}
}
/**
+ * Adds remote animations to a {@link RemoteAnimationDefinition}. May be overridden to add
+ * additional animations.
+ */
+ protected void addRemoteAnimations(RemoteAnimationDefinition definition) {
+ mWallpaperOpenRunner = createWallpaperOpenRunner(false /* fromUnlock */);
+ definition.addRemoteAnimation(WindowManager.TRANSIT_OLD_WALLPAPER_OPEN,
+ WindowConfiguration.ACTIVITY_TYPE_STANDARD,
+ new RemoteAnimationAdapter(
+ new LauncherAnimationRunner(mHandler, mWallpaperOpenRunner,
+ false /* startAtFrontOfQueue */),
+ CLOSING_TRANSITION_DURATION_MS, 0 /* statusBarTransitionDelay */));
+
+ if (KEYGUARD_ANIMATION.get()) {
+ mKeyguardGoingAwayRunner = createWallpaperOpenRunner(true /* fromUnlock */);
+ definition.addRemoteAnimation(
+ WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
+ new RemoteAnimationAdapter(
+ new LauncherAnimationRunner(
+ mHandler, mKeyguardGoingAwayRunner,
+ true /* startAtFrontOfQueue */),
+ CLOSING_TRANSITION_DURATION_MS, 0 /* statusBarTransitionDelay */));
+ }
+ }
+
+ /**
* Registers remote animations used when closing apps to home screen.
*/
public void registerRemoteTransitions() {
@@ -1163,7 +1169,7 @@
SystemUiProxy.INSTANCE.get(mLauncher).setStartingWindowListener(null);
}
- private void unregisterRemoteAnimations() {
+ protected void unregisterRemoteAnimations() {
if (SEPARATE_RECENTS_ACTIVITY.get()) {
return;
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index 9a97bca..2cbb899 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -239,7 +239,7 @@
mActionsView.updateDimension(getDeviceProfile(), overviewPanel.getLastComputedTaskSize());
mActionsView.updateVerticalMargin(DisplayController.getNavigationMode(this));
- mAppTransitionManager = new QuickstepTransitionManager(this);
+ mAppTransitionManager = buildAppTransitionManager();
mAppTransitionManager.registerRemoteAnimations();
mAppTransitionManager.registerRemoteTransitions();
@@ -308,6 +308,13 @@
return mHotseatPredictionController;
}
+ /**
+ * Builds the {@link QuickstepTransitionManager} instance to use for managing transitions.
+ */
+ protected QuickstepTransitionManager buildAppTransitionManager() {
+ return new QuickstepTransitionManager(this);
+ }
+
@Override
protected QuickstepOnboardingPrefs createOnboardingPrefs(SharedPreferences sharedPrefs) {
return new QuickstepOnboardingPrefs(this, sharedPrefs);
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 4f10dde..3f6eb94 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -50,6 +50,7 @@
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.CANCEL_RECENTS_ANIMATION;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.EXPECTING_TASK_APPEARED;
+import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.LAUNCHER_DESTROYED;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.ON_SETTLED_ON_END_TARGET;
import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
@@ -181,6 +182,7 @@
if (mActivity != activity) {
return;
}
+ ActiveGestureLog.INSTANCE.addLog("Launcher destroyed", LAUNCHER_DESTROYED);
mRecentsView = null;
mActivity = null;
}
diff --git a/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java b/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java
index 60065fb..2964868 100644
--- a/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java
+++ b/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java
@@ -20,7 +20,6 @@
import androidx.annotation.NonNull;
import java.io.PrintWriter;
-import java.util.List;
import java.util.Set;
/**
@@ -37,7 +36,7 @@
ON_SETTLED_ON_END_TARGET, START_RECENTS_ANIMATION, FINISH_RECENTS_ANIMATION,
CANCEL_RECENTS_ANIMATION, SET_ON_PAGE_TRANSITION_END_CALLBACK, CANCEL_CURRENT_ANIMATION,
CLEANUP_SCREENSHOT, SCROLLER_ANIMATION_ABORTED, TASK_APPEARED, EXPECTING_TASK_APPEARED,
- FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER,
+ FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER, LAUNCHER_DESTROYED,
/**
* These GestureEvents are specifically associated to state flags that get set in
@@ -68,288 +67,288 @@
protected static void analyseAndDump(
@NonNull String prefix,
@NonNull PrintWriter writer,
- List<ActiveGestureLog.EventLog> eventLogs) {
- writer.println(prefix + "ActiveGestureErrorDetector:");
- for (int i = 0; i < eventLogs.size(); i++) {
- ActiveGestureLog.EventLog eventLog = eventLogs.get(i);
- if (eventLog == null) {
+ @NonNull ActiveGestureLog.EventLog eventLog) {
+ writer.println(prefix + "Error messages for gesture ID: " + eventLog.logId);
+
+ boolean errorDetected = false;
+ // Use a Set since the order is inherently checked in the loop.
+ final Set<GestureEvent> encounteredEvents = new ArraySet<>();
+ // Set flags and check order of operations.
+ for (ActiveGestureLog.EventEntry eventEntry : eventLog.eventEntries) {
+ GestureEvent gestureEvent = eventEntry.getGestureEvent();
+ if (gestureEvent == null) {
continue;
}
- int gestureId = eventLog.logId;
- writer.println(prefix + "\tError messages for gesture ID: " + gestureId);
+ encounteredEvents.add(gestureEvent);
- boolean errorDetected = false;
- // Use a Set since the order is inherently checked in the loop.
- final Set<GestureEvent> encounteredEvents = new ArraySet<>();
- // Set flags and check order of operations.
- for (ActiveGestureLog.EventEntry eventEntry : eventLog.eventEntries) {
- GestureEvent gestureEvent = eventEntry.getGestureEvent();
- if (gestureEvent == null) {
- continue;
- }
- encounteredEvents.add(gestureEvent);
- switch (gestureEvent) {
- case MOTION_UP:
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(GestureEvent.MOTION_DOWN),
- prefix,
- /* errorMessage= */ "Motion up detected before/without"
- + " motion down.",
- writer);
- break;
- case ON_SETTLED_ON_END_TARGET:
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(GestureEvent.SET_END_TARGET),
- prefix,
- /* errorMessage= */ "onSettledOnEndTarget called "
- + "before/without setEndTarget.",
- writer);
- break;
- case FINISH_RECENTS_ANIMATION:
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(GestureEvent.START_RECENTS_ANIMATION),
- prefix,
- /* errorMessage= */ "finishRecentsAnimation called "
- + "before/without startRecentsAnimation.",
- writer);
- break;
- case CANCEL_RECENTS_ANIMATION:
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(GestureEvent.START_RECENTS_ANIMATION),
- prefix,
- /* errorMessage= */ "cancelRecentsAnimation called "
- + "before/without startRecentsAnimation.",
- writer);
- break;
- case CLEANUP_SCREENSHOT:
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(GestureEvent.STATE_SCREENSHOT_CAPTURED),
- prefix,
- /* errorMessage= */ "recents activity screenshot was "
- + "cleaned up before/without STATE_SCREENSHOT_CAPTURED "
- + "being set.",
- writer);
- break;
- case SCROLLER_ANIMATION_ABORTED:
- errorDetected |= printErrorIfTrue(
- encounteredEvents.contains(GestureEvent.SET_END_TARGET_HOME)
- && !encounteredEvents.contains(
- GestureEvent.ON_SETTLED_ON_END_TARGET),
- prefix,
- /* errorMessage= */ "recents view scroller animation "
- + "aborted after setting end target HOME, but before"
- + " settling on end target.",
- writer);
- break;
- case TASK_APPEARED:
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(GestureEvent.SET_END_TARGET_NEW_TASK),
- prefix,
- /* errorMessage= */ "onTasksAppeared called "
- + "before/without setting end target to new task",
- writer);
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(GestureEvent.EXPECTING_TASK_APPEARED),
- prefix,
- /* errorMessage= */ "onTasksAppeared was not expected to be called",
- writer);
- break;
- case EXPECTING_TASK_APPEARED:
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(GestureEvent.SET_END_TARGET_NEW_TASK),
- prefix,
- /* errorMessage= */ "expecting onTasksAppeared to be called "
- + "before/without setting end target to new task",
- writer);
- break;
- case STATE_GESTURE_COMPLETED:
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(GestureEvent.MOTION_UP),
- prefix,
- /* errorMessage= */ "STATE_GESTURE_COMPLETED set "
- + "before/without motion up.",
- writer);
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(GestureEvent.STATE_GESTURE_STARTED),
- prefix,
- /* errorMessage= */ "STATE_GESTURE_COMPLETED set "
- + "before/without STATE_GESTURE_STARTED.",
- writer);
- break;
- case STATE_GESTURE_CANCELLED:
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(GestureEvent.MOTION_UP),
- prefix,
- /* errorMessage= */ "STATE_GESTURE_CANCELLED set "
- + "before/without motion up.",
- writer);
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(GestureEvent.STATE_GESTURE_STARTED),
- prefix,
- /* errorMessage= */ "STATE_GESTURE_CANCELLED set "
- + "before/without STATE_GESTURE_STARTED.",
- writer);
- break;
- case STATE_SCREENSHOT_CAPTURED:
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(GestureEvent.STATE_CAPTURE_SCREENSHOT),
- prefix,
- /* errorMessage= */ "STATE_SCREENSHOT_CAPTURED set "
- + "before/without STATE_CAPTURE_SCREENSHOT.",
- writer);
- break;
- case STATE_RECENTS_SCROLLING_FINISHED:
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(
- GestureEvent.SET_ON_PAGE_TRANSITION_END_CALLBACK),
- prefix,
- /* errorMessage= */ "STATE_RECENTS_SCROLLING_FINISHED "
- + "set before/without calling "
- + "setOnPageTransitionEndCallback.",
- writer);
- break;
- case STATE_RECENTS_ANIMATION_CANCELED:
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(
- GestureEvent.START_RECENTS_ANIMATION),
- prefix,
- /* errorMessage= */ "STATE_RECENTS_ANIMATION_CANCELED "
- + "set before/without startRecentsAnimation.",
- writer);
- break;
- case MOTION_DOWN:
- case SET_END_TARGET:
- case SET_END_TARGET_HOME:
- case SET_END_TARGET_NEW_TASK:
- case START_RECENTS_ANIMATION:
- case SET_ON_PAGE_TRANSITION_END_CALLBACK:
- case CANCEL_CURRENT_ANIMATION:
- case FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER:
- case STATE_GESTURE_STARTED:
- case STATE_END_TARGET_ANIMATION_FINISHED:
- case STATE_CAPTURE_SCREENSHOT:
- case STATE_HANDLER_INVALIDATED:
- case STATE_LAUNCHER_DRAWN:
- default:
- // No-Op
- }
+ switch (gestureEvent) {
+ case MOTION_UP:
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(GestureEvent.MOTION_DOWN),
+ prefix,
+ /* errorMessage= */ "Motion up detected before/without"
+ + " motion down.",
+ writer);
+ break;
+ case ON_SETTLED_ON_END_TARGET:
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(GestureEvent.SET_END_TARGET),
+ prefix,
+ /* errorMessage= */ "onSettledOnEndTarget called "
+ + "before/without setEndTarget.",
+ writer);
+ break;
+ case FINISH_RECENTS_ANIMATION:
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(GestureEvent.START_RECENTS_ANIMATION),
+ prefix,
+ /* errorMessage= */ "finishRecentsAnimation called "
+ + "before/without startRecentsAnimation.",
+ writer);
+ break;
+ case CANCEL_RECENTS_ANIMATION:
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(GestureEvent.START_RECENTS_ANIMATION),
+ prefix,
+ /* errorMessage= */ "cancelRecentsAnimation called "
+ + "before/without startRecentsAnimation.",
+ writer);
+ break;
+ case CLEANUP_SCREENSHOT:
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(GestureEvent.STATE_SCREENSHOT_CAPTURED),
+ prefix,
+ /* errorMessage= */ "recents activity screenshot was "
+ + "cleaned up before/without STATE_SCREENSHOT_CAPTURED "
+ + "being set.",
+ writer);
+ break;
+ case SCROLLER_ANIMATION_ABORTED:
+ errorDetected |= printErrorIfTrue(
+ encounteredEvents.contains(GestureEvent.SET_END_TARGET_HOME)
+ && !encounteredEvents.contains(
+ GestureEvent.ON_SETTLED_ON_END_TARGET),
+ prefix,
+ /* errorMessage= */ "recents view scroller animation "
+ + "aborted after setting end target HOME, but before"
+ + " settling on end target.",
+ writer);
+ break;
+ case TASK_APPEARED:
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(GestureEvent.SET_END_TARGET_NEW_TASK),
+ prefix,
+ /* errorMessage= */ "onTasksAppeared called "
+ + "before/without setting end target to new task",
+ writer);
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(GestureEvent.EXPECTING_TASK_APPEARED),
+ prefix,
+ /* errorMessage= */ "onTasksAppeared was not expected to be called",
+ writer);
+ break;
+ case EXPECTING_TASK_APPEARED:
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(GestureEvent.SET_END_TARGET_NEW_TASK),
+ prefix,
+ /* errorMessage= */ "expecting onTasksAppeared to be called "
+ + "before/without setting end target to new task",
+ writer);
+ break;
+ case LAUNCHER_DESTROYED:
+ errorDetected |= printErrorIfTrue(
+ true,
+ prefix,
+ /* errorMessage= */ "Launcher destroyed mid-gesture",
+ writer);
+ break;
+ case STATE_GESTURE_COMPLETED:
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(GestureEvent.MOTION_UP),
+ prefix,
+ /* errorMessage= */ "STATE_GESTURE_COMPLETED set "
+ + "before/without motion up.",
+ writer);
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(GestureEvent.STATE_GESTURE_STARTED),
+ prefix,
+ /* errorMessage= */ "STATE_GESTURE_COMPLETED set "
+ + "before/without STATE_GESTURE_STARTED.",
+ writer);
+ break;
+ case STATE_GESTURE_CANCELLED:
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(GestureEvent.MOTION_UP),
+ prefix,
+ /* errorMessage= */ "STATE_GESTURE_CANCELLED set "
+ + "before/without motion up.",
+ writer);
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(GestureEvent.STATE_GESTURE_STARTED),
+ prefix,
+ /* errorMessage= */ "STATE_GESTURE_CANCELLED set "
+ + "before/without STATE_GESTURE_STARTED.",
+ writer);
+ break;
+ case STATE_SCREENSHOT_CAPTURED:
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(GestureEvent.STATE_CAPTURE_SCREENSHOT),
+ prefix,
+ /* errorMessage= */ "STATE_SCREENSHOT_CAPTURED set "
+ + "before/without STATE_CAPTURE_SCREENSHOT.",
+ writer);
+ break;
+ case STATE_RECENTS_SCROLLING_FINISHED:
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(
+ GestureEvent.SET_ON_PAGE_TRANSITION_END_CALLBACK),
+ prefix,
+ /* errorMessage= */ "STATE_RECENTS_SCROLLING_FINISHED "
+ + "set before/without calling "
+ + "setOnPageTransitionEndCallback.",
+ writer);
+ break;
+ case STATE_RECENTS_ANIMATION_CANCELED:
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(
+ GestureEvent.START_RECENTS_ANIMATION),
+ prefix,
+ /* errorMessage= */ "STATE_RECENTS_ANIMATION_CANCELED "
+ + "set before/without startRecentsAnimation.",
+ writer);
+ break;
+ case MOTION_DOWN:
+ case SET_END_TARGET:
+ case SET_END_TARGET_HOME:
+ case SET_END_TARGET_NEW_TASK:
+ case START_RECENTS_ANIMATION:
+ case SET_ON_PAGE_TRANSITION_END_CALLBACK:
+ case CANCEL_CURRENT_ANIMATION:
+ case FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER:
+ case STATE_GESTURE_STARTED:
+ case STATE_END_TARGET_ANIMATION_FINISHED:
+ case STATE_CAPTURE_SCREENSHOT:
+ case STATE_HANDLER_INVALIDATED:
+ case STATE_LAUNCHER_DRAWN:
+ default:
+ // No-Op
}
+ }
- // Check that all required events were found.
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(GestureEvent.MOTION_DOWN),
- prefix,
- /* errorMessage= */ "Motion down never detected.",
- writer);
- errorDetected |= printErrorIfTrue(
- !encounteredEvents.contains(GestureEvent.MOTION_UP),
- prefix,
- /* errorMessage= */ "Motion up never detected.",
- writer);
+ // Check that all required events were found.
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(GestureEvent.MOTION_DOWN),
+ prefix,
+ /* errorMessage= */ "Motion down never detected.",
+ writer);
+ errorDetected |= printErrorIfTrue(
+ !encounteredEvents.contains(GestureEvent.MOTION_UP),
+ prefix,
+ /* errorMessage= */ "Motion up never detected.",
+ writer);
- errorDetected |= printErrorIfTrue(
- /* condition= */ encounteredEvents.contains(GestureEvent.SET_END_TARGET)
- && !encounteredEvents.contains(GestureEvent.ON_SETTLED_ON_END_TARGET),
- prefix,
- /* errorMessage= */ "setEndTarget was called, but "
- + "onSettledOnEndTarget wasn't.",
- writer);
- errorDetected |= printErrorIfTrue(
- /* condition= */ encounteredEvents.contains(GestureEvent.SET_END_TARGET)
- && !encounteredEvents.contains(
- GestureEvent.STATE_END_TARGET_ANIMATION_FINISHED),
- prefix,
- /* errorMessage= */ "setEndTarget was called, but "
- + "STATE_END_TARGET_ANIMATION_FINISHED was never set.",
- writer);
- errorDetected |= printErrorIfTrue(
- /* condition= */ encounteredEvents.contains(GestureEvent.SET_END_TARGET)
- && !encounteredEvents.contains(
- GestureEvent.STATE_RECENTS_SCROLLING_FINISHED),
- prefix,
- /* errorMessage= */ "setEndTarget was called, but "
- + "STATE_RECENTS_SCROLLING_FINISHED was never set.",
- writer);
- errorDetected |= printErrorIfTrue(
- /* condition= */ encounteredEvents.contains(
- GestureEvent.STATE_END_TARGET_ANIMATION_FINISHED)
- && encounteredEvents.contains(
- GestureEvent.STATE_RECENTS_SCROLLING_FINISHED)
- && !encounteredEvents.contains(GestureEvent.ON_SETTLED_ON_END_TARGET),
- prefix,
- /* errorMessage= */ "STATE_END_TARGET_ANIMATION_FINISHED and "
- + "STATE_RECENTS_SCROLLING_FINISHED were set, but onSettledOnEndTarget "
- + "wasn't called.",
- writer);
+ errorDetected |= printErrorIfTrue(
+ /* condition= */ encounteredEvents.contains(GestureEvent.SET_END_TARGET)
+ && !encounteredEvents.contains(GestureEvent.ON_SETTLED_ON_END_TARGET),
+ prefix,
+ /* errorMessage= */ "setEndTarget was called, but "
+ + "onSettledOnEndTarget wasn't.",
+ writer);
+ errorDetected |= printErrorIfTrue(
+ /* condition= */ encounteredEvents.contains(GestureEvent.SET_END_TARGET)
+ && !encounteredEvents.contains(
+ GestureEvent.STATE_END_TARGET_ANIMATION_FINISHED),
+ prefix,
+ /* errorMessage= */ "setEndTarget was called, but "
+ + "STATE_END_TARGET_ANIMATION_FINISHED was never set.",
+ writer);
+ errorDetected |= printErrorIfTrue(
+ /* condition= */ encounteredEvents.contains(GestureEvent.SET_END_TARGET)
+ && !encounteredEvents.contains(
+ GestureEvent.STATE_RECENTS_SCROLLING_FINISHED),
+ prefix,
+ /* errorMessage= */ "setEndTarget was called, but "
+ + "STATE_RECENTS_SCROLLING_FINISHED was never set.",
+ writer);
+ errorDetected |= printErrorIfTrue(
+ /* condition= */ encounteredEvents.contains(
+ GestureEvent.STATE_END_TARGET_ANIMATION_FINISHED)
+ && encounteredEvents.contains(
+ GestureEvent.STATE_RECENTS_SCROLLING_FINISHED)
+ && !encounteredEvents.contains(GestureEvent.ON_SETTLED_ON_END_TARGET),
+ prefix,
+ /* errorMessage= */ "STATE_END_TARGET_ANIMATION_FINISHED and "
+ + "STATE_RECENTS_SCROLLING_FINISHED were set, but onSettledOnEndTarget "
+ + "wasn't called.",
+ writer);
- errorDetected |= printErrorIfTrue(
- /* condition= */ encounteredEvents.contains(
- GestureEvent.START_RECENTS_ANIMATION)
- && !encounteredEvents.contains(GestureEvent.FINISH_RECENTS_ANIMATION)
- && !encounteredEvents.contains(GestureEvent.CANCEL_RECENTS_ANIMATION),
- prefix,
- /* errorMessage= */ "startRecentsAnimation was called, but "
- + "finishRecentsAnimation and cancelRecentsAnimation weren't.",
- writer);
+ errorDetected |= printErrorIfTrue(
+ /* condition= */ encounteredEvents.contains(
+ GestureEvent.START_RECENTS_ANIMATION)
+ && !encounteredEvents.contains(GestureEvent.FINISH_RECENTS_ANIMATION)
+ && !encounteredEvents.contains(GestureEvent.CANCEL_RECENTS_ANIMATION),
+ prefix,
+ /* errorMessage= */ "startRecentsAnimation was called, but "
+ + "finishRecentsAnimation and cancelRecentsAnimation weren't.",
+ writer);
- errorDetected |= printErrorIfTrue(
- /* condition= */ encounteredEvents.contains(GestureEvent.STATE_GESTURE_STARTED)
- && !encounteredEvents.contains(GestureEvent.STATE_GESTURE_COMPLETED)
- && !encounteredEvents.contains(GestureEvent.STATE_GESTURE_CANCELLED),
- prefix,
- /* errorMessage= */ "STATE_GESTURE_STARTED was set, but "
- + "STATE_GESTURE_COMPLETED and STATE_GESTURE_CANCELLED weren't.",
- writer);
+ errorDetected |= printErrorIfTrue(
+ /* condition= */ encounteredEvents.contains(GestureEvent.STATE_GESTURE_STARTED)
+ && !encounteredEvents.contains(GestureEvent.STATE_GESTURE_COMPLETED)
+ && !encounteredEvents.contains(GestureEvent.STATE_GESTURE_CANCELLED),
+ prefix,
+ /* errorMessage= */ "STATE_GESTURE_STARTED was set, but "
+ + "STATE_GESTURE_COMPLETED and STATE_GESTURE_CANCELLED weren't.",
+ writer);
- errorDetected |= printErrorIfTrue(
- /* condition= */ encounteredEvents.contains(
- GestureEvent.STATE_CAPTURE_SCREENSHOT)
- && !encounteredEvents.contains(GestureEvent.STATE_SCREENSHOT_CAPTURED),
- prefix,
- /* errorMessage= */ "STATE_CAPTURE_SCREENSHOT was set, but "
- + "STATE_SCREENSHOT_CAPTURED wasn't.",
- writer);
+ errorDetected |= printErrorIfTrue(
+ /* condition= */ encounteredEvents.contains(
+ GestureEvent.STATE_CAPTURE_SCREENSHOT)
+ && !encounteredEvents.contains(GestureEvent.STATE_SCREENSHOT_CAPTURED),
+ prefix,
+ /* errorMessage= */ "STATE_CAPTURE_SCREENSHOT was set, but "
+ + "STATE_SCREENSHOT_CAPTURED wasn't.",
+ writer);
- errorDetected |= printErrorIfTrue(
- /* condition= */ encounteredEvents.contains(
- GestureEvent.SET_ON_PAGE_TRANSITION_END_CALLBACK)
- && !encounteredEvents.contains(
- GestureEvent.STATE_RECENTS_SCROLLING_FINISHED),
- prefix,
- /* errorMessage= */ "setOnPageTransitionEndCallback called, but "
- + "STATE_RECENTS_SCROLLING_FINISHED wasn't set.",
- writer);
+ errorDetected |= printErrorIfTrue(
+ /* condition= */ encounteredEvents.contains(
+ GestureEvent.SET_ON_PAGE_TRANSITION_END_CALLBACK)
+ && !encounteredEvents.contains(
+ GestureEvent.STATE_RECENTS_SCROLLING_FINISHED),
+ prefix,
+ /* errorMessage= */ "setOnPageTransitionEndCallback called, but "
+ + "STATE_RECENTS_SCROLLING_FINISHED wasn't set.",
+ writer);
- errorDetected |= printErrorIfTrue(
- /* condition= */ encounteredEvents.contains(
- GestureEvent.FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER)
- && !encounteredEvents.contains(GestureEvent.CANCEL_CURRENT_ANIMATION)
- && !encounteredEvents.contains(GestureEvent.STATE_HANDLER_INVALIDATED),
- prefix,
- /* errorMessage= */ "AbsSwipeUpHandler.cancelCurrentAnimation "
- + "wasn't called and STATE_HANDLER_INVALIDATED wasn't set.",
- writer);
+ errorDetected |= printErrorIfTrue(
+ /* condition= */ encounteredEvents.contains(
+ GestureEvent.FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER)
+ && !encounteredEvents.contains(GestureEvent.CANCEL_CURRENT_ANIMATION)
+ && !encounteredEvents.contains(GestureEvent.STATE_HANDLER_INVALIDATED),
+ prefix,
+ /* errorMessage= */ "AbsSwipeUpHandler.cancelCurrentAnimation "
+ + "wasn't called and STATE_HANDLER_INVALIDATED wasn't set.",
+ writer);
- errorDetected |= printErrorIfTrue(
- /* condition= */ encounteredEvents.contains(
- GestureEvent.STATE_RECENTS_ANIMATION_CANCELED)
- && !encounteredEvents.contains(GestureEvent.CLEANUP_SCREENSHOT),
- prefix,
- /* errorMessage= */ "STATE_RECENTS_ANIMATION_CANCELED was set but "
- + "the task screenshot wasn't cleaned up.",
- writer);
+ errorDetected |= printErrorIfTrue(
+ /* condition= */ encounteredEvents.contains(
+ GestureEvent.STATE_RECENTS_ANIMATION_CANCELED)
+ && !encounteredEvents.contains(GestureEvent.CLEANUP_SCREENSHOT),
+ prefix,
+ /* errorMessage= */ "STATE_RECENTS_ANIMATION_CANCELED was set but "
+ + "the task screenshot wasn't cleaned up.",
+ writer);
- errorDetected |= printErrorIfTrue(
- /* condition= */ encounteredEvents.contains(
- GestureEvent.EXPECTING_TASK_APPEARED)
- && !encounteredEvents.contains(GestureEvent.TASK_APPEARED),
- prefix,
- /* errorMessage= */ "onTaskAppeared was expected to be called but wasn't.",
- writer);
+ errorDetected |= printErrorIfTrue(
+ /* condition= */ encounteredEvents.contains(
+ GestureEvent.EXPECTING_TASK_APPEARED)
+ && !encounteredEvents.contains(GestureEvent.TASK_APPEARED),
+ prefix,
+ /* errorMessage= */ "onTaskAppeared was expected to be called but wasn't.",
+ writer);
- if (!errorDetected) {
- writer.println(prefix + "\t\tNo errors detected.");
- }
+ if (!errorDetected) {
+ writer.println(prefix + "\tNo errors detected.");
}
}
@@ -358,7 +357,8 @@
if (!condition) {
return false;
}
- writer.println(prefix + "\t\t- " + errorMessage);
+ writer.println(prefix + "\t- " + errorMessage);
+
return true;
}
}
diff --git a/quickstep/src/com/android/quickstep/util/ActiveGestureLog.java b/quickstep/src/com/android/quickstep/util/ActiveGestureLog.java
index 23fdd58..e05d85c 100644
--- a/quickstep/src/com/android/quickstep/util/ActiveGestureLog.java
+++ b/quickstep/src/com/android/quickstep/util/ActiveGestureLog.java
@@ -155,19 +155,27 @@
}
public void dump(String prefix, PrintWriter writer) {
+ if (FeatureFlags.ENABLE_GESTURE_ERROR_DETECTION.get()) {
+ writer.println(prefix + "ActiveGestureErrorDetector:");
+ for (int i = 0; i < logs.length; i++) {
+ EventLog eventLog = logs[(nextIndex + i) % logs.length];
+ if (eventLog == null) {
+ continue;
+ }
+ ActiveGestureErrorDetector.analyseAndDump(prefix + '\t', writer, eventLog);
+ }
+ }
+
writer.println(prefix + "ActiveGestureLog history:");
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSSZ ", Locale.US);
Date date = new Date();
- ArrayList<EventLog> eventLogs = new ArrayList<>();
-
for (int i = 0; i < logs.length; i++) {
EventLog eventLog = logs[(nextIndex + i) % logs.length];
if (eventLog == null) {
continue;
}
- eventLogs.add(eventLog);
- writer.println(prefix + "\tLogs for logId: " + eventLog.logId);
+ writer.println(prefix + "\tLogs for logId: " + eventLog.logId);
for (EventEntry eventEntry : eventLog.eventEntries) {
date.setTime(eventEntry.time);
@@ -199,10 +207,6 @@
writer.println(msg);
}
}
-
- if (FeatureFlags.ENABLE_GESTURE_ERROR_DETECTION.get()) {
- ActiveGestureErrorDetector.analyseAndDump(prefix + '\t', writer, eventLogs);
- }
}
/**
diff --git a/quickstep/src/com/android/quickstep/views/DesktopTaskView.java b/quickstep/src/com/android/quickstep/views/DesktopTaskView.java
index dc265e4..0ac682f 100644
--- a/quickstep/src/com/android/quickstep/views/DesktopTaskView.java
+++ b/quickstep/src/com/android/quickstep/views/DesktopTaskView.java
@@ -24,6 +24,8 @@
import android.content.Context;
import android.graphics.Point;
import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RoundRectShape;
import android.os.SystemProperties;
@@ -31,14 +33,16 @@
import android.util.Log;
import android.util.SparseArray;
import android.view.MotionEvent;
+import android.view.View;
+import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
+import com.android.launcher3.R;
import com.android.launcher3.Utilities;
-import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.util.RunnableList;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.SystemUiProxy;
@@ -87,7 +91,7 @@
private final ArrayList<CancellableTask<?>> mPendingThumbnailRequests = new ArrayList<>();
- private ShapeDrawable mBackground;
+ private View mBackgroundView;
public DesktopTaskView(Context context) {
this(context, null);
@@ -104,14 +108,28 @@
@Override
protected void onFinishInflate() {
super.onFinishInflate();
+
+ mBackgroundView = findViewById(R.id.background);
+
+ int topMarginPx =
+ mActivity.getDeviceProfile().overviewTaskThumbnailTopMarginPx;
+ FrameLayout.LayoutParams params = (LayoutParams) mBackgroundView.getLayoutParams();
+ params.topMargin = topMarginPx;
+ mBackgroundView.setLayoutParams(params);
+
float[] outerRadii = new float[8];
Arrays.fill(outerRadii, getTaskCornerRadius());
RoundRectShape shape = new RoundRectShape(outerRadii, null, null);
- mBackground = new ShapeDrawable(shape);
- mBackground.setTint(getResources().getColor(android.R.color.system_neutral2_300,
+ ShapeDrawable background = new ShapeDrawable(shape);
+ background.setTint(getResources().getColor(android.R.color.system_neutral2_300,
getContext().getTheme()));
// TODO(b/244348395): this should be wallpaper
- setBackground(mBackground);
+ mBackgroundView.setBackground(background);
+
+ Drawable icon = getResources().getDrawable(R.drawable.ic_desktop, getContext().getTheme());
+ Drawable iconBackground = getResources().getDrawable(R.drawable.bg_circle,
+ getContext().getTheme());
+ mIconView.setDrawable(new LayerDrawable(new Drawable[]{iconBackground, icon}));
}
@Override
@@ -252,20 +270,9 @@
}
@Override
- public void setOrientationState(RecentsOrientedState orientationState) {
- // TODO(b/249371338): this copies logic from TaskView
- PagedOrientationHandler orientationHandler = orientationState.getOrientationHandler();
- boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
+ protected void setThumbnailOrientation(RecentsOrientedState orientationState) {
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
-
- LayoutParams iconParams = (LayoutParams) mIconView.getLayoutParams();
-
int thumbnailTopMargin = deviceProfile.overviewTaskThumbnailTopMarginPx;
- int taskIconHeight = deviceProfile.overviewTaskIconSizePx;
- int taskMargin = deviceProfile.overviewTaskMarginPx;
-
- orientationHandler.setTaskIconParams(iconParams, taskMargin, taskIconHeight,
- thumbnailTopMargin, isRtl);
LayoutParams snapshotParams = (LayoutParams) mSnapshotView.getLayoutParams();
snapshotParams.topMargin = thumbnailTopMargin;
@@ -374,6 +381,9 @@
setMeasuredDimension(containerWidth, containerHeight);
+ int thumbnailTopMarginPx = mActivity.getDeviceProfile().overviewTaskThumbnailTopMarginPx;
+ containerHeight -= thumbnailTopMarginPx;
+
int thumbnails = mSnapshotViewMap.size();
if (thumbnails == 0) {
return;
@@ -416,6 +426,8 @@
}
int taskX = (int) (positionInParent.x * scaleWidth);
int taskY = (int) (positionInParent.y * scaleHeight);
+ // move task down by margin size
+ taskY += thumbnailTopMarginPx;
thumbnailView.setX(taskX);
thumbnailView.setY(taskY);
@@ -439,9 +451,9 @@
mFullscreenProgress = progress;
if (mFullscreenProgress > 0) {
// Don't show background while we are transitioning to/from fullscreen
- setBackground(null);
+ mBackgroundView.setVisibility(INVISIBLE);
} else {
- setBackground(mBackground);
+ mBackgroundView.setVisibility(VISIBLE);
}
for (int i = 0; i < mSnapshotViewMap.size(); i++) {
TaskThumbnailView thumbnailView = mSnapshotViewMap.valueAt(i);
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 829e72c..d3c7778 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -996,6 +996,11 @@
}
public void setOrientationState(RecentsOrientedState orientationState) {
+ setIconOrientation(orientationState);
+ setThumbnailOrientation(orientationState);
+ }
+
+ protected void setIconOrientation(RecentsOrientedState orientationState) {
PagedOrientationHandler orientationHandler = orientationState.getOrientationHandler();
boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
@@ -1016,6 +1021,11 @@
int iconDrawableSize = isGridTask ? deviceProfile.overviewTaskIconDrawableSizeGridPx
: deviceProfile.overviewTaskIconDrawableSizePx;
mIconView.setDrawableSize(iconDrawableSize, iconDrawableSize);
+ }
+
+ protected void setThumbnailOrientation(RecentsOrientedState orientationState) {
+ DeviceProfile deviceProfile = mActivity.getDeviceProfile();
+ int thumbnailTopMargin = deviceProfile.overviewTaskThumbnailTopMarginPx;
LayoutParams snapshotParams = (LayoutParams) mSnapshotView.getLayoutParams();
snapshotParams.topMargin = thumbnailTopMargin;
diff --git a/res/drawable/ic_desktop.xml b/res/drawable/ic_desktop.xml
new file mode 100644
index 0000000..dfaf8b8
--- /dev/null
+++ b/res/drawable/ic_desktop.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2023 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.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="32.0dp"
+ android:height="32.0dp"
+ android:viewportWidth="32.0"
+ android:viewportHeight="32.0"
+ >
+ <group android:scaleX="0.5"
+ android:scaleY="0.5"
+ android:translateX="6.0"
+ android:translateY="6.0">
+ <path
+ android:fillColor="?android:attr/textColorPrimary"
+ android:pathData="M5.958,37.708Q4.458,37.708 3.354,36.604Q2.25,35.5 2.25,34V18.292Q2.25,16.792 3.354,15.688Q4.458,14.583 5.958,14.583H9.5V5.958Q9.5,4.458 10.625,3.354Q11.75,2.25 13.208,2.25H34Q35.542,2.25 36.646,3.354Q37.75,4.458 37.75,5.958V21.667Q37.75,23.167 36.646,24.271Q35.542,25.375 34,25.375H30.5V34Q30.5,35.5 29.396,36.604Q28.292,37.708 26.792,37.708ZM5.958,34H26.792Q26.792,34 26.792,34Q26.792,34 26.792,34V21.542H5.958V34Q5.958,34 5.958,34Q5.958,34 5.958,34ZM30.5,21.667H34Q34,21.667 34,21.667Q34,21.667 34,21.667V9.208H13.208V14.583H26.833Q28.375,14.583 29.438,15.667Q30.5,16.75 30.5,18.25Z"/>
+ </group>
+</vector>
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 2dc3e70..674ed2e 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -379,6 +379,10 @@
"Enable the ability to generate monochromatic icons, if it is not provided by the app"
);
+ public static final BooleanFlag ENABLE_DREAM_TRANSITION = getDebugFlag(
+ "ENABLE_DREAM_TRANSITION", true,
+ "Enable the launcher transition when the device enters a dream");
+
public static final BooleanFlag ENABLE_TASKBAR_EDU_TOOLTIP = getDebugFlag(
"ENABLE_TASKBAR_EDU_TOOLTIP", true,
"Enable the tooltip version of the Taskbar education flow.");