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

Commit e6fdb5e2 authored by Charlie Anderson's avatar Charlie Anderson Committed by Android Build Coastguard Worker
Browse files

Update test activities with a non-default icon.

Check against default app icon in FolderIconLoadTest

Bug: 357441807
Bug: 369222239
Bug: 369240511
Flag: EXEMPT bc-triaged bugfix
Test: FolderIconLoadTest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:65c1010029e65c7e3062fd5e1407fa53437ac417)
Merged-In: I0e224f5b8bf8c0a8c51d88abd7c562d8e1ff7a55
Change-Id: I0e224f5b8bf8c0a8c51d88abd7c562d8e1ff7a55
parent 6e975b5b
Loading
Loading
Loading
Loading
+14 −1
Original line number Original line Diff line number Diff line
@@ -183,6 +183,7 @@
        </activity>
        </activity>
        <activity-alias android:name="Activity2"
        <activity-alias android:name="Activity2"
                        android:label="TestActivity2"
                        android:label="TestActivity2"
                        android:icon="@drawable/test_icon"
                        android:exported="true"
                        android:exported="true"
                        android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
                        android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
            <intent-filter>
            <intent-filter>
@@ -192,6 +193,7 @@
        </activity-alias>
        </activity-alias>
        <activity-alias android:name="Activity3"
        <activity-alias android:name="Activity3"
                        android:label="TestActivity3"
                        android:label="TestActivity3"
                        android:icon="@drawable/test_icon"
                        android:exported="true"
                        android:exported="true"
                        android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
                        android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
            <intent-filter>
            <intent-filter>
@@ -201,6 +203,7 @@
        </activity-alias>
        </activity-alias>
        <activity-alias android:name="Activity4"
        <activity-alias android:name="Activity4"
                        android:label="TestActivity4"
                        android:label="TestActivity4"
                        android:icon="@drawable/test_icon"
                        android:exported="true"
                        android:exported="true"
                        android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
                        android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
            <intent-filter>
            <intent-filter>
@@ -210,6 +213,7 @@
        </activity-alias>
        </activity-alias>
        <activity-alias android:name="Activity5"
        <activity-alias android:name="Activity5"
                        android:label="TestActivity5"
                        android:label="TestActivity5"
                        android:icon="@drawable/test_icon"
                        android:exported="true"
                        android:exported="true"
                        android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
                        android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
            <intent-filter>
            <intent-filter>
@@ -219,6 +223,7 @@
        </activity-alias>
        </activity-alias>
        <activity-alias android:name="Activity6"
        <activity-alias android:name="Activity6"
                        android:label="TestActivity6"
                        android:label="TestActivity6"
                        android:icon="@drawable/test_icon"
                        android:exported="true"
                        android:exported="true"
                        android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
                        android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
            <intent-filter>
            <intent-filter>
@@ -228,6 +233,7 @@
        </activity-alias>
        </activity-alias>
        <activity-alias android:name="Activity7"
        <activity-alias android:name="Activity7"
                        android:label="TestActivity7"
                        android:label="TestActivity7"
                        android:icon="@drawable/test_icon"
                        android:exported="true"
                        android:exported="true"
                        android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
                        android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
            <intent-filter>
            <intent-filter>
@@ -237,6 +243,7 @@
        </activity-alias>
        </activity-alias>
        <activity-alias android:name="Activity8"
        <activity-alias android:name="Activity8"
                        android:label="TestActivity8"
                        android:label="TestActivity8"
                        android:icon="@drawable/test_icon"
                        android:exported="true"
                        android:exported="true"
                        android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
                        android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
            <intent-filter>
            <intent-filter>
@@ -246,6 +253,7 @@
        </activity-alias>
        </activity-alias>
        <activity-alias android:name="Activity9" android:exported="true"
        <activity-alias android:name="Activity9" android:exported="true"
            android:label="TestActivity9"
            android:label="TestActivity9"
            android:icon="@drawable/test_icon"
            android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
            android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
            <intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.MAIN" />
@@ -254,6 +262,7 @@
        </activity-alias>
        </activity-alias>
        <activity-alias android:name="Activity10" android:exported="true"
        <activity-alias android:name="Activity10" android:exported="true"
            android:label="TestActivity10"
            android:label="TestActivity10"
            android:icon="@drawable/test_icon"
            android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
            android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
            <intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.MAIN" />
@@ -262,6 +271,7 @@
        </activity-alias>
        </activity-alias>
        <activity-alias android:name="Activity11" android:exported="true"
        <activity-alias android:name="Activity11" android:exported="true"
            android:label="TestActivity11"
            android:label="TestActivity11"
            android:icon="@drawable/test_icon"
            android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
            android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
            <intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.MAIN" />
