From 2d7b0048425f9b28ae438c2cf531f54376a1bde0 Mon Sep 17 00:00:00 2001 From: Marcelo Arteiro Date: Tue, 22 Oct 2024 13:22:18 +0000 Subject: [PATCH 01/15] Fix home screen briefly flashes after setup. Bug: 368521393 Change-Id: I5ef6a6332bb54f058fefe56cdada13952341bb22 Flag: EXEMPT bugfix Test: Manual --- quickstep/res/values/styles.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/quickstep/res/values/styles.xml b/quickstep/res/values/styles.xml index c423d094bf..6ffcb9b687 100644 --- a/quickstep/res/values/styles.xml +++ b/quickstep/res/values/styles.xml @@ -211,6 +211,7 @@ false true @android:color/transparent + false 12dp diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarOverflowView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarOverflowView.java index 712478e440..8775766b25 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarOverflowView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarOverflowView.java @@ -41,6 +41,7 @@ import com.android.app.animation.Interpolators; import com.android.launcher3.R; import com.android.launcher3.Reorderable; import com.android.launcher3.Utilities; +import com.android.launcher3.icons.IconNormalizer; import com.android.launcher3.util.MultiTranslateDelegate; import com.android.launcher3.util.Themes; import com.android.systemui.shared.recents.model.Task; @@ -68,8 +69,15 @@ public class TaskbarOverflowView extends FrameLayout implements Reorderable { private static final long LEAVE_BEHIND_ANIMATIONS_DELAY = 500L; private static final long LEAVE_BEHIND_OPACITY_ANIMATION_DURATION = 100L; private static final long LEAVE_BEHIND_SIZE_ANIMATION_DURATION = 500L; + private static final float LEAVE_BEHIND_SIZE_SCALE_DOWN_MULTIPLIER = 0.83f; private static final int MAX_ITEMS_IN_PREVIEW = 4; + // The height divided by the width of the horizontal box containing two overlapping app icons. + // According to the spec, this ratio is constant for different sizes of taskbar app icons. + // Assuming the width of this box = taskbar app icon size - 2 paddings - 2 stroke widths, and + // the height = width * 0.61, which is also equal to the height of a single item in the preview. + private static final float TWO_ITEM_ICONS_BOX_ASPECT_RATIO = 0.61f; + private static final FloatProperty ITEM_ICON_CENTER_OFFSET = new FloatProperty<>("itemIconCenterOffset") { @Override @@ -208,9 +216,24 @@ public class TaskbarOverflowView extends FrameLayout implements Reorderable { icon.mIconSize = iconSize; icon.mPadding = padding; - final float radius = iconSize / 2f - padding; - final float size = radius + icon.mItemIconStrokeWidth; - icon.mItemIconCenterOffsetDefault = radius - size / 2 - icon.mItemIconStrokeWidth; + final float taskbarIconRadius = + iconSize * IconNormalizer.ICON_VISIBLE_AREA_FACTOR / 2f - padding; + + icon.mLeaveBehindSizeDefault = taskbarIconRadius; // 1/2 of taskbar app icon size + icon.mLeaveBehindSizeScaledDown = + icon.mLeaveBehindSizeDefault * LEAVE_BEHIND_SIZE_SCALE_DOWN_MULTIPLIER; + icon.mLeaveBehindSize = icon.mLeaveBehindSizeScaledDown; + + icon.mItemIconStrokeWidthDefault = taskbarIconRadius / 5f; // 1/10 of taskbar app icon size + icon.mItemIconStrokeWidth = icon.mItemIconStrokeWidthDefault; + + icon.mItemIconSizeDefault = 2 * (taskbarIconRadius - icon.mItemIconStrokeWidthDefault) + * TWO_ITEM_ICONS_BOX_ASPECT_RATIO; + icon.mItemIconSizeScaledDown = icon.mLeaveBehindSizeScaledDown; + icon.mItemIconSize = icon.mItemIconSizeDefault; + + icon.mItemIconCenterOffsetDefault = taskbarIconRadius - icon.mItemIconSizeDefault / 2f + - icon.mItemIconStrokeWidthDefault; icon.mItemIconCenterOffset = icon.mItemIconCenterOffsetDefault; return icon; @@ -222,22 +245,6 @@ public class TaskbarOverflowView extends FrameLayout implements Reorderable { mItemBackgroundColor = getContext().getColor(R.color.taskbar_background); mLeaveBehindColor = Themes.getAttrColor(getContext(), android.R.attr.textColorTertiary); - mItemIconSizeDefault = getResources().getDimension( - R.dimen.taskbar_overflow_item_icon_size_default); - mItemIconSizeScaledDown = getResources().getDimension( - R.dimen.taskbar_overflow_item_icon_size_scaled_down); - mItemIconSize = mItemIconSizeDefault; - - mItemIconStrokeWidthDefault = getResources().getDimension( - R.dimen.taskbar_overflow_item_icon_stroke_width_default); - mItemIconStrokeWidth = mItemIconStrokeWidthDefault; - - mLeaveBehindSizeDefault = getResources().getDimension( - R.dimen.taskbar_overflow_leave_behind_size_default); - mLeaveBehindSizeScaledDown = getResources().getDimension( - R.dimen.taskbar_overflow_leave_behind_size_scaled_down); - mLeaveBehindSize = mLeaveBehindSizeScaledDown; - setWillNotDraw(false); } From 970d19327d05bbaf21493b679b9b99632d114398 Mon Sep 17 00:00:00 2001 From: Uwais Ashraf Date: Sat, 16 Nov 2024 17:43:00 +0000 Subject: [PATCH 09/15] Close repeatedly unclosed resources at the end of tests Fix: 379432671 Test: edited tests, presubmits passing Flag: EXEMPT test only change Change-Id: I45c46d7a56a30af4a11dff54b5bcc8a1e9bcda5f --- .../launcher3/icons/IconCacheTest.java | 6 ++ .../launcher3/model/DatabaseHelperTest.kt | 21 ++++-- .../launcher3/model/GridSizeMigrationTest.kt | 1 + .../launcher3/model/LoaderCursorTest.java | 1 + .../launcher3/provider/RestoreDbTaskTest.java | 70 ++++++++++--------- .../launcher3/widget/GeneratedPreviewTest.kt | 20 +++--- 6 files changed, 72 insertions(+), 47 deletions(-) diff --git a/tests/multivalentTests/src/com/android/launcher3/icons/IconCacheTest.java b/tests/multivalentTests/src/com/android/launcher3/icons/IconCacheTest.java index ce00b28c51..9b4bd71608 100644 --- a/tests/multivalentTests/src/com/android/launcher3/icons/IconCacheTest.java +++ b/tests/multivalentTests/src/com/android/launcher3/icons/IconCacheTest.java @@ -71,6 +71,7 @@ import com.android.launcher3.util.PackageUserKey; import com.google.common.truth.Truth; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -99,6 +100,11 @@ public class IconCacheTest { new LauncherIconProvider(mContext)); } + @After + public void tearDown() { + mIconCache.close(); + } + @Test public void getShortcutInfoBadge_nullComponent_overrideAllowed() throws Exception { String overridePackage = "com.android.settings"; diff --git a/tests/multivalentTests/src/com/android/launcher3/model/DatabaseHelperTest.kt b/tests/multivalentTests/src/com/android/launcher3/model/DatabaseHelperTest.kt index c9ea421039..09752b860e 100644 --- a/tests/multivalentTests/src/com/android/launcher3/model/DatabaseHelperTest.kt +++ b/tests/multivalentTests/src/com/android/launcher3/model/DatabaseHelperTest.kt @@ -1,5 +1,6 @@ package com.android.launcher3.model +import android.content.Context import android.database.sqlite.SQLiteDatabase import android.os.UserHandle import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -11,8 +12,10 @@ import com.android.launcher3.LauncherSettings.Favorites.addTableToDb import com.android.launcher3.pm.UserCache import com.android.launcher3.provider.LauncherDbUtils import java.util.function.ToLongFunction +import org.junit.After import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse +import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -24,6 +27,19 @@ private const val ICON_RESOURCE = "iconResource" @SmallTest @RunWith(AndroidJUnit4::class) class DatabaseHelperTest { + val context: Context = InstrumentationRegistry.getInstrumentation().targetContext + // v30 - 21 columns + lateinit var db: SQLiteDatabase + + @Before + fun setUp() { + db = FactitiousDbController(context, INSERTION_SQL).inMemoryDb + } + + @After + fun tearDown() { + db.close() + } /** * b/304687723 occurred when a return was accidentally added to a case statement in @@ -33,13 +49,11 @@ class DatabaseHelperTest { */ @Test fun onUpgrade_to_version_32_from_30() { - val context = InstrumentationRegistry.getInstrumentation().targetContext val userSerialProvider = ToLongFunction { UserCache.INSTANCE.get(context).getSerialNumberForUser(it) } val dbHelper = DatabaseHelper(context, null, userSerialProvider) {} - val db = FactitiousDbController(context, INSERTION_SQL).inMemoryDb dbHelper.onUpgrade(db, 30, 32) @@ -54,9 +68,6 @@ class DatabaseHelperTest { */ @Test fun after_migrating_from_db_v30_to_v32_copy_table() { - val context = InstrumentationRegistry.getInstrumentation().targetContext - val db = FactitiousDbController(context, INSERTION_SQL).inMemoryDb // v30 - 21 columns - addTableToDb(db, 1, true, TMP_TABLE) LauncherDbUtils.copyTable(db, TABLE_NAME, db, TMP_TABLE, context) diff --git a/tests/multivalentTests/src/com/android/launcher3/model/GridSizeMigrationTest.kt b/tests/multivalentTests/src/com/android/launcher3/model/GridSizeMigrationTest.kt index 7933331cff..eee6191f15 100644 --- a/tests/multivalentTests/src/com/android/launcher3/model/GridSizeMigrationTest.kt +++ b/tests/multivalentTests/src/com/android/launcher3/model/GridSizeMigrationTest.kt @@ -82,6 +82,7 @@ class GridSizeMigrationTest { @After fun tearDown() { + db.close() modelHelper.destroy() } diff --git a/tests/multivalentTests/src/com/android/launcher3/model/LoaderCursorTest.java b/tests/multivalentTests/src/com/android/launcher3/model/LoaderCursorTest.java index b4945d7129..63359ec1cd 100644 --- a/tests/multivalentTests/src/com/android/launcher3/model/LoaderCursorTest.java +++ b/tests/multivalentTests/src/com/android/launcher3/model/LoaderCursorTest.java @@ -109,6 +109,7 @@ public class LoaderCursorTest { @After public void tearDown() { + mCursor.close(); mModelHelper.destroy(); } diff --git a/tests/multivalentTests/src/com/android/launcher3/provider/RestoreDbTaskTest.java b/tests/multivalentTests/src/com/android/launcher3/provider/RestoreDbTaskTest.java index d0c168a8d1..c30b730807 100644 --- a/tests/multivalentTests/src/com/android/launcher3/provider/RestoreDbTaskTest.java +++ b/tests/multivalentTests/src/com/android/launcher3/provider/RestoreDbTaskTest.java @@ -92,6 +92,7 @@ public class RestoreDbTaskTest { private Cursor mMockCursor; private LauncherPrefs mPrefs; private LauncherRestoreEventLogger mMockRestoreEventLogger; + private SQLiteDatabase mDb; @Before public void setup() { @@ -107,57 +108,60 @@ public class RestoreDbTaskTest { @After public void teardown() { + if (mDb != null) { + mDb.close(); + } mModelHelper.destroy(); LauncherPrefs.get(mContext).removeSync(RESTORE_DEVICE); } @Test public void testGetProfileId() throws Exception { - SQLiteDatabase db = new MyModelDbController(23).getDb(); - assertEquals(23, new RestoreDbTask().getDefaultProfileId(db)); + mDb = new MyModelDbController(23).getDb(); + assertEquals(23, new RestoreDbTask().getDefaultProfileId(mDb)); } @Test public void testMigrateProfileId() throws Exception { - SQLiteDatabase db = new MyModelDbController(42).getDb(); + mDb = new MyModelDbController(42).getDb(); // Add some mock data for (int i = 0; i < 5; i++) { ContentValues values = new ContentValues(); values.put(Favorites._ID, i); values.put(Favorites.TITLE, "item " + i); - db.insert(Favorites.TABLE_NAME, null, values); + mDb.insert(Favorites.TABLE_NAME, null, values); } // Verify item add - assertEquals(5, getCount(db, "select * from favorites where profileId = 42")); + assertEquals(5, getCount(mDb, "select * from favorites where profileId = 42")); - new RestoreDbTask().migrateProfileId(db, 42, 33); + new RestoreDbTask().migrateProfileId(mDb, 42, 33); // verify data migrated - assertEquals(0, getCount(db, "select * from favorites where profileId = 42")); - assertEquals(5, getCount(db, "select * from favorites where profileId = 33")); + assertEquals(0, getCount(mDb, "select * from favorites where profileId = 42")); + assertEquals(5, getCount(mDb, "select * from favorites where profileId = 33")); } @Test public void testChangeDefaultColumn() throws Exception { - SQLiteDatabase db = new MyModelDbController(42).getDb(); + mDb = new MyModelDbController(42).getDb(); // Add some mock data for (int i = 0; i < 5; i++) { ContentValues values = new ContentValues(); values.put(Favorites._ID, i); values.put(Favorites.TITLE, "item " + i); - db.insert(Favorites.TABLE_NAME, null, values); + mDb.insert(Favorites.TABLE_NAME, null, values); } // Verify default column is 42 - assertEquals(5, getCount(db, "select * from favorites where profileId = 42")); + assertEquals(5, getCount(mDb, "select * from favorites where profileId = 42")); - new RestoreDbTask().changeDefaultColumn(db, 33); + new RestoreDbTask().changeDefaultColumn(mDb, 33); // Verify default value changed ContentValues values = new ContentValues(); values.put(Favorites._ID, 100); values.put(Favorites.TITLE, "item 100"); - db.insert(Favorites.TABLE_NAME, null, values); - assertEquals(1, getCount(db, "select * from favorites where profileId = 33")); + mDb.insert(Favorites.TABLE_NAME, null, values); + assertEquals(1, getCount(mDb, "select * from favorites where profileId = 33")); } @Test @@ -170,7 +174,7 @@ public class RestoreDbTaskTest { long workProfileId_old = myProfileId + 3; MyModelDbController controller = new MyModelDbController(myProfileId); - SQLiteDatabase db = controller.getDb(); + mDb = controller.getDb(); BackupManager bm = spy(new BackupManager(mContext)); doReturn(myUserHandle()).when(bm).getUserForAncestralSerialNumber(eq(myProfileId_old)); doReturn(mWorkUser).when(bm).getUserForAncestralSerialNumber(eq(workProfileId_old)); @@ -178,16 +182,16 @@ public class RestoreDbTaskTest { addIconsBulk(controller, 10, 1, myProfileId_old); addIconsBulk(controller, 6, 2, workProfileId_old); - assertEquals(10, getItemCountForProfile(db, myProfileId_old)); - assertEquals(6, getItemCountForProfile(db, workProfileId_old)); + assertEquals(10, getItemCountForProfile(mDb, myProfileId_old)); + assertEquals(6, getItemCountForProfile(mDb, workProfileId_old)); mTask.sanitizeDB(mContext, controller, controller.getDb(), bm, mMockRestoreEventLogger); // All the data has been migrated to the new user ids - assertEquals(0, getItemCountForProfile(db, myProfileId_old)); - assertEquals(0, getItemCountForProfile(db, workProfileId_old)); - assertEquals(10, getItemCountForProfile(db, myProfileId)); - assertEquals(6, getItemCountForProfile(db, workProfileId)); + assertEquals(0, getItemCountForProfile(mDb, myProfileId_old)); + assertEquals(0, getItemCountForProfile(mDb, workProfileId_old)); + assertEquals(10, getItemCountForProfile(mDb, myProfileId)); + assertEquals(6, getItemCountForProfile(mDb, workProfileId)); } @Test @@ -199,7 +203,7 @@ public class RestoreDbTaskTest { long workProfileId_old = myProfileId + 3; MyModelDbController controller = new MyModelDbController(myProfileId); - SQLiteDatabase db = controller.getDb(); + mDb = controller.getDb(); BackupManager bm = spy(new BackupManager(mContext)); doReturn(myUserHandle()).when(bm).getUserForAncestralSerialNumber(eq(myProfileId_old)); // Work profile is not migrated @@ -207,16 +211,16 @@ public class RestoreDbTaskTest { addIconsBulk(controller, 10, 1, myProfileId_old); addIconsBulk(controller, 6, 2, workProfileId_old); - assertEquals(10, getItemCountForProfile(db, myProfileId_old)); - assertEquals(6, getItemCountForProfile(db, workProfileId_old)); + assertEquals(10, getItemCountForProfile(mDb, myProfileId_old)); + assertEquals(6, getItemCountForProfile(mDb, workProfileId_old)); mTask.sanitizeDB(mContext, controller, controller.getDb(), bm, mMockRestoreEventLogger); // All the data has been migrated to the new user ids - assertEquals(0, getItemCountForProfile(db, myProfileId_old)); - assertEquals(0, getItemCountForProfile(db, workProfileId_old)); - assertEquals(10, getItemCountForProfile(db, myProfileId)); - assertEquals(10, getCount(db, "select * from favorites")); + assertEquals(0, getItemCountForProfile(mDb, myProfileId_old)); + assertEquals(0, getItemCountForProfile(mDb, workProfileId_old)); + assertEquals(10, getItemCountForProfile(mDb, myProfileId)); + assertEquals(10, getCount(mDb, "select * from favorites")); } @Test @@ -342,24 +346,24 @@ public class RestoreDbTaskTest { } private void runRemoveScreenIdGapsTest(int[] screenIds, int[] expectedScreenIds) { - SQLiteDatabase db = new MyModelDbController(42).getDb(); + mDb = new MyModelDbController(42).getDb(); // Add some mock data for (int i = 0; i < screenIds.length; i++) { ContentValues values = new ContentValues(); values.put(Favorites._ID, i); values.put(Favorites.SCREEN, screenIds[i]); values.put(Favorites.CONTAINER, CONTAINER_DESKTOP); - db.insert(Favorites.TABLE_NAME, null, values); + mDb.insert(Favorites.TABLE_NAME, null, values); } // Verify items are added assertEquals(screenIds.length, - getCount(db, "select * from favorites where container = -100")); + getCount(mDb, "select * from favorites where container = -100")); - new RestoreDbTask().removeScreenIdGaps(db); + new RestoreDbTask().removeScreenIdGaps(mDb); // verify screenId gaps removed int[] resultScreenIds = new int[screenIds.length]; - try (Cursor c = db.rawQuery( + try (Cursor c = mDb.rawQuery( "select screen from favorites where container = -100 order by screen", null)) { int i = 0; while (c.moveToNext()) { diff --git a/tests/multivalentTests/src/com/android/launcher3/widget/GeneratedPreviewTest.kt b/tests/multivalentTests/src/com/android/launcher3/widget/GeneratedPreviewTest.kt index 7484bce091..ac5fda26a4 100644 --- a/tests/multivalentTests/src/com/android/launcher3/widget/GeneratedPreviewTest.kt +++ b/tests/multivalentTests/src/com/android/launcher3/widget/GeneratedPreviewTest.kt @@ -26,6 +26,7 @@ import com.android.launcher3.model.WidgetItem import com.android.launcher3.util.ActivityContextWrapper import com.android.launcher3.util.Executors import com.google.common.truth.Truth.assertThat +import org.junit.After import org.junit.Before import org.junit.Rule import org.junit.Test @@ -38,7 +39,7 @@ class GeneratedPreviewTest { @get:Rule val checkFlagsRule: CheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule() private val providerName = ComponentName( - getInstrumentation().getContext().getPackageName(), + getInstrumentation().context.packageName, "com.android.launcher3.testcomponent.AppWidgetNoConfig", ) private val generatedPreviewLayout = @@ -51,6 +52,7 @@ class GeneratedPreviewTest { private lateinit var helper: WidgetManagerHelper private lateinit var appWidgetProviderInfo: LauncherAppWidgetProviderInfo private lateinit var widgetItem: WidgetItem + private lateinit var iconCache: IconCache @Before fun setup() { @@ -88,17 +90,17 @@ class GeneratedPreviewTest { createWidgetItem() } + @After + fun tearDown() { + iconCache.close() + } + private fun createWidgetItem() { Executors.MODEL_EXECUTOR.submit { val idp = InvariantDeviceProfile() - widgetItem = - WidgetItem( - appWidgetProviderInfo, - idp, - IconCache(context, idp, null, IconProvider(context)), - context, - helper, - ) + if (::iconCache.isInitialized) iconCache.close() + iconCache = IconCache(context, idp, null, IconProvider(context)) + widgetItem = WidgetItem(appWidgetProviderInfo, idp, iconCache, context, helper) } .get() } From 82efdccc6e0883465c751f4648aa00d1dd2b2ccb Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 18 Nov 2024 13:42:24 -0800 Subject: [PATCH 10/15] Wait for animations before injecting input event While animaiton is running, some views might not be visible causing them to miss input events Bug: 378167329 Bug: 378167718 Test: Presubmit Flag: EXEMPT test fix Change-Id: I8608c415e524fc5186833eac840ec18c6f244eb0 --- .../com/android/launcher3/util/BaseLauncherActivityTest.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/src/com/android/launcher3/util/BaseLauncherActivityTest.kt b/tests/src/com/android/launcher3/util/BaseLauncherActivityTest.kt index 644659296d..61fa7d57ea 100644 --- a/tests/src/com/android/launcher3/util/BaseLauncherActivityTest.kt +++ b/tests/src/com/android/launcher3/util/BaseLauncherActivityTest.kt @@ -124,9 +124,10 @@ open class BaseLauncherActivityTest { @JvmOverloads protected fun injectKeyEvent(keyCode: Int, actionDown: Boolean, metaState: Int = 0) { + uiDevice.waitForIdle() val eventTime = SystemClock.uptimeMillis() val event = - KeyEvent.obtain( + KeyEvent( eventTime, eventTime, if (actionDown) KeyEvent.ACTION_DOWN else MotionEvent.ACTION_UP, @@ -137,10 +138,8 @@ open class BaseLauncherActivityTest { /* scancode= */ 0, /* flags= */ 0, InputDevice.SOURCE_KEYBOARD, - /* characters =*/ null, ) executeOnLauncher { it.dispatchKeyEvent(event) } - event.recycle() } @JvmOverloads From d2cc1f057736fa7b5f4e83bc3d8e277fd84ff032 Mon Sep 17 00:00:00 2001 From: Shamali Patwa Date: Mon, 18 Nov 2024 20:18:17 +0000 Subject: [PATCH 11/15] Update the enforce_system_radius_for_app_widgets flag's type Renamed to use_system_radius_for_app_widgets since metadata cannot be updated after submitting definition. Bug: 373351337 Test: N/A flag metadata update Change-Id: I25283b05341517f5984b0f2fc0d27efe8027a3de Flag: com.android.launcher3.use_system_radius_for_app_widgets --- aconfig/launcher.aconfig | 9 ++++++--- .../launcher3/widget/RoundedCornerEnforcement.java | 4 ++-- .../launcher3/widget/RoundedCornerEnforcementTest.kt | 6 +++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/aconfig/launcher.aconfig b/aconfig/launcher.aconfig index 1856b39372..4ff976d148 100644 --- a/aconfig/launcher.aconfig +++ b/aconfig/launcher.aconfig @@ -501,10 +501,13 @@ flag { } flag { - name: "enforce_system_radius_for_app_widgets" + name: "use_system_radius_for_app_widgets" namespace: "launcher" - description: "Enforce system radius for widget corners instead of a separate 16.dp value" - bug: "370950552" + description: "Use system radius for enforced widget corners instead of a separate 16.dp value" + bug: "373351337" + metadata { + purpose: PURPOSE_BUGFIX + } } flag { diff --git a/src/com/android/launcher3/widget/RoundedCornerEnforcement.java b/src/com/android/launcher3/widget/RoundedCornerEnforcement.java index e190dc3749..2c07fd9ad1 100644 --- a/src/com/android/launcher3/widget/RoundedCornerEnforcement.java +++ b/src/com/android/launcher3/widget/RoundedCornerEnforcement.java @@ -16,7 +16,7 @@ package com.android.launcher3.widget; -import static com.android.launcher3.Flags.enforceSystemRadiusForAppWidgets; +import static com.android.launcher3.Flags.useSystemRadiusForAppWidgets; import android.appwidget.AppWidgetHostView; import android.content.Context; @@ -99,7 +99,7 @@ public class RoundedCornerEnforcement { public static float computeEnforcedRadius(@NonNull Context context) { Resources res = context.getResources(); float systemRadius = res.getDimension(android.R.dimen.system_app_widget_background_radius); - if (enforceSystemRadiusForAppWidgets()) { + if (useSystemRadiusForAppWidgets()) { return systemRadius; } diff --git a/tests/multivalentTests/src/com/android/launcher3/widget/RoundedCornerEnforcementTest.kt b/tests/multivalentTests/src/com/android/launcher3/widget/RoundedCornerEnforcementTest.kt index c82e84c18a..13e23c9753 100644 --- a/tests/multivalentTests/src/com/android/launcher3/widget/RoundedCornerEnforcementTest.kt +++ b/tests/multivalentTests/src/com/android/launcher3/widget/RoundedCornerEnforcementTest.kt @@ -86,7 +86,7 @@ class RoundedCornerEnforcementTest { } @Test - @DisableFlags(Flags.FLAG_ENFORCE_SYSTEM_RADIUS_FOR_APP_WIDGETS) + @DisableFlags(Flags.FLAG_USE_SYSTEM_RADIUS_FOR_APP_WIDGETS) fun `Compute system radius when smaller`() { val mockContext = mock(Context::class.java) val mockRes = mock(Resources::class.java) @@ -103,7 +103,7 @@ class RoundedCornerEnforcementTest { } @Test - @DisableFlags(Flags.FLAG_ENFORCE_SYSTEM_RADIUS_FOR_APP_WIDGETS) + @DisableFlags(Flags.FLAG_USE_SYSTEM_RADIUS_FOR_APP_WIDGETS) fun `Compute launcher radius when smaller`() { val mockContext = mock(Context::class.java) val mockRes = mock(Resources::class.java) @@ -120,7 +120,7 @@ class RoundedCornerEnforcementTest { } @Test - @EnableFlags(Flags.FLAG_ENFORCE_SYSTEM_RADIUS_FOR_APP_WIDGETS) + @EnableFlags(Flags.FLAG_USE_SYSTEM_RADIUS_FOR_APP_WIDGETS) fun `Compute system radius ignoring launcher radius`() { val mockContext = mock(Context::class.java) val mockRes = mock(Resources::class.java) From 232db796aa4000655a90c1180e9fba9b411b594c Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Mon, 18 Nov 2024 17:05:12 -0500 Subject: [PATCH 12/15] Fix bubble animation when swiping home When swiping home during the bubble animation, and if the show edu view state field is on, we try to show the bubble bar as part of preparing to show the edu view. This updates the stash state and prevents the animation from getting interrupted. The expected behavior around showing the edu view is to store the request when it is received and show the view later after the user taps on the bubble bar or the flyout to expand it. We shouldn't attempt to show the bubble bar at that point. Flag: com.android.wm.shell.enable_bubble_bar Fixes: 378967270 Bug: 374842575 Test: manual - force show the edu: adb shell settings put secure force_show_bubbles_user_education 1 - launch an app and send a bubble - while the bubble animates, swipe to go home - observe the flyout is removed correctly, and we don't end up in stashed state Change-Id: I478b06ac5f6f9d398cd143bcc0b3f796d9ad8a49 --- .../launcher3/taskbar/bubbles/BubbleBarViewController.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index d842138e8b..d13e0c4d07 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -997,10 +997,9 @@ public class BubbleBarViewController { } } - /** Marks as should show education and shows the bubble bar in a collapsed state */ + /** Marks as should show education. */ public void prepareToShowEducation() { mShouldShowEducation = true; - mBubbleStashController.showBubbleBar(false /* expand the bubbles */); } /** From df5e51ce34938d89d32412cbf884f606e3d1f167 Mon Sep 17 00:00:00 2001 From: Brandon Dayauon Date: Mon, 18 Nov 2024 14:59:04 -0800 Subject: [PATCH 13/15] Fix work tab accessbility issues. The issue is that the accessibility scanner says tap target is 46dp rather than 48dp because of the 1dp padding that is added to the viewgroup. Rather, we should delegate that 1dp to the insets of the drawable instead. bug: 379222957 Test manually, photos: beforeAccessibilityscanner: https://drive.google.com/file/d/1-XssMfXstpKQk5Ve7l5UCPFORtCkYluH/view?usp=sharing before:https://drive.google.com/file/d/1rip4gIKpoOw-cCNroEjrpcJ9TMSthHhB/view?usp=sharing after: https://drive.google.com/file/d/1dOh4yxEAPBG_pGn92yUGizTCLTTW1w2K/view?usp=sharing Flag: NONE bug fix changing dp Change-Id: I5ac69e5d92bbbbc3617e30801316eb04d65ace7a --- res/drawable/all_apps_tabs_background_selected.xml | 8 ++++---- res/drawable/all_apps_tabs_background_unselected.xml | 8 ++++---- res/layout/all_apps_personal_work_tabs.xml | 2 -- res/values/dimens.xml | 5 ++--- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/res/drawable/all_apps_tabs_background_selected.xml b/res/drawable/all_apps_tabs_background_selected.xml index 47f95dd745..6560632fe9 100644 --- a/res/drawable/all_apps_tabs_background_selected.xml +++ b/res/drawable/all_apps_tabs_background_selected.xml @@ -15,10 +15,10 @@ --> + android:bottom="@dimen/all_apps_tabs_focus_vertical_inset" + android:end="@dimen/all_apps_tabs_focus_horizontal_inset" + android:start="@dimen/all_apps_tabs_focus_horizontal_inset" + android:top="@dimen/all_apps_tabs_focus_vertical_inset"> diff --git a/res/drawable/all_apps_tabs_background_unselected.xml b/res/drawable/all_apps_tabs_background_unselected.xml index ab592a8304..ce7b334687 100644 --- a/res/drawable/all_apps_tabs_background_unselected.xml +++ b/res/drawable/all_apps_tabs_background_unselected.xml @@ -15,10 +15,10 @@ --> + android:bottom="@dimen/all_apps_tabs_focus_vertical_inset" + android:end="@dimen/all_apps_tabs_focus_horizontal_inset" + android:start="@dimen/all_apps_tabs_focus_horizontal_inset" + android:top="@dimen/all_apps_tabs_focus_vertical_inset"> diff --git a/res/layout/all_apps_personal_work_tabs.xml b/res/layout/all_apps_personal_work_tabs.xml index ecc5a1404a..b6a8ed8dc8 100644 --- a/res/layout/all_apps_personal_work_tabs.xml +++ b/res/layout/all_apps_personal_work_tabs.xml @@ -21,8 +21,6 @@ android:layout_width="match_parent" android:layout_height="@dimen/all_apps_header_pill_height" android:layout_gravity="center_horizontal" - android:paddingTop="@dimen/all_apps_tabs_vertical_padding_focus" - android:paddingBottom="@dimen/all_apps_tabs_vertical_padding_focus" android:layout_marginTop="@dimen/all_apps_tabs_margin_top" android:orientation="horizontal" style="@style/TextHeadline" diff --git a/res/values/dimens.xml b/res/values/dimens.xml index c69778a95d..c31b4ee3b6 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -125,9 +125,8 @@ 16dp 20dp 4dp - 6dp - 1dp - 5dp + 5dp + 6dp 3dp 2dp 8dp From dd28335d78889e4138eb124f9dd05f9be498964d Mon Sep 17 00:00:00 2001 From: Federico Baron Date: Tue, 19 Nov 2024 00:49:26 +0000 Subject: [PATCH 14/15] Remove any fixed landscape foldable dumps Bug: 364711064 Flag: com.android.launcher3.one_grid_specs Test: DeviceProfileAlternativeDisplaysDumpTest Change-Id: I71f026d34dd536cc4041e1dd36908824eb479153 --- .../src/com/android/launcher3/AbstractDeviceProfileTest.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/multivalentTests/src/com/android/launcher3/AbstractDeviceProfileTest.kt b/tests/multivalentTests/src/com/android/launcher3/AbstractDeviceProfileTest.kt index f8794f86b4..c4519ebfd5 100644 --- a/tests/multivalentTests/src/com/android/launcher3/AbstractDeviceProfileTest.kt +++ b/tests/multivalentTests/src/com/android/launcher3/AbstractDeviceProfileTest.kt @@ -168,7 +168,6 @@ abstract class AbstractDeviceProfileTest { isLandscape: Boolean = false, isGestureMode: Boolean = true, isFolded: Boolean = false, - isFixedLandscape: Boolean = false, ) { val (unfoldedNaturalX, unfoldedNaturalY) = deviceSpecUnfolded.naturalSize val unfoldedWindowsBounds = @@ -195,7 +194,6 @@ abstract class AbstractDeviceProfileTest { rotation = if (isLandscape) Surface.ROTATION_90 else Surface.ROTATION_0, isGestureMode = isGestureMode, densityDpi = deviceSpecFolded.densityDpi, - isFixedLandscape = isFixedLandscape, ) } else { initializeCommonVars( @@ -204,7 +202,6 @@ abstract class AbstractDeviceProfileTest { rotation = if (isLandscape) Surface.ROTATION_0 else Surface.ROTATION_90, isGestureMode = isGestureMode, densityDpi = deviceSpecUnfolded.densityDpi, - isFixedLandscape = isFixedLandscape, ) } } From fadf3a891c639f2d583d236eb34092e3c17257f7 Mon Sep 17 00:00:00 2001 From: Marzia Favaro Date: Tue, 19 Nov 2024 15:19:34 +0000 Subject: [PATCH 15/15] Enable split screen from app handle also for non-desktop devices Test: manual, open menu and go to split screen Flag: com.android.window.flags.show_app_handle_large_screens Bug: 377689543 Change-Id: Iaf8794abc1111c4ebce9254f6f5d1bada7f57dd5 --- .../com/android/launcher3/uioverrides/QuickstepLauncher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 34d9a68a58..1baba74359 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -304,7 +304,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer, mTISBindHelper = new TISBindHelper(this, this::onTISConnected); mDepthController = new DepthController(this); - if (DesktopModeStatus.canEnterDesktopMode(this)) { + if (DesktopModeStatus.canEnterDesktopModeOrShowAppHandle(this)) { mSplitSelectStateController.initSplitFromDesktopController(this, overviewComponentObserver); }