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

Commit b3843853 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Show compat warnings even with 'pageSizeCompat' set" into main

parents 5460dfd3 3474bb8b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -105,14 +105,14 @@ public class AppWarningsHostTest extends BaseHostJUnit4Test {
    @AppModeFull
    public void runAppWith4KbLib_overrideCompatMode()
            throws FileNotFoundException, DeviceNotAvailableException, TargetSetupError {
        runPageSizeWarningsTest(TEST_APP_COMPAT_ENABLED, TEST_NO_WARNINGS);
        runPageSizeWarningsTest(TEST_APP_COMPAT_ENABLED, TEST_WARNINGS);
    }

    @Test
    @AppModeFull
    public void runAppWith4KbLib_disabledCompatMode()
            throws FileNotFoundException, DeviceNotAvailableException, TargetSetupError {
        runPageSizeWarningsTest(TEST_APP_COMPAT_DISABLED, TEST_NO_WARNINGS);
        runPageSizeWarningsTest(TEST_APP_COMPAT_DISABLED, TEST_WARNINGS);
    }

    @Test
+10 −3
Original line number Diff line number Diff line
@@ -78,21 +78,28 @@ public class PageSizeCompatTest {
    @Test
    public void testPageSizeCompat_compatEnabled() throws Exception {
        testPageSizeCompat_appLaunch(true);
        //verify warning dialog
        Assert.assertTrue(findCompatWaring() != null);
    }

    @Test
    public void testPageSizeCompat_compatDisabled() throws Exception {
        testPageSizeCompat_appLaunch(false);
        //verify warning dialog
        Assert.assertTrue(findCompatWaring() != null);
    }

    @Test
    public void testPageSizeCompat_compatByAlignmentChecks() throws Exception {
        testPageSizeCompat_appLaunch(true);

        //verify warning dialog
        Assert.assertTrue(findCompatWaring() != null);
    }

    private UiObject2 findCompatWaring() {
        UiDevice device = UiDevice.getInstance(getInstrumentation());
        device.waitForWindowUpdate(null, TIMEOUT);
        UiObject2 targetObject = device.wait(Until.findObject(By.text(WARNING_TEXT)), TIMEOUT);
        Assert.assertTrue(targetObject != null);
        UiObject2 object = device.wait(Until.findObject(By.text(WARNING_TEXT)), TIMEOUT);
        return object;
    }
}
+1 −3
Original line number Diff line number Diff line
@@ -1892,13 +1892,11 @@ public class PackageSetting extends SettingBase implements PackageStateInternal
     */
    @Override
    public String getPageSizeCompatWarningMessage(Context context) {
        boolean manifestOverrideEnabled =  (mPageSizeAppCompatFlags
                & ApplicationInfo.PAGE_SIZE_APP_COMPAT_FLAG_MANIFEST_OVERRIDE_ENABLED) != 0;
        boolean settingsOverrideEnabled =  (mPageSizeAppCompatFlags
                & ApplicationInfo.PAGE_SIZE_APP_COMPAT_FLAG_SETTINGS_OVERRIDE_ENABLED) != 0;
        boolean settingsOverrideDisabled =  (mPageSizeAppCompatFlags
                & ApplicationInfo.PAGE_SIZE_APP_COMPAT_FLAG_SETTINGS_OVERRIDE_DISABLED) != 0;
        if (manifestOverrideEnabled || settingsOverrideEnabled || settingsOverrideDisabled) {
        if (settingsOverrideEnabled || settingsOverrideDisabled) {
            return null;
        }

+21 −21
Original line number Diff line number Diff line
@@ -437,7 +437,8 @@ final class ScanPackageUtils {
            if (parsedPackage.getPageSizeAppCompatFlags()
                    > ApplicationInfo.PAGE_SIZE_APP_COMPAT_FLAG_UNDEFINED) {
                pkgSetting.setPageSizeAppCompatFlags(parsedPackage.getPageSizeAppCompatFlags());
            } else {
            }

            // 16 KB is only support for 64 bit ABIs and for apps which are being installed
            // Check alignment. System, Apex and Platform packages should be page-agnostic now
            if ((Build.SUPPORTED_64_BIT_ABIS.length > 0)
@@ -460,7 +461,6 @@ final class ScanPackageUtils {
                }
            }
        }
        }

        parsedPackage.setFactoryTest(isUnderFactoryTest && parsedPackage.getRequestedPermissions()
                .contains(android.Manifest.permission.FACTORY_TEST));