Loading core/tests/FileSystemUtilsTest/Android.bp +21 −21 Original line number Diff line number Diff line Loading @@ -36,10 +36,10 @@ cc_library { ldflags: ["-z max-page-size=0x1000"], } android_test_helper_app { name: "app_with_4kb_elf", java_defaults { name: "app_with_4kb_elf_defaults", srcs: ["app_with_4kb_elf/src/**/*.java"], manifest: "app_with_4kb_elf/app_with_4kb_elf.xml", resource_dirs: ["app_with_4kb_elf/res"], compile_multilib: "64", jni_libs: [ "libpunchtest_4kb", Loading @@ -47,37 +47,36 @@ android_test_helper_app { static_libs: [ "androidx.test.rules", "platform-test-annotations", "androidx.test.uiautomator_uiautomator", "sysui-helper", ], } android_test_helper_app { name: "app_with_4kb_elf", defaults: ["app_with_4kb_elf_defaults"], manifest: "app_with_4kb_elf/app_with_4kb_elf.xml", use_embedded_native_libs: true, } android_test_helper_app { name: "app_with_4kb_compressed_elf", srcs: ["app_with_4kb_elf/src/**/*.java"], defaults: ["app_with_4kb_elf_defaults"], manifest: "app_with_4kb_elf/app_with_4kb_elf.xml", compile_multilib: "64", jni_libs: [ "libpunchtest_4kb", ], static_libs: [ "androidx.test.rules", "platform-test-annotations", ], use_embedded_native_libs: false, } android_test_helper_app { name: "page_size_compat_disabled_app", srcs: ["app_with_4kb_elf/src/**/*.java"], defaults: ["app_with_4kb_elf_defaults"], manifest: "app_with_4kb_elf/page_size_compat_disabled.xml", compile_multilib: "64", jni_libs: [ "libpunchtest_4kb", ], static_libs: [ "androidx.test.rules", "platform-test-annotations", ], use_embedded_native_libs: true, } android_test_helper_app { name: "app_with_4kb_elf_no_override", defaults: ["app_with_4kb_elf_defaults"], manifest: "app_with_4kb_elf/app_with_4kb_no_override.xml", use_embedded_native_libs: true, } Loading Loading @@ -131,6 +130,7 @@ java_test_host { ":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_with_4kb_elf/app_with_4kb_no_override.xml 0 → 100644 +37 −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" package="android.test.pagesizecompat"> <application android:label="PageSizeCompatTestApp"> <uses-library android:name="android.test.runner"/> <activity android:name=".MainActivity" android:exported="true" android:label="Home page" android:process=":NewProcess"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> </application> <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" android:targetPackage="android.test.pagesizecompat"/> </manifest> No newline at end of file core/tests/FileSystemUtilsTest/app_with_4kb_elf/res/layout/hello.xml 0 → 100644 +28 −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. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:keepScreenOn="true"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="this is a test activity" /> </LinearLayout> core/tests/FileSystemUtilsTest/app_with_4kb_elf/src/android/test/pagesizecompat/MainActivity.java +3 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.test.pagesizecompat; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import androidx.annotation.VisibleForTesting; Loading @@ -43,6 +44,8 @@ public class MainActivity extends Activity { @Override public void onCreate(Bundle savedOnstanceState) { super.onCreate(savedOnstanceState); View view = getLayoutInflater().inflate(R.layout.hello, null); setContentView(view); Intent received = getIntent(); int op1 = received.getIntExtra(KEY_OPERAND_1, -1); Loading core/tests/FileSystemUtilsTest/app_with_4kb_elf/src/android/test/pagesizecompat/PageSizeCompatTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.test.pagesizecompat; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; Loading @@ -23,6 +25,10 @@ import android.content.IntentFilter; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import androidx.test.uiautomator.By; import androidx.test.uiautomator.UiDevice; import androidx.test.uiautomator.UiObject2; import androidx.test.uiautomator.Until; import org.junit.Assert; import org.junit.Test; Loading @@ -33,6 +39,8 @@ import java.util.concurrent.TimeUnit; @RunWith(AndroidJUnit4.class) public class PageSizeCompatTest { private static final String WARNING_TEXT = "PageSizeCompatTestApp"; private static final long TIMEOUT = 5000; public void testPageSizeCompat_appLaunch(boolean shouldPass) throws Exception { Context context = InstrumentationRegistry.getContext(); Loading Loading @@ -61,6 +69,9 @@ public class PageSizeCompatTest { launchIntent.putExtra(MainActivity.KEY_OPERAND_2, op2); context.startActivity(launchIntent); UiDevice device = UiDevice.getInstance(getInstrumentation()); device.waitForWindowUpdate(null, TIMEOUT); Assert.assertEquals(receivedSignal.await(10, TimeUnit.SECONDS), shouldPass); } Loading @@ -73,4 +84,15 @@ public class PageSizeCompatTest { public void testPageSizeCompat_compatDisabled() throws Exception { testPageSizeCompat_appLaunch(false); } @Test public void testPageSizeCompat_compatByAlignmentChecks() throws Exception { testPageSizeCompat_appLaunch(true); //verify warning dialog UiDevice device = UiDevice.getInstance(getInstrumentation()); device.waitForWindowUpdate(null, TIMEOUT); UiObject2 targetObject = device.wait(Until.findObject(By.text(WARNING_TEXT)), TIMEOUT); Assert.assertTrue(targetObject != null); } } Loading
core/tests/FileSystemUtilsTest/Android.bp +21 −21 Original line number Diff line number Diff line Loading @@ -36,10 +36,10 @@ cc_library { ldflags: ["-z max-page-size=0x1000"], } android_test_helper_app { name: "app_with_4kb_elf", java_defaults { name: "app_with_4kb_elf_defaults", srcs: ["app_with_4kb_elf/src/**/*.java"], manifest: "app_with_4kb_elf/app_with_4kb_elf.xml", resource_dirs: ["app_with_4kb_elf/res"], compile_multilib: "64", jni_libs: [ "libpunchtest_4kb", Loading @@ -47,37 +47,36 @@ android_test_helper_app { static_libs: [ "androidx.test.rules", "platform-test-annotations", "androidx.test.uiautomator_uiautomator", "sysui-helper", ], } android_test_helper_app { name: "app_with_4kb_elf", defaults: ["app_with_4kb_elf_defaults"], manifest: "app_with_4kb_elf/app_with_4kb_elf.xml", use_embedded_native_libs: true, } android_test_helper_app { name: "app_with_4kb_compressed_elf", srcs: ["app_with_4kb_elf/src/**/*.java"], defaults: ["app_with_4kb_elf_defaults"], manifest: "app_with_4kb_elf/app_with_4kb_elf.xml", compile_multilib: "64", jni_libs: [ "libpunchtest_4kb", ], static_libs: [ "androidx.test.rules", "platform-test-annotations", ], use_embedded_native_libs: false, } android_test_helper_app { name: "page_size_compat_disabled_app", srcs: ["app_with_4kb_elf/src/**/*.java"], defaults: ["app_with_4kb_elf_defaults"], manifest: "app_with_4kb_elf/page_size_compat_disabled.xml", compile_multilib: "64", jni_libs: [ "libpunchtest_4kb", ], static_libs: [ "androidx.test.rules", "platform-test-annotations", ], use_embedded_native_libs: true, } android_test_helper_app { name: "app_with_4kb_elf_no_override", defaults: ["app_with_4kb_elf_defaults"], manifest: "app_with_4kb_elf/app_with_4kb_no_override.xml", use_embedded_native_libs: true, } Loading Loading @@ -131,6 +130,7 @@ java_test_host { ":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_with_4kb_elf/app_with_4kb_no_override.xml 0 → 100644 +37 −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" package="android.test.pagesizecompat"> <application android:label="PageSizeCompatTestApp"> <uses-library android:name="android.test.runner"/> <activity android:name=".MainActivity" android:exported="true" android:label="Home page" android:process=":NewProcess"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> </application> <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" android:targetPackage="android.test.pagesizecompat"/> </manifest> No newline at end of file
core/tests/FileSystemUtilsTest/app_with_4kb_elf/res/layout/hello.xml 0 → 100644 +28 −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. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:keepScreenOn="true"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="this is a test activity" /> </LinearLayout>
core/tests/FileSystemUtilsTest/app_with_4kb_elf/src/android/test/pagesizecompat/MainActivity.java +3 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.test.pagesizecompat; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import androidx.annotation.VisibleForTesting; Loading @@ -43,6 +44,8 @@ public class MainActivity extends Activity { @Override public void onCreate(Bundle savedOnstanceState) { super.onCreate(savedOnstanceState); View view = getLayoutInflater().inflate(R.layout.hello, null); setContentView(view); Intent received = getIntent(); int op1 = received.getIntExtra(KEY_OPERAND_1, -1); Loading
core/tests/FileSystemUtilsTest/app_with_4kb_elf/src/android/test/pagesizecompat/PageSizeCompatTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.test.pagesizecompat; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; Loading @@ -23,6 +25,10 @@ import android.content.IntentFilter; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import androidx.test.uiautomator.By; import androidx.test.uiautomator.UiDevice; import androidx.test.uiautomator.UiObject2; import androidx.test.uiautomator.Until; import org.junit.Assert; import org.junit.Test; Loading @@ -33,6 +39,8 @@ import java.util.concurrent.TimeUnit; @RunWith(AndroidJUnit4.class) public class PageSizeCompatTest { private static final String WARNING_TEXT = "PageSizeCompatTestApp"; private static final long TIMEOUT = 5000; public void testPageSizeCompat_appLaunch(boolean shouldPass) throws Exception { Context context = InstrumentationRegistry.getContext(); Loading Loading @@ -61,6 +69,9 @@ public class PageSizeCompatTest { launchIntent.putExtra(MainActivity.KEY_OPERAND_2, op2); context.startActivity(launchIntent); UiDevice device = UiDevice.getInstance(getInstrumentation()); device.waitForWindowUpdate(null, TIMEOUT); Assert.assertEquals(receivedSignal.await(10, TimeUnit.SECONDS), shouldPass); } Loading @@ -73,4 +84,15 @@ public class PageSizeCompatTest { public void testPageSizeCompat_compatDisabled() throws Exception { testPageSizeCompat_appLaunch(false); } @Test public void testPageSizeCompat_compatByAlignmentChecks() throws Exception { testPageSizeCompat_appLaunch(true); //verify warning dialog UiDevice device = UiDevice.getInstance(getInstrumentation()); device.waitForWindowUpdate(null, TIMEOUT); UiObject2 targetObject = device.wait(Until.findObject(By.text(WARNING_TEXT)), TIMEOUT); Assert.assertTrue(targetObject != null); } }