@@ -270,6 +280,7 @@
        </activity-alias>
        </activity-alias>
        <activity-alias android:name="Activity12" android:exported="true"
        <activity-alias android:name="Activity12" android:exported="true"
            android:label="TestActivity12"
            android:label="TestActivity12"
            android:icon="@drawable/test_icon"
            android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
            android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
            <intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.MAIN" />
@@ -278,6 +289,7 @@
        </activity-alias>
        </activity-alias>
        <activity-alias android:name="Activity13" android:exported="true"
        <activity-alias android:name="Activity13" android:exported="true"
            android:label="TestActivity13"
            android:label="TestActivity13"
            android:icon="@drawable/test_icon"
            android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
            android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
            <intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.MAIN" />
@@ -286,6 +298,7 @@
        </activity-alias>
        </activity-alias>
        <activity-alias android:name="Activity14" android:exported="true"
        <activity-alias android:name="Activity14" android:exported="true"
            android:label="TestActivity14"
            android:label="TestActivity14"
            android:icon="@drawable/test_icon"
            android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
            android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
            <intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.MAIN" />
@@ -363,7 +376,7 @@
        </activity>
        </activity>
        <activity android:name="com.android.launcher3.testcomponent.ImeTestActivity"
        <activity android:name="com.android.launcher3.testcomponent.ImeTestActivity"
            android:label="ImeTestActivity"
            android:label="ImeTestActivity"
            android:icon="@drawable/test_theme_icon"
            android:icon="@drawable/test_icon"
            android:exported="true">
            android:exported="true">
            <intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.MAIN" />
+13 −1
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.launcher3.model
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import androidx.test.filters.SmallTest
import com.android.launcher3.LauncherAppState
import com.android.launcher3.LauncherAppState
import com.android.launcher3.icons.BitmapInfo
import com.android.launcher3.model.data.WorkspaceItemInfo
import com.android.launcher3.model.data.WorkspaceItemInfo
import com.android.launcher3.util.Executors
import com.android.launcher3.util.Executors
import com.android.launcher3.util.LauncherLayoutBuilder
import com.android.launcher3.util.LauncherLayoutBuilder
@@ -58,7 +59,7 @@ class FolderIconLoadTest {
            TEST_ACTIVITY11,
            TEST_ACTIVITY11,
            TEST_ACTIVITY12,
            TEST_ACTIVITY12,
            TEST_ACTIVITY13,
            TEST_ACTIVITY13,
            TEST_ACTIVITY14
            TEST_ACTIVITY14,
        )
        )


    @Before
    @Before
@@ -169,6 +170,9 @@ class FolderIconLoadTest {
            assertWithMessage("Index $index was not highRes")
            assertWithMessage("Index $index was not highRes")
                .that(items[index].bitmap.isNullOrLowRes)
                .that(items[index].bitmap.isNullOrLowRes)
                .isFalse()
                .isFalse()
            assertWithMessage("Index $index was the default icon")
                .that(isDefaultIcon(items[index].bitmap))
                .isFalse()
        }
        }
    }
    }


@@ -177,9 +181,17 @@ class FolderIconLoadTest {
            assertWithMessage("Index $index was not lowRes")
            assertWithMessage("Index $index was not lowRes")
                .that(items[index].bitmap.isNullOrLowRes)
                .that(items[index].bitmap.isNullOrLowRes)
                .isTrue()
                .isTrue()
            assertWithMessage("Index $index was the default icon")
                .that(isDefaultIcon(items[index].bitmap))
                .isFalse()
        }
        }
    }
    }


    private fun isDefaultIcon(bitmap: BitmapInfo) =
        LauncherAppState.getInstance(modelHelper.sandboxContext)
            .iconCache
            .isDefaultIcon(bitmap, modelHelper.sandboxContext.user)

    /** Recreate DeviceProfiles after changing InvariantDeviceProfile */
    /** Recreate DeviceProfiles after changing InvariantDeviceProfile */
    private fun recreateSupportedDeviceProfiles() {
    private fun recreateSupportedDeviceProfiles() {
        LauncherAppState.getIDP(modelHelper.sandboxContext).supportedProfiles =
        LauncherAppState.getIDP(modelHelper.sandboxContext).supportedProfiles =
+29 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2024 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.
-->
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@android:color/white"/>
    <foreground>
        <color android:color="#FFFF0000" />
    </foreground>
    <monochrome>
        <vector android:width="48dp" android:height="48dp" android:viewportWidth="48.0" android:viewportHeight="48.0">
            <path
                android:fillColor="#FF000000"
                android:pathData="M0,24L48,24 48,48, 0,48 Z"/>
        </vector>
    </monochrome>
</adaptive-icon>