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

Commit a8e26bab authored by Pawan Wagh's avatar Pawan Wagh
Browse files

Set runtime flag to zygote

Set runtime flag to zygote to enable page size compat
mode for application which will be started. Based on the runtime
flag, compat mode will be set for application.

Flag: android.content.pm.app_compat_option_16kb
Test: atest -c FileSystemUtilsTests
Test: Install 4KB aligned app and see the dialog on 16 KB device,
Test that app is working in compat mode
Bug: 371049373

Change-Id: Id7ce7088f2b650a6ff6504085bf0dd67049c45a2
parent 4e46533a
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.app.ActivityManager.PROCESS_STATE_NONEXISTENT;
import static android.app.ActivityManagerInternal.OOM_ADJ_REASON_PROCESS_END;
import static android.app.ActivityManagerInternal.OOM_ADJ_REASON_RESTRICTION_CHANGE;
import static android.app.ActivityThread.PROC_START_SEQ_IDENT;
import static android.content.pm.Flags.appCompatOption16kb;
import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AUTO;
import static android.net.NetworkPolicyManager.isProcStateAllowedWhileIdleOrPowerSaveMode;
import static android.net.NetworkPolicyManager.isProcStateAllowedWhileOnRestrictBackground;
@@ -2025,6 +2026,16 @@ public final class ProcessList {
                runtimeFlags |= Zygote.USE_APP_IMAGE_STARTUP_CACHE;
            }

            if (appCompatOption16kb()) {
                boolean is16KbDevice = Os.sysconf(OsConstants._SC_PAGESIZE) == 16384;
                if (is16KbDevice
                        && mService.mContext
                        .getPackageManager()
                        .isPageSizeCompatEnabled(app.info.packageName)) {
                    runtimeFlags |= Zygote.ENABLE_PAGE_SIZE_APP_COMPAT;
                }
            }

            String invokeWith = null;
            if (debuggableFlag) {
                // Debuggable apps may include a wrapper script with their library directory.