Merge "Clean up ENABLE_INPUT_CONSUMER_REASON_LOGGING" into udc-dev
diff --git a/quickstep/res/layout/redesigned_gesture_tutorial_fragment.xml b/quickstep/res/layout/redesigned_gesture_tutorial_fragment.xml
index 43439c6..2887518 100644
--- a/quickstep/res/layout/redesigned_gesture_tutorial_fragment.xml
+++ b/quickstep/res/layout/redesigned_gesture_tutorial_fragment.xml
@@ -205,15 +205,16 @@
android:id="@+id/checkmark_animation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginBottom="44dp"
android:gravity="center"
android:scaleType="centerCrop"
app:lottie_loop="false"
android:visibility="gone"
- app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@id/gesture_tutorial_fragment_feedback_subtitle" />
+ app:layout_constraintTop_toBottomOf="@id/gesture_tutorial_fragment_feedback_subtitle"
+ app:layout_constraintBottom_toBottomOf="parent" />
<Button
android:id="@+id/gesture_tutorial_fragment_action_button"
@@ -224,6 +225,7 @@
android:stateListAnimator="@null"
android:text="@string/gesture_tutorial_action_button_label"
android:visibility="invisible"
+ android:layout_marginBottom="60dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
diff --git a/quickstep/res/values-sw600dp/config.xml b/quickstep/res/values-sw600dp/config.xml
deleted file mode 100644
index e1e442f..0000000
--- a/quickstep/res/values-sw600dp/config.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?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.
--->
-<!-- Applies to large tablet screens portrait -->
-<resources>
- <!-- Taskbar -->
- <!-- Align the Taskbar to the start (Left/Right) of the device when 3 button nav is enabled. -->
- <bool name="start_align_taskbar">true</bool>
-</resources>
\ No newline at end of file
diff --git a/quickstep/res/values-sw720dp-land/config.xml b/quickstep/res/values-sw720dp-land/config.xml
deleted file mode 100644
index bf0f9ad..0000000
--- a/quickstep/res/values-sw720dp-land/config.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?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.
--->
-<!-- Applies to large tablet screens landscape -->
-<resources>
- <!-- Taskbar -->
- <!-- Align the Taskbar to the start (Left/Right) of the device when 3 button nav is enabled. -->
- <bool name="start_align_taskbar">false</bool>
-</resources>
\ No newline at end of file
diff --git a/quickstep/res/values-sw720dp/config.xml b/quickstep/res/values-sw720dp/config.xml
deleted file mode 100644
index e1e442f..0000000
--- a/quickstep/res/values-sw720dp/config.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?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.
--->
-<!-- Applies to large tablet screens portrait -->
-<resources>
- <!-- Taskbar -->
- <!-- Align the Taskbar to the start (Left/Right) of the device when 3 button nav is enabled. -->
- <bool name="start_align_taskbar">true</bool>
-</resources>
\ No newline at end of file
diff --git a/quickstep/res/values/config.xml b/quickstep/res/values/config.xml
index 0d3aeb3..e45d9fd 100644
--- a/quickstep/res/values/config.xml
+++ b/quickstep/res/values/config.xml
@@ -52,10 +52,6 @@
<string name="setup_wizard_pkg" translatable="false" />
- <!-- Taskbar -->
- <!-- Align the Taskbar to the start (Left/Right) of the device when 3 button nav is enabled. -->
- <bool name="start_align_taskbar">false</bool>
-
<!-- This is a float because it is converted to dp later in DeviceProfile -->
<item name="taskbar_icon_size" type="dimen" format="float">44</item>
</resources>
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java
index 66a903b..41093bd 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java
@@ -55,7 +55,6 @@
import com.android.launcher3.R;
import com.android.launcher3.accessibility.DragViewStateAnnouncer;
import com.android.launcher3.anim.Interpolators;
-import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragDriver;
import com.android.launcher3.dragndrop.DragOptions;
@@ -188,12 +187,10 @@
DragOptions dragOptions = new DragOptions();
dragOptions.preDragCondition = null;
- if (FeatureFlags.ENABLE_TASKBAR_POPUP_MENU.get()) {
- PopupContainerWithArrow<BaseTaskbarContext> popupContainer =
- mControllers.taskbarPopupController.showForIcon(btv);
- if (popupContainer != null) {
- dragOptions.preDragCondition = popupContainer.createPreDragCondition(false);
- }
+ PopupContainerWithArrow<BaseTaskbarContext> popupContainer =
+ mControllers.taskbarPopupController.showForIcon(btv);
+ if (popupContainer != null) {
+ dragOptions.preDragCondition = popupContainer.createPreDragCondition(false);
}
if (dragOptions.preDragCondition == null) {
dragOptions.preDragCondition = new DragOptions.PreDragCondition() {
@@ -208,8 +205,7 @@
public void onPreDragStart(DropTarget.DragObject dragObject) {
mDragView = dragObject.dragView;
- if (FeatureFlags.ENABLE_TASKBAR_POPUP_MENU.get()
- && !shouldStartDrag(0)) {
+ if (!shouldStartDrag(0)) {
mDragView.setOnAnimationEndCallback(() -> {
// Drag might be cancelled during the DragView animation, so check
// mIsPreDrag again.
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
index 5fedb3d..fcb2042 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
@@ -98,7 +98,8 @@
windowLayoutParams.providedInsets =
arrayOf(
InsetsFrameProvider(insetsOwner, 0, navigationBars()),
- InsetsFrameProvider(insetsOwner, 0, tappableElement())
+ InsetsFrameProvider(insetsOwner, 0, tappableElement()),
+ InsetsFrameProvider(insetsOwner, 0, mandatorySystemGestures())
)
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
index 9bc8cdd..58cb558 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
@@ -642,7 +642,7 @@
long resetDuration = mControllers.taskbarStashController.isInApp()
? duration
: duration / 2;
- if (!mControllers.taskbarTranslationController.willAnimateToZeroBefore(resetDuration)
+ if (mControllers.taskbarTranslationController.shouldResetBackToZero(resetDuration)
&& (isAnimatingToLauncher() || mLauncherState == LauncherState.NORMAL)) {
animatorSet.play(mControllers.taskbarTranslationController
.createAnimToResetTranslation(resetDuration));
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarShortcutMenuAccessibilityDelegate.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarShortcutMenuAccessibilityDelegate.java
index c10b57a..054689b 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarShortcutMenuAccessibilityDelegate.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarShortcutMenuAccessibilityDelegate.java
@@ -32,7 +32,6 @@
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.R;
import com.android.launcher3.accessibility.BaseAccessibilityDelegate;
-import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
@@ -75,7 +74,7 @@
@Override
protected void getSupportedActions(View host, ItemInfo item, List<LauncherAction> out) {
- if (ShortcutUtil.supportsShortcuts(item) && FeatureFlags.ENABLE_TASKBAR_POPUP_MENU.get()) {
+ if (ShortcutUtil.supportsShortcuts(item)) {
out.add(mActions.get(NotificationListener.getInstanceIfConnected() != null
? SHORTCUTS_AND_NOTIFICATIONS : DEEP_SHORTCUTS));
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
index 5f11740..69ea9fd 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
@@ -36,6 +36,7 @@
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SWITCHER_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
+import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_GOING_AWAY;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -43,6 +44,7 @@
import android.app.RemoteAction;
import android.content.SharedPreferences;
import android.graphics.drawable.Icon;
+import android.os.SystemClock;
import android.util.Log;
import android.view.InsetsController;
import android.view.View;
@@ -187,6 +189,10 @@
// Auto stashes when user has not interacted with the Taskbar after X ms.
private static final long NO_TOUCH_TIMEOUT_TO_STASH_MS = 5000;
+ // Duration for which an unlock event is considered "current", as other events are received
+ // asynchronously.
+ private static final long UNLOCK_TRANSITION_MEMOIZATION_MS = 200;
+
/**
* The default stash animation, morphing the taskbar into the navbar.
*/
@@ -743,56 +749,77 @@
private void createTransientAnimToIsStashed(AnimatorSet as, boolean isStashed, long duration,
@StashAnimation int animationType) {
- Interpolator skipInterpolator = null;
+ // Target values of the properties this is going to set
+ final float backgroundOffsetTarget = isStashed ? 1 : 0;
+ final float iconAlphaTarget = isStashed ? 0 : 1;
+ final float stashedHandleAlphaTarget = isStashed ? 1 : 0;
+
+ // Timing for the alpha values depend on the animation played
+ long iconAlphaStartDelay = 0, iconAlphaDuration = 0, stashedHandleAlphaDelay = 0,
+ stashedHandleAlphaDuration = 0;
+ if (duration > 0) {
+ if (animationType == TRANSITION_HANDLE_FADE) {
+ // When fading, the handle fades in/out at the beginning of the transition with
+ // TASKBAR_STASH_ALPHA_DURATION.
+ stashedHandleAlphaDuration = TASKBAR_STASH_ALPHA_DURATION;
+ // The iconAlphaDuration must be set to duration for the skippable interpolators
+ // below to work.
+ iconAlphaDuration = duration;
+ } else {
+ iconAlphaStartDelay = TASKBAR_STASH_ALPHA_START_DELAY;
+ iconAlphaDuration = TASKBAR_STASH_ALPHA_DURATION;
+ stashedHandleAlphaDuration = TASKBAR_STASH_ALPHA_DURATION;
+
+ if (isStashed) {
+ if (animationType == TRANSITION_HOME_TO_APP) {
+ iconAlphaStartDelay = TASKBAR_STASH_ICON_ALPHA_HOME_TO_APP_START_DELAY;
+ }
+ stashedHandleAlphaDelay = iconAlphaStartDelay;
+ stashedHandleAlphaDuration = Math.max(0, duration - iconAlphaStartDelay);
+ }
+
+ }
+ }
+
+ play(as, mTaskbarStashedHandleAlpha.animateToValue(stashedHandleAlphaTarget),
+ stashedHandleAlphaDelay,
+ stashedHandleAlphaDuration, LINEAR);
+
+ // The rest of the animations might be "skipped" in TRANSITION_HANDLE_FADE transitions.
+ AnimatorSet skippable = as;
+ if (animationType == TRANSITION_HANDLE_FADE) {
+ skippable = new AnimatorSet();
+ as.play(skippable);
+ skippable.setInterpolator(isStashed ? INSTANT : FINAL_FRAME);
+ }
+
+ final boolean animateBg = animationType != TRANSITION_UNSTASH_SUW_MANUAL;
+ if (animateBg) {
+ play(skippable, mTaskbarBackgroundOffset.animateToValue(backgroundOffsetTarget), 0,
+ duration, EMPHASIZED);
+ } else {
+ skippable.addListener(AnimatorListeners.forEndCallback(
+ () -> mTaskbarBackgroundOffset.updateValue(backgroundOffsetTarget)));
+ }
+
+ play(skippable, mIconAlphaForStash.animateToValue(iconAlphaTarget), iconAlphaStartDelay,
+ iconAlphaDuration,
+ LINEAR);
if (isStashed) {
- play(as, mTaskbarBackgroundOffset.animateToValue(1), 0, duration, EMPHASIZED);
-
- long alphaStartDelay = duration == 0 ? 0 : animationType == TRANSITION_HOME_TO_APP
- ? TASKBAR_STASH_ICON_ALPHA_HOME_TO_APP_START_DELAY
- : TASKBAR_STASH_ALPHA_START_DELAY;
- long alphaDuration = duration == 0 ? 0 : TASKBAR_STASH_ALPHA_DURATION;
- play(as, mIconAlphaForStash.animateToValue(0), alphaStartDelay, alphaDuration, LINEAR);
- play(as, mTaskbarStashedHandleAlpha.animateToValue(1), alphaStartDelay,
- Math.max(0, duration - alphaStartDelay), LINEAR);
-
- play(as, mControllers.taskbarSpringOnStashController.createSpringToStash(), 0, duration,
- LINEAR);
-
- if (animationType == TRANSITION_HANDLE_FADE) {
- skipInterpolator = INSTANT;
- }
- } else {
- final boolean animateBg = animationType != TRANSITION_UNSTASH_SUW_MANUAL;
- if (animateBg) {
- play(as, mTaskbarBackgroundOffset.animateToValue(0), 0, duration, EMPHASIZED);
- } else {
- as.addListener(AnimatorListeners.forEndCallback(
- () -> mTaskbarBackgroundOffset.updateValue(0)));
- }
-
- long alphaStartDelay = duration == 0 ? 0 : TASKBAR_STASH_ALPHA_START_DELAY;
- long alphaDuration = duration == 0 ? 0 : TASKBAR_STASH_ALPHA_DURATION;
- play(as, mIconAlphaForStash.animateToValue(1), alphaStartDelay, alphaDuration, LINEAR);
- play(as, mTaskbarStashedHandleAlpha.animateToValue(0), 0, alphaDuration, LINEAR);
-
- if (animationType == TRANSITION_HANDLE_FADE) {
- skipInterpolator = FINAL_FRAME;
- }
+ play(skippable, mControllers.taskbarSpringOnStashController.createSpringToStash(),
+ 0, duration, LINEAR);
}
- mControllers.taskbarViewController.addRevealAnimToIsStashed(as, isStashed, duration,
+
+ mControllers.taskbarViewController.addRevealAnimToIsStashed(skippable, isStashed, duration,
EMPHASIZED);
- if (skipInterpolator != null) {
- as.setInterpolator(skipInterpolator);
- }
-
- play(as, mControllers.stashedHandleViewController
+ play(skippable, mControllers.stashedHandleViewController
.createRevealAnimToIsStashed(isStashed), 0, duration, EMPHASIZED);
// Return the stashed handle to its default scale in case it was changed as part of the
// feedforward hint. Note that the reveal animation above also visually scales it.
- as.play(mTaskbarStashedHandleHintScale.animateToValue(1f)
+ skippable.play(mTaskbarStashedHandleHintScale.animateToValue(1f)
.setDuration(isStashed ? duration / 2 : duration));
}
@@ -951,7 +978,8 @@
updateStateForFlag(FLAG_STASHED_SYSUI,
hasAnyFlag(systemUiStateFlags, SYSUI_STATE_SCREEN_PINNING));
- boolean isLocked = hasAnyFlag(systemUiStateFlags, MASK_ANY_SYSUI_LOCKED);
+ boolean isLocked = hasAnyFlag(systemUiStateFlags, MASK_ANY_SYSUI_LOCKED)
+ && !hasAnyFlag(systemUiStateFlags, SYSUI_STATE_STATUS_BAR_KEYGUARD_GOING_AWAY);
updateStateForFlag(FLAG_STASHED_DEVICE_LOCKED, isLocked);
// Only update FLAG_STASHED_IN_APP_IME when system gesture is not in progress.
@@ -1169,6 +1197,8 @@
private @StashAnimation int mLastStartedTransitionType = TRANSITION_DEFAULT;
private int mPrevFlags;
+ private long mLastUnlockTransitionTimeout = 0;
+
StatePropertyHolder(IntPredicate stashCondition) {
mStashCondition = stashCondition;
}
@@ -1186,7 +1216,7 @@
if (DEBUG) {
String stateString = formatFlagChange(flags, mPrevFlags,
- TaskbarStashController::getStateString);
+ TaskbarStashController::getStateString);
Log.d(TAG, "createSetStateAnimator: flags: " + stateString
+ ", duration: " + duration
+ ", isStashed: " + isStashed
@@ -1199,6 +1229,17 @@
mPrevFlags = flags;
}
+ boolean isUnlockTransition = hasAnyFlag(changedFlags, FLAG_STASHED_DEVICE_LOCKED)
+ && !hasAnyFlag(FLAG_STASHED_DEVICE_LOCKED);
+ if (isUnlockTransition) {
+ // the launcher might not be resumed at the time the device is considered
+ // unlocked (when the keyguard goes away), but possibly shortly afterwards.
+ // To play the unlock transition at the time the unstash animation actually happens,
+ // this memoizes the state transition for UNLOCK_TRANSITION_MEMOIZATION_MS.
+ mLastUnlockTransitionTimeout =
+ SystemClock.elapsedRealtime() + UNLOCK_TRANSITION_MEMOIZATION_MS;
+ }
+
@StashAnimation int animationType = computeTransitionType(changedFlags);
// Allow re-starting animation if upgrading from default animation type, otherwise
@@ -1229,6 +1270,7 @@
}
private @StashAnimation int computeTransitionType(int changedFlags) {
+
boolean hotseatHiddenDuringAppLaunch =
!mControllers.uiController.isHotseatIconOnTopWhenAligned()
&& hasAnyFlag(changedFlags, FLAG_IN_APP);
@@ -1240,8 +1282,8 @@
return TRANSITION_HANDLE_FADE;
}
- boolean isUnlockTransition = hasAnyFlag(changedFlags, FLAG_STASHED_DEVICE_LOCKED)
- && !hasAnyFlag(FLAG_STASHED_DEVICE_LOCKED);
+ boolean isUnlockTransition =
+ SystemClock.elapsedRealtime() < mLastUnlockTransitionTimeout;
if (isUnlockTransition) {
// When transitioning to unlocked device, the hotseat will already be visible on
// the homescreen, thus do not play an un-stash animation.
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java
index 065d111..4b18bb6 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java
@@ -54,6 +54,7 @@
private boolean mHasSprungOnceThisGesture;
private @Nullable ValueAnimator mSpringBounce;
private boolean mGestureEnded;
+ private boolean mGestureInProgress;
private boolean mAnimationToHomeRunning;
private final boolean mIsTransientTaskbar;
@@ -123,6 +124,7 @@
private void reset() {
mGestureEnded = false;
+ mGestureInProgress = false;
mHasSprungOnceThisGesture = false;
}
@@ -134,18 +136,24 @@
}
/**
- * Returns true if we will animate to zero before the input duration.
+ * Returns {@code true} if we should reset the animation back to zero.
+ *
+ * Returns {@code false} if there is a gesture in progress, or if we are already animating
+ * to 0 within the specified duration.
*/
- public boolean willAnimateToZeroBefore(long duration) {
+ public boolean shouldResetBackToZero(long duration) {
+ if (mGestureInProgress) {
+ return false;
+ }
if (mSpringBounce != null && mSpringBounce.isRunning()) {
long springDuration = mSpringBounce.getDuration();
long current = mSpringBounce.getCurrentPlayTime();
- return (springDuration - current < duration);
+ return (springDuration - current >= duration);
}
if (mTranslationYForSwipe.isAnimatingToValue(0)) {
- return mTranslationYForSwipe.getRemainingTime() < duration;
+ return mTranslationYForSwipe.getRemainingTime() >= duration;
}
- return false;
+ return true;
}
/**
@@ -188,6 +196,7 @@
mAnimationToHomeRunning = false;
cancelSpringIfExists();
reset();
+ mGestureInProgress = true;
}
/**
* Called when there is movement to move the taskbar.
@@ -211,6 +220,7 @@
mGestureEnded = true;
startSpring();
}
+ mGestureInProgress = false;
}
}
@@ -222,6 +232,7 @@
pw.println(prefix + "\tmHasSprungOnceThisGesture=" + mHasSprungOnceThisGesture);
pw.println(prefix + "\tmAnimationToHomeRunning=" + mAnimationToHomeRunning);
pw.println(prefix + "\tmGestureEnded=" + mGestureEnded);
+ pw.println(prefix + "\tmGestureInProgress=" + mGestureInProgress);
pw.println(prefix + "\tmSpringBounce is running=" + (mSpringBounce != null
&& mSpringBounce.isRunning()));
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
index b9242b2..1435cb0 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
@@ -244,7 +244,8 @@
taskAttributes.getIconView().getDrawable(),
taskAttributes.getThumbnailView(),
taskAttributes.getThumbnailView().getThumbnail(),
- null /* intent */);
+ null /* intent */,
+ null /* user */);
return;
}
}
@@ -256,7 +257,8 @@
new BitmapDrawable(info.bitmap.icon),
startingView,
null /* thumbnail */,
- intent);
+ intent,
+ info.user);
}
);
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
index 87df5b0..a3e6814 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
@@ -57,7 +57,8 @@
/**
* Hosts the Taskbar content such as Hotseat and Recent Apps. Drawn on top of other apps.
*/
-public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconParent, Insettable {
+public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconParent, Insettable,
+ DeviceProfile.OnDeviceProfileChangeListener {
private static final String TAG = TaskbarView.class.getSimpleName();
private static final Rect sTmpRect = new Rect();
@@ -92,7 +93,7 @@
private float mTransientTaskbarAllAppsButtonTranslationXOffset;
- private final boolean mShouldTryStartAlign;
+ private boolean mShouldTryStartAlign;
public TaskbarView(@NonNull Context context) {
this(context, null);
@@ -121,8 +122,8 @@
resources.getDimension(isTransientTaskbar
? R.dimen.transient_taskbar_all_apps_button_translation_x_offset
: R.dimen.taskbar_all_apps_button_translation_x_offset);
- mShouldTryStartAlign = mActivityContext.isThreeButtonNav()
- && resources.getBoolean(R.bool.start_align_taskbar);
+
+ onDeviceProfileChanged(mActivityContext.getDeviceProfile());
int actualMargin = resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing);
int actualIconSize = mActivityContext.getDeviceProfile().taskbarIconSize;
@@ -162,6 +163,23 @@
}
@Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ mActivityContext.addOnDeviceProfileChangeListener(this);
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ mActivityContext.removeOnDeviceProfileChangeListener(this);
+ }
+
+ @Override
+ public void onDeviceProfileChanged(DeviceProfile dp) {
+ mShouldTryStartAlign = mActivityContext.isThreeButtonNav() && dp.startAlignTaskbar;
+ }
+
+ @Override
public boolean performAccessibilityActionInternal(int action, Bundle arguments) {
if (action == AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS) {
announceForAccessibility(mContext.getString(R.string.taskbar_a11y_shown_title));
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index b4990e4..9ca8928 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -73,7 +73,6 @@
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
-import com.android.app.viewcapture.SettingsAwareViewCapture;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.R;
@@ -1232,10 +1231,6 @@
createdOverviewActivity.getDeviceProfile().dump(this, "", pw);
}
mTaskbarManager.dumpLogs("", pw);
-
- if (FeatureFlags.CONTINUOUS_VIEW_TREE_CAPTURE.get()) {
- SettingsAwareViewCapture.getInstance(this).dump(pw, fd, this);
- }
}
}
diff --git a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
index c537ef8..11e1fbd 100644
--- a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
+++ b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
@@ -89,11 +89,17 @@
private final StateManager mStateManager;
@Nullable
private DepthController mDepthController;
- private @StagePosition int mStagePosition;
+ private @StagePosition int mInitialStagePosition;
private ItemInfo mItemInfo;
+ /** {@link #mInitialTaskIntent} and {@link #mInitialUser} (the user of the Intent) are set
+ * together when split is initiated from an Intent. */
private Intent mInitialTaskIntent;
+ private UserHandle mInitialUser;
private int mInitialTaskId = INVALID_TASK_ID;
+ /** {@link #mSecondTaskIntent} and {@link #mSecondUser} (the user of the Intent) are set
+ * together when split is confirmed with an Intent. */
private Intent mSecondTaskIntent;
+ private UserHandle mSecondUser;
private int mSecondTaskId = INVALID_TASK_ID;
private boolean mRecentsAnimationRunning;
/** If {@code true}, animates the existing task view split placeholder view */
@@ -103,8 +109,6 @@
* split pair task view without wanting to animate current task dismissal overall
*/
private boolean mDismissingFromSplitPair;
- @Nullable
- private UserHandle mUser;
/** If not null, this is the TaskView we want to launch from */
@Nullable
private GroupedTaskView mLaunchingTaskView;
@@ -138,7 +142,7 @@
mInitialTaskId = alreadyRunningTask;
} else {
mInitialTaskIntent = intent;
- mUser = itemInfo.user;
+ mInitialUser = itemInfo.user;
}
setInitialData(stagePosition, splitEvent, itemInfo);
@@ -158,7 +162,7 @@
private void setInitialData(@StagePosition int stagePosition,
StatsLogManager.EventEnum splitEvent, ItemInfo itemInfo) {
mItemInfo = itemInfo;
- mStagePosition = stagePosition;
+ mInitialStagePosition = stagePosition;
mSplitEvent = splitEvent;
}
@@ -215,7 +219,7 @@
Pair<InstanceId, com.android.launcher3.logging.InstanceId> instanceIds =
LogUtils.getShellShareableInstanceId();
launchTasks(mInitialTaskId, mInitialTaskIntent, mSecondTaskId, mSecondTaskIntent,
- mStagePosition, callback, false /* freezeTaskList */, DEFAULT_SPLIT_RATIO,
+ mInitialStagePosition, callback, false /* freezeTaskList */, DEFAULT_SPLIT_RATIO,
instanceIds.first);
mStatsLogManager.logger()
@@ -232,8 +236,14 @@
mSecondTaskId = task.key.id;
}
- public void setSecondTask(Intent intent) {
+ /**
+ * To be called as soon as user selects the second app (even if animations aren't complete)
+ * @param intent The second intent that will be launched.
+ * @param user The user of that intent.
+ */
+ public void setSecondTask(Intent intent, UserHandle user) {
mSecondTaskIntent = intent;
+ mSecondUser = user;
}
/**
@@ -291,16 +301,17 @@
null /* options2 */, stagePosition, splitRatio, remoteTransition,
shellInstanceId);
} else if (intent2 == null) {
- launchIntentOrShortcut(intent1, options1, taskId2, stagePosition, splitRatio,
- remoteTransition, shellInstanceId);
+ launchIntentOrShortcut(intent1, mInitialUser, options1, taskId2, stagePosition,
+ splitRatio, remoteTransition, shellInstanceId);
} else if (intent1 == null) {
- launchIntentOrShortcut(intent2, options1, taskId1,
+ launchIntentOrShortcut(intent2, mSecondUser, options1, taskId1,
getOppositeStagePosition(stagePosition), splitRatio, remoteTransition,
shellInstanceId);
} else {
- mSystemUiProxy.startIntents(getPendingIntent(intent1), options1.toBundle(),
- getPendingIntent(intent2), null /* options2 */, stagePosition,
- splitRatio, remoteTransition, shellInstanceId);
+ mSystemUiProxy.startIntents(getPendingIntent(intent1, mInitialUser),
+ options1.toBundle(), getPendingIntent(intent2, mSecondUser),
+ null /* options2 */, stagePosition, splitRatio, remoteTransition,
+ shellInstanceId);
}
} else {
final RemoteSplitLaunchAnimationRunner animationRunner =
@@ -314,61 +325,64 @@
taskId2, null /* options2 */, stagePosition, splitRatio, adapter,
shellInstanceId);
} else if (intent2 == null) {
- launchIntentOrShortcutLegacy(intent1, options1, taskId2, stagePosition, splitRatio,
- adapter, shellInstanceId);
+ launchIntentOrShortcutLegacy(intent1, mInitialUser, options1, taskId2,
+ stagePosition, splitRatio, adapter, shellInstanceId);
} else if (intent1 == null) {
- launchIntentOrShortcutLegacy(intent2, options1, taskId1,
+ launchIntentOrShortcutLegacy(intent2, mSecondUser, options1, taskId1,
getOppositeStagePosition(stagePosition), splitRatio, adapter,
shellInstanceId);
} else {
mSystemUiProxy.startIntentsWithLegacyTransition(
- getPendingIntent(intent1), getShortcutInfo(intent1), options1.toBundle(),
- getPendingIntent(intent2), getShortcutInfo(intent2), null /* options2 */,
- stagePosition, splitRatio, adapter, shellInstanceId);
+ getPendingIntent(intent1, mInitialUser),
+ getShortcutInfo(intent1, mInitialUser), options1.toBundle(),
+ getPendingIntent(intent2, mSecondUser),
+ getShortcutInfo(intent2, mSecondUser), null /* options2 */, stagePosition,
+ splitRatio, adapter, shellInstanceId);
}
}
}
- private void launchIntentOrShortcut(Intent intent, ActivityOptions options1, int taskId,
- @StagePosition int stagePosition, float splitRatio, RemoteTransition remoteTransition,
- @Nullable InstanceId shellInstanceId) {
- final ShortcutInfo shortcutInfo = getShortcutInfo(intent);
+ private void launchIntentOrShortcut(Intent intent, UserHandle user, ActivityOptions options1,
+ int taskId, @StagePosition int stagePosition, float splitRatio,
+ RemoteTransition remoteTransition, @Nullable InstanceId shellInstanceId) {
+ final ShortcutInfo shortcutInfo = getShortcutInfo(intent, user);
if (shortcutInfo != null) {
mSystemUiProxy.startShortcutAndTask(shortcutInfo,
options1.toBundle(), taskId, null /* options2 */, stagePosition,
splitRatio, remoteTransition, shellInstanceId);
} else {
- mSystemUiProxy.startIntentAndTask(getPendingIntent(intent), options1.toBundle(), taskId,
- null /* options2 */, stagePosition, splitRatio, remoteTransition,
- shellInstanceId);
+ mSystemUiProxy.startIntentAndTask(getPendingIntent(intent, user),
+ options1.toBundle(), taskId, null /* options2 */, stagePosition, splitRatio,
+ remoteTransition, shellInstanceId);
}
}
- private void launchIntentOrShortcutLegacy(Intent intent, ActivityOptions options1, int taskId,
- @StagePosition int stagePosition, float splitRatio, RemoteAnimationAdapter adapter,
+ private void launchIntentOrShortcutLegacy(Intent intent, UserHandle user,
+ ActivityOptions options1, int taskId, @StagePosition int stagePosition,
+ float splitRatio, RemoteAnimationAdapter adapter,
@Nullable InstanceId shellInstanceId) {
- final ShortcutInfo shortcutInfo = getShortcutInfo(intent);
+ final ShortcutInfo shortcutInfo = getShortcutInfo(intent, user);
if (shortcutInfo != null) {
mSystemUiProxy.startShortcutAndTaskWithLegacyTransition(shortcutInfo,
options1.toBundle(), taskId, null /* options2 */, stagePosition,
splitRatio, adapter, shellInstanceId);
} else {
- mSystemUiProxy.startIntentAndTaskWithLegacyTransition(getPendingIntent(intent),
- options1.toBundle(), taskId, null /* options2 */, stagePosition, splitRatio,
- adapter, shellInstanceId);
+ mSystemUiProxy.startIntentAndTaskWithLegacyTransition(
+ getPendingIntent(intent, user), options1.toBundle(), taskId,
+ null /* options2 */, stagePosition, splitRatio, adapter, shellInstanceId);
}
}
- private PendingIntent getPendingIntent(Intent intent) {
- return intent == null ? null : (mUser != null
+ private PendingIntent getPendingIntent(Intent intent, UserHandle user) {
+ return intent == null ? null : (user != null
? PendingIntent.getActivityAsUser(mContext, 0, intent,
- FLAG_MUTABLE | FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT, null /* options */, mUser)
+ FLAG_MUTABLE | FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT, null /* options */, user)
: PendingIntent.getActivity(mContext, 0, intent,
FLAG_MUTABLE | FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT));
}
public @StagePosition int getActiveSplitStagePosition() {
- return mStagePosition;
+ return mInitialStagePosition;
}
public StatsLogManager.EventEnum getSplitEvent() {
@@ -380,7 +394,7 @@
}
@Nullable
- private ShortcutInfo getShortcutInfo(Intent intent) {
+ private ShortcutInfo getShortcutInfo(Intent intent, UserHandle user) {
if (intent == null || intent.getPackage() == null) {
return null;
}
@@ -392,7 +406,7 @@
try {
final Context context = mContext.createPackageContextAsUser(
- intent.getPackage(), 0 /* flags */, mUser);
+ intent.getPackage(), 0 /* flags */, user);
return new ShortcutInfo.Builder(context, shortcutId).build();
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "Failed to create a ShortcutInfo for " + intent.getPackage());
@@ -522,7 +536,9 @@
mInitialTaskIntent = null;
mSecondTaskId = INVALID_TASK_ID;
mSecondTaskIntent = null;
- mStagePosition = SplitConfigurationOptions.STAGE_POSITION_UNDEFINED;
+ mInitialUser = null;
+ mSecondUser = null;
+ mInitialStagePosition = SplitConfigurationOptions.STAGE_POSITION_UNDEFINED;
mRecentsAnimationRunning = false;
mLaunchingTaskView = null;
mItemInfo = null;
diff --git a/quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java b/quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java
index e5c74dc..dd10c2d 100644
--- a/quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java
+++ b/quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java
@@ -24,6 +24,7 @@
import android.content.Intent;
import android.graphics.Rect;
import android.graphics.RectF;
+import android.os.UserHandle;
import android.view.View;
import com.android.launcher3.DeviceProfile;
@@ -66,21 +67,24 @@
}
Object tag = view.getTag();
Intent intent;
+ UserHandle user;
BitmapInfo bitmapInfo;
if (tag instanceof WorkspaceItemInfo) {
final WorkspaceItemInfo workspaceItemInfo = (WorkspaceItemInfo) tag;
intent = workspaceItemInfo.intent;
+ user = workspaceItemInfo.user;
bitmapInfo = workspaceItemInfo.bitmap;
} else if (tag instanceof com.android.launcher3.model.data.AppInfo) {
final com.android.launcher3.model.data.AppInfo appInfo =
(com.android.launcher3.model.data.AppInfo) tag;
intent = appInfo.intent;
+ user = appInfo.user;
bitmapInfo = appInfo.bitmap;
} else {
return false;
}
- mController.setSecondTask(intent);
+ mController.setSecondTask(intent, user);
boolean isTablet = mLauncher.getDeviceProfile().isTablet;
SplitAnimationTimings timings = AnimUtils.getDeviceSplitToConfirmTimings(isTablet);
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 7989bb0..cf6ee2d 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -4589,11 +4589,13 @@
* is (either the ThumbnailView or the tapped icon).
* @param intent If we are launching a fresh instance of the app, this is the Intent for it. If
* the second app is already running in Recents, this will be null.
+ * @param user If we are launching a fresh instance of the app, this is the UserHandle for it.
+ * If the second app is already running in Recents, this will be null.
* @return true if waiting for confirmation of second app or if split animations are running,
* false otherwise
*/
public boolean confirmSplitSelect(TaskView containerTaskView, Task task, Drawable drawable,
- View secondView, @Nullable Bitmap thumbnail, Intent intent) {
+ View secondView, @Nullable Bitmap thumbnail, Intent intent, UserHandle user) {
if (canLaunchFullscreenTask()) {
return false;
}
@@ -4609,7 +4611,7 @@
}
mSplitSelectStateController.setSecondTask(task);
} else {
- mSplitSelectStateController.setSecondTask(intent);
+ mSplitSelectStateController.setSecondTask(intent, user);
}
RectF secondTaskStartingBounds = new RectF();
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index df90583..42589ce 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -761,7 +761,8 @@
if (container != null) {
return getRecentsView().confirmSplitSelect(this, container.getTask(),
container.getIconView().getDrawable(), container.getThumbnailView(),
- container.getThumbnailView().getThumbnail(), /* intent */ null);
+ container.getThumbnailView().getThumbnail(), /* intent */ null,
+ /* user */ null);
}
return false;
}
diff --git a/res/layout/widgets_two_pane_sheet_paged_view.xml b/res/layout/widgets_two_pane_sheet_paged_view.xml
index 5cc2406..d3a8584 100644
--- a/res/layout/widgets_two_pane_sheet_paged_view.xml
+++ b/res/layout/widgets_two_pane_sheet_paged_view.xml
@@ -74,7 +74,9 @@
android:id="@+id/suggestions_header"
android:layout_marginTop="8dp"
android:layout_marginHorizontal="@dimen/widget_list_horizontal_margin_two_pane"
- android:orientation="horizontal">
+ android:orientation="horizontal"
+ android:background="?android:attr/colorBackground"
+ launcher:layout_sticky="true">
</LinearLayout>
<com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip
diff --git a/res/layout/widgets_two_pane_sheet_recyclerview.xml b/res/layout/widgets_two_pane_sheet_recyclerview.xml
index 09cef88..8f2a25e 100644
--- a/res/layout/widgets_two_pane_sheet_recyclerview.xml
+++ b/res/layout/widgets_two_pane_sheet_recyclerview.xml
@@ -59,7 +59,10 @@
android:id="@+id/suggestions_header"
android:layout_marginTop="8dp"
android:layout_marginHorizontal="@dimen/widget_list_horizontal_margin_two_pane"
- android:orientation="horizontal">
+ android:paddingBottom="16dp"
+ android:orientation="horizontal"
+ android:background="?android:attr/colorBackground"
+ launcher:layout_sticky="true">
</LinearLayout>
</com.android.launcher3.views.StickyHeaderLayout>
</FrameLayout>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 04eb0db..82bab56 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -404,6 +404,16 @@
<!-- defaults to iconTextSize, if not specified -->
<attr name="iconTextSizeTwoPanelLandscape" format="float" />
+ <!-- If true, used to layout taskbar in 3 button navigation mode. -->
+ <!-- defaults to false if not specified -->
+ <attr name="startAlignTaskbar" format="boolean" />
+ <!-- defaults to startAlignTaskbar, if not specified -->
+ <attr name="startAlignTaskbarLandscape" format="boolean" />
+ <!-- defaults to startAlignTaskbarLandscape, if not specified -->
+ <attr name="startAlignTaskbarTwoPanelLandscape" format="boolean" />
+ <!-- defaults to startAlignTaskbar, if not specified -->
+ <attr name="startAlignTaskbarTwoPanelPortrait" format="boolean" />
+
<!-- If set, this display option is used to determine the default grid -->
<attr name="canBeDefault" format="boolean" />
diff --git a/src/com/android/launcher3/AutoInstallsLayout.java b/src/com/android/launcher3/AutoInstallsLayout.java
index 27c41c2..2083726 100644
--- a/src/com/android/launcher3/AutoInstallsLayout.java
+++ b/src/com/android/launcher3/AutoInstallsLayout.java
@@ -24,30 +24,29 @@
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.LauncherActivityInfo;
+import android.content.pm.LauncherApps;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.database.sqlite.SQLiteDatabase;
-import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
+import android.os.Process;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.AttributeSet;
import android.util.Log;
-import android.util.Patterns;
import android.util.Xml;
import androidx.annotation.Nullable;
import com.android.launcher3.LauncherProvider.SqlArguments;
import com.android.launcher3.LauncherSettings.Favorites;
-import com.android.launcher3.icons.GraphicsUtils;
-import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.pm.UserCache;
import com.android.launcher3.qsb.QsbContainerView;
+import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.uioverrides.ApiWrapper;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.Partner;
@@ -58,6 +57,7 @@
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
+import java.util.Collections;
import java.util.Locale;
import java.util.Map;
import java.util.function.Supplier;
@@ -135,6 +135,7 @@
private static final String ATTR_TITLE = "title";
private static final String ATTR_TITLE_TEXT = "titleText";
private static final String ATTR_SCREEN = "screen";
+ private static final String ATTR_SHORTCUT_ID = "shortcutId";
// x and y can be specified as negative integers, in which case -1 represents the
// last row / column, -2 represents the second last, and so on.
@@ -143,8 +144,6 @@
private static final String ATTR_SPAN_X = "spanX";
private static final String ATTR_SPAN_Y = "spanY";
- private static final String ATTR_ICON = "icon";
- private static final String ATTR_URL = "url";
// Attrs for "Include"
private static final String ATTR_WORKSPACE = "workspace";
@@ -156,10 +155,8 @@
private static final String HOTSEAT_CONTAINER_NAME =
Favorites.containerToString(Favorites.CONTAINER_HOTSEAT);
- @Thunk
- final Context mContext;
- @Thunk
- final LauncherWidgetHolder mAppWidgetHolder;
+ protected final Context mContext;
+ protected final LauncherWidgetHolder mAppWidgetHolder;
protected final LayoutParserCallback mCallback;
protected final PackageManager mPackageManager;
@@ -308,7 +305,15 @@
mValues.put(Favorites.SPANY, 1);
mValues.put(Favorites._ID, id);
- maybeReplaceShortcut(intent.getComponent().getPackageName(), type);
+ if (type == ITEM_TYPE_APPLICATION) {
+ ComponentName cn = intent.getComponent();
+ if (cn != null && mActivityOverride.containsKey(cn.getPackageName())) {
+ LauncherActivityInfo replacementInfo = mActivityOverride.get(cn.getPackageName());
+ mValues.put(Favorites.PROFILE_ID, UserCache.INSTANCE.get(mContext)
+ .getSerialNumberForUser(replacementInfo.getUser()));
+ mValues.put(Favorites.INTENT, AppInfo.makeLaunchIntent(replacementInfo).toUri(0));
+ }
+ }
if (mCallback.insertAndCheck(mDb, mValues) < 0) {
return -1;
@@ -321,7 +326,7 @@
ArrayMap<String, TagParser> parsers = new ArrayMap<>();
parsers.put(TAG_APP_ICON, new AppShortcutParser());
parsers.put(TAG_AUTO_INSTALL, new AutoInstallParser());
- parsers.put(TAG_SHORTCUT, new ShortcutParser(mSourceRes));
+ parsers.put(TAG_SHORTCUT, new ShortcutParser());
return parsers;
}
@@ -332,7 +337,7 @@
parsers.put(TAG_FOLDER, new FolderParser());
parsers.put(TAG_APPWIDGET, new PendingWidgetParser());
parsers.put(TAG_SEARCH_WIDGET, new SearchWidgetParser());
- parsers.put(TAG_SHORTCUT, new ShortcutParser(mSourceRes));
+ parsers.put(TAG_SHORTCUT, new ShortcutParser());
return parsers;
}
@@ -420,59 +425,27 @@
}
/**
- * Parses a web shortcut. Required attributes url, icon, title
+ * Parses a deep shortcut. Required attributes packageName and shortcutId
*/
protected class ShortcutParser implements TagParser {
- private final Resources mIconRes;
-
- public ShortcutParser(Resources iconRes) {
- mIconRes = iconRes;
- }
-
@Override
public int parseAndAdd(XmlPullParser parser) {
- final int titleResId = getAttributeResourceValue(parser, ATTR_TITLE, 0);
- final int iconId = getAttributeResourceValue(parser, ATTR_ICON, 0);
+ final String packageName = getAttributeValue(parser, ATTR_PACKAGE_NAME);
+ final String shortcutId = getAttributeValue(parser, ATTR_SHORTCUT_ID);
- if (titleResId == 0 || iconId == 0) {
- if (LOGD) Log.d(TAG, "Ignoring shortcut");
- return -1;
+ try {
+ LauncherApps launcherApps = mContext.getSystemService(LauncherApps.class);
+ launcherApps.pinShortcuts(packageName, Collections.singletonList(shortcutId),
+ Process.myUserHandle());
+ Intent intent = ShortcutKey.makeIntent(shortcutId, packageName);
+ mValues.put(Favorites.RESTORED, WorkspaceItemInfo.FLAG_RESTORED_ICON);
+ return addShortcut(null, intent, Favorites.ITEM_TYPE_DEEP_SHORTCUT);
+ } catch (Exception e) {
+ Log.e(TAG, "Unable to pin the shortcut for shortcut id = " + shortcutId
+ + " and package name = " + packageName, e);
}
-
- final Intent intent = parseIntent(parser);
- if (intent == null) {
- return -1;
- }
-
- Drawable icon = mIconRes.getDrawable(iconId);
- if (icon == null) {
- if (LOGD) Log.d(TAG, "Ignoring shortcut, can't load icon");
- return -1;
- }
-
- // Auto installs should always support the current platform version.
- LauncherIcons li = LauncherIcons.obtain(mContext);
- mValues.put(LauncherSettings.Favorites.ICON, GraphicsUtils.flattenBitmap(
- li.createBadgedIconBitmap(icon).icon));
- li.recycle();
-
- mValues.put(Favorites.ICON_PACKAGE, mIconRes.getResourcePackageName(iconId));
- mValues.put(Favorites.ICON_RESOURCE, mIconRes.getResourceName(iconId));
-
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
- Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
- return addShortcut(mSourceRes.getString(titleResId),
- intent, Favorites.ITEM_TYPE_SHORTCUT);
- }
-
- protected Intent parseIntent(XmlPullParser parser) {
- final String url = getAttributeValue(parser, ATTR_URL);
- if (TextUtils.isEmpty(url) || !Patterns.WEB_URL.matcher(url).matches()) {
- if (LOGD) Log.d(TAG, "Ignoring shortcut, invalid url: " + url);
- return null;
- }
- return new Intent(Intent.ACTION_VIEW, null).setData(Uri.parse(url));
+ return -1;
}
}
@@ -728,12 +701,4 @@
to.put(key, from.getAsInteger(key));
}
- private void maybeReplaceShortcut(String packageName, int type) {
- if (mActivityOverride.containsKey(packageName) && type == ITEM_TYPE_APPLICATION) {
- LauncherActivityInfo replacementInfo = mActivityOverride.get(packageName);
- mValues.put(Favorites.PROFILE_ID, UserCache.INSTANCE.get(mContext)
- .getSerialNumberForUser(replacementInfo.getUser()));
- mValues.put(Favorites.INTENT, AppInfo.makeLaunchIntent(replacementInfo).toUri(0));
- }
- }
}
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 53d9281..961c254 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -872,7 +872,9 @@
if (mIcon instanceof PreloadIconDrawable) {
preloadIconDrawable = (PreloadIconDrawable) mIcon;
preloadIconDrawable.setLevel(progressLevel);
- preloadIconDrawable.setIsDisabled(!info.isAppStartable());
+ preloadIconDrawable.setIsDisabled(ENABLE_DOWNLOAD_APP_UX_V2.get()
+ ? info.getProgressLevel() == 0
+ : !info.isAppStartable());
} else {
preloadIconDrawable = makePreloadIcon();
setIcon(preloadIconDrawable);
@@ -897,8 +899,9 @@
final PreloadIconDrawable preloadDrawable = newPendingIcon(getContext(), info);
preloadDrawable.setLevel(progressLevel);
- preloadDrawable.setIsDisabled(!info.isAppStartable());
-
+ preloadDrawable.setIsDisabled(ENABLE_DOWNLOAD_APP_UX_V2.get()
+ ? info.getProgressLevel() == 0
+ : !info.isAppStartable());
return preloadDrawable;
}
diff --git a/src/com/android/launcher3/DefaultLayoutParser.java b/src/com/android/launcher3/DefaultLayoutParser.java
index c69ae4d..c748693 100644
--- a/src/com/android/launcher3/DefaultLayoutParser.java
+++ b/src/com/android/launcher3/DefaultLayoutParser.java
@@ -6,19 +6,15 @@
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
-import android.content.pm.LauncherApps;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.os.Bundle;
-import android.os.Process;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;
import com.android.launcher3.LauncherSettings.Favorites;
-import com.android.launcher3.model.data.WorkspaceItemInfo;
-import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.util.Partner;
import com.android.launcher3.util.Thunk;
import com.android.launcher3.widget.LauncherWidgetHolder;
@@ -28,7 +24,6 @@
import java.io.IOException;
import java.net.URISyntaxException;
-import java.util.Collections;
import java.util.List;
/**
@@ -49,8 +44,6 @@
private static final String ATTR_CONTAINER = "container";
private static final String ATTR_SCREEN = "screen";
private static final String ATTR_FOLDER_ITEMS = "folderItems";
- private static final String ATTR_SHORTCUT_ID = "shortcutId";
- private static final String ATTR_PACKAGE_NAME = "packageName";
public static final String RES_PARTNER_FOLDER = "partner_folder";
public static final String RES_PARTNER_DEFAULT_LAYOUT = "partner_default_layout";
@@ -66,14 +59,9 @@
@Override
protected ArrayMap<String, TagParser> getFolderElementsMap() {
- return getFolderElementsMap(mSourceRes);
- }
-
- @Thunk
- ArrayMap<String, TagParser> getFolderElementsMap(Resources res) {
ArrayMap<String, TagParser> parsers = new ArrayMap<>();
parsers.put(TAG_FAVORITE, new AppShortcutWithUriParser());
- parsers.put(TAG_SHORTCUT, new UriShortcutParser(res));
+ parsers.put(TAG_SHORTCUT, new ShortcutParser());
return parsers;
}
@@ -83,7 +71,7 @@
parsers.put(TAG_FAVORITE, new AppShortcutWithUriParser());
parsers.put(TAG_APPWIDGET, new AppWidgetParser());
parsers.put(TAG_SEARCH_WIDGET, new SearchWidgetParser());
- parsers.put(TAG_SHORTCUT, new UriShortcutParser(mSourceRes));
+ parsers.put(TAG_SHORTCUT, new ShortcutParser());
parsers.put(TAG_RESOLVE, new ResolveParser());
parsers.put(TAG_FOLDER, new MyFolderParser());
parsers.put(TAG_PARTNER_FOLDER, new PartnerFolderParser());
@@ -190,57 +178,6 @@
}
/**
- * Shortcut parser which allows any uri and not just web urls.
- */
- public class UriShortcutParser extends ShortcutParser {
-
- public UriShortcutParser(Resources iconRes) {
- super(iconRes);
- }
-
- @Override
- public int parseAndAdd(XmlPullParser parser) {
- final String packageName = getAttributeValue(parser, ATTR_PACKAGE_NAME);
- final String shortcutId = getAttributeValue(parser, ATTR_SHORTCUT_ID);
- if (!TextUtils.isEmpty(packageName) && !TextUtils.isEmpty(shortcutId)) {
- return parseAndAddDeepShortcut(shortcutId, packageName);
- }
- return super.parseAndAdd(parser);
- }
-
- /**
- * This method parses and adds a deep shortcut.
- * @return item id if the shortcut is successfully added else -1
- */
- private int parseAndAddDeepShortcut(String shortcutId, String packageName) {
- try {
- LauncherApps launcherApps = mContext.getSystemService(LauncherApps.class);
- launcherApps.pinShortcuts(packageName, Collections.singletonList(shortcutId),
- Process.myUserHandle());
- Intent intent = ShortcutKey.makeIntent(shortcutId, packageName);
- mValues.put(Favorites.RESTORED, WorkspaceItemInfo.FLAG_RESTORED_ICON);
- return addShortcut(null, intent, Favorites.ITEM_TYPE_DEEP_SHORTCUT);
- } catch (Exception e) {
- Log.e(TAG, "Unable to pin the shortcut for shortcut id = " + shortcutId
- + " and package name = " + packageName);
- }
- return -1;
- }
-
- @Override
- protected Intent parseIntent(XmlPullParser parser) {
- String uri = null;
- try {
- uri = getAttributeValue(parser, ATTR_URI);
- return Intent.parseUri(uri, 0);
- } catch (URISyntaxException e) {
- Log.w(TAG, "Shortcut has malformed uri: " + uri);
- return null; // Oh well
- }
- }
- }
-
- /**
* Contains a list of <favorite> nodes, and accepts the first successfully parsed node.
*/
public class ResolveParser implements TagParser {
@@ -284,11 +221,9 @@
if (partner != null) {
final int resId = partner.getXmlResId(RES_PARTNER_FOLDER);
if (resId != 0) {
- final Resources partnerRes = partner.getResources();
- final XmlPullParser partnerParser = partnerRes.getXml(resId);
+ final XmlPullParser partnerParser = partner.getResources().getXml(resId);
beginDocument(partnerParser, TAG_FOLDER);
-
- FolderParser folderParser = new FolderParser(getFolderElementsMap(partnerRes));
+ FolderParser folderParser = new FolderParser(getFolderElementsMap());
return folderParser.parseAndAdd(partnerParser);
}
}
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index fcb220e..86c9f16 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -267,6 +267,8 @@
public final int stashedTaskbarHeight;
public final int taskbarBottomMargin;
public final int taskbarIconSize;
+ // If true, used to layout taskbar in 3 button navigation mode.
+ public final boolean startAlignTaskbar;
// DragController
public int flingToDeleteThresholdVelocity;
@@ -338,12 +340,14 @@
res.getDimensionPixelSize(R.dimen.transient_taskbar_stashed_height);
taskbarBottomMargin =
res.getDimensionPixelSize(R.dimen.transient_taskbar_bottom_margin);
+ startAlignTaskbar = false;
} else {
taskbarIconSize = pxFromDp(ResourcesCompat.getFloat(res, R.dimen.taskbar_icon_size),
mMetrics);
taskbarHeight = res.getDimensionPixelSize(R.dimen.taskbar_size);
stashedTaskbarHeight = res.getDimensionPixelSize(R.dimen.taskbar_stashed_size);
taskbarBottomMargin = 0;
+ startAlignTaskbar = inv.startAlignTaskbar[mTypeIndex];
}
edgeMarginPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin);
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 485b36c..4c34648 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -149,6 +149,8 @@
public float[] transientTaskbarIconSize;
+ public boolean[] startAlignTaskbar;
+
/**
* Number of icons inside the hotseat area.
*/
@@ -394,6 +396,8 @@
transientTaskbarIconSize = displayOption.transientTaskbarIconSize;
+ startAlignTaskbar = displayOption.startAlignTaskbar;
+
// If the partner customization apk contains any grid overrides, apply them
// Supported overrides: numRows, numColumns, iconSize
applyPartnerDeviceProfileOverrides(context, metrics);
@@ -915,6 +919,8 @@
private final float[] transientTaskbarIconSize = new float[COUNT_SIZES];
+ private final boolean[] startAlignTaskbar = new boolean[COUNT_SIZES];
+
DisplayOption(GridOption grid, Context context, AttributeSet attrs) {
this.grid = grid;
@@ -1147,6 +1153,18 @@
R.styleable.ProfileDisplayOption_transientTaskbarIconSizeTwoPanelPortrait,
transientTaskbarIconSize[INDEX_DEFAULT]);
+ startAlignTaskbar[INDEX_DEFAULT] = a.getBoolean(
+ R.styleable.ProfileDisplayOption_startAlignTaskbar, false);
+ startAlignTaskbar[INDEX_LANDSCAPE] = a.getBoolean(
+ R.styleable.ProfileDisplayOption_startAlignTaskbarLandscape,
+ startAlignTaskbar[INDEX_DEFAULT]);
+ startAlignTaskbar[INDEX_TWO_PANEL_LANDSCAPE] = a.getBoolean(
+ R.styleable.ProfileDisplayOption_startAlignTaskbarTwoPanelLandscape,
+ startAlignTaskbar[INDEX_LANDSCAPE]);
+ startAlignTaskbar[INDEX_TWO_PANEL_PORTRAIT] = a.getBoolean(
+ R.styleable.ProfileDisplayOption_startAlignTaskbarTwoPanelPortrait,
+ startAlignTaskbar[INDEX_DEFAULT]);
+
a.recycle();
}
@@ -1169,6 +1187,7 @@
allAppsIconTextSizes[i] = 0;
allAppsBorderSpaces[i] = new PointF();
transientTaskbarIconSize[i] = 0;
+ startAlignTaskbar[i] = false;
}
}
@@ -1213,6 +1232,7 @@
allAppsBorderSpaces[i].x += p.allAppsBorderSpaces[i].x;
allAppsBorderSpaces[i].y += p.allAppsBorderSpaces[i].y;
transientTaskbarIconSize[i] += p.transientTaskbarIconSize[i];
+ startAlignTaskbar[i] |= p.startAlignTaskbar[i];
}
return this;
diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
index c5cf647..b485780 100644
--- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
@@ -184,7 +184,7 @@
this, mActivityContext.getStatsLogManager());
mAH = Arrays.asList(null, null, null);
mNavBarScrimPaint = new Paint();
- mNavBarScrimPaint.setColor(Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor));
+ mNavBarScrimPaint.setColor(Themes.getNavBarScrimColor(mActivityContext));
AllAppsStore.OnUpdateListener onAppsUpdated = this::onAppsUpdated;
if (TestProtocol.sDebugTracing) {
@@ -380,7 +380,23 @@
return rv.shouldContainerScroll(ev, dragLayer);
}
+ /**
+ * Resets the UI to be ready for fresh interactions in the future. Exits search and returns to
+ * A-Z apps list.
+ *
+ * @param animate Whether to animate the header during the reset (e.g. switching profile tabs).
+ **/
public void reset(boolean animate) {
+ reset(animate, true);
+ }
+
+ /**
+ * Resets the UI to be ready for fresh interactions in the future.
+ *
+ * @param animate Whether to animate the header during the reset (e.g. switching profile tabs).
+ * @param exitSearch Whether to force exit the search state and return to A-Z apps list.
+ **/
+ public void reset(boolean animate, boolean exitSearch) {
for (int i = 0; i < mAH.size(); i++) {
if (mAH.get(i).mRecyclerView != null) {
mAH.get(i).mRecyclerView.scrollToTop();
@@ -394,10 +410,12 @@
}
// Reset the base recycler view after transitioning home.
updateHeaderScroll(0);
- // Reset the search bar after transitioning home.
- mSearchUiManager.resetSearch();
- // Animate to A-Z with 0 time to reset the animation with proper state management.
- animateToSearchState(false, 0);
+ if (exitSearch) {
+ // Reset the search bar after transitioning home.
+ mSearchUiManager.resetSearch();
+ // Animate to A-Z with 0 time to reset the animation with proper state management.
+ animateToSearchState(false, 0);
+ }
}
@Override
@@ -441,7 +459,7 @@
}
// Header keeps track of active recycler view to properly render header protection.
mHeader.setActiveRV(currentActivePage);
- reset(true /* animate */);
+ reset(true /* animate */, !isSearching() /* exitSearch */);
mWorkManager.onActivePageChanged(currentActivePage);
}
@@ -462,12 +480,6 @@
return;
}
- if (isSearching()) {
- mUsingTabs = showTabs;
- mWorkManager.detachWorkModeSwitch();
- return;
- }
-
if (!FeatureFlags.ENABLE_SEARCH_RESULT_BACKGROUND_DRAWABLES.get()) {
RecyclerView.ItemDecoration decoration = getMainAdapterProvider().getDecorator();
getSearchRecyclerView().removeItemDecoration(decoration);
@@ -532,7 +544,7 @@
mAllAppsStore.registerIconContainer(mAH.get(AdapterHolder.SEARCH).mRecyclerView);
}
- protected View replaceAppsRVContainer(boolean showTabs) {
+ private void replaceAppsRVContainer(boolean showTabs) {
for (int i = AdapterHolder.MAIN; i <= AdapterHolder.WORK; i++) {
AdapterHolder adapterHolder = mAH.get(i);
if (adapterHolder.mRecyclerView != null) {
@@ -586,7 +598,7 @@
layoutBelowSearchContainer(getSearchRecyclerView(), /* tabs= */ false);
}
- return rvContainer;
+ updateSearchResultsVisibility();
}
void setupHeader() {
@@ -819,6 +831,12 @@
}
}
updateBackground(dp);
+
+ int navBarScrimColor = Themes.getNavBarScrimColor(mActivityContext);
+ if (mNavBarScrimPaint.getColor() != navBarScrimColor) {
+ mNavBarScrimPaint.setColor(navBarScrimColor);
+ invalidate();
+ }
}
protected void updateBackground(DeviceProfile deviceProfile) {
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 85d7a05..4d1006a 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -521,7 +521,6 @@
*/
private void onProgressAnimationEnd() {
if (Float.compare(mProgress, 1f) == 0) {
- mAppsView.reset(false /* animate */);
if (mShouldControlKeyboard) {
mLauncher.getAppsView().getSearchUiManager().getEditText().hideKeyboard();
}
diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java
index b3ea3ab..330d13d 100644
--- a/src/com/android/launcher3/allapps/FloatingHeaderView.java
+++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java
@@ -228,7 +228,7 @@
updateExpectedHeight();
mTabsHidden = tabsHidden;
- mTabLayout.setVisibility(tabsHidden ? View.GONE : View.VISIBLE);
+ maybeSetTabVisibility(VISIBLE);
mMainRV = mainRV;
mWorkRV = workRV;
mSearchRV = searchRV;
@@ -250,6 +250,12 @@
rvType == AdapterHolder.MAIN ? mMainRV
: rvType == AdapterHolder.WORK ? mWorkRV : mSearchRV;
mCurrentRV.addOnScrollListener(mOnScrollListener);
+ maybeSetTabVisibility(rvType == AdapterHolder.SEARCH ? GONE : VISIBLE);
+ }
+
+ /** Update tab visibility to the given state, only if tabs are active (work profile exists). */
+ void maybeSetTabVisibility(int visibility) {
+ mTabLayout.setVisibility(mTabsHidden ? GONE : visibility);
}
private void updateExpectedHeight() {
diff --git a/src/com/android/launcher3/allapps/SearchTransitionController.java b/src/com/android/launcher3/allapps/SearchTransitionController.java
index 5056782..de65302 100644
--- a/src/com/android/launcher3/allapps/SearchTransitionController.java
+++ b/src/com/android/launcher3/allapps/SearchTransitionController.java
@@ -125,6 +125,7 @@
mAllAppsContainerView.getFloatingHeaderView().setFloatingRowsCollapsed(true);
mAllAppsContainerView.getFloatingHeaderView().setVisibility(VISIBLE);
+ mAllAppsContainerView.getFloatingHeaderView().maybeSetTabVisibility(VISIBLE);
mAllAppsContainerView.getAppsRecyclerViewContainer().setVisibility(VISIBLE);
getSearchRecyclerView().setVisibility(VISIBLE);
getSearchRecyclerView().setChildAttachedConsumer(this::onSearchChildAttached);
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 4f5f149..f25d26e 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -139,17 +139,10 @@
"ENABLE_BULK_WORKSPACE_ICON_LOADING", ENABLED,
"Enable loading workspace icons in bulk.");
- public static final BooleanFlag ENABLE_BULK_ALL_APPS_ICON_LOADING = getDebugFlag(270392465,
- "ENABLE_BULK_ALL_APPS_ICON_LOADING", ENABLED, "Enable loading all apps icons in bulk.");
-
public static final BooleanFlag ENABLE_DATABASE_RESTORE = getDebugFlag(270392706,
"ENABLE_DATABASE_RESTORE", DISABLED,
"Enable database restore when new restore session is created");
- public static final BooleanFlag ENABLE_SMARTSPACE_DISMISS = getDebugFlag(270391664,
- "ENABLE_SMARTSPACE_DISMISS", ENABLED,
- "Adds a menu option to dismiss the current Enhanced Smartspace card.");
-
public static final BooleanFlag ENABLE_OVERLAY_CONNECTION_OPTIM = getDebugFlag(270392629,
"ENABLE_OVERLAY_CONNECTION_OPTIM", DISABLED,
"Enable optimizing overlay service connection");
@@ -173,10 +166,6 @@
"ENABLE_MINIMAL_DEVICE", DISABLED,
"Allow user to toggle minimal device mode in launcher.");
- public static final BooleanFlag ENABLE_TASKBAR_POPUP_MENU = getDebugFlag(270392477,
- "ENABLE_TASKBAR_POPUP_MENU", ENABLED,
- "Enables long pressing taskbar icons to show the popup menu.");
-
public static final BooleanFlag ENABLE_TWO_PANEL_HOME = getDebugFlag(270392643,
"ENABLE_TWO_PANEL_HOME", ENABLED,
"Uses two panel on home screen. Only applicable on large screen devices.");
@@ -199,9 +188,6 @@
"WIDGETS_IN_LAUNCHER_PREVIEW", ENABLED,
"Enables widgets in Launcher preview for the Wallpaper app.");
- public static final BooleanFlag QUICK_WALLPAPER_PICKER = getDebugFlag(270393112,
- "QUICK_WALLPAPER_PICKER", ENABLED, "Shows quick wallpaper picker in long-press menu");
-
public static final BooleanFlag ENABLE_BACK_SWIPE_HOME_ANIMATION = getDebugFlag(270393426,
"ENABLE_BACK_SWIPE_HOME_ANIMATION", ENABLED,
"Enables home animation to icon when user swipes back.");
diff --git a/src/com/android/launcher3/graphics/PreloadIconDrawable.java b/src/com/android/launcher3/graphics/PreloadIconDrawable.java
index 5a50569..0fe79e7 100644
--- a/src/com/android/launcher3/graphics/PreloadIconDrawable.java
+++ b/src/com/android/launcher3/graphics/PreloadIconDrawable.java
@@ -27,16 +27,11 @@
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathMeasure;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
-import android.os.SystemClock;
import android.util.Property;
import com.android.launcher3.R;
@@ -47,10 +42,6 @@
import com.android.launcher3.icons.GraphicsUtils;
import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.util.Themes;
-import com.android.launcher3.util.window.RefreshRateTracker;
-
-import java.util.WeakHashMap;
-import java.util.function.Function;
/**
* Extension of {@link FastBitmapDrawable} which shows a progress bar around the icon.
@@ -91,14 +82,6 @@
private static final int PRELOAD_ACCENT_COLOR_INDEX = 0;
private static final int PRELOAD_BACKGROUND_COLOR_INDEX = 1;
- private static final int ALPHA_DURATION_MILLIS = 3000;
- private static final int OVERLAY_ALPHA_RANGE = 191;
- private static final long WAVE_MOTION_DELAY_FACTOR_MILLIS = 100;
- private static final WeakHashMap<Integer, PorterDuffColorFilter> COLOR_FILTER_MAP =
- new WeakHashMap<>();
- public static final Function<Integer, PorterDuffColorFilter> FILTER_FACTORY =
- currArgb -> new PorterDuffColorFilter(currArgb, PorterDuff.Mode.SRC_ATOP);
-
private final Matrix mTmpMatrix = new Matrix();
private final PathMeasure mPathMeasure = new PathMeasure();
@@ -119,7 +102,6 @@
private float mTrackLength;
private boolean mRanFinishAnimation;
- private final int mRefreshRateMillis;
// Progress of the internal state. [0, 1] indicates the fraction of completed progress,
// [1, (1 + COMPLETE_ANIM_FRACTION)] indicates the progress of zoom animation.
@@ -138,7 +120,6 @@
IconPalette.getPreloadProgressColor(context, info.bitmap.color),
getPreloadColors(context),
Utilities.isDarkTheme(context),
- getRefreshRateMillis(context),
GraphicsUtils.getShapePath(context, DEFAULT_PATH_SIZE));
}
@@ -147,7 +128,6 @@
int indicatorColor,
int[] preloadColors,
boolean isDarkMode,
- int refreshRateMillis,
Path shapePath) {
super(info.bitmap);
mItem = info;
@@ -162,13 +142,14 @@
mSystemAccentColor = preloadColors[PRELOAD_ACCENT_COLOR_INDEX];
mSystemBackgroundColor = preloadColors[PRELOAD_BACKGROUND_COLOR_INDEX];
mIsDarkMode = isDarkMode;
- mRefreshRateMillis = refreshRateMillis;
// If it's a pending app we will animate scale and alpha when it's no longer pending.
mIconScaleMultiplier.updateValue(info.getProgressLevel() == 0 ? 0 : 1);
setLevel(info.getProgressLevel());
- setIsStartable(info.isAppStartable());
+ if (!ENABLE_DOWNLOAD_APP_UX_V2.get()) {
+ setIsStartable(info.isAppStartable());
+ }
}
@Override
@@ -223,20 +204,16 @@
: SMALL_SCALE;
canvas.scale(scale, scale, bounds.exactCenterX(), bounds.exactCenterY());
- ColorFilter filter = getOverlayFilter();
- mPaint.setColorFilter(filter);
super.drawInternal(canvas, bounds);
canvas.restoreToCount(saveCount);
-
- if (ENABLE_DOWNLOAD_APP_UX_V2.get() && filter != null) {
- reschedule();
- }
}
@Override
protected void updateFilter() {
if (!ENABLE_DOWNLOAD_APP_UX_V2.get()) {
setAlpha(mIsDisabled ? DISABLED_ICON_ALPHA : MAX_PAINT_ALPHA);
+ } else {
+ super.updateFilter();
}
}
@@ -317,7 +294,7 @@
/**
* Sets the internal progress and updates the UI accordingly
* for progress <= 0:
- * - icon with pending motion
+ * - icon is pending
* - progress track is not visible
* - progress bar is not visible
* for progress < 1:
@@ -367,11 +344,6 @@
return preloadColors;
}
-
- private static int getRefreshRateMillis(Context context) {
- return RefreshRateTracker.getSingleFrameMs(context);
- }
-
/**
* Returns a FastBitmapDrawable with the icon.
*/
@@ -388,55 +360,9 @@
mIndicatorColor,
new int[] {mSystemAccentColor, mSystemBackgroundColor},
mIsDarkMode,
- mRefreshRateMillis,
mShapePath);
}
- @Override
- public boolean setVisible(boolean visible, boolean restart) {
- if (!visible) {
- unscheduleSelf(mInvalidateRunnable);
- }
- return super.setVisible(visible, restart);
- }
-
- private void reschedule() {
- unscheduleSelf(mInvalidateRunnable);
- if (!isVisible()) {
- return;
- }
- final long upTime = SystemClock.uptimeMillis();
- scheduleSelf(mInvalidateRunnable,
- upTime - ((upTime % mRefreshRateMillis)) + mRefreshRateMillis);
- }
-
- /**
- * Returns a color filter to be used as an overlay on the pending icon with cascading motion
- * based on its position.
- */
- private ColorFilter getOverlayFilter() {
- if (!ENABLE_DOWNLOAD_APP_UX_V2.get() || mInternalStateProgress > 0) {
- // If the download has started, we do no need to animate
- return null;
- }
- long waveMotionDelay = (mItem.cellX * WAVE_MOTION_DELAY_FACTOR_MILLIS)
- + (mItem.cellY * WAVE_MOTION_DELAY_FACTOR_MILLIS);
- long time = SystemClock.uptimeMillis();
- int alpha = (int) Utilities.mapBoundToRange(
- (int) ((time + waveMotionDelay) % ALPHA_DURATION_MILLIS),
- 0,
- ALPHA_DURATION_MILLIS,
- 0,
- OVERLAY_ALPHA_RANGE * 2,
- LINEAR);
- if (alpha > OVERLAY_ALPHA_RANGE) {
- alpha = (OVERLAY_ALPHA_RANGE - (alpha % OVERLAY_ALPHA_RANGE));
- }
- int overlayColor = mIsDarkMode ? 0 : 255;
- int currArgb = Color.argb(alpha, overlayColor, overlayColor, overlayColor);
- return COLOR_FILTER_MAP.computeIfAbsent(currArgb, FILTER_FACTORY);
- }
-
protected static class PreloadIconConstantState extends FastBitmapConstantState {
protected final ItemInfoWithIcon mInfo;
@@ -444,7 +370,6 @@
protected final int[] mPreloadColors;
protected final boolean mIsDarkMode;
protected final int mLevel;
- protected final int mRefreshRateMillis;
private final Path mShapePath;
public PreloadIconConstantState(
@@ -454,7 +379,6 @@
int indicatorColor,
int[] preloadColors,
boolean isDarkMode,
- int refreshRateMillis,
Path shapePath) {
super(bitmap, iconColor);
mInfo = info;
@@ -462,7 +386,6 @@
mPreloadColors = preloadColors;
mIsDarkMode = isDarkMode;
mLevel = info.getProgressLevel();
- mRefreshRateMillis = refreshRateMillis;
mShapePath = shapePath;
}
@@ -473,7 +396,6 @@
mIndicatorColor,
mPreloadColors,
mIsDarkMode,
- mRefreshRateMillis,
mShapePath);
}
}
diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java
index da9be49..3e99772 100644
--- a/src/com/android/launcher3/model/LoaderTask.java
+++ b/src/com/android/launcher3/model/LoaderTask.java
@@ -960,7 +960,7 @@
iconRequestInfos.add(new IconRequestInfo<>(
appInfo, app, /* useLowResIcon= */ false));
mBgAllAppsList.add(
- appInfo, app, !FeatureFlags.ENABLE_BULK_ALL_APPS_ICON_LOADING.get());
+ appInfo, app, false);
}
allActivityList.addAll(apps);
}
@@ -973,7 +973,7 @@
AppInfo promiseAppInfo = mBgAllAppsList.addPromiseApp(
mApp.getContext(),
PackageInstallInfo.fromInstallingState(info),
- !FeatureFlags.ENABLE_BULK_ALL_APPS_ICON_LOADING.get());
+ false);
if (promiseAppInfo != null) {
iconRequestInfos.add(new IconRequestInfo<>(
@@ -984,15 +984,13 @@
}
}
- if (FeatureFlags.ENABLE_BULK_ALL_APPS_ICON_LOADING.get()) {
- Trace.beginSection("LoadAllAppsIconsInBulk");
- try {
- mIconCache.getTitlesAndIconsInBulk(iconRequestInfos);
- iconRequestInfos.forEach(iconRequestInfo ->
- mBgAllAppsList.updateSectionName(iconRequestInfo.itemInfo));
- } finally {
- Trace.endSection();
- }
+ Trace.beginSection("LoadAllAppsIconsInBulk");
+ try {
+ mIconCache.getTitlesAndIconsInBulk(iconRequestInfos);
+ iconRequestInfos.forEach(iconRequestInfo ->
+ mBgAllAppsList.updateSectionName(iconRequestInfo.itemInfo));
+ } finally {
+ Trace.endSection();
}
mBgAllAppsList.setFlags(FLAG_QUIET_MODE_ENABLED,
diff --git a/src/com/android/launcher3/util/Themes.java b/src/com/android/launcher3/util/Themes.java
index 5526839..a5c663f 100644
--- a/src/com/android/launcher3/util/Themes.java
+++ b/src/com/android/launcher3/util/Themes.java
@@ -32,10 +32,13 @@
import android.util.SparseArray;
import android.util.TypedValue;
+import androidx.annotation.ColorInt;
+
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.icons.GraphicsUtils;
+import com.android.launcher3.views.ActivityContext;
/**
* Various utility methods associated with theming.
@@ -198,4 +201,12 @@
return result;
}
+
+ /** Returns the desired navigation bar scrim color depending on the {@code DeviceProfile}. */
+ @ColorInt
+ public static <T extends Context & ActivityContext> int getNavBarScrimColor(T context) {
+ return context.getDeviceProfile().isTaskbarPresent
+ ? context.getColor(R.color.taskbar_background)
+ : Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor);
+ }
}
diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java
index 07c6ba4..c3f26fa 100644
--- a/src/com/android/launcher3/widget/BaseWidgetSheet.java
+++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java
@@ -37,6 +37,7 @@
import androidx.core.view.ViewCompat;
import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.DragSource;
import com.android.launcher3.DropTarget.DragObject;
import com.android.launcher3.Insettable;
@@ -60,7 +61,7 @@
*/
public abstract class BaseWidgetSheet extends AbstractSlideInView<Launcher>
implements OnClickListener, OnLongClickListener, DragSource,
- PopupDataProvider.PopupDataChangeListener, Insettable {
+ PopupDataProvider.PopupDataChangeListener, Insettable, OnDeviceProfileChangeListener {
/** The default number of cells that can fit horizontally in a widget sheet. */
public static final int DEFAULT_MAX_HORIZONTAL_SPANS = 4;
@@ -84,7 +85,7 @@
mWidgetCellHorizontalPadding = getResources().getDimensionPixelSize(
R.dimen.widget_cell_horizontal_padding);
mNavBarScrimPaint = new Paint();
- mNavBarScrimPaint.setColor(Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor));
+ mNavBarScrimPaint.setColor(Themes.getNavBarScrimColor(mActivityContext));
}
protected int getScrimColor(Context context) {
@@ -98,12 +99,23 @@
.normalizeWindowInsets(getContext(), getRootWindowInsets(), new Rect());
mNavBarScrimHeight = getNavBarScrimHeight(windowInsets);
mActivityContext.getPopupDataProvider().setChangeListener(this);
+ mActivityContext.addOnDeviceProfileChangeListener(this);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mActivityContext.getPopupDataProvider().setChangeListener(null);
+ mActivityContext.removeOnDeviceProfileChangeListener(this);
+ }
+
+ @Override
+ public void onDeviceProfileChanged(DeviceProfile dp) {
+ int navBarScrimColor = Themes.getNavBarScrimColor(mActivityContext);
+ if (mNavBarScrimPaint.getColor() != navBarScrimColor) {
+ mNavBarScrimPaint.setColor(navBarScrimColor);
+ invalidate();
+ }
}
@Override
diff --git a/tests/src/com/android/launcher3/FakeInvariantDeviceProfileTest.kt b/tests/src/com/android/launcher3/FakeInvariantDeviceProfileTest.kt
index a5f33c0..c22cf40 100644
--- a/tests/src/com/android/launcher3/FakeInvariantDeviceProfileTest.kt
+++ b/tests/src/com/android/launcher3/FakeInvariantDeviceProfileTest.kt
@@ -153,6 +153,9 @@
isScalable = true
+ transientTaskbarIconSize = FloatArray(4) { 44f }
+ startAlignTaskbar = BooleanArray(4) { false }
+
inlineQsb = BooleanArray(4) { false }
devicePaddingId = R.xml.paddings_handhelds
@@ -233,6 +236,9 @@
isScalable = true
devicePaddingId = R.xml.paddings_6x5
+ transientTaskbarIconSize = FloatArray(4) { 44f }
+ startAlignTaskbar = booleanArrayOf(true, false, true, true)
+
inlineQsb = booleanArrayOf(false, true, false, false)
devicePaddingId = R.xml.paddings_handhelds
@@ -308,6 +314,9 @@
isScalable = true
+ transientTaskbarIconSize = FloatArray(4) { 44f }
+ startAlignTaskbar = BooleanArray(4) { true }
+
inlineQsb = booleanArrayOf(false, false, false, false)
devicePaddingId = R.xml.paddings_handhelds
diff --git a/tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java b/tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java
index 004ed06..2b89321 100644
--- a/tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java
+++ b/tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java
@@ -20,8 +20,10 @@
import static com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeTrue;
import android.content.Context;
+import android.content.pm.LauncherApps;
import android.content.pm.PackageInstaller;
import android.content.pm.PackageInstaller.SessionParams;
@@ -127,6 +129,38 @@
assertEquals(2, info.spanY);
}
+ @Test
+ public void testCustomProfileLoaded_with_shortcut_on_hotseat() throws Exception {
+ assumeTrue(mTargetContext.getSystemService(LauncherApps.class).hasShortcutHostPermission());
+ writeLayoutAndLoad(new LauncherLayoutBuilder().atHotseat(0)
+ .putShortcut(TEST_PACKAGE, "shortcut2"));
+
+ // Verify one item in hotseat
+ assertEquals(1, mModelHelper.getBgDataModel().workspaceItems.size());
+ ItemInfo info = mModelHelper.getBgDataModel().workspaceItems.get(0);
+ assertEquals(LauncherSettings.Favorites.CONTAINER_HOTSEAT, info.container);
+ assertEquals(LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT, info.itemType);
+ }
+
+ @Test
+ public void testCustomProfileLoaded_with_shortcut_in_folder() throws Exception {
+ assumeTrue(mTargetContext.getSystemService(LauncherApps.class).hasShortcutHostPermission());
+ writeLayoutAndLoad(new LauncherLayoutBuilder().atHotseat(0).putFolder(android.R.string.copy)
+ .addApp(TEST_PACKAGE, TEST_ACTIVITY)
+ .addApp(TEST_PACKAGE, TEST_ACTIVITY)
+ .addShortcut(TEST_PACKAGE, "shortcut2")
+ .build());
+
+ // Verify folder
+ assertEquals(1, mModelHelper.getBgDataModel().workspaceItems.size());
+ FolderInfo info = (FolderInfo) mModelHelper.getBgDataModel().workspaceItems.get(0);
+ assertEquals(3, info.contents.size());
+
+ // Verify last icon
+ assertEquals(LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT,
+ info.contents.get(info.contents.size() - 1).itemType);
+ }
+
private void writeLayoutAndLoad(LauncherLayoutBuilder builder) throws Exception {
mModelHelper.setupDefaultLayoutProvider(builder).loadModelSync();
}
diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
index ae12861..f30538d 100644
--- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
+++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
@@ -525,14 +525,8 @@
try {
Workspace workspace = mLauncher.getWorkspace();
final HomeAllApps allApps = workspace.switchToAllApps();
- allApps.freeze();
- try {
- workspace = allApps.getAppIcon(DUMMY_APP_NAME).uninstall();
- // After the toast clears, then the model tries to commit the uninstall transaction
- mLauncher.waitForModelQueueCleared();
- } finally {
- allApps.unfreeze();
- }
+ workspace = allApps.getAppIcon(DUMMY_APP_NAME).uninstall();
+ waitForLauncherUIUpdate();
verifyAppUninstalledFromAllApps(workspace, DUMMY_APP_NAME);
} finally {
TestUtil.uninstallDummyApp();
@@ -633,6 +627,10 @@
private void installDummyAppAndWaitForUIUpdate() throws IOException {
TestUtil.installDummyApp();
+ waitForLauncherUIUpdate();
+ }
+
+ private void waitForLauncherUIUpdate() {
// Wait for model thread completion as it may be processing
// the install event from the SystemService
mLauncher.waitForModelQueueCleared();
diff --git a/tests/src/com/android/launcher3/util/LauncherLayoutBuilder.java b/tests/src/com/android/launcher3/util/LauncherLayoutBuilder.java
index 4e21dce..ba01b04 100644
--- a/tests/src/com/android/launcher3/util/LauncherLayoutBuilder.java
+++ b/tests/src/com/android/launcher3/util/LauncherLayoutBuilder.java
@@ -39,6 +39,7 @@
private static final String TAG_AUTO_INSTALL = "autoinstall";
private static final String TAG_FOLDER = "folder";
private static final String TAG_APPWIDGET = "appwidget";
+ private static final String TAG_SHORTCUT = "shortcut";
private static final String TAG_EXTRA = "extra";
private static final String ATTR_CONTAINER = "container";
@@ -49,6 +50,7 @@
private static final String ATTR_TITLE = "title";
private static final String ATTR_TITLE_TEXT = "titleText";
private static final String ATTR_SCREEN = "screen";
+ private static final String ATTR_SHORTCUT_ID = "shortcutId";
// x and y can be specified as negative integers, in which case -1 represents the
// last row / column, -2 represents the second last, and so on.
@@ -135,6 +137,13 @@
return LauncherLayoutBuilder.this;
}
+ public LauncherLayoutBuilder putShortcut(String packageName, String shortcutId) {
+ items.put(ATTR_PACKAGE_NAME, packageName);
+ items.put(ATTR_SHORTCUT_ID, shortcutId);
+ mNodes.add(Pair.create(TAG_SHORTCUT, items));
+ return LauncherLayoutBuilder.this;
+ }
+
public LauncherLayoutBuilder putWidget(String packageName, String className,
int spanX, int spanY) {
items.put(ATTR_PACKAGE_NAME, packageName);
@@ -175,6 +184,14 @@
return this;
}
+ public FolderBuilder addShortcut(String packageName, String shortcutId) {
+ HashMap<String, Object> items = new HashMap<>();
+ items.put(ATTR_PACKAGE_NAME, packageName);
+ items.put(ATTR_SHORTCUT_ID, shortcutId);
+ mChildren.add(Pair.create(TAG_SHORTCUT, items));
+ return this;
+ }
+
public LauncherLayoutBuilder build() {
return LauncherLayoutBuilder.this;
}