Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7ae1ec3 authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

Merge "Moving manifest initialization to RoboApplication instead of a separate rule" into main

parents 74180640 6a207fc4
Loading
Loading
Loading
Loading
+8 −12
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import com.android.launcher3.graphics.PreloadIconDrawable
import com.android.launcher3.icons.BaseIconFactory
import com.android.launcher3.icons.FastBitmapDrawable
import com.android.launcher3.icons.UserBadgeDrawable
import com.android.launcher3.model.ModelTestRule
import com.android.launcher3.model.data.FolderInfo
import com.android.launcher3.model.data.ItemInfo
import com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_ARCHIVED
@@ -45,7 +44,6 @@ import com.android.launcher3.util.UserIconInfo
import com.google.common.truth.Truth.assertThat
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@@ -54,8 +52,6 @@ import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class PreviewItemManagerTest {

    @get:Rule val modelTestRule = ModelTestRule()

    private lateinit var previewItemManager: PreviewItemManager
    private lateinit var context: Context
    private lateinit var folderItems: ArrayList<ItemInfo>
@@ -99,8 +95,8 @@ class PreviewItemManagerTest {
                BaseIconFactory(
                    context,
                    context.resources.configuration.densityDpi,
                    previewItemManager.mIconSize
                )
                    previewItemManager.mIconSize,
                ),
            )

        // Set second icon to be non-themed.
@@ -111,8 +107,8 @@ class PreviewItemManagerTest {
                BaseIconFactory(
                    context,
                    context.resources.configuration.densityDpi,
                    previewItemManager.mIconSize
                )
                    previewItemManager.mIconSize,
                ),
            )

        // Set third icon to be themed with badge.
@@ -123,8 +119,8 @@ class PreviewItemManagerTest {
                BaseIconFactory(
                    context,
                    context.resources.configuration.densityDpi,
                    previewItemManager.mIconSize
                )
                    previewItemManager.mIconSize,
                ),
            )
        folderApps[2].bitmap = folderApps[2].bitmap.withFlags(profileFlagOp(UserIconInfo.TYPE_WORK))

@@ -137,8 +133,8 @@ class PreviewItemManagerTest {
                BaseIconFactory(
                    context,
                    context.resources.configuration.densityDpi,
                    previewItemManager.mIconSize
                )
                    previewItemManager.mIconSize,
                ),
            )

        defaultThemedIcons = get(context).get(THEMED_ICONS)
+0 −5
Original line number Diff line number Diff line
@@ -68,7 +68,6 @@ import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.util.ApplicationInfoWrapper;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.util.RoboApiWrapper;

import com.google.common.truth.Truth;

