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

Commit cf6a399e authored by Gavin Corkery's avatar Gavin Corkery
Browse files

Log native crashing process

Use the new sys.init.updatable_crashing_process_name in
Watchdog-triggered rollback logs in order to track the
process that causes updatable_crashing to be set.

Test: Run atest StagedRollbackTest#testNativeWatchdogTriggersRollback,
      manually test correct process "zygote" is sent to logs.
Bug: 138782888

Change-Id: I81b55dbf9dc74c9b8d505988b99f7e97ef659fe9
parent 3ee1b172
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -393,13 +393,20 @@ public final class RollbackPackageHealthObserver implements PackageHealthObserve
            @FailureReasons int rollbackReason) {
        final RollbackManager rollbackManager = mContext.getSystemService(RollbackManager.class);
        int reasonToLog = mapFailureReasonToMetric(rollbackReason);
        final String failedPackageToLog;
        if (rollbackReason == PackageWatchdog.FAILURE_REASON_NATIVE_CRASH) {
            failedPackageToLog = SystemProperties.get(
                    "sys.init.updatable_crashing_process_name", "");
        } else {
            failedPackageToLog = failedPackage.getPackageName();
        }
        final VersionedPackage logPackage = isModule(failedPackage.getPackageName())
                ? getModuleMetadataPackage()
                : null;

        logEvent(logPackage,
                StatsLog.WATCHDOG_ROLLBACK_OCCURRED__ROLLBACK_TYPE__ROLLBACK_INITIATE,
                reasonToLog, failedPackage.getPackageName());
                reasonToLog, failedPackageToLog);
        final LocalIntentReceiver rollbackReceiver = new LocalIntentReceiver((Intent result) -> {
            int status = result.getIntExtra(RollbackManager.EXTRA_STATUS,
                    RollbackManager.STATUS_FAILURE);
@@ -417,12 +424,12 @@ public final class RollbackPackageHealthObserver implements PackageHealthObserve
                } else {
                    logEvent(logPackage,
                            StatsLog.WATCHDOG_ROLLBACK_OCCURRED__ROLLBACK_TYPE__ROLLBACK_SUCCESS,
                            reasonToLog, failedPackage.getPackageName());
                            reasonToLog, failedPackageToLog);
                }
            } else {
                logEvent(logPackage,
                        StatsLog.WATCHDOG_ROLLBACK_OCCURRED__ROLLBACK_TYPE__ROLLBACK_FAILURE,
                        reasonToLog, failedPackage.getPackageName());
                        reasonToLog, failedPackageToLog);
            }
        });