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

Commit ab0c5d28 authored by Harshit Mahajan's avatar Harshit Mahajan Committed by Automerger Merge Worker
Browse files

Merge "Refactoring RescueParty for CrashRecovery" into main am: 01fdab6a am: 628aaed4

parents 9009f3e9 628aaed4
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ import android.provider.Settings;
import android.sysprop.CrashRecoveryProperties;
import android.text.TextUtils;
import android.util.ArraySet;
import android.util.ExceptionUtils;
import android.util.Log;
import android.util.Slog;

@@ -136,7 +135,7 @@ public class RescueParty {
        }

        // We're disabled on all engineering devices
        if (Build.IS_ENG) {
        if (Build.TYPE.equals("eng")) {
            Slog.v(TAG, "Disabled because of eng build");
            return true;
        }
@@ -144,7 +143,7 @@ public class RescueParty {
        // We're disabled on userdebug devices connected over USB, since that's
        // a decent signal that someone is actively trying to debug the device,
        // or that it's in a lab environment.
        if (Build.IS_USERDEBUG && isUsbActive()) {
        if (Build.TYPE.equals("userdebug") && isUsbActive()) {
            Slog.v(TAG, "Disabled because of active USB connection");
            return true;
        }
@@ -478,9 +477,18 @@ public class RescueParty {
        }
    }

    private static String getCompleteMessage(Throwable t) {
        final StringBuilder builder = new StringBuilder();
        builder.append(t.getMessage());
        while ((t = t.getCause()) != null) {
            builder.append(": ").append(t.getMessage());
        }
        return builder.toString();
    }

    private static void logRescueException(int level, @Nullable String failedPackageName,
            Throwable t) {
        final String msg = ExceptionUtils.getCompleteMessage(t);
        final String msg = getCompleteMessage(t);
        EventLogTags.writeRescueFailure(level, msg);
        String failureMsg = "Failed rescue level " + levelToString(level);
        if (!TextUtils.isEmpty(failedPackageName)) {