diff options
| -rw-r--r-- | services/core/java/com/android/server/PackageWatchdog.java | 10 | ||||
| -rw-r--r-- | services/core/java/com/android/server/RescueParty.java | 13 |
2 files changed, 20 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/PackageWatchdog.java b/services/core/java/com/android/server/PackageWatchdog.java index 9060250d9869..2acedd56e505 100644 --- a/services/core/java/com/android/server/PackageWatchdog.java +++ b/services/core/java/com/android/server/PackageWatchdog.java @@ -47,6 +47,7 @@ import android.text.TextUtils; import android.util.ArrayMap; import android.util.ArraySet; import android.util.AtomicFile; +import android.util.EventLog; import android.util.IndentingPrintWriter; import android.util.LongArrayQueue; import android.util.Slog; @@ -200,6 +201,13 @@ public class PackageWatchdog { // aborted. private static final String METADATA_FILE = "/metadata/watchdog/mitigation_count.txt"; + /** + * EventLog tags used when logging into the event log. Note the values must be sync with + * frameworks/base/services/core/java/com/android/server/EventLogTags.logtags to get correct + * name translation. + */ + private static final int LOG_TAG_RESCUE_NOTE = 2900; + private static final Object sPackageWatchdogLock = new Object(); @GuardedBy("sPackageWatchdogLock") private static PackageWatchdog sPackageWatchdog; @@ -2024,7 +2032,7 @@ public class PackageWatchdog { } else { int count = getCount() + 1; setCount(count); - EventLogTags.writeRescueNote(Process.ROOT_UID, count, window); + EventLog.writeEvent(LOG_TAG_RESCUE_NOTE, Process.ROOT_UID, count, window); if (Flags.recoverabilityDetection()) { // After a reboot (e.g. by WARM_REBOOT or mainline rollback) we apply // mitigations without waiting for DEFAULT_BOOT_LOOP_TRIGGER_COUNT. diff --git a/services/core/java/com/android/server/RescueParty.java b/services/core/java/com/android/server/RescueParty.java index ada19530abfb..feb5775e5aac 100644 --- a/services/core/java/com/android/server/RescueParty.java +++ b/services/core/java/com/android/server/RescueParty.java @@ -42,6 +42,7 @@ import android.provider.Settings; import android.sysprop.CrashRecoveryProperties; import android.text.TextUtils; import android.util.ArraySet; +import android.util.EventLog; import android.util.Log; import android.util.Slog; @@ -154,6 +155,14 @@ public class RescueParty { private static final int PERSISTENT_MASK = ApplicationInfo.FLAG_PERSISTENT | ApplicationInfo.FLAG_SYSTEM; + /** + * EventLog tags used when logging into the event log. Note the values must be sync with + * frameworks/base/services/core/java/com/android/server/EventLogTags.logtags to get correct + * name translation. + */ + private static final int LOG_TAG_RESCUE_SUCCESS = 2902; + private static final int LOG_TAG_RESCUE_FAILURE = 2903; + /** Register the Rescue Party observer as a Package Watchdog health observer */ public static void registerHealthObserver(Context context) { PackageWatchdog.getInstance(context).registerHealthObserver( @@ -523,7 +532,7 @@ public class RescueParty { Slog.w(TAG, "Attempting rescue level " + levelToString(level)); try { executeRescueLevelInternal(context, level, failedPackage); - EventLogTags.writeRescueSuccess(level); + EventLog.writeEvent(LOG_TAG_RESCUE_SUCCESS, level); String successMsg = "Finished rescue level " + levelToString(level); if (!TextUtils.isEmpty(failedPackage)) { successMsg += " for package " + failedPackage; @@ -704,7 +713,7 @@ public class RescueParty { private static void logRescueException(int level, @Nullable String failedPackageName, Throwable t) { final String msg = getCompleteMessage(t); - EventLogTags.writeRescueFailure(level, msg); + EventLog.writeEvent(LOG_TAG_RESCUE_FAILURE, level, msg); String failureMsg = "Failed rescue level " + levelToString(level); if (!TextUtils.isEmpty(failedPackageName)) { failureMsg += " for package " + failedPackageName; |