[automerger skipped] Import translations. DO NOT MERGE ANYWHERE am: 897d7d4d85 -s ours
am skip reason: subject contains skip directive
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20149392
Change-Id: Id0934177b8372b28813095e6f3457eb3696e88ad
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/quickstep/res/layout/activity_allset.xml b/quickstep/res/layout/activity_allset.xml
index 0cae733..56e1d16 100644
--- a/quickstep/res/layout/activity_allset.xml
+++ b/quickstep/res/layout/activity_allset.xml
@@ -26,7 +26,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/content_view"
- android:fitsSystemWindows="true">
+ android:fitsSystemWindows="false">
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animated_background"
diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
index e1a3b72..9aeb370 100644
--- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
@@ -518,6 +518,7 @@
appsView.setAlpha(startAlpha);
SCALE_PROPERTY.set(appsView, startScale);
appsView.setLayerType(View.LAYER_TYPE_NONE, null);
+ mLauncher.resumeExpensiveViewUpdates();
};
} else if (mLauncher.isInState(OVERVIEW)) {
endListener = composeViewContentAnimator(launcherAnimator, alphas, scales);
@@ -647,6 +648,7 @@
overview.setFreezeViewVisibility(false);
SCALE_PROPERTY.set(overview, 1f);
mLauncher.getStateManager().reapplyState();
+ mLauncher.resumeExpensiveViewUpdates();
};
}
diff --git a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java
index 5680170..47bb3cf 100644
--- a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java
+++ b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java
@@ -82,6 +82,8 @@
private static final int MAX_SWIPE_DURATION = 350;
+ private static final float ANIMATION_PAUSE_ALPHA_THRESHOLD = 0.1f;
+
private TISBindHelper mTISBindHelper;
private TISBinder mBinder;
@@ -144,6 +146,10 @@
}
private void runOnUiHelperThread(Runnable runnable) {
+ if (!isResumed()
+ || getContentViewAlphaForSwipeProgress() <= ANIMATION_PAUSE_ALPHA_THRESHOLD) {
+ return;
+ }
Executors.UI_HELPER_EXECUTOR.execute(runnable);
}
@@ -192,6 +198,7 @@
@Override
protected void onResume() {
super.onResume();
+ maybeResumeOrPauseBackgroundAnimation();
if (mBinder != null) {
mBinder.getTaskbarManager().setSetupUIVisible(true);
mBinder.setSwipeUpProxy(this::createSwipeUpProxy);
@@ -210,6 +217,7 @@
protected void onPause() {
super.onPause();
clearBinderOverride();
+ maybeResumeOrPauseBackgroundAnimation();
if (mSwipeProgress.value >= 1) {
finishAndRemoveTask();
}
@@ -244,10 +252,25 @@
return mSwipeProgress;
}
+ private float getContentViewAlphaForSwipeProgress() {
+ return Utilities.mapBoundToRange(
+ mSwipeProgress.value, 0, HINT_BOTTOM_FACTOR, 1, 0, LINEAR);
+ }
+
+ private void maybeResumeOrPauseBackgroundAnimation() {
+ boolean shouldPlayAnimation =
+ getContentViewAlphaForSwipeProgress() > ANIMATION_PAUSE_ALPHA_THRESHOLD
+ && isResumed();
+ if (mAnimatedBackground.isAnimating() && !shouldPlayAnimation) {
+ mAnimatedBackground.pauseAnimation();
+ } else if (!mAnimatedBackground.isAnimating() && shouldPlayAnimation) {
+ mAnimatedBackground.resumeAnimation();
+ }
+ }
+
private void onSwipeProgressUpdate() {
mBackground.setProgress(mSwipeProgress.value);
- float alpha = Utilities.mapBoundToRange(
- mSwipeProgress.value, 0, HINT_BOTTOM_FACTOR, 1, 0, LINEAR);
+ float alpha = getContentViewAlphaForSwipeProgress();
mContentView.setAlpha(alpha);
mContentView.setTranslationY((alpha - 1) * mSwipeUpShift);
@@ -259,12 +282,7 @@
mLauncherStartAnim.setPlayFraction(Utilities.mapBoundToRange(
mSwipeProgress.value, 0, 1, 0, 1, FAST_OUT_SLOW_IN));
}
-
- if (alpha == 0f) {
- mAnimatedBackground.pauseAnimation();
- } else if (!mAnimatedBackground.isAnimating()) {
- mAnimatedBackground.resumeAnimation();
- }
+ maybeResumeOrPauseBackgroundAnimation();
}
/**
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 4903d77..b96c40d 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -2063,20 +2063,11 @@
if (container != LauncherSettings.Favorites.CONTAINER_HOTSEAT &&
cell instanceof LauncherAppWidgetHostView) {
- final CellLayout cellLayout = dropTargetLayout;
+
// We post this call so that the widget has a chance to be placed
// in its final location
-
- final LauncherAppWidgetHostView hostView = (LauncherAppWidgetHostView) cell;
- AppWidgetProviderInfo pInfo = hostView.getAppWidgetInfo();
- if (pInfo != null && pInfo.resizeMode != AppWidgetProviderInfo.RESIZE_NONE
- && !options.isAccessibleDrag) {
- onCompleteRunnable = () -> {
- if (!isPageInTransition()) {
- AppWidgetResizeFrame.showForWidget(hostView, cellLayout);
- }
- };
- }
+ onCompleteRunnable = getWidgetResizeFrameRunnable(options,
+ (LauncherAppWidgetHostView) cell, dropTargetLayout);
}
mLauncher.getModelWriter().modifyItemInDatabase(info, container, screenId,
lp.cellX, lp.cellY, item.spanX, item.spanY);
@@ -2097,8 +2088,16 @@
}
} else {
// When drag is cancelled, reattach content view back to its original parent.
- if (mDragInfo.cell instanceof LauncherAppWidgetHostView) {
+ if (cell instanceof LauncherAppWidgetHostView) {
d.dragView.detachContentView(/* reattachToPreviousParent= */ true);
+
+ final CellLayout cellLayout = getParentCellLayoutForView(cell);
+ boolean pageIsVisible = isVisible(cellLayout);
+
+ if (pageIsVisible) {
+ onCompleteRunnable = getWidgetResizeFrameRunnable(options,
+ (LauncherAppWidgetHostView) cell, cellLayout);
+ }
}
}
@@ -2150,6 +2149,21 @@
}
}
+ @Nullable
+ private Runnable getWidgetResizeFrameRunnable(DragOptions options,
+ LauncherAppWidgetHostView hostView, CellLayout cellLayout) {
+ AppWidgetProviderInfo pInfo = hostView.getAppWidgetInfo();
+ if (pInfo != null && pInfo.resizeMode != AppWidgetProviderInfo.RESIZE_NONE
+ && !options.isAccessibleDrag) {
+ return () -> {
+ if (!isPageInTransition()) {
+ AppWidgetResizeFrame.showForWidget(hostView, cellLayout);
+ }
+ };
+ }
+ return null;
+ }
+
public void onNoCellFound(
View dropTargetLayout, ItemInfo itemInfo, @Nullable InstanceId logInstanceId) {
int strId = mLauncher.isHotseatLayout(dropTargetLayout)
diff --git a/src/com/android/launcher3/model/LoaderCursor.java b/src/com/android/launcher3/model/LoaderCursor.java
index ae5b66a..87e8ebf 100644
--- a/src/com/android/launcher3/model/LoaderCursor.java
+++ b/src/com/android/launcher3/model/LoaderCursor.java
@@ -291,12 +291,16 @@
// from the db
if (TextUtils.isEmpty(info.title)) {
- info.title = getTitle();
- }
+ if (loadIcon) {
+ info.title = getTitle();
- // fall back to the class name of the activity
- if (info.title == null) {
- info.title = componentName.getClassName();
+ // fall back to the class name of the activity
+ if (info.title == null) {
+ info.title = componentName.getClassName();
+ }
+ } else {
+ info.title = "";
+ }
}
info.contentDescription = mPM.getUserBadgedLabel(info.title, info.user);