@@ -148,7 +147,6 @@ public class IconCacheTest {

    @Test
    public void launcherActivityInfo_cached_in_memory() {
        RoboApiWrapper.INSTANCE.initialize();
        ComponentName cn = new ComponentName(TEST_PACKAGE, TEST_ACTIVITY);
        UserHandle user = myUserHandle();
        ComponentKey cacheKey = new ComponentKey(cn, user);
@@ -213,7 +211,6 @@ public class IconCacheTest {

    @Test
    public void item_kept_in_db_if_nothing_changes() {
        RoboApiWrapper.INSTANCE.initialize();
        ComponentName cn = new ComponentName(TEST_PACKAGE, TEST_ACTIVITY);
        UserHandle user = myUserHandle();

@@ -232,7 +229,6 @@ public class IconCacheTest {

    @Test
    public void item_updated_in_db_if_appInfo_changes() {
        RoboApiWrapper.INSTANCE.initialize();
        ComponentName cn = new ComponentName(TEST_PACKAGE, TEST_ACTIVITY);
        UserHandle user = myUserHandle();

@@ -253,7 +249,6 @@ public class IconCacheTest {

    @Test
    public void item_removed_in_db_if_item_removed() {
        RoboApiWrapper.INSTANCE.initialize();
        ComponentName cn = new ComponentName(TEST_PACKAGE, TEST_ACTIVITY);
        UserHandle user = myUserHandle();

+5 −18
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import com.android.launcher3.util.TestUtil.runOnExecutorSync
import com.google.common.truth.Truth.assertThat
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.times
@@ -44,8 +43,6 @@ import org.mockito.kotlin.whenever
@RunWith(AndroidJUnit4::class)
class AddWorkspaceItemsTaskTest : AbstractWorkspaceModelTest() {

    @get:Rule val modelTestRule = ModelTestRule()

    private lateinit var mDataModelCallbacks: MyCallbacks

    private val mWorkspaceItemSpaceFinder: WorkspaceItemSpaceFinder = mock()
@@ -121,18 +118,8 @@ class AddWorkspaceItemsTaskTest : AbstractWorkspaceModelTest() {
    @Test
    fun givenMultipleItems_whenExecuteTask_thenAddThem() {
        val itemsToAdd =
            arrayOf(
                getNewItem(),
                getExistingItem(),
                getNewItem(),
                getNewItem(),
                getExistingItem(),
            )
        givenNewItemSpaces(
            NewItemSpace(1, 3, 3),
            NewItemSpace(2, 0, 0),
            NewItemSpace(2, 0, 1),
        )
            arrayOf(getNewItem(), getExistingItem(), getNewItem(), getNewItem(), getExistingItem())
        givenNewItemSpaces(NewItemSpace(1, 3, 3), NewItemSpace(2, 0, 0), NewItemSpace(2, 0, 1))
        val nonEmptyScreenIds = listOf(0, 1)

        val addedItems = testAddItems(nonEmptyScreenIds, *itemsToAdd)
@@ -173,7 +160,7 @@ class AddWorkspaceItemsTaskTest : AbstractWorkspaceModelTest() {
                eq(IntArray.wrap(*nonEmptyScreenIds.toIntArray())),
                eq(IntArray()),
                eq(1),
                eq(1)
                eq(1),
            )
    }

@@ -183,7 +170,7 @@ class AddWorkspaceItemsTaskTest : AbstractWorkspaceModelTest() {
     */
    private fun testAddItems(
        nonEmptyScreenIds: List<Int>,
        vararg itemsToAdd: WorkspaceItemInfo
        vararg itemsToAdd: WorkspaceItemInfo,
    ): List<AddedItem> {
        setupWorkspaces(nonEmptyScreenIds)
        val task = newTask(*itemsToAdd)
@@ -220,7 +207,7 @@ private class MyCallbacks : BgDataModel.Callbacks {
    override fun bindAppsAdded(
        newScreens: IntArray?,
        addNotAnimated: ArrayList<ItemInfo>,
        addAnimated: ArrayList<ItemInfo>
        addAnimated: ArrayList<ItemInfo>,
    ) {
        addedItems.addAll(addAnimated.map { AddedItem(it, true) })
        addedItems.addAll(addNotAnimated.map { AddedItem(it, false) })
+1 −3
Original line number Diff line number Diff line
@@ -64,8 +64,6 @@ class AsyncBindingTest {

    @get:Rule val setFlagsRule = SetFlagsRule()

    @get:Rule val modelTestRule = ModelTestRule()

    @Spy private var callbacks = MyCallbacks()
    @Mock private lateinit var itemInflater: ItemInflater<*>

@@ -203,7 +201,7 @@ class AsyncBindingTest {
            pendingTasks: RunnableList,
            onCompleteSignal: RunnableList,
            workspaceItemCount: Int,
            isBindSync: Boolean
            isBindSync: Boolean,
        ) {
            this.pendingTasks = pendingTasks
            this.onCompleteSignal = onCompleteSignal
+1 −5
Original line number Diff line number Diff line
@@ -64,11 +64,7 @@ import java.util.List;
@RunWith(AndroidJUnit4.class)
public class CacheDataUpdatedTaskTest {

    @Rule(order = 0)
    public TestRule testStabilityRule = new TestStabilityRule();

    @Rule(order = 1)
    public ModelTestRule mModelTestRule = new ModelTestRule();
    @Rule public TestRule testStabilityRule = new TestStabilityRule();

    private static final String PENDING_APP_1 = TEST_PACKAGE + ".pending1";
    private static final String PENDING_APP_2 = TEST_PACKAGE + ".pending2";
Loading