Loading core/tests/FileSystemUtilsTest/Android.bp +12 −5 Original line number Diff line number Diff line Loading @@ -46,8 +46,8 @@ java_defaults { ], static_libs: [ "androidx.test.rules", "platform-test-annotations", "androidx.test.uiautomator_uiautomator", "platform-test-annotations", "sysui-helper", ], } Loading Loading @@ -80,6 +80,13 @@ android_test_helper_app { use_embedded_native_libs: true, } android_test_helper_app { name: "app_with_4kb_elf_no_override_debuggable", defaults: ["app_with_4kb_elf_defaults"], manifest: "app_with_4kb_elf/app_with_4kb_no_override_debuggable.xml", use_embedded_native_libs: true, } android_test_helper_app { name: "embedded_native_libs_test_app", srcs: ["apk_embedded_native_libs/src/**/*.java"], Loading Loading @@ -120,17 +127,17 @@ java_test_host { "truth", ], libs: [ "tradefed", "compatibility-host-util", "compatibility-tradefed", "tradefed", ], device_common_data: [ ":app_with_4kb_compressed_elf", ":app_with_4kb_elf", ":app_with_4kb_elf_no_override", ":embedded_native_libs_test_app", ":extract_native_libs_test_app", ":app_with_4kb_elf", ":page_size_compat_disabled_app", ":app_with_4kb_compressed_elf", ":app_with_4kb_elf_no_override", ], test_suites: ["general-tests"], test_config: "AndroidTest.xml", Loading core/tests/FileSystemUtilsTest/app_warnings_test/Android.bp 0 → 100644 +57 −0 Original line number Diff line number Diff line // Copyright (C) 2025 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 { default_applicable_licenses: ["frameworks_base_license"], default_team: "trendy_team_android_kernel", } android_test_helper_app { name: "page_size_warnings_app", srcs: ["src/**/*.java"], static_libs: [ "androidx.test.core", "androidx.test.rules", "androidx.test.runner", "compatibility-device-util-axt", "platform-test-annotations", ], manifest: "TestAppAndroidManifest.xml", platform_apis: true, } java_test_host { name: "PageSizeCompatWarningsTest", // Include all test java files srcs: ["host/**/*.java"], static_libs: [ "junit", "platform-test-annotations", "truth", ], libs: [ "compatibility-host-util", "compatibility-tradefed", "tradefed", ], device_common_data: [ ":app_with_4kb_elf", ":app_with_4kb_elf_no_override", ":app_with_4kb_elf_no_override_debuggable", ":page_size_compat_disabled_app", ":page_size_warnings_app", ], test_suites: ["general-tests"], test_config: "AndroidTest.xml", } core/tests/FileSystemUtilsTest/app_warnings_test/AndroidTest.xml 0 → 100644 +53 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2025 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="Run app warnings test."> <option name="test-suite-tag" value="apct"/> <target_preparer class="com.android.tradefed.targetprep.DeviceSetup"> <option name="force-skip-system-props" value="true" /> <option name="set-global-setting" key="verifier_engprod" value="1" /> <option name="set-global-setting" key="verifier_verify_adb_installs" value="0" /> <option name="restore-settings" value="true" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" > <option name="force-root" value="true" /> <option name="throw-on-error" value="false" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> <option name="cleanup-apks" value="true"/> <option name="test-file-name" value="page_size_warnings_app.apk"/> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer"> <option name="run-command" value="mkdir -p /data/local/tmp/pagesizewarnings/" /> <option name="teardown-command" value="rm -rf /data/local/tmp/pagesizewarnings/"/> <option name="run-command" value="settings put global development_settings_enabled 1" /> <option name="run-command" value="am start -a com.android.setupwizard.FOUR_CORNER_EXIT" /> </target_preparer> <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> <option name="cleanup" value="true" /> <option name="push" value="app_with_4kb_elf_no_override.apk->/data/local/tmp/pagesizewarnings/app_with_4kb_elf_no_override.apk" /> </target_preparer> <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" > <option name="jar" value="PageSizeCompatWarningsTest.jar" /> </test> </configuration> No newline at end of file core/tests/FileSystemUtilsTest/app_warnings_test/TestAppAndroidManifest.xml 0 → 100644 +33 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2025 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" android:installLocation="internalOnly" package="android.content.pm.tests"> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" /> <application android:label="PageSizeAppWarningsTest" android:debuggable="true"> <uses-library android:name="android.test.runner"/> </application> <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" android:targetPackage="android.content.pm.tests" android:label="PageSizeAppWarningsTest" /> </manifest> No newline at end of file core/tests/FileSystemUtilsTest/app_warnings_test/host/android/test/appwarnings/AppWarningsHostTest.java 0 → 100644 +131 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 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.test.appwarnings; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeTrue; import android.platform.test.annotations.AppModeFull; import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper; import com.android.tradefed.device.DeviceNotAvailableException; import com.android.tradefed.targetprep.TargetSetupError; import com.android.tradefed.testtype.DeviceJUnit4ClassRunner; import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import java.io.FileNotFoundException; @RunWith(DeviceJUnit4ClassRunner.class) public class AppWarningsHostTest extends BaseHostJUnit4Test { private static final String TEST_APP_COMPAT_ENABLED = "app_with_4kb_elf.apk"; private static final String TEST_APP_COMPAT_DISABLED = "page_size_compat_disabled_app.apk"; private static final String TEST_APP_NON_DEBUG = "app_with_4kb_elf_no_override.apk"; private static final String TEST_APP_DEBUG = "app_with_4kb_elf_no_override_debuggable.apk"; private static final String TEST_NO_WARNINGS = "testNoWarnings"; private static final String TEST_WARNINGS = "testWarnings"; private static final String TEST_INSTALL_VIA_SESSION = "installAppViaSession"; private static final int DEVICE_WAIT_TIMEOUT = 120000; private static final String TEST_APP_PACKAGE = "android.test.pagesizecompat"; private CompatibilityBuildHelper mBuildHelper; @Before public void setup() throws Exception { mBuildHelper = new CompatibilityBuildHelper(getBuild()); // Only run on userdebug devices. String buildType = getDevice().getProperty("ro.build.type"); assumeTrue(buildType.equals("userdebug") || buildType.equals("eng")); getDevice().waitForDeviceAvailable(DEVICE_WAIT_TIMEOUT); getDevice().executeShellCommand("input keyevent KEYCODE_WAKEUP"); getDevice().executeShellCommand("wm dismiss-keyguard"); } private void installAppViaAdb(String appName) throws FileNotFoundException, DeviceNotAvailableException { String fullPath = mBuildHelper.getTestFile(appName).getAbsolutePath(); getDevice().executeAdbCommand("install", fullPath); } private void runPageSizeWarningsTest(String appName, String testMethodName) throws FileNotFoundException, DeviceNotAvailableException, TargetSetupError { getDevice().enableAdbRoot(); if (isPackageInstalled(TEST_APP_PACKAGE)) { uninstallPackage(TEST_APP_PACKAGE); } installAppViaAdb(appName); String testPackage = "android.content.pm.tests"; String testName = "AppWarningsTest"; assertTrue(isPackageInstalled(testPackage)); assertTrue(isPackageInstalled(TEST_APP_PACKAGE)); assertTrue(runDeviceTests(testPackage, testPackage + "." + testName, testMethodName)); if (isPackageInstalled(TEST_APP_PACKAGE)) { uninstallPackage(TEST_APP_PACKAGE); } } @Test @AppModeFull public void testWarnings_installedBySession() throws FileNotFoundException, DeviceNotAvailableException, TargetSetupError { String appPackage = "android.content.pm.tests"; String testName = "AppWarningsTest"; assertTrue(isPackageInstalled(appPackage)); // Run a test to install the app using pacakage manager session first and then check // for no warnings. runDeviceTests(appPackage, appPackage + "." + testName, TEST_INSTALL_VIA_SESSION); runDeviceTests(appPackage, appPackage + "." + testName, TEST_NO_WARNINGS); } @Test @AppModeFull public void runAppWith4KbLib_overrideCompatMode() throws FileNotFoundException, DeviceNotAvailableException, TargetSetupError { runPageSizeWarningsTest(TEST_APP_COMPAT_ENABLED, TEST_NO_WARNINGS); } @Test @AppModeFull public void runAppWith4KbLib_disabledCompatMode() throws FileNotFoundException, DeviceNotAvailableException, TargetSetupError { runPageSizeWarningsTest(TEST_APP_COMPAT_DISABLED, TEST_NO_WARNINGS); } @Test @AppModeFull public void runAppWith4KbLib_installedByAdb() throws FileNotFoundException, DeviceNotAvailableException, TargetSetupError { runPageSizeWarningsTest(TEST_APP_DEBUG, TEST_WARNINGS); } @Test @AppModeFull public void runNonDebugAppWith4KbLib_installedByAdb() throws FileNotFoundException, DeviceNotAvailableException, TargetSetupError { runPageSizeWarningsTest(TEST_APP_NON_DEBUG, TEST_NO_WARNINGS); } } Loading
core/tests/FileSystemUtilsTest/Android.bp +12 −5 Original line number Diff line number Diff line Loading @@ -46,8 +46,8 @@ java_defaults { ], static_libs: [ "androidx.test.rules", "platform-test-annotations", "androidx.test.uiautomator_uiautomator", "platform-test-annotations", "sysui-helper", ], } Loading Loading @@ -80,6 +80,13 @@ android_test_helper_app { use_embedded_native_libs: true, } android_test_helper_app { name: "app_with_4kb_elf_no_override_debuggable", defaults: ["app_with_4kb_elf_defaults"], manifest: "app_with_4kb_elf/app_with_4kb_no_override_debuggable.xml", use_embedded_native_libs: true, } android_test_helper_app { name: "embedded_native_libs_test_app", srcs: ["apk_embedded_native_libs/src/**/*.java"], Loading Loading @@ -120,17 +127,17 @@ java_test_host { "truth", ], libs: [ "tradefed", "compatibility-host-util", "compatibility-tradefed", "tradefed", ], device_common_data: [ ":app_with_4kb_compressed_elf", ":app_with_4kb_elf", ":app_with_4kb_elf_no_override", ":embedded_native_libs_test_app", ":extract_native_libs_test_app", ":app_with_4kb_elf", ":page_size_compat_disabled_app", ":app_with_4kb_compressed_elf", ":app_with_4kb_elf_no_override", ], test_suites: ["general-tests"], test_config: "AndroidTest.xml", Loading
core/tests/FileSystemUtilsTest/app_warnings_test/Android.bp 0 → 100644 +57 −0 Original line number Diff line number Diff line // Copyright (C) 2025 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 { default_applicable_licenses: ["frameworks_base_license"], default_team: "trendy_team_android_kernel", } android_test_helper_app { name: "page_size_warnings_app", srcs: ["src/**/*.java"], static_libs: [ "androidx.test.core", "androidx.test.rules", "androidx.test.runner", "compatibility-device-util-axt", "platform-test-annotations", ], manifest: "TestAppAndroidManifest.xml", platform_apis: true, } java_test_host { name: "PageSizeCompatWarningsTest", // Include all test java files srcs: ["host/**/*.java"], static_libs: [ "junit", "platform-test-annotations", "truth", ], libs: [ "compatibility-host-util", "compatibility-tradefed", "tradefed", ], device_common_data: [ ":app_with_4kb_elf", ":app_with_4kb_elf_no_override", ":app_with_4kb_elf_no_override_debuggable", ":page_size_compat_disabled_app", ":page_size_warnings_app", ], test_suites: ["general-tests"], test_config: "AndroidTest.xml", }
core/tests/FileSystemUtilsTest/app_warnings_test/AndroidTest.xml 0 → 100644 +53 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2025 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="Run app warnings test."> <option name="test-suite-tag" value="apct"/> <target_preparer class="com.android.tradefed.targetprep.DeviceSetup"> <option name="force-skip-system-props" value="true" /> <option name="set-global-setting" key="verifier_engprod" value="1" /> <option name="set-global-setting" key="verifier_verify_adb_installs" value="0" /> <option name="restore-settings" value="true" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" > <option name="force-root" value="true" /> <option name="throw-on-error" value="false" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> <option name="cleanup-apks" value="true"/> <option name="test-file-name" value="page_size_warnings_app.apk"/> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer"> <option name="run-command" value="mkdir -p /data/local/tmp/pagesizewarnings/" /> <option name="teardown-command" value="rm -rf /data/local/tmp/pagesizewarnings/"/> <option name="run-command" value="settings put global development_settings_enabled 1" /> <option name="run-command" value="am start -a com.android.setupwizard.FOUR_CORNER_EXIT" /> </target_preparer> <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher"> <option name="cleanup" value="true" /> <option name="push" value="app_with_4kb_elf_no_override.apk->/data/local/tmp/pagesizewarnings/app_with_4kb_elf_no_override.apk" /> </target_preparer> <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" > <option name="jar" value="PageSizeCompatWarningsTest.jar" /> </test> </configuration> No newline at end of file
core/tests/FileSystemUtilsTest/app_warnings_test/TestAppAndroidManifest.xml 0 → 100644 +33 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2025 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" android:installLocation="internalOnly" package="android.content.pm.tests"> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" /> <application android:label="PageSizeAppWarningsTest" android:debuggable="true"> <uses-library android:name="android.test.runner"/> </application> <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" android:targetPackage="android.content.pm.tests" android:label="PageSizeAppWarningsTest" /> </manifest> No newline at end of file
core/tests/FileSystemUtilsTest/app_warnings_test/host/android/test/appwarnings/AppWarningsHostTest.java 0 → 100644 +131 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 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.test.appwarnings; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeTrue; import android.platform.test.annotations.AppModeFull; import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper; import com.android.tradefed.device.DeviceNotAvailableException; import com.android.tradefed.targetprep.TargetSetupError; import com.android.tradefed.testtype.DeviceJUnit4ClassRunner; import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import java.io.FileNotFoundException; @RunWith(DeviceJUnit4ClassRunner.class) public class AppWarningsHostTest extends BaseHostJUnit4Test { private static final String TEST_APP_COMPAT_ENABLED = "app_with_4kb_elf.apk"; private static final String TEST_APP_COMPAT_DISABLED = "page_size_compat_disabled_app.apk"; private static final String TEST_APP_NON_DEBUG = "app_with_4kb_elf_no_override.apk"; private static final String TEST_APP_DEBUG = "app_with_4kb_elf_no_override_debuggable.apk"; private static final String TEST_NO_WARNINGS = "testNoWarnings"; private static final String TEST_WARNINGS = "testWarnings"; private static final String TEST_INSTALL_VIA_SESSION = "installAppViaSession"; private static final int DEVICE_WAIT_TIMEOUT = 120000; private static final String TEST_APP_PACKAGE = "android.test.pagesizecompat"; private CompatibilityBuildHelper mBuildHelper; @Before public void setup() throws Exception { mBuildHelper = new CompatibilityBuildHelper(getBuild()); // Only run on userdebug devices. String buildType = getDevice().getProperty("ro.build.type"); assumeTrue(buildType.equals("userdebug") || buildType.equals("eng")); getDevice().waitForDeviceAvailable(DEVICE_WAIT_TIMEOUT); getDevice().executeShellCommand("input keyevent KEYCODE_WAKEUP"); getDevice().executeShellCommand("wm dismiss-keyguard"); } private void installAppViaAdb(String appName) throws FileNotFoundException, DeviceNotAvailableException { String fullPath = mBuildHelper.getTestFile(appName).getAbsolutePath(); getDevice().executeAdbCommand("install", fullPath); } private void runPageSizeWarningsTest(String appName, String testMethodName) throws FileNotFoundException, DeviceNotAvailableException, TargetSetupError { getDevice().enableAdbRoot(); if (isPackageInstalled(TEST_APP_PACKAGE)) { uninstallPackage(TEST_APP_PACKAGE); } installAppViaAdb(appName); String testPackage = "android.content.pm.tests"; String testName = "AppWarningsTest"; assertTrue(isPackageInstalled(testPackage)); assertTrue(isPackageInstalled(TEST_APP_PACKAGE)); assertTrue(runDeviceTests(testPackage, testPackage + "." + testName, testMethodName)); if (isPackageInstalled(TEST_APP_PACKAGE)) { uninstallPackage(TEST_APP_PACKAGE); } } @Test @AppModeFull public void testWarnings_installedBySession() throws FileNotFoundException, DeviceNotAvailableException, TargetSetupError { String appPackage = "android.content.pm.tests"; String testName = "AppWarningsTest"; assertTrue(isPackageInstalled(appPackage)); // Run a test to install the app using pacakage manager session first and then check // for no warnings. runDeviceTests(appPackage, appPackage + "." + testName, TEST_INSTALL_VIA_SESSION); runDeviceTests(appPackage, appPackage + "." + testName, TEST_NO_WARNINGS); } @Test @AppModeFull public void runAppWith4KbLib_overrideCompatMode() throws FileNotFoundException, DeviceNotAvailableException, TargetSetupError { runPageSizeWarningsTest(TEST_APP_COMPAT_ENABLED, TEST_NO_WARNINGS); } @Test @AppModeFull public void runAppWith4KbLib_disabledCompatMode() throws FileNotFoundException, DeviceNotAvailableException, TargetSetupError { runPageSizeWarningsTest(TEST_APP_COMPAT_DISABLED, TEST_NO_WARNINGS); } @Test @AppModeFull public void runAppWith4KbLib_installedByAdb() throws FileNotFoundException, DeviceNotAvailableException, TargetSetupError { runPageSizeWarningsTest(TEST_APP_DEBUG, TEST_WARNINGS); } @Test @AppModeFull public void runNonDebugAppWith4KbLib_installedByAdb() throws FileNotFoundException, DeviceNotAvailableException, TargetSetupError { runPageSizeWarningsTest(TEST_APP_NON_DEBUG, TEST_NO_WARNINGS); } }