Loading services/core/java/com/android/server/pm/DexOptHelper.java +7 −1 Original line number Original line Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.content.Context; import android.content.Intent; import android.content.Intent; import android.content.IntentFilter; import android.content.IntentFilter; import android.content.pm.ApexStagedEvent; import android.content.pm.ApexStagedEvent; import android.content.pm.Flags; import android.content.pm.IPackageManagerNative; import android.content.pm.IPackageManagerNative; import android.content.pm.IStagedApexObserver; import android.content.pm.IStagedApexObserver; import android.content.pm.PackageManager; import android.content.pm.PackageManager; Loading Loading @@ -766,6 +767,10 @@ public final class DexOptHelper { final PackageSetting ps = installRequest.getScannedPackageSetting(); final PackageSetting ps = installRequest.getScannedPackageSetting(); final AndroidPackage pkg = ps.getPkg(); final AndroidPackage pkg = ps.getPkg(); final boolean onIncremental = isIncrementalPath(ps.getPathString()); final boolean onIncremental = isIncrementalPath(ps.getPathString()); final boolean performDexOptForRollback = Flags.recoverabilityDetection() ? !(installRequest.isRollback() && installRequest.getInstallSource().mInitiatingPackageName.equals("android")) : true; return (!instantApp || Global.getInt(context.getContentResolver(), return (!instantApp || Global.getInt(context.getContentResolver(), Global.INSTANT_APP_DEXOPT_ENABLED, 0) != 0) Global.INSTANT_APP_DEXOPT_ENABLED, 0) != 0) Loading @@ -773,7 +778,8 @@ public final class DexOptHelper { && !pkg.isDebuggable() && !pkg.isDebuggable() && (!onIncremental) && (!onIncremental) && dexoptOptions.isCompilationEnabled() && dexoptOptions.isCompilationEnabled() && !isApex; && !isApex && performDexOptForRollback; } } private static class StagedApexObserver extends IStagedApexObserver.Stub { private static class StagedApexObserver extends IStagedApexObserver.Stub { Loading services/core/java/com/android/server/pm/VerifyingSession.java +11 −1 Original line number Original line Diff line number Diff line Loading @@ -141,6 +141,8 @@ final class VerifyingSession { @NonNull @NonNull private final PackageManagerService mPm; private final PackageManagerService mPm; private final int mInstallReason; VerifyingSession(UserHandle user, File stagedDir, IPackageInstallObserver2 observer, VerifyingSession(UserHandle user, File stagedDir, IPackageInstallObserver2 observer, PackageInstaller.SessionParams sessionParams, InstallSource installSource, PackageInstaller.SessionParams sessionParams, InstallSource installSource, int installerUid, SigningDetails signingDetails, int sessionId, PackageLite lite, int installerUid, SigningDetails signingDetails, int sessionId, PackageLite lite, Loading Loading @@ -168,6 +170,7 @@ final class VerifyingSession { mUserActionRequiredType = sessionParams.requireUserAction; mUserActionRequiredType = sessionParams.requireUserAction; mIsInherit = sessionParams.mode == MODE_INHERIT_EXISTING; mIsInherit = sessionParams.mode == MODE_INHERIT_EXISTING; mIsStaged = sessionParams.isStaged; mIsStaged = sessionParams.isStaged; mInstallReason = sessionParams.installReason; } } @Override @Override Loading @@ -190,7 +193,9 @@ final class VerifyingSession { // Perform package verification and enable rollback (unless we are simply moving the // Perform package verification and enable rollback (unless we are simply moving the // package). // package). if (!mOriginInfo.mExisting) { if (!mOriginInfo.mExisting) { if (!isApex() && !isArchivedInstallation()) { final boolean verifyForRollback = Flags.recoverabilityDetection() ? !isARollback() : true; if (!isApex() && !isArchivedInstallation() && verifyForRollback) { // TODO(b/182426975): treat APEX as APK when APK verification is concerned // TODO(b/182426975): treat APEX as APK when APK verification is concerned sendApkVerificationRequest(pkgLite); sendApkVerificationRequest(pkgLite); } } Loading @@ -200,6 +205,11 @@ final class VerifyingSession { } } } } private boolean isARollback() { return mInstallReason == PackageManager.INSTALL_REASON_ROLLBACK && mInstallSource.mInitiatingPackageName.equals("android"); } private void sendApkVerificationRequest(PackageInfoLite pkgLite) { private void sendApkVerificationRequest(PackageInfoLite pkgLite) { final int verificationId = mPm.mPendingVerificationToken++; final int verificationId = mPm.mPendingVerificationToken++; Loading services/java/com/android/server/SystemServer.java +30 −8 Original line number Original line Diff line number Diff line Loading @@ -47,6 +47,7 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManagerInternal; import android.content.pm.PackageManagerInternal; import android.content.res.Configuration; import android.content.res.Configuration; import android.content.res.Resources.Theme; import android.content.res.Resources.Theme; import android.crashrecovery.flags.Flags; import android.credentials.CredentialManager; import android.credentials.CredentialManager; import android.database.sqlite.SQLiteCompatibilityWalFlags; import android.database.sqlite.SQLiteCompatibilityWalFlags; import android.database.sqlite.SQLiteGlobal; import android.database.sqlite.SQLiteGlobal; Loading Loading @@ -1195,11 +1196,13 @@ public final class SystemServer implements Dumpable { mSystemServiceManager.startService(RecoverySystemService.Lifecycle.class); mSystemServiceManager.startService(RecoverySystemService.Lifecycle.class); t.traceEnd(); t.traceEnd(); if (!Flags.recoverabilityDetection()) { // Now that we have the bare essentials of the OS up and running, take // Now that we have the bare essentials of the OS up and running, take // note that we just booted, which might send out a rescue party if // note that we just booted, which might send out a rescue party if // we're stuck in a runtime restart loop. // we're stuck in a runtime restart loop. RescueParty.registerHealthObserver(mSystemContext); RescueParty.registerHealthObserver(mSystemContext); PackageWatchdog.getInstance(mSystemContext).noteBoot(); PackageWatchdog.getInstance(mSystemContext).noteBoot(); } // Manages LEDs and display backlight so we need it to bring up the display. // Manages LEDs and display backlight so we need it to bring up the display. t.traceBegin("StartLightsService"); t.traceBegin("StartLightsService"); Loading Loading @@ -1469,10 +1472,13 @@ public final class SystemServer implements Dumpable { boolean enableVrService = context.getPackageManager().hasSystemFeature( boolean enableVrService = context.getPackageManager().hasSystemFeature( PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE); PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE); if (!Flags.recoverabilityDetection()) { // For debugging RescueParty // For debugging RescueParty if (Build.IS_DEBUGGABLE && SystemProperties.getBoolean("debug.crash_system", false)) { if (Build.IS_DEBUGGABLE && SystemProperties.getBoolean("debug.crash_system", false)) { throw new RuntimeException(); throw new RuntimeException(); } } } try { try { final String SECONDARY_ZYGOTE_PRELOAD = "SecondaryZygotePreload"; final String SECONDARY_ZYGOTE_PRELOAD = "SecondaryZygotePreload"; Loading Loading @@ -2910,6 +2916,14 @@ public final class SystemServer implements Dumpable { mPackageManagerService.systemReady(); mPackageManagerService.systemReady(); t.traceEnd(); t.traceEnd(); if (Flags.recoverabilityDetection()) { // Now that we have the essential services needed for rescue party, initialize // RescuParty. note that we just booted, which might send out a rescue party if // we're stuck in a runtime restart loop. RescueParty.registerHealthObserver(mSystemContext); PackageWatchdog.getInstance(mSystemContext).noteBoot(); } t.traceBegin("MakeDisplayManagerServiceReady"); t.traceBegin("MakeDisplayManagerServiceReady"); try { try { // TODO: use boot phase and communicate this flag some other way // TODO: use boot phase and communicate this flag some other way Loading Loading @@ -3313,6 +3327,14 @@ public final class SystemServer implements Dumpable { * are updated outside of OTA; and to avoid breaking dependencies from system into apexes. * are updated outside of OTA; and to avoid breaking dependencies from system into apexes. */ */ private void startApexServices(@NonNull TimingsTraceAndSlog t) { private void startApexServices(@NonNull TimingsTraceAndSlog t) { if (Flags.recoverabilityDetection()) { // For debugging RescueParty if (Build.IS_DEBUGGABLE && SystemProperties.getBoolean("debug.crash_system", false)) { throw new RuntimeException(); } } t.traceBegin("startApexServices"); t.traceBegin("startApexServices"); // TODO(b/192880996): get the list from "android" package, once the manifest entries // TODO(b/192880996): get the list from "android" package, once the manifest entries // are migrated to system manifest. // are migrated to system manifest. Loading Loading
services/core/java/com/android/server/pm/DexOptHelper.java +7 −1 Original line number Original line Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.content.Context; import android.content.Intent; import android.content.Intent; import android.content.IntentFilter; import android.content.IntentFilter; import android.content.pm.ApexStagedEvent; import android.content.pm.ApexStagedEvent; import android.content.pm.Flags; import android.content.pm.IPackageManagerNative; import android.content.pm.IPackageManagerNative; import android.content.pm.IStagedApexObserver; import android.content.pm.IStagedApexObserver; import android.content.pm.PackageManager; import android.content.pm.PackageManager; Loading Loading @@ -766,6 +767,10 @@ public final class DexOptHelper { final PackageSetting ps = installRequest.getScannedPackageSetting(); final PackageSetting ps = installRequest.getScannedPackageSetting(); final AndroidPackage pkg = ps.getPkg(); final AndroidPackage pkg = ps.getPkg(); final boolean onIncremental = isIncrementalPath(ps.getPathString()); final boolean onIncremental = isIncrementalPath(ps.getPathString()); final boolean performDexOptForRollback = Flags.recoverabilityDetection() ? !(installRequest.isRollback() && installRequest.getInstallSource().mInitiatingPackageName.equals("android")) : true; return (!instantApp || Global.getInt(context.getContentResolver(), return (!instantApp || Global.getInt(context.getContentResolver(), Global.INSTANT_APP_DEXOPT_ENABLED, 0) != 0) Global.INSTANT_APP_DEXOPT_ENABLED, 0) != 0) Loading @@ -773,7 +778,8 @@ public final class DexOptHelper { && !pkg.isDebuggable() && !pkg.isDebuggable() && (!onIncremental) && (!onIncremental) && dexoptOptions.isCompilationEnabled() && dexoptOptions.isCompilationEnabled() && !isApex; && !isApex && performDexOptForRollback; } } private static class StagedApexObserver extends IStagedApexObserver.Stub { private static class StagedApexObserver extends IStagedApexObserver.Stub { Loading
services/core/java/com/android/server/pm/VerifyingSession.java +11 −1 Original line number Original line Diff line number Diff line Loading @@ -141,6 +141,8 @@ final class VerifyingSession { @NonNull @NonNull private final PackageManagerService mPm; private final PackageManagerService mPm; private final int mInstallReason; VerifyingSession(UserHandle user, File stagedDir, IPackageInstallObserver2 observer, VerifyingSession(UserHandle user, File stagedDir, IPackageInstallObserver2 observer, PackageInstaller.SessionParams sessionParams, InstallSource installSource, PackageInstaller.SessionParams sessionParams, InstallSource installSource, int installerUid, SigningDetails signingDetails, int sessionId, PackageLite lite, int installerUid, SigningDetails signingDetails, int sessionId, PackageLite lite, Loading Loading @@ -168,6 +170,7 @@ final class VerifyingSession { mUserActionRequiredType = sessionParams.requireUserAction; mUserActionRequiredType = sessionParams.requireUserAction; mIsInherit = sessionParams.mode == MODE_INHERIT_EXISTING; mIsInherit = sessionParams.mode == MODE_INHERIT_EXISTING; mIsStaged = sessionParams.isStaged; mIsStaged = sessionParams.isStaged; mInstallReason = sessionParams.installReason; } } @Override @Override Loading @@ -190,7 +193,9 @@ final class VerifyingSession { // Perform package verification and enable rollback (unless we are simply moving the // Perform package verification and enable rollback (unless we are simply moving the // package). // package). if (!mOriginInfo.mExisting) { if (!mOriginInfo.mExisting) { if (!isApex() && !isArchivedInstallation()) { final boolean verifyForRollback = Flags.recoverabilityDetection() ? !isARollback() : true; if (!isApex() && !isArchivedInstallation() && verifyForRollback) { // TODO(b/182426975): treat APEX as APK when APK verification is concerned // TODO(b/182426975): treat APEX as APK when APK verification is concerned sendApkVerificationRequest(pkgLite); sendApkVerificationRequest(pkgLite); } } Loading @@ -200,6 +205,11 @@ final class VerifyingSession { } } } } private boolean isARollback() { return mInstallReason == PackageManager.INSTALL_REASON_ROLLBACK && mInstallSource.mInitiatingPackageName.equals("android"); } private void sendApkVerificationRequest(PackageInfoLite pkgLite) { private void sendApkVerificationRequest(PackageInfoLite pkgLite) { final int verificationId = mPm.mPendingVerificationToken++; final int verificationId = mPm.mPendingVerificationToken++; Loading
services/java/com/android/server/SystemServer.java +30 −8 Original line number Original line Diff line number Diff line Loading @@ -47,6 +47,7 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManagerInternal; import android.content.pm.PackageManagerInternal; import android.content.res.Configuration; import android.content.res.Configuration; import android.content.res.Resources.Theme; import android.content.res.Resources.Theme; import android.crashrecovery.flags.Flags; import android.credentials.CredentialManager; import android.credentials.CredentialManager; import android.database.sqlite.SQLiteCompatibilityWalFlags; import android.database.sqlite.SQLiteCompatibilityWalFlags; import android.database.sqlite.SQLiteGlobal; import android.database.sqlite.SQLiteGlobal; Loading Loading @@ -1195,11 +1196,13 @@ public final class SystemServer implements Dumpable { mSystemServiceManager.startService(RecoverySystemService.Lifecycle.class); mSystemServiceManager.startService(RecoverySystemService.Lifecycle.class); t.traceEnd(); t.traceEnd(); if (!Flags.recoverabilityDetection()) { // Now that we have the bare essentials of the OS up and running, take // Now that we have the bare essentials of the OS up and running, take // note that we just booted, which might send out a rescue party if // note that we just booted, which might send out a rescue party if // we're stuck in a runtime restart loop. // we're stuck in a runtime restart loop. RescueParty.registerHealthObserver(mSystemContext); RescueParty.registerHealthObserver(mSystemContext); PackageWatchdog.getInstance(mSystemContext).noteBoot(); PackageWatchdog.getInstance(mSystemContext).noteBoot(); } // Manages LEDs and display backlight so we need it to bring up the display. // Manages LEDs and display backlight so we need it to bring up the display. t.traceBegin("StartLightsService"); t.traceBegin("StartLightsService"); Loading Loading @@ -1469,10 +1472,13 @@ public final class SystemServer implements Dumpable { boolean enableVrService = context.getPackageManager().hasSystemFeature( boolean enableVrService = context.getPackageManager().hasSystemFeature( PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE); PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE); if (!Flags.recoverabilityDetection()) { // For debugging RescueParty // For debugging RescueParty if (Build.IS_DEBUGGABLE && SystemProperties.getBoolean("debug.crash_system", false)) { if (Build.IS_DEBUGGABLE && SystemProperties.getBoolean("debug.crash_system", false)) { throw new RuntimeException(); throw new RuntimeException(); } } } try { try { final String SECONDARY_ZYGOTE_PRELOAD = "SecondaryZygotePreload"; final String SECONDARY_ZYGOTE_PRELOAD = "SecondaryZygotePreload"; Loading Loading @@ -2910,6 +2916,14 @@ public final class SystemServer implements Dumpable { mPackageManagerService.systemReady(); mPackageManagerService.systemReady(); t.traceEnd(); t.traceEnd(); if (Flags.recoverabilityDetection()) { // Now that we have the essential services needed for rescue party, initialize // RescuParty. note that we just booted, which might send out a rescue party if // we're stuck in a runtime restart loop. RescueParty.registerHealthObserver(mSystemContext); PackageWatchdog.getInstance(mSystemContext).noteBoot(); } t.traceBegin("MakeDisplayManagerServiceReady"); t.traceBegin("MakeDisplayManagerServiceReady"); try { try { // TODO: use boot phase and communicate this flag some other way // TODO: use boot phase and communicate this flag some other way Loading Loading @@ -3313,6 +3327,14 @@ public final class SystemServer implements Dumpable { * are updated outside of OTA; and to avoid breaking dependencies from system into apexes. * are updated outside of OTA; and to avoid breaking dependencies from system into apexes. */ */ private void startApexServices(@NonNull TimingsTraceAndSlog t) { private void startApexServices(@NonNull TimingsTraceAndSlog t) { if (Flags.recoverabilityDetection()) { // For debugging RescueParty if (Build.IS_DEBUGGABLE && SystemProperties.getBoolean("debug.crash_system", false)) { throw new RuntimeException(); } } t.traceBegin("startApexServices"); t.traceBegin("startApexServices"); // TODO(b/192880996): get the list from "android" package, once the manifest entries // TODO(b/192880996): get the list from "android" package, once the manifest entries // are migrated to system manifest. // are migrated to system manifest. Loading