Merge "Fix failing tests that are blocking OOM investigation" into main
diff --git a/quickstep/AndroidManifest.xml b/quickstep/AndroidManifest.xml
index 201c5f6..5ca7143 100644
--- a/quickstep/AndroidManifest.xml
+++ b/quickstep/AndroidManifest.xml
@@ -119,6 +119,7 @@
android:autoRemoveFromRecents="true"
android:excludeFromRecents="true"
android:theme="@style/GestureTutorialActivity"
+ android:label="@string/gesture_tutorial_title"
android:exported="true"
android:configChanges="orientation">
<intent-filter>
diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml
index 324ea31..0474000 100644
--- a/quickstep/res/values/strings.xml
+++ b/quickstep/res/values/strings.xml
@@ -98,6 +98,9 @@
<!-- content description for hotseat items -->
<string name="hotseat_prediction_content_description">Predicted app: <xliff:g id="title" example="Chrome">%1$s</xliff:g></string>
+ <!-- Title of the Gesture Navigation Tutorial page [CHAR LIMIT=NONE] -->
+ <string name="gesture_tutorial_title">Gesture Navigation Tutorial</string>
+
<!-- Title of prompt shown before the gesture navigation tutorial to users who need to rotate their screen. [CHAR LIMIT=100] -->
<string name="gesture_tutorial_rotation_prompt_title">Rotate your device</string>
<!-- Prompt shown before the gesture navigation tutorial to users who need to rotate their screen to begin. [CHAR LIMIT=100] -->
diff --git a/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java b/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java
index b0cb484..a85e5e0 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java
@@ -50,8 +50,8 @@
import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
import com.android.launcher3.celllayout.DelegatedCellDrawing;
+import com.android.launcher3.graphics.IconShape;
import com.android.launcher3.icons.FastBitmapDrawable;
-import com.android.launcher3.icons.GraphicsUtils;
import com.android.launcher3.icons.IconNormalizer;
import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.model.data.ItemInfoWithIcon;
@@ -142,7 +142,7 @@
int shadowSize = context.getResources().getDimensionPixelSize(
R.dimen.blur_size_thin_outline);
mShadowFilter = new BlurMaskFilter(shadowSize, BlurMaskFilter.Blur.OUTER);
- mShapePath = GraphicsUtils.getShapePath(context, mNormalizedIconSize);
+ mShapePath = IconShape.INSTANCE.get(context).getShapeOverridePath(mNormalizedIconSize);
}
@Override
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsOverviewDesktop.kt b/quickstep/tests/src/com/android/quickstep/TaplTestsOverviewDesktop.kt
index b744039..75947ab 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsOverviewDesktop.kt
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsOverviewDesktop.kt
@@ -122,25 +122,25 @@
val desktop = moveTaskToDesktop(TEST_ACTIVITY_EXTRA)
var overview = desktop.switchToOverview()
- // Open focused task and go back to Overview to validate whether it has adjacent tasks in
- // its both sides (grid task on left and desktop tasks at its right side)
- val focusedTaskOpened = overview.getTestActivityTask(TEST_ACTIVITY_2).open()
+ // Open first fullscreen task and go back to Overview to validate whether it has adjacent
+ // tasks in its both sides (grid task on left and desktop tasks at its right side)
+ val firstFullscreenTaskOpened = overview.getTestActivityTask(TEST_ACTIVITY_2).open()
- // Fling to desktop task and dismiss the focused task to check repositioning of
+ // Fling to desktop task and dismiss the first fullscreen task to check repositioning of
// grid tasks.
- overview = focusedTaskOpened.switchToOverview().apply { flingBackward() }
+ overview = firstFullscreenTaskOpened.switchToOverview().apply { flingBackward() }
val desktopTask = overview.currentTask
assertWithMessage("The current task is not a Desktop.").that(desktopTask.isDesktop).isTrue()
- // Get focused task (previously opened task) then dismiss this task
- val focusedTaskInOverview = overview.getTestActivityTask(TEST_ACTIVITY_2)
- assertTaskContentDescription(focusedTaskInOverview, TEST_ACTIVITY_2)
- focusedTaskInOverview.dismiss()
+ // Get first fullscreen task (previously opened task) then dismiss this task
+ val firstFullscreenTaskInOverview = overview.getTestActivityTask(TEST_ACTIVITY_2)
+ assertTaskContentDescription(firstFullscreenTaskInOverview, TEST_ACTIVITY_2)
+ firstFullscreenTaskInOverview.dismiss()
- // Dismiss DesktopTask to validate whether the new focused task will take its position
+ // Dismiss DesktopTask to validate whether the new task will take its position
desktopTask.dismiss()
- // Dismiss last focused task
+ // Dismiss last fullscreen task
val lastFocusedTask = overview.currentTask
assertTaskContentDescription(lastFocusedTask, TEST_ACTIVITY_1)
lastFocusedTask.dismiss()
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 9ebae9f..5e88385 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -26,7 +26,6 @@
import static com.android.launcher3.Utilities.dpiFromPx;
import static com.android.launcher3.Utilities.pxFromSp;
import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.ICON_OVERLAP_FACTOR;
-import static com.android.launcher3.icons.GraphicsUtils.getShapePath;
import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR;
import static com.android.launcher3.testing.shared.ResourceUtils.INVALID_RESOURCE_HANDLE;
import static com.android.launcher3.testing.shared.ResourceUtils.pxFromDp;
@@ -53,6 +52,7 @@
import com.android.launcher3.CellLayout.ContainerType;
import com.android.launcher3.DevicePaddings.DevicePadding;
+import com.android.launcher3.graphics.IconShape;
import com.android.launcher3.icons.DotRenderer;
import com.android.launcher3.icons.IconNormalizer;
import com.android.launcher3.model.data.ItemInfo;
@@ -872,7 +872,9 @@
@NonNull Context context, int size, @NonNull SparseArray<DotRenderer> cache) {
DotRenderer renderer = cache.get(size);
if (renderer == null) {
- renderer = new DotRenderer(size, getShapePath(context, DEFAULT_DOT_SIZE),
+ renderer = new DotRenderer(
+ size,
+ IconShape.INSTANCE.get(context).getShapeOverridePath(DEFAULT_DOT_SIZE),
DEFAULT_DOT_SIZE);
cache.put(size, renderer);
}
diff --git a/src/com/android/launcher3/dragndrop/DragView.java b/src/com/android/launcher3/dragndrop/DragView.java
index f1b461b..9c82748 100644
--- a/src/com/android/launcher3/dragndrop/DragView.java
+++ b/src/com/android/launcher3/dragndrop/DragView.java
@@ -60,6 +60,7 @@
import com.android.app.animation.Interpolators;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
+import com.android.launcher3.graphics.IconShape;
import com.android.launcher3.icons.FastBitmapDrawable;
import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.model.data.ItemInfo;
@@ -272,7 +273,7 @@
Rect shrunkBounds = new Rect(bounds);
Utilities.scaleRectAboutCenter(shrunkBounds, 0.98f);
adaptiveIcon.setBounds(shrunkBounds);
- final Path mask = adaptiveIcon.getIconMask();
+ final Path mask = IconShape.INSTANCE.get(getContext()).getShapeOverridePath(w);
mTranslateX = new SpringFloatValue(DragView.this,
w * AdaptiveIconDrawable.getExtraInsetFraction());
diff --git a/src/com/android/launcher3/graphics/IconShape.kt b/src/com/android/launcher3/graphics/IconShape.kt
index 2d2ee30..2c4d8e4 100644
--- a/src/com/android/launcher3/graphics/IconShape.kt
+++ b/src/com/android/launcher3/graphics/IconShape.kt
@@ -34,6 +34,7 @@
import android.view.View
import android.view.ViewOutlineProvider
import androidx.annotation.VisibleForTesting
+import androidx.core.graphics.PathParser
import androidx.graphics.shapes.CornerRounding
import androidx.graphics.shapes.Morph
import androidx.graphics.shapes.RoundedPolygon
@@ -65,7 +66,7 @@
constructor(
@ApplicationContext private val context: Context,
private val prefs: LauncherPrefs,
- themeManager: ThemeManager,
+ private val themeManager: ThemeManager,
lifeCycle: DaggerSingletonTracker,
) {
@@ -89,6 +90,17 @@
lifeCycle.addCloseable { themeManager.removeChangeListener(changeListener) }
}
+ fun getShapeOverridePath(pathSize: Float = DEFAULT_PATH_SIZE): Path {
+ val path = PathParser.createPathFromPathData(themeManager.iconState.iconMask)
+ if (pathSize != DEFAULT_PATH_SIZE) {
+ val matrix = Matrix()
+ val scale: Float = pathSize / DEFAULT_PATH_SIZE
+ matrix.setScale(scale, scale)
+ path.transform(matrix)
+ }
+ return path
+ }
+
/** Initializes the shape which is closest to the [AdaptiveIconDrawable] */
private fun pickBestShape(themeManager: ThemeManager): ShapeDelegate {
val drawable =
@@ -281,6 +293,7 @@
const val TAG = "IconShape"
const val KEY_ICON_SHAPE = "icon_shape"
+ const val DEFAULT_PATH_SIZE = 100f
const val AREA_CALC_SIZE = 1000
// .1% error margin
const val AREA_DIFF_THRESHOLD = AREA_CALC_SIZE * AREA_CALC_SIZE / 1000
diff --git a/src/com/android/launcher3/graphics/PreloadIconDrawable.java b/src/com/android/launcher3/graphics/PreloadIconDrawable.java
index 9fffcc1..3464e9b 100644
--- a/src/com/android/launcher3/graphics/PreloadIconDrawable.java
+++ b/src/com/android/launcher3/graphics/PreloadIconDrawable.java
@@ -40,7 +40,6 @@
import com.android.launcher3.anim.AnimatedFloat;
import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.icons.FastBitmapDrawable;
-import com.android.launcher3.icons.GraphicsUtils;
import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.util.Themes;
@@ -121,7 +120,8 @@
IconPalette.getPreloadProgressColor(context, info.bitmap.color),
getPreloadColors(context),
Utilities.isDarkTheme(context),
- GraphicsUtils.getShapePath(context, DEFAULT_PATH_SIZE));
+ IconShape.INSTANCE.get(context).getShapeOverridePath(DEFAULT_PATH_SIZE)
+ );
}
public PreloadIconDrawable(
diff --git a/tests/tapl/com/android/launcher3/tapl/OverviewTask.java b/tests/tapl/com/android/launcher3/tapl/OverviewTask.java
index 70bfb60..2431ef5 100644
--- a/tests/tapl/com/android/launcher3/tapl/OverviewTask.java
+++ b/tests/tapl/com/android/launcher3/tapl/OverviewTask.java
@@ -157,6 +157,7 @@
}
boolean taskWasFocused = mLauncher.isTablet()
+ && !isDesktop()
&& getVisibleHeight() == mLauncher.getOverviewTaskSize().height();
List<Integer> originalTasksCenterX =
getCurrentTasksCenterXList().stream().sorted().toList();