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

Commit e313f13b authored by Harshit Mahajan's avatar Harshit Mahajan
Browse files

Remove EventLogTags depdendency

Inline functions and copy constants to the service.

Bug: 289203818
Test: TH
Flag: EXEMPT refactor
Change-Id: Ie305348efea99be168e86f070034dc503a6ad1aa
parent ffd04a7f
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -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.
+11 −2
Original line number Diff line number Diff line
@@ -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;