diff options
61 files changed, 2 insertions, 2045 deletions
diff --git a/core/java/android/content/res/TEST_MAPPING b/core/java/android/content/res/TEST_MAPPING index daf9a1491cf9..9ebc9969a730 100644 --- a/core/java/android/content/res/TEST_MAPPING +++ b/core/java/android/content/res/TEST_MAPPING @@ -1,7 +1,7 @@ { "presubmit": [ { - "name": "FrameworksResourceLoaderTests" + "name": "CtsResourcesLoaderTests" } ] } diff --git a/core/tests/ResourceLoaderTests/Android.bp b/core/tests/ResourceLoaderTests/Android.bp deleted file mode 100644 index 2b14bca1f7c1..000000000000 --- a/core/tests/ResourceLoaderTests/Android.bp +++ /dev/null @@ -1,64 +0,0 @@ -// -// Copyright (C) 2019 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. -// - -android_test { - name: "FrameworksResourceLoaderTests", - srcs: [ - "src/**/*.kt" - ], - libs: [ - "android.test.runner", - "android.test.base" - ], - static_libs: [ - "FrameworksResourceLoaderTests_Providers", - "androidx.test.espresso.core", - "androidx.test.ext.junit", - "androidx.test.runner", - "androidx.test.rules", - "mockito-target-minus-junit4", - "truth-prebuilt" - ], - resource_dirs: ["res", "resources/provider_stable/res"], - platform_apis: true, - test_suites: ["device-tests"], - aaptflags: ["-0 .txt"], - data: [ - ":FrameworksResourceLoaderTests_ProviderOne_Split", - ":FrameworksResourceLoaderTests_ProviderTwo_Split", - ":FrameworksResourceLoaderTests_ProviderThree_Split", - ":FrameworksResourceLoaderTests_ProviderFour_Split" - ] -} - -java_genrule { - name: "FrameworksResourceLoaderTests_Providers", - tools: ["soong_zip"], - srcs : [ - ":FrameworksResourceLoaderTests_ProviderOne", - ":FrameworksResourceLoaderTests_ProviderOne_ARSC", - ":FrameworksResourceLoaderTests_ProviderTwo", - ":FrameworksResourceLoaderTests_ProviderTwo_ARSC", - ":FrameworksResourceLoaderTests_ProviderThree", - ":FrameworksResourceLoaderTests_ProviderThree_ARSC", - ":FrameworksResourceLoaderTests_ProviderFour", - ":FrameworksResourceLoaderTests_ProviderFour_ARSC" - ], - out: ["FrameworksResourceLoaderTests_Providers.jar"], - cmd: "mkdir -p $(genDir)/assets/ && cp $(in) $(genDir)/assets/ && " + - "$(location soong_zip) -o $(out) " + - "-L 0 -C $(genDir) -D $(genDir)/assets/" -}
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/AndroidManifest.xml b/core/tests/ResourceLoaderTests/AndroidManifest.xml deleted file mode 100644 index 00b4ccbd8030..000000000000 --- a/core/tests/ResourceLoaderTests/AndroidManifest.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2019 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 - --> - -<!-- Split loading is tested separately, so this must be marked isolated --> -<manifest - xmlns:android="http://schemas.android.com/apk/res/android" - package="android.content.res.loader.test" - android:isolatedSplits="true" - > - - <uses-sdk android:minSdkVersion="29"/> - - <application> - <uses-library android:name="android.test.runner"/> - - <activity - android:name=".TestActivity" - android:configChanges="orientation" - /> - </application> - - <instrumentation - android:name="androidx.test.runner.AndroidJUnitRunner" - android:label="ResourceLoaderTests" - android:targetPackage="android.content.res.loader.test" - /> - -</manifest> diff --git a/core/tests/ResourceLoaderTests/AndroidTest.xml b/core/tests/ResourceLoaderTests/AndroidTest.xml deleted file mode 100644 index 800e7a7124ac..000000000000 --- a/core/tests/ResourceLoaderTests/AndroidTest.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2019 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. - --> - -<configuration description="Test module config for ResourceLoaderTests"> - <option name="test-tag" value="ResourceLoaderTests" /> - - <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup"> - <option name="cleanup-apks" value="true" /> - <!-- The following value cannot be multi-line as whitespace is parsed by the installer --> - <option name="split-apk-file-names" - value="FrameworksResourceLoaderTests.apk,FrameworksResourceLoaderTests_ProviderOne_Split.apk,FrameworksResourceLoaderTests_ProviderTwo_Split.apk,FrameworksResourceLoaderTests_ProviderThree_Split.apk,FrameworksResourceLoaderTests_ProviderFour_Split.apk" /> - </target_preparer> - - <test class="com.android.tradefed.testtype.AndroidJUnitTest"> - <option name="package" value="android.content.res.loader.test" /> - </test> -</configuration> diff --git a/core/tests/ResourceLoaderTests/assets/asset.txt b/core/tests/ResourceLoaderTests/assets/asset.txt deleted file mode 100644 index 271704bdc1b5..000000000000 --- a/core/tests/ResourceLoaderTests/assets/asset.txt +++ /dev/null @@ -1 +0,0 @@ -In assets directory
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/assets/base_asset.txt b/core/tests/ResourceLoaderTests/assets/base_asset.txt deleted file mode 100644 index 8e62cc346238..000000000000 --- a/core/tests/ResourceLoaderTests/assets/base_asset.txt +++ /dev/null @@ -1 +0,0 @@ -Base
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/lib/kotlin-reflect-sources.jar b/core/tests/ResourceLoaderTests/lib/kotlin-reflect-sources.jar Binary files differdeleted file mode 100644 index a12e33a34aee..000000000000 --- a/core/tests/ResourceLoaderTests/lib/kotlin-reflect-sources.jar +++ /dev/null diff --git a/core/tests/ResourceLoaderTests/lib/kotlin-reflect.jar b/core/tests/ResourceLoaderTests/lib/kotlin-reflect.jar Binary files differdeleted file mode 100644 index 182cbabadfe6..000000000000 --- a/core/tests/ResourceLoaderTests/lib/kotlin-reflect.jar +++ /dev/null diff --git a/core/tests/ResourceLoaderTests/lib/kotlin-stdlib-jdk7-sources.jar b/core/tests/ResourceLoaderTests/lib/kotlin-stdlib-jdk7-sources.jar Binary files differdeleted file mode 100644 index e6b5f15b8a57..000000000000 --- a/core/tests/ResourceLoaderTests/lib/kotlin-stdlib-jdk7-sources.jar +++ /dev/null diff --git a/core/tests/ResourceLoaderTests/lib/kotlin-stdlib-jdk7.jar b/core/tests/ResourceLoaderTests/lib/kotlin-stdlib-jdk7.jar Binary files differdeleted file mode 100644 index e9c743c60289..000000000000 --- a/core/tests/ResourceLoaderTests/lib/kotlin-stdlib-jdk7.jar +++ /dev/null diff --git a/core/tests/ResourceLoaderTests/lib/kotlin-stdlib-jdk8-sources.jar b/core/tests/ResourceLoaderTests/lib/kotlin-stdlib-jdk8-sources.jar Binary files differdeleted file mode 100644 index cd0536042662..000000000000 --- a/core/tests/ResourceLoaderTests/lib/kotlin-stdlib-jdk8-sources.jar +++ /dev/null diff --git a/core/tests/ResourceLoaderTests/lib/kotlin-stdlib-jdk8.jar b/core/tests/ResourceLoaderTests/lib/kotlin-stdlib-jdk8.jar Binary files differdeleted file mode 100644 index dc8aa90385fd..000000000000 --- a/core/tests/ResourceLoaderTests/lib/kotlin-stdlib-jdk8.jar +++ /dev/null diff --git a/core/tests/ResourceLoaderTests/lib/kotlin-stdlib-sources.jar b/core/tests/ResourceLoaderTests/lib/kotlin-stdlib-sources.jar Binary files differdeleted file mode 100644 index 8a672bac4685..000000000000 --- a/core/tests/ResourceLoaderTests/lib/kotlin-stdlib-sources.jar +++ /dev/null diff --git a/core/tests/ResourceLoaderTests/lib/kotlin-stdlib.jar b/core/tests/ResourceLoaderTests/lib/kotlin-stdlib.jar Binary files differdeleted file mode 100644 index 56f3d1e385e4..000000000000 --- a/core/tests/ResourceLoaderTests/lib/kotlin-stdlib.jar +++ /dev/null diff --git a/core/tests/ResourceLoaderTests/lib/kotlin-test-sources.jar b/core/tests/ResourceLoaderTests/lib/kotlin-test-sources.jar Binary files differdeleted file mode 100644 index 663d3128dd54..000000000000 --- a/core/tests/ResourceLoaderTests/lib/kotlin-test-sources.jar +++ /dev/null diff --git a/core/tests/ResourceLoaderTests/lib/kotlin-test.jar b/core/tests/ResourceLoaderTests/lib/kotlin-test.jar Binary files differdeleted file mode 100644 index 5f6e4b8cc988..000000000000 --- a/core/tests/ResourceLoaderTests/lib/kotlin-test.jar +++ /dev/null diff --git a/core/tests/ResourceLoaderTests/res/drawable-nodpi/drawable_png.png b/core/tests/ResourceLoaderTests/res/drawable-nodpi/drawable_png.png Binary files differdeleted file mode 100644 index 8102d1539d53..000000000000 --- a/core/tests/ResourceLoaderTests/res/drawable-nodpi/drawable_png.png +++ /dev/null diff --git a/core/tests/ResourceLoaderTests/res/drawable-nodpi/drawable_xml.xml b/core/tests/ResourceLoaderTests/res/drawable-nodpi/drawable_xml.xml deleted file mode 100644 index d1211c50a203..000000000000 --- a/core/tests/ResourceLoaderTests/res/drawable-nodpi/drawable_xml.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2019 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. - --> - -<color - xmlns:android="http://schemas.android.com/apk/res/android" - android:color="#B2D2F2" - /> diff --git a/core/tests/ResourceLoaderTests/res/layout/layout.xml b/core/tests/ResourceLoaderTests/res/layout/layout.xml deleted file mode 100644 index 05499ed35e50..000000000000 --- a/core/tests/ResourceLoaderTests/res/layout/layout.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2019 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. - --> - -<MysteryLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - /> - diff --git a/core/tests/ResourceLoaderTests/res/values/values.xml b/core/tests/ResourceLoaderTests/res/values/values.xml deleted file mode 100644 index ad785322fcc9..000000000000 --- a/core/tests/ResourceLoaderTests/res/values/values.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2019 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. - --> - -<resources> - <dimen name="test">0dp</dimen> - <string name="test">Not overlaid</string> -</resources> diff --git a/core/tests/ResourceLoaderTests/resources/Android.bp b/core/tests/ResourceLoaderTests/resources/Android.bp deleted file mode 100644 index 18ef64b70927..000000000000 --- a/core/tests/ResourceLoaderTests/resources/Android.bp +++ /dev/null @@ -1,115 +0,0 @@ -// -// Copyright (C) 2020 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. -// - -android_test_helper_app { - name: "FrameworksResourceLoaderTests_ProviderOne", - manifest: "AndroidManifestApp.xml", - asset_dirs: ["provider1/assets"], - resource_dirs: ["provider1/res", "provider_stable/res"], - aaptflags: ["-0 .txt"] -} - -android_test_helper_app { - name: "FrameworksResourceLoaderTests_ProviderTwo", - manifest: "AndroidManifestApp.xml", - asset_dirs: ["provider2/assets"], - resource_dirs: ["provider2/res", "provider_stable/res"], - aaptflags: ["-0 .txt"] -} - -android_test_helper_app { - name: "FrameworksResourceLoaderTests_ProviderThree", - manifest: "AndroidManifestApp.xml", - asset_dirs: ["provider3/assets"], - resource_dirs: ["provider3/res", "provider_stable/res"], - aaptflags: ["-0 .txt"] -} - -android_test_helper_app { - name: "FrameworksResourceLoaderTests_ProviderFour", - manifest: "AndroidManifestApp.xml", - asset_dirs: ["provider4/assets"], - resource_dirs: ["provider4/res", "provider_stable/res"], - aaptflags: ["-0 .txt"] -} - -// Resources.arsc(s) - -genrule { - name: "FrameworksResourceLoaderTests_ProviderOne_ARSC", - srcs: [":FrameworksResourceLoaderTests_ProviderOne"], - cmd: "unzip $(in) resources.arsc -d $(genDir) && " - + " mv $(genDir)/resources.arsc $(genDir)/FrameworksResourceLoaderTests_ProviderOne.arsc", - out: ["FrameworksResourceLoaderTests_ProviderOne.arsc"] -} - -genrule { - name: "FrameworksResourceLoaderTests_ProviderTwo_ARSC", - srcs: [":FrameworksResourceLoaderTests_ProviderTwo"], - cmd: "unzip $(in) resources.arsc -d $(genDir) && " - + " mv $(genDir)/resources.arsc $(genDir)/FrameworksResourceLoaderTests_ProviderTwo.arsc", - out: ["FrameworksResourceLoaderTests_ProviderTwo.arsc"] -} - -genrule { - name: "FrameworksResourceLoaderTests_ProviderThree_ARSC", - srcs: [":FrameworksResourceLoaderTests_ProviderThree"], - cmd: "unzip $(in) resources.arsc -d $(genDir) && " - + " mv $(genDir)/resources.arsc $(genDir)/FrameworksResourceLoaderTests_ProviderThree.arsc", - out: ["FrameworksResourceLoaderTests_ProviderThree.arsc"] -} - -genrule { - name: "FrameworksResourceLoaderTests_ProviderFour_ARSC", - srcs: [":FrameworksResourceLoaderTests_ProviderFour"], - cmd: "unzip $(in) resources.arsc -d $(genDir) && " - + " mv $(genDir)/resources.arsc $(genDir)/FrameworksResourceLoaderTests_ProviderFour.arsc", - out: ["FrameworksResourceLoaderTests_ProviderFour.arsc"] -} - -// Split APKs - -android_test_helper_app { - name: "FrameworksResourceLoaderTests_ProviderOne_Split", - manifest: "AndroidManifestSplit1.xml", - asset_dirs: ["provider1/assets"], - resource_dirs: ["provider1/res", "provider_stable/res"], - aaptflags: ["-0 .txt"] -} - -android_test_helper_app { - name: "FrameworksResourceLoaderTests_ProviderTwo_Split", - manifest: "AndroidManifestSplit2.xml", - asset_dirs: ["provider2/assets"], - resource_dirs: ["provider2/res", "provider_stable/res"], - aaptflags: ["-0 .txt"] -} - -android_test_helper_app { - name: "FrameworksResourceLoaderTests_ProviderThree_Split", - manifest: "AndroidManifestSplit3.xml", - asset_dirs: ["provider3/assets"], - resource_dirs: ["provider3/res", "provider_stable/res"], - aaptflags: ["-0 .txt"] -} - -android_test_helper_app { - name: "FrameworksResourceLoaderTests_ProviderFour_Split", - manifest: "AndroidManifestSplit4.xml", - asset_dirs: ["provider4/assets"], - resource_dirs: ["provider4/res", "provider_stable/res"], - aaptflags: ["-0 .txt"] -}
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/resources/AndroidManifestApp.xml b/core/tests/ResourceLoaderTests/resources/AndroidManifestApp.xml deleted file mode 100644 index c8a3590aaa62..000000000000 --- a/core/tests/ResourceLoaderTests/resources/AndroidManifestApp.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="android.content.res.loader.test"> - - <uses-sdk android:minSdkVersion="1" android:targetSdkVersion="1" /> - <application/> -</manifest> diff --git a/core/tests/ResourceLoaderTests/resources/AndroidManifestFramework.xml b/core/tests/ResourceLoaderTests/resources/AndroidManifestFramework.xml deleted file mode 100644 index d5fa83f59546..000000000000 --- a/core/tests/ResourceLoaderTests/resources/AndroidManifestFramework.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<!-- Mocks the framework package name so that AAPT2 assigns the correct package --> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="android"> - - <uses-sdk android:minSdkVersion="1" android:targetSdkVersion="1" /> - <application/> -</manifest> diff --git a/core/tests/ResourceLoaderTests/resources/AndroidManifestSplit1.xml b/core/tests/ResourceLoaderTests/resources/AndroidManifestSplit1.xml deleted file mode 100644 index 5cd4227286a2..000000000000 --- a/core/tests/ResourceLoaderTests/resources/AndroidManifestSplit1.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2019 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. - --> - -<manifest - xmlns:android="http://schemas.android.com/apk/res/android" - package="android.content.res.loader.test" - split="FrameworksResourceLoaderTests_ProviderOne_Split" - android:isFeatureSplit="true" - > - - <uses-sdk android:minSdkVersion="1" android:targetSdkVersion="1" /> - <application android:hasCode="false" /> - -</manifest> diff --git a/core/tests/ResourceLoaderTests/resources/AndroidManifestSplit2.xml b/core/tests/ResourceLoaderTests/resources/AndroidManifestSplit2.xml deleted file mode 100644 index b5180e66b3a1..000000000000 --- a/core/tests/ResourceLoaderTests/resources/AndroidManifestSplit2.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<manifest - xmlns:android="http://schemas.android.com/apk/res/android" - package="android.content.res.loader.test" - split="FrameworksResourceLoaderTests_ProviderTwo_Split" - android:isFeatureSplit="true" - > - - <uses-sdk android:minSdkVersion="1" android:targetSdkVersion="1" /> - <application android:hasCode="false" /> - -</manifest> diff --git a/core/tests/ResourceLoaderTests/resources/AndroidManifestSplit3.xml b/core/tests/ResourceLoaderTests/resources/AndroidManifestSplit3.xml deleted file mode 100644 index 8ddb89280d60..000000000000 --- a/core/tests/ResourceLoaderTests/resources/AndroidManifestSplit3.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<manifest - xmlns:android="http://schemas.android.com/apk/res/android" - package="android.content.res.loader.test" - split="FrameworksResourceLoaderTests_ProviderThree_Split" - android:isFeatureSplit="true" - > - - <uses-sdk android:minSdkVersion="1" android:targetSdkVersion="1" /> - <application android:hasCode="false" /> - -</manifest> diff --git a/core/tests/ResourceLoaderTests/resources/AndroidManifestSplit4.xml b/core/tests/ResourceLoaderTests/resources/AndroidManifestSplit4.xml deleted file mode 100644 index b6bf552c9892..000000000000 --- a/core/tests/ResourceLoaderTests/resources/AndroidManifestSplit4.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<manifest - xmlns:android="http://schemas.android.com/apk/res/android" - package="android.content.res.loader.test" - split="FrameworksResourceLoaderTests_ProviderFour_Split" - android:isFeatureSplit="true" - > - - <uses-sdk android:minSdkVersion="1" android:targetSdkVersion="1" /> - <application android:hasCode="false" /> - -</manifest> diff --git a/core/tests/ResourceLoaderTests/resources/framework/res/drawable-mdpi/ic_delete.png b/core/tests/ResourceLoaderTests/resources/framework/res/drawable-mdpi/ic_delete.png Binary files differdeleted file mode 100644 index f3e53d7596c1..000000000000 --- a/core/tests/ResourceLoaderTests/resources/framework/res/drawable-mdpi/ic_delete.png +++ /dev/null diff --git a/core/tests/ResourceLoaderTests/resources/framework/res/layout/activity_list_item.xml b/core/tests/ResourceLoaderTests/resources/framework/res/layout/activity_list_item.xml deleted file mode 100644 index d59059b453d6..000000000000 --- a/core/tests/ResourceLoaderTests/resources/framework/res/layout/activity_list_item.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2019 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. - --> - -<FrameLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - /> - diff --git a/core/tests/ResourceLoaderTests/resources/framework/res/values/public.xml b/core/tests/ResourceLoaderTests/resources/framework/res/values/public.xml deleted file mode 100644 index 2e501826e00a..000000000000 --- a/core/tests/ResourceLoaderTests/resources/framework/res/values/public.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<resources> - <public type="drawable" name="ic_delete" id="0x0108001d" /> - <public type="layout" name="activity_list_item" id="0x01090000" /> - <public type="string" name="cancel" id="0x01040000" /> -</resources>
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/resources/framework/res/values/values.xml b/core/tests/ResourceLoaderTests/resources/framework/res/values/values.xml deleted file mode 100644 index 5f6e90cf9e0d..000000000000 --- a/core/tests/ResourceLoaderTests/resources/framework/res/values/values.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<resources> - <string name="cancel">SomeRidiculouslyUnlikelyString</string> -</resources> diff --git a/core/tests/ResourceLoaderTests/resources/provider1/assets/asset.txt b/core/tests/ResourceLoaderTests/resources/provider1/assets/asset.txt deleted file mode 100644 index 6dcd8e419a8c..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider1/assets/asset.txt +++ /dev/null @@ -1 +0,0 @@ -One
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/resources/provider1/assets/loader_asset.txt b/core/tests/ResourceLoaderTests/resources/provider1/assets/loader_asset.txt deleted file mode 100644 index 0e41ffa475af..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider1/assets/loader_asset.txt +++ /dev/null @@ -1 +0,0 @@ -LoaderOne
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/resources/provider1/res/drawable-nodpi/drawable_png.png b/core/tests/ResourceLoaderTests/resources/provider1/res/drawable-nodpi/drawable_png.png Binary files differdeleted file mode 100644 index 4eb8ca3537ea..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider1/res/drawable-nodpi/drawable_png.png +++ /dev/null diff --git a/core/tests/ResourceLoaderTests/resources/provider1/res/drawable-nodpi/drawable_xml.xml b/core/tests/ResourceLoaderTests/resources/provider1/res/drawable-nodpi/drawable_xml.xml deleted file mode 100644 index 57a8cf1b86de..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider1/res/drawable-nodpi/drawable_xml.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2019 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. - --> - -<color - xmlns:android="http://schemas.android.com/apk/res/android" - android:color="#000001" - /> diff --git a/core/tests/ResourceLoaderTests/resources/provider1/res/layout/layout.xml b/core/tests/ResourceLoaderTests/resources/provider1/res/layout/layout.xml deleted file mode 100644 index ede3838be8de..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider1/res/layout/layout.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2019 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. - --> - -<RelativeLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - /> - diff --git a/core/tests/ResourceLoaderTests/resources/provider1/res/values/values.xml b/core/tests/ResourceLoaderTests/resources/provider1/res/values/values.xml deleted file mode 100644 index 5ef75d5426a0..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider1/res/values/values.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<resources> - <dimen name="test">100dp</dimen> - <string name="test">One</string> - - <string name="additional">One</string> - <public type="string" name="additional" id="0x7f0400fe" /> -</resources>
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/resources/provider2/assets/asset.txt b/core/tests/ResourceLoaderTests/resources/provider2/assets/asset.txt deleted file mode 100644 index 5673baa5b53d..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider2/assets/asset.txt +++ /dev/null @@ -1 +0,0 @@ -Two
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/resources/provider2/assets/loader_asset.txt b/core/tests/ResourceLoaderTests/resources/provider2/assets/loader_asset.txt deleted file mode 100644 index bca782ec1b2b..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider2/assets/loader_asset.txt +++ /dev/null @@ -1 +0,0 @@ -LoaderTwo
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/resources/provider2/res/drawable-nodpi/drawable_png.png b/core/tests/ResourceLoaderTests/resources/provider2/res/drawable-nodpi/drawable_png.png Binary files differdeleted file mode 100644 index 671d6d00be31..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider2/res/drawable-nodpi/drawable_png.png +++ /dev/null diff --git a/core/tests/ResourceLoaderTests/resources/provider2/res/drawable-nodpi/drawable_xml.xml b/core/tests/ResourceLoaderTests/resources/provider2/res/drawable-nodpi/drawable_xml.xml deleted file mode 100644 index 333fe346998c..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider2/res/drawable-nodpi/drawable_xml.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2019 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. - --> - -<color - xmlns:android="http://schemas.android.com/apk/res/android" - android:color="#000002" - /> diff --git a/core/tests/ResourceLoaderTests/resources/provider2/res/layout/layout.xml b/core/tests/ResourceLoaderTests/resources/provider2/res/layout/layout.xml deleted file mode 100644 index d8bff90d56d8..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider2/res/layout/layout.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2019 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. - --> - -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - /> - diff --git a/core/tests/ResourceLoaderTests/resources/provider2/res/values/values.xml b/core/tests/ResourceLoaderTests/resources/provider2/res/values/values.xml deleted file mode 100644 index 387c51905d8a..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider2/res/values/values.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<resources> - <dimen name="test">200dp</dimen> - <string name="test">Two</string> - - <string name="additional">Two</string> - <public type="string" name="additional" id="0x7f0400fe" /> -</resources>
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/resources/provider3/assets/asset.txt b/core/tests/ResourceLoaderTests/resources/provider3/assets/asset.txt deleted file mode 100644 index 368c34d3ba04..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider3/assets/asset.txt +++ /dev/null @@ -1 +0,0 @@ -Three
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/resources/provider3/assets/loader_asset.txt b/core/tests/ResourceLoaderTests/resources/provider3/assets/loader_asset.txt deleted file mode 100644 index bae8ef79a2ce..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider3/assets/loader_asset.txt +++ /dev/null @@ -1 +0,0 @@ -LoaderThree
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/resources/provider3/res/drawable-nodpi/drawable_png.png b/core/tests/ResourceLoaderTests/resources/provider3/res/drawable-nodpi/drawable_png.png Binary files differdeleted file mode 100644 index 5231d175569e..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider3/res/drawable-nodpi/drawable_png.png +++ /dev/null diff --git a/core/tests/ResourceLoaderTests/resources/provider3/res/drawable-nodpi/drawable_xml.xml b/core/tests/ResourceLoaderTests/resources/provider3/res/drawable-nodpi/drawable_xml.xml deleted file mode 100644 index 41095d4a158b..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider3/res/drawable-nodpi/drawable_xml.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<color - xmlns:android="http://schemas.android.com/apk/res/android" - android:color="#000003" - /> diff --git a/core/tests/ResourceLoaderTests/resources/provider3/res/layout/layout.xml b/core/tests/ResourceLoaderTests/resources/provider3/res/layout/layout.xml deleted file mode 100644 index d58d3db12ad4..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider3/res/layout/layout.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<FrameLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - /> - diff --git a/core/tests/ResourceLoaderTests/resources/provider3/res/values/values.xml b/core/tests/ResourceLoaderTests/resources/provider3/res/values/values.xml deleted file mode 100644 index ab75bfac29c6..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider3/res/values/values.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<resources> - <dimen name="test">300dp</dimen> - <string name="test">Three</string> - - <string name="additional">Three</string> - <public type="string" name="additional" id="0x7f0400fe" /> -</resources>
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/resources/provider4/assets/asset.txt b/core/tests/ResourceLoaderTests/resources/provider4/assets/asset.txt deleted file mode 100644 index ad70cdd4ab64..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider4/assets/asset.txt +++ /dev/null @@ -1 +0,0 @@ -Four
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/resources/provider4/assets/loader_asset.txt b/core/tests/ResourceLoaderTests/resources/provider4/assets/loader_asset.txt deleted file mode 100644 index b75d9963575b..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider4/assets/loader_asset.txt +++ /dev/null @@ -1 +0,0 @@ -LoaderFour
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/resources/provider4/res/drawable-nodpi/drawable_png.png b/core/tests/ResourceLoaderTests/resources/provider4/res/drawable-nodpi/drawable_png.png Binary files differdeleted file mode 100644 index e9a4cfcef316..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider4/res/drawable-nodpi/drawable_png.png +++ /dev/null diff --git a/core/tests/ResourceLoaderTests/resources/provider4/res/drawable-nodpi/drawable_xml.xml b/core/tests/ResourceLoaderTests/resources/provider4/res/drawable-nodpi/drawable_xml.xml deleted file mode 100644 index 0623245c6152..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider4/res/drawable-nodpi/drawable_xml.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<color - xmlns:android="http://schemas.android.com/apk/res/android" - android:color="#000004" - /> diff --git a/core/tests/ResourceLoaderTests/resources/provider4/res/layout/layout.xml b/core/tests/ResourceLoaderTests/resources/provider4/res/layout/layout.xml deleted file mode 100644 index ab9e26529fe7..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider4/res/layout/layout.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<TableLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - /> - diff --git a/core/tests/ResourceLoaderTests/resources/provider4/res/values/values.xml b/core/tests/ResourceLoaderTests/resources/provider4/res/values/values.xml deleted file mode 100644 index 896993e9d9a6..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider4/res/values/values.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<resources> - <dimen name="test">400dp</dimen> - <string name="test">Four</string> - - <string name="additional">Four</string> - <public type="string" name="additional" id="0x7f0400fe" /> -</resources>
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/resources/provider_additional/res/values/values.xml b/core/tests/ResourceLoaderTests/resources/provider_additional/res/values/values.xml deleted file mode 100644 index 29918d7105ef..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider_additional/res/values/values.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<resources> - <public type="string" name="additional" id="0x7f0400fe" /> -</resources> diff --git a/core/tests/ResourceLoaderTests/resources/provider_stable/res/values/public.xml b/core/tests/ResourceLoaderTests/resources/provider_stable/res/values/public.xml deleted file mode 100644 index 269c40fc2a38..000000000000 --- a/core/tests/ResourceLoaderTests/resources/provider_stable/res/values/public.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2020 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. - --> - -<resources> - <public type="dimen" name="test" id="0x7f010000" /> - <public type="drawable" name="drawable_png" id="0x7f020000" /> - <public type="drawable" name="drawable_xml" id="0x7f020001" /> - <public type="layout" name="layout" id="0x7f030000" /> - <public type="string" name="test" id="0x7f040000" /> -</resources>
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/src/android/content/res/loader/test/ResourceLoaderTestBase.kt b/core/tests/ResourceLoaderTests/src/android/content/res/loader/test/ResourceLoaderTestBase.kt deleted file mode 100644 index ec6a605340ae..000000000000 --- a/core/tests/ResourceLoaderTests/src/android/content/res/loader/test/ResourceLoaderTestBase.kt +++ /dev/null @@ -1,298 +0,0 @@ -/* - * Copyright (C) 2019 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 - */ - -package android.content.res.loader.test - -import android.content.Context -import android.content.res.AssetFileDescriptor -import android.content.res.Configuration -import android.content.res.Resources -import android.content.res.loader.AssetsProvider -import android.content.res.loader.ResourcesProvider -import android.os.ParcelFileDescriptor -import android.system.Os -import android.util.ArrayMap -import androidx.test.InstrumentationRegistry -import org.json.JSONObject -import org.junit.After -import org.junit.Before -import java.io.Closeable -import java.io.FileOutputStream -import java.io.File -import java.io.FileDescriptor -import java.util.zip.ZipInputStream - -abstract class ResourceLoaderTestBase { - protected val PROVIDER_ONE: String = "FrameworksResourceLoaderTests_ProviderOne" - protected val PROVIDER_TWO: String = "FrameworksResourceLoaderTests_ProviderTwo" - protected val PROVIDER_THREE: String = "FrameworksResourceLoaderTests_ProviderThree" - protected val PROVIDER_FOUR: String = "FrameworksResourceLoaderTests_ProviderFour" - protected val PROVIDER_EMPTY: String = "empty" - - companion object { - /** Converts the map to a stable JSON string representation. */ - fun mapToString(m: Map<String, String>): String { - return JSONObject(ArrayMap<String, String>().apply { putAll(m) }).toString() - } - - /** Creates a lambda that runs multiple resources queries and concatenates the results. */ - fun query(queries: Map<String, (Resources) -> String>): Resources.() -> String { - return { - val resultMap = ArrayMap<String, String>() - queries.forEach { q -> - resultMap[q.key] = try { - q.value.invoke(this) - } catch (e: Exception) { - e.javaClass.simpleName - } - } - mapToString(resultMap) - } - } - } - - // Data type of the current test iteration - open lateinit var dataType: DataType - - protected lateinit var context: Context - protected lateinit var resources: Resources - - // Track opened streams and ResourcesProviders to close them after testing - private val openedObjects = mutableListOf<Closeable>() - - @Before - fun setUpBase() { - context = InstrumentationRegistry.getTargetContext() - .createConfigurationContext(Configuration()) - resources = context.resources - } - - @After - fun removeAllLoaders() { - resources.clearLoaders() - context.applicationContext.resources.clearLoaders() - openedObjects.forEach { - try { - it.close() - } catch (ignored: Exception) { - } - } - } - - protected fun String.openProvider(dataType: DataType, - assetsProvider: MemoryAssetsProvider?): ResourcesProvider { - if (assetsProvider != null) { - openedObjects += assetsProvider - } - return when (dataType) { - DataType.APK_DISK_FD -> { - val file = context.copiedAssetFile("$this.apk") - ResourcesProvider.loadFromApk(ParcelFileDescriptor.fromFd(file.fd), - assetsProvider).apply { - file.close() - } - } - DataType.APK_DISK_FD_OFFSETS -> { - val asset = context.assets.openFd("$this.apk") - ResourcesProvider.loadFromApk(asset.parcelFileDescriptor, asset.startOffset, - asset.length, assetsProvider).apply { - asset.close() - } - } - DataType.ARSC_DISK_FD -> { - val file = context.copiedAssetFile("$this.arsc") - ResourcesProvider.loadFromTable(ParcelFileDescriptor.fromFd(file.fd), - assetsProvider).apply { - file.close() - } - } - DataType.ARSC_DISK_FD_OFFSETS -> { - val asset = context.assets.openFd("$this.arsc") - ResourcesProvider.loadFromTable(asset.parcelFileDescriptor, asset.startOffset, - asset.length, assetsProvider).apply { - asset.close() - } - } - DataType.APK_RAM_OFFSETS -> { - val asset = context.assets.openFd("$this.apk") - val leadingGarbageSize = 100L - val trailingGarbageSize = 55L - val fd = loadAssetIntoMemory(asset, leadingGarbageSize.toInt(), - trailingGarbageSize.toInt()) - ResourcesProvider.loadFromApk(fd, leadingGarbageSize, asset.declaredLength, - assetsProvider).apply { - asset.close() - fd.close() - } - } - DataType.APK_RAM_FD -> { - val asset = context.assets.openFd("$this.apk") - var fd = loadAssetIntoMemory(asset) - ResourcesProvider.loadFromApk(fd, assetsProvider).apply { - asset.close() - fd.close() - } - } - DataType.ARSC_RAM_MEMORY -> { - val asset = context.assets.openFd("$this.arsc") - var fd = loadAssetIntoMemory(asset) - ResourcesProvider.loadFromTable(fd, assetsProvider).apply { - asset.close() - fd.close() - } - } - DataType.ARSC_RAM_MEMORY_OFFSETS -> { - val asset = context.assets.openFd("$this.arsc") - val leadingGarbageSize = 100L - val trailingGarbageSize = 55L - val fd = loadAssetIntoMemory(asset, leadingGarbageSize.toInt(), - trailingGarbageSize.toInt()) - ResourcesProvider.loadFromTable(fd, leadingGarbageSize, asset.declaredLength, - assetsProvider).apply { - asset.close() - fd.close() - } - } - DataType.EMPTY -> { - if (equals(PROVIDER_EMPTY)) { - ResourcesProvider.empty(EmptyAssetsProvider()) - } else { - if (assetsProvider == null) ResourcesProvider.empty(ZipAssetsProvider(this)) - else ResourcesProvider.empty(assetsProvider) - } - } - DataType.DIRECTORY -> { - ResourcesProvider.loadFromDirectory(zipToDir("$this.apk").absolutePath, - assetsProvider) - } - DataType.SPLIT -> { - ResourcesProvider.loadFromSplit(context, "${this}_Split") - } - } - } - - class EmptyAssetsProvider : AssetsProvider - - /** An AssetsProvider that reads from a zip asset. */ - inner class ZipAssetsProvider(val providerName: String) : AssetsProvider { - val root: File = zipToDir("$providerName.apk") - - override fun loadAssetFd(path: String, accessMode: Int): AssetFileDescriptor? { - val f = File(root, path) - return if (f.exists()) AssetFileDescriptor( - ParcelFileDescriptor.open(File(root, path), - ParcelFileDescriptor.MODE_READ_ONLY), 0, - AssetFileDescriptor.UNKNOWN_LENGTH) else null - } - } - - /** AssetsProvider for testing that returns file descriptors to files in RAM. */ - class MemoryAssetsProvider : AssetsProvider, Closeable { - var loadAssetResults = HashMap<String, FileDescriptor>() - - fun addLoadAssetFdResult(path: String, value: String) = apply { - val fd = Os.memfd_create(path, 0) - val valueBytes = value.toByteArray() - Os.write(fd, valueBytes, 0, valueBytes.size) - loadAssetResults[path] = fd - } - - override fun loadAssetFd(path: String, accessMode: Int): AssetFileDescriptor? { - return if (loadAssetResults.containsKey(path)) AssetFileDescriptor( - ParcelFileDescriptor.dup(loadAssetResults[path]), 0, - AssetFileDescriptor.UNKNOWN_LENGTH) else null - } - - override fun close() { - for (f in loadAssetResults.values) { - Os.close(f) - } - } - } - - /** Extracts an archive-based asset into a directory on disk. */ - private fun zipToDir(name: String): File { - val root = File(context.filesDir, name.split('.')[0]) - if (root.exists()) { - return root - } - - root.mkdir() - ZipInputStream(context.assets.open(name)).use { zis -> - while (true) { - val entry = zis.nextEntry ?: break - val file = File(root, entry.name) - if (entry.isDirectory) { - continue - } - - file.parentFile.mkdirs() - file.outputStream().use { output -> - var b = zis.read() - while (b != -1) { - output.write(b) - b = zis.read() - } - } - } - } - return root - } - - /** Loads the asset into a temporary file stored in RAM. */ - private fun loadAssetIntoMemory( - asset: AssetFileDescriptor, - leadingGarbageSize: Int = 0, - trailingGarbageSize: Int = 0 - ): ParcelFileDescriptor { - val originalFd = Os.memfd_create(asset.toString(), 0 /* flags */) - val fd = ParcelFileDescriptor.dup(originalFd) - Os.close(originalFd) - - val input = asset.createInputStream() - FileOutputStream(fd.fileDescriptor).use { output -> - // Add garbage before the APK data - for (i in 0 until leadingGarbageSize) { - output.write(Math.random().toInt()) - } - - for (i in 0 until asset.length.toInt()) { - output.write(input.read()) - } - - // Add garbage after the APK data - for (i in 0 until trailingGarbageSize) { - output.write(Math.random().toInt()) - } - } - - return fd - } - - enum class DataType { - APK_DISK_FD, - APK_DISK_FD_OFFSETS, - APK_RAM_FD, - APK_RAM_OFFSETS, - ARSC_DISK_FD, - ARSC_DISK_FD_OFFSETS, - ARSC_RAM_MEMORY, - ARSC_RAM_MEMORY_OFFSETS, - EMPTY, - DIRECTORY, - SPLIT - } -} diff --git a/core/tests/ResourceLoaderTests/src/android/content/res/loader/test/ResourceLoaderValuesTest.kt b/core/tests/ResourceLoaderTests/src/android/content/res/loader/test/ResourceLoaderValuesTest.kt deleted file mode 100644 index 5aa8814c7481..000000000000 --- a/core/tests/ResourceLoaderTests/src/android/content/res/loader/test/ResourceLoaderValuesTest.kt +++ /dev/null @@ -1,815 +0,0 @@ -/* - * Copyright (C) 2019 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 - */ - -package android.content.res.loader.test - -import android.app.Activity -import android.content.Context -import android.content.Intent -import android.content.res.AssetManager -import android.content.res.Configuration -import android.content.res.Resources -import android.content.res.loader.ResourcesLoader -import android.graphics.Color -import android.graphics.drawable.BitmapDrawable -import android.graphics.drawable.ColorDrawable -import android.os.IBinder -import androidx.test.rule.ActivityTestRule -import org.junit.Assert.assertEquals -import org.junit.Assert.assertNotEquals -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.junit.runners.Parameterized -import java.util.Collections - -/** - * Tests generic ResourceLoader behavior. Intentionally abstract in its test methodology because - * the behavior being verified isn't specific to any resource type. As long as it can pass an - * equals check. - * - * Currently tests strings and dimens since String and any Number seemed most relevant to verify. - */ -@RunWith(Parameterized::class) -class ResourceLoaderValuesTest : ResourceLoaderTestBase() { - - @get:Rule - private val mTestActivityRule = ActivityTestRule<TestActivity>(TestActivity::class.java) - - companion object { - @Parameterized.Parameters(name = "{1} {0}") - @JvmStatic - fun parameters(): Array<Any> { - val parameters = mutableListOf<Parameter>() - - // Test resolution of resources encoded within the resources.arsc. - parameters += Parameter( - "tableBased", - query(mapOf( - "getOverlaid" to { res -> - res.getString(R.string.test) - }, - "getAdditional" to { res -> - res.getString(0x7f0400fe /* R.string.additional */) - }, - "getIdentifier" to { res -> - res.getString(res.getIdentifier("test", "string", - "android.content.res.loader.test")) - }, - "getIdentifierAdditional" to { res -> - res.getString(res.getIdentifier("additional", "string", - "android.content.res.loader.test")) - } - )), - mapOf("getOverlaid" to "Not overlaid", - "getAdditional" to "NotFoundException", - "getIdentifier" to "Not overlaid", - "getIdentifierAdditional" to "NotFoundException"), - - mapOf("getOverlaid" to "One", - "getAdditional" to "One", - "getIdentifier" to "One", - "getIdentifierAdditional" to "One"), - - mapOf("getOverlaid" to "Two", - "getAdditional" to "Two", - "getIdentifier" to "Two", - "getIdentifierAdditional" to "Two"), - - mapOf("getOverlaid" to "Three", - "getAdditional" to "Three", - "getIdentifier" to "Three", - "getIdentifierAdditional" to "Three"), - - mapOf("getOverlaid" to "Four", - "getAdditional" to "Four", - "getIdentifier" to "Four", - "getIdentifierAdditional" to "Four"), - listOf(DataType.APK_DISK_FD, DataType.APK_DISK_FD_OFFSETS, DataType.APK_RAM_FD, - DataType.APK_RAM_OFFSETS, DataType.ARSC_DISK_FD, - DataType.ARSC_DISK_FD_OFFSETS, DataType.ARSC_RAM_MEMORY, - DataType.ARSC_RAM_MEMORY_OFFSETS, DataType.SPLIT, DataType.DIRECTORY) - ) - - // Test resolution of file-based resources and assets with no assets provider. - parameters += Parameter( - "tableFileBased", - query(mapOf( - // Drawable xml in res directory - "drawableXml" to { res -> - (res.getDrawable(R.drawable.drawable_xml) as ColorDrawable) - .color.toString() - }, - // Asset as compiled XML layout in res directory - "layout" to { res -> - res.getLayout(R.layout.layout).advanceToRoot().name - }, - // Bitmap drawable in res directory - "drawablePng" to { res -> - (res.getDrawable(R.drawable.drawable_png) as BitmapDrawable) - .bitmap.getColor(0, 0).toArgb().toString() - } - )), - mapOf("drawableXml" to Color.parseColor("#B2D2F2").toString(), - "layout" to "MysteryLayout", - "drawablePng" to Color.parseColor("#FF00FF").toString()), - - mapOf("drawableXml" to Color.parseColor("#000001").toString(), - "layout" to "RelativeLayout", - "drawablePng" to Color.RED.toString()), - - mapOf("drawableXml" to Color.parseColor("#000002").toString(), - "layout" to "LinearLayout", - "drawablePng" to Color.GREEN.toString()), - - mapOf("drawableXml" to Color.parseColor("#000003").toString(), - "layout" to "FrameLayout", - "drawablePng" to Color.BLUE.toString()), - - mapOf("drawableXml" to Color.parseColor("#000004").toString(), - "layout" to "TableLayout", - "drawablePng" to Color.WHITE.toString()), - listOf(DataType.APK_DISK_FD, DataType.APK_DISK_FD_OFFSETS, DataType.APK_RAM_FD, - DataType.APK_RAM_OFFSETS, DataType.SPLIT, DataType.DIRECTORY) - ) - - // Test resolution of assets. - parameters += Parameter( - "fileBased", - query(mapOf( - // File in the assets directory - "openAsset" to { res -> - res.assets.open("asset.txt").reader().readText() - }, - // From assets directory returning file descriptor - "openAssetFd" to { res -> - res.assets.openFd("asset.txt").readText() - }, - // Asset as compiled XML layout in res directory - "layout" to { res -> - res.assets.openXmlResourceParser("res/layout/layout.xml") - .advanceToRoot().name - } - )), - mapOf("openAsset" to "In assets directory", - "openAssetFd" to "In assets directory", - "layout" to "MysteryLayout"), - - mapOf("openAsset" to "One", - "openAssetFd" to "One", - "layout" to "RelativeLayout"), - - mapOf("openAsset" to "Two", - "openAssetFd" to "Two", - "layout" to "LinearLayout"), - - mapOf("openAsset" to "Three", - "openAssetFd" to "Three", - "layout" to "FrameLayout"), - - mapOf("openAsset" to "Four", - "openAssetFd" to "Four", - "layout" to "TableLayout"), - listOf(DataType.EMPTY) - ) - - // Test assets from apk and provider - parameters += Parameter( - "fileBasedApkAssetsProvider", - query(mapOf( - // File in the assets directory - "openAsset" to { res -> - res.assets.open("asset.txt").reader().readText() - }, - // From assets directory returning file descriptor - "openAssetFd" to { res -> - res.assets.openFd("asset.txt").readText() - } - )), - mapOf("openAsset" to "In assets directory", - "openAssetFd" to "In assets directory"), - - mapOf("openAsset" to "AssetsOne", - "openAssetFd" to "AssetsOne"), - { MemoryAssetsProvider().addLoadAssetFdResult("assets/asset.txt", - "AssetsOne") }, - - mapOf("openAsset" to "Two", - "openAssetFd" to "Two"), - null /* assetProviderTwo */, - - mapOf("openAsset" to "AssetsThree", - "openAssetFd" to "AssetsThree"), - { MemoryAssetsProvider().addLoadAssetFdResult("assets/asset.txt", - "AssetsThree") }, - - mapOf("openAsset" to "Four", - "openAssetFd" to "Four"), - null /* assetProviderFour */, - listOf(DataType.APK_DISK_FD, DataType.APK_DISK_FD_OFFSETS, DataType.APK_RAM_FD, - DataType.APK_RAM_OFFSETS, DataType.DIRECTORY) - - ) - - // TODO(151949807): Increase testing for cookie based APIs and for what happens when - // some providers do not overlay base resources - - return parameters.flatMap { parameter -> - parameter.dataTypes.map { dataType -> - arrayOf(dataType, parameter) - } - }.toTypedArray() - } - } - - @Suppress("LateinitVarOverridesLateinitVar") - @field:Parameterized.Parameter(0) - override lateinit var dataType: DataType - - @field:Parameterized.Parameter(1) - lateinit var parameter: Parameter - - private val valueOriginal by lazy { mapToString(parameter.valueOriginal) } - private val valueOne by lazy { mapToString(parameter.valueOne) } - private val valueTwo by lazy { mapToString(parameter.valueTwo) } - private val valueThree by lazy { mapToString(parameter.valueThree) } - private val valueFour by lazy { mapToString(parameter.valueFour) } - - private fun openOne() = PROVIDER_ONE.openProvider(dataType, - parameter.assetProviderOne?.invoke()) - private fun openTwo() = PROVIDER_TWO.openProvider(dataType, - parameter.assetProviderTwo?.invoke()) - private fun openThree() = PROVIDER_THREE.openProvider(dataType, - parameter.assetProviderThree?.invoke()) - private fun openFour() = PROVIDER_FOUR.openProvider(dataType, - parameter.assetProviderFour?.invoke()) - private fun openEmpty() = PROVIDER_EMPTY.openProvider(DataType.EMPTY, null) - - // Class method for syntax highlighting purposes - private fun getValue(c: Context = context) = parameter.getValue(c.resources) - private fun getValue(r: Resources) = parameter.getValue(r) - - @Test - fun assertValueUniqueness() { - // Ensure the parameters are valid in case of coding errors - val original = getValue() - assertEquals(valueOriginal, original) - assertNotEquals(valueOne, original) - assertNotEquals(valueTwo, original) - assertNotEquals(valueThree, original) - assertNotEquals(valueFour, original) - assertNotEquals(valueTwo, valueOne) - assertNotEquals(valueThree, valueOne) - assertNotEquals(valueFour, valueOne) - assertNotEquals(valueThree, valueTwo) - assertNotEquals(valueFour, valueTwo) - assertNotEquals(valueFour, valueThree) - } - - @Test - fun addProvidersRepeatedly() { - val testOne = openOne() - val testTwo = openTwo() - val loader = ResourcesLoader() - - resources.addLoaders(loader) - loader.addProvider(testOne) - assertEquals(valueOne, getValue()) - - loader.addProvider(testTwo) - assertEquals(valueTwo, getValue()) - - loader.removeProvider(testOne) - assertEquals(valueTwo, getValue()) - - loader.removeProvider(testTwo) - assertEquals(valueOriginal, getValue()) - } - - @Test - fun addLoadersRepeatedly() { - val testOne = openOne() - val testTwo = openTwo() - val loader1 = ResourcesLoader() - val loader2 = ResourcesLoader() - - resources.addLoaders(loader1) - loader1.addProvider(testOne) - assertEquals(valueOne, getValue()) - - resources.addLoaders(loader2) - loader2.addProvider(testTwo) - assertEquals(valueTwo, getValue()) - - resources.removeLoaders(loader1) - assertEquals(valueTwo, getValue()) - - resources.removeLoaders(loader2) - assertEquals(valueOriginal, getValue()) - } - - @Test - fun setMultipleProviders() { - val testOne = openOne() - val testTwo = openTwo() - val loader = ResourcesLoader() - - resources.addLoaders(loader) - loader.providers = listOf(testOne, testTwo) - assertEquals(valueTwo, getValue()) - - loader.removeProvider(testTwo) - assertEquals(valueOne, getValue()) - - loader.providers = Collections.emptyList() - assertEquals(valueOriginal, getValue()) - } - - @Test - fun addMultipleLoaders() { - val loader1 = ResourcesLoader() - loader1.addProvider(openOne()) - val loader2 = ResourcesLoader() - loader2.addProvider(openTwo()) - - resources.addLoaders(loader1, loader2) - assertEquals(valueTwo, getValue()) - - resources.removeLoaders(loader2) - assertEquals(valueOne, getValue()) - - resources.removeLoaders(loader1) - assertEquals(valueOriginal, getValue()) - } - - @Test - fun emptyProvider() { - val testOne = openOne() - val testTwo = openTwo() - val testEmpty = openEmpty() - val loader = ResourcesLoader() - - resources.addLoaders(loader) - loader.providers = listOf(testOne, testEmpty, testTwo) - assertEquals(valueTwo, getValue()) - - loader.removeProvider(testTwo) - assertEquals(valueOne, getValue()) - - loader.removeProvider(testOne) - assertEquals(valueOriginal, getValue()) - - loader.providers = Collections.emptyList() - assertEquals(valueOriginal, getValue()) - } - - @Test(expected = UnsupportedOperationException::class) - fun getProvidersDoesNotLeakMutability() { - val testOne = openOne() - val loader = ResourcesLoader() - val providers = loader.providers - providers += testOne - } - - @Test(expected = UnsupportedOperationException::class) - fun getLoadersDoesNotLeakMutability() { - val loaders = resources.loaders - loaders += ResourcesLoader() - } - - @Test - fun alreadyAddedProviderNoOps() { - val testOne = openOne() - val testTwo = openTwo() - val loader = ResourcesLoader() - - resources.addLoaders(loader) - loader.addProvider(testOne) - loader.addProvider(testTwo) - loader.addProvider(testOne) - - assertEquals(2, loader.providers.size) - assertEquals(loader.providers[0], testOne) - assertEquals(loader.providers[1], testTwo) - } - - @Test - fun alreadyAddedLoaderNoOps() { - val loader1 = ResourcesLoader() - loader1.addProvider(openOne()) - val loader2 = ResourcesLoader() - loader2.addProvider(openTwo()) - - resources.addLoaders(loader1) - resources.addLoaders(loader2) - resources.addLoaders(loader1) - - assertEquals(2, resources.loaders.size) - assertEquals(resources.loaders[0], loader1) - assertEquals(resources.loaders[1], loader2) - } - - @Test - fun repeatedRemoveProviderNoOps() { - val testOne = openOne() - val testTwo = openTwo() - val loader = ResourcesLoader() - - resources.addLoaders(loader) - loader.addProvider(testOne) - loader.addProvider(testTwo) - - loader.removeProvider(testOne) - loader.removeProvider(testOne) - - assertEquals(1, loader.providers.size) - assertEquals(loader.providers[0], testTwo) - } - - @Test - fun repeatedRemoveLoaderNoOps() { - val loader1 = ResourcesLoader() - loader1.addProvider(openOne()) - val loader2 = ResourcesLoader() - loader2.addProvider(openTwo()) - - resources.addLoaders(loader1, loader2) - resources.removeLoaders(loader1) - resources.removeLoaders(loader1) - - assertEquals(1, resources.loaders.size) - assertEquals(resources.loaders[0], loader2) - - resources.removeLoaders(loader2, loader2) - - assertEquals(0, resources.loaders.size) - } - - @Test - fun repeatedSetProvider() { - val testOne = openOne() - val testTwo = openTwo() - val loader = ResourcesLoader() - - resources.addLoaders(loader) - loader.providers = listOf(testOne, testTwo) - loader.providers = listOf(testOne, testTwo) - - assertEquals(2, loader.providers.size) - assertEquals(loader.providers[0], testOne) - assertEquals(loader.providers[1], testTwo) - } - - @Test - fun repeatedAddMultipleLoaders() { - val loader1 = ResourcesLoader() - loader1.addProvider(openOne()) - val loader2 = ResourcesLoader() - loader2.addProvider(openTwo()) - - resources.addLoaders(loader1, loader2) - resources.addLoaders(loader1, loader2) - - assertEquals(2, resources.loaders.size) - assertEquals(resources.loaders[0], loader1) - assertEquals(resources.loaders[1], loader2) - } - - @Test - fun reorderProviders() { - val testOne = openOne() - val testTwo = openTwo() - val loader = ResourcesLoader() - - resources.addLoaders(loader) - loader.addProvider(testOne) - loader.addProvider(testTwo) - assertEquals(valueTwo, getValue()) - - loader.removeProvider(testOne) - assertEquals(valueTwo, getValue()) - - loader.addProvider(testOne) - assertEquals(valueOne, getValue()) - - loader.removeProvider(testTwo) - assertEquals(valueOne, getValue()) - - loader.removeProvider(testOne) - assertEquals(valueOriginal, getValue()) - } - - @Test - fun reorderLoaders() { - val testOne = openOne() - val testTwo = openTwo() - val loader1 = ResourcesLoader() - loader1.addProvider(testOne) - val loader2 = ResourcesLoader() - loader2.addProvider(testTwo) - - resources.addLoaders(loader1) - resources.addLoaders(loader2) - assertEquals(valueTwo, getValue()) - - resources.removeLoaders(loader1) - assertEquals(valueTwo, getValue()) - - resources.addLoaders(loader1) - assertEquals(valueOne, getValue()) - - resources.removeLoaders(loader2) - assertEquals(valueOne, getValue()) - - resources.removeLoaders(loader1) - assertEquals(valueOriginal, getValue()) - } - - @Test - fun reorderMultipleLoadersAndProviders() { - val testOne = openOne() - val testTwo = openTwo() - val testThree = openThree() - val testFour = openFour() - - val loader1 = ResourcesLoader() - loader1.providers = listOf(testOne, testTwo) - - val loader2 = ResourcesLoader() - loader2.providers = listOf(testThree, testFour) - - resources.addLoaders(loader1, loader2) - assertEquals(valueFour, getValue()) - - resources.removeLoaders(loader1) - resources.addLoaders(loader1) - assertEquals(valueTwo, getValue()) - - loader1.removeProvider(testTwo) - assertEquals(valueOne, getValue()) - - loader1.removeProvider(testOne) - assertEquals(valueFour, getValue()) - - loader2.removeProvider(testFour) - assertEquals(valueThree, getValue()) - } - - private fun createContext(context: Context, id: Int): Context { - val overrideConfig = Configuration() - overrideConfig.orientation = Int.MAX_VALUE - id - return context.createConfigurationContext(overrideConfig) - } - - @Test - fun copyContextLoaders() { - val loader1 = ResourcesLoader() - loader1.addProvider(openOne()) - val loader2 = ResourcesLoader() - loader2.addProvider(openTwo()) - - resources.addLoaders(loader1) - assertEquals(valueOne, getValue()) - - // The child context should include the loaders of the original context. - val childContext = createContext(context, 0) - assertEquals(valueOne, getValue(childContext)) - - // Changing the loaders of the child context should not affect the original context. - childContext.resources.addLoaders(loader2) - assertEquals(valueOne, getValue()) - assertEquals(valueTwo, getValue(childContext)) - - // Changing the loaders of the original context should not affect the child context. - resources.removeLoaders(loader1) - assertEquals(valueOriginal, getValue()) - assertEquals(valueTwo, getValue(childContext)) - - // A new context created from the original after an update to the original's loaders should - // have the updated loaders. - val originalPrime = createContext(context, 2) - assertEquals(valueOriginal, getValue(originalPrime)) - - // A new context created from the child context after an update to the child's loaders - // should have the updated loaders. - val childPrime = createContext(childContext, 1) - assertEquals(valueTwo, getValue(childPrime)) - } - - @Test - fun loaderUpdatesAffectContexts() { - val testOne = openOne() - val testTwo = openTwo() - val loader = ResourcesLoader() - - resources.addLoaders(loader) - loader.addProvider(testOne) - assertEquals(valueOne, getValue()) - - val childContext = createContext(context, 0) - assertEquals(valueOne, getValue(childContext)) - - // Adding a provider to a loader affects all contexts that use the loader. - loader.addProvider(testTwo) - assertEquals(valueTwo, getValue()) - assertEquals(valueTwo, getValue(childContext)) - - // Changes to the loaders for a context do not affect providers. - resources.clearLoaders() - assertEquals(valueOriginal, getValue()) - assertEquals(valueTwo, getValue(childContext)) - - val childContext2 = createContext(context, 1) - assertEquals(valueOriginal, getValue()) - assertEquals(valueOriginal, getValue(childContext2)) - - childContext2.resources.addLoaders(loader) - assertEquals(valueOriginal, getValue()) - assertEquals(valueTwo, getValue(childContext)) - assertEquals(valueTwo, getValue(childContext2)) - } - - @Test - fun appLoadersIncludedInActivityContexts() { - val loader = ResourcesLoader() - loader.addProvider(openOne()) - - val applicationContext = context.applicationContext - applicationContext.resources.addLoaders(loader) - assertEquals(valueOne, getValue(applicationContext)) - - val activity = mTestActivityRule.launchActivity(Intent()) - assertEquals(valueOne, getValue(activity)) - - applicationContext.resources.clearLoaders() - } - - @Test - fun loadersApplicationInfoChanged() { - val loader1 = ResourcesLoader() - loader1.addProvider(openOne()) - val loader2 = ResourcesLoader() - loader2.addProvider(openTwo()) - - val applicationContext = context.applicationContext - applicationContext.resources.addLoaders(loader1) - assertEquals(valueOne, getValue(applicationContext)) - - var token: IBinder? = null - val activity = mTestActivityRule.launchActivity(Intent()) - mTestActivityRule.runOnUiThread(Runnable { - token = activity.activityToken - val at = activity.activityThread - - // The activity should have the loaders from the application. - assertEquals(valueOne, getValue(applicationContext)) - assertEquals(valueOne, getValue(activity)) - - activity.resources.addLoaders(loader2) - assertEquals(valueOne, getValue(applicationContext)) - assertEquals(valueTwo, getValue(activity)) - - // Relaunches the activity. - at.handleApplicationInfoChanged(activity.applicationInfo) - }) - - mTestActivityRule.runOnUiThread(Runnable { - val activityThread = activity.activityThread - val newActivity = activityThread.getActivity(token) - - // The loader added to the activity loaders should not be persisted. - assertEquals(valueOne, getValue(applicationContext)) - assertEquals(valueOne, getValue(newActivity)) - }) - - applicationContext.resources.clearLoaders() - } - - @Test - fun multipleLoadersHaveSameProviders() { - val provider1 = openOne() - val loader1 = ResourcesLoader() - loader1.addProvider(provider1) - val loader2 = ResourcesLoader() - loader2.addProvider(provider1) - loader2.addProvider(openTwo()) - - resources.addLoaders(loader1, loader2) - assertEquals(valueTwo, getValue()) - - resources.removeLoaders(loader1) - resources.addLoaders(loader1) - assertEquals(valueOne, getValue()) - - assertEquals(2, resources.assets.apkAssets.count { apkAssets -> apkAssets.isForLoader }) - } - - @Test(expected = IllegalStateException::class) - fun cannotUseClosedProvider() { - val provider = openOne() - provider.close() - val loader = ResourcesLoader() - loader.addProvider(provider) - } - - @Test(expected = IllegalStateException::class) - fun cannotCloseUsedProvider() { - val provider = openOne() - val loader = ResourcesLoader() - loader.addProvider(provider) - provider.close() - } - - @Test - fun addLoadersRepeatedlyCustomResources() { - val res = Resources(AssetManager::class.java.newInstance(), resources.displayMetrics, - resources.configuration!!) - val originalValue = getValue(res) - val testOne = openOne() - val testTwo = openTwo() - val loader1 = ResourcesLoader() - val loader2 = ResourcesLoader() - - res.addLoaders(loader1) - loader1.addProvider(testOne) - assertEquals(valueOne, getValue(res)) - - res.addLoaders(loader2) - loader2.addProvider(testTwo) - assertEquals(valueTwo, getValue(res)) - - res.removeLoaders(loader1) - res.addLoaders(loader1) - assertEquals(valueOne, getValue(res)) - - res.removeLoaders(loader1) - assertEquals(valueTwo, getValue(res)) - - res.removeLoaders(loader2) - assertEquals(originalValue, getValue(res)) - } - - @Test - fun setMultipleProvidersCustomResources() { - val res = Resources(AssetManager::class.java.newInstance(), resources.displayMetrics, - resources.configuration!!) - val originalValue = getValue(res) - val testOne = openOne() - val testTwo = openTwo() - val loader = ResourcesLoader() - - res.addLoaders(loader) - loader.providers = listOf(testOne, testTwo) - assertEquals(valueTwo, getValue(res)) - - loader.removeProvider(testTwo) - assertEquals(valueOne, getValue(res)) - - loader.providers = Collections.emptyList() - assertEquals(originalValue, getValue(res)) - } - - data class Parameter( - val testPrefix: String, - val getValue: Resources.() -> String, - val valueOriginal: Map<String, String>, - val valueOne: Map<String, String>, - val assetProviderOne: (() -> MemoryAssetsProvider)? = null, - val valueTwo: Map<String, String>, - val assetProviderTwo: (() -> MemoryAssetsProvider)? = null, - val valueThree: Map<String, String>, - val assetProviderThree: (() -> MemoryAssetsProvider)? = null, - val valueFour: Map<String, String>, - val assetProviderFour: (() -> MemoryAssetsProvider)? = null, - val dataTypes: List<DataType> - ) { - constructor( - testPrefix: String, - getValue: Resources.() -> String, - valueOriginal: Map<String, String>, - valueOne: Map<String, String>, - valueTwo: Map<String, String>, - valueThree: Map<String, String>, - valueFour: Map<String, String>, - dataTypes: List<DataType> - ): this(testPrefix, getValue, valueOriginal, valueOne, - null, valueTwo, null, valueThree, null, valueFour, null, dataTypes) - - override fun toString() = testPrefix - } -} - -class TestActivity : Activity()
\ No newline at end of file diff --git a/core/tests/ResourceLoaderTests/src/android/content/res/loader/test/Utils.kt b/core/tests/ResourceLoaderTests/src/android/content/res/loader/test/Utils.kt deleted file mode 100644 index 526160d04000..000000000000 --- a/core/tests/ResourceLoaderTests/src/android/content/res/loader/test/Utils.kt +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2019 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. - */ - -package android.content.res.loader.test - -import android.content.Context -import android.content.res.AssetFileDescriptor -import android.content.res.Resources -import android.os.ParcelFileDescriptor -import android.util.TypedValue -import org.mockito.Answers -import org.mockito.stubbing.Answer -import org.xmlpull.v1.XmlPullParser -import java.io.File - -object Utils { - val ANSWER_THROWS = Answer<Any> { - when (val name = it.method.name) { - "toString" -> return@Answer Answers.CALLS_REAL_METHODS.answer(it) - else -> throw UnsupportedOperationException("$name with " + - "${it.arguments?.joinToString()} should not be called") - } - } -} - -fun Int.dpToPx(resources: Resources) = TypedValue.applyDimension( - TypedValue.COMPLEX_UNIT_DIP, - this.toFloat(), - resources.displayMetrics -).toInt() - -fun AssetFileDescriptor.readText() = createInputStream().reader().readText() - -fun XmlPullParser.advanceToRoot() = apply { - while (next() != XmlPullParser.START_TAG) { - // Empty - } -} - -fun Context.copiedAssetFile(fileName: String): ParcelFileDescriptor { - return resources.assets.open(fileName).use { input -> - // AssetManager doesn't expose a direct file descriptor to the asset, so copy it to - // an individual file so one can be created manually. - val copiedFile = File(filesDir, fileName) - copiedFile.outputStream().use { output -> - input.copyTo(output) - } - ParcelFileDescriptor.open(copiedFile, ParcelFileDescriptor.MODE_READ_WRITE) - } -} diff --git a/libs/androidfw/TEST_MAPPING b/libs/androidfw/TEST_MAPPING index d1a6a5c18299..777aa0b429e5 100644 --- a/libs/androidfw/TEST_MAPPING +++ b/libs/androidfw/TEST_MAPPING @@ -5,7 +5,7 @@ "host": true }, { - "name": "FrameworksResourceLoaderTests" + "name": "CtsResourcesLoaderTests" } ] }
\ No newline at end of file |