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

Commit 2abeafcf authored by Jerry Chang's avatar Jerry Chang Committed by Android (Google) Code Review
Browse files

Merge "Clear binder identity while dumping pre-reboot logs"

parents 9be59a73 7d7c22a8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.power;
import android.annotation.DurationMillisLong;
import android.annotation.NonNull;
import android.content.Context;
import android.os.Binder;
import android.os.Environment;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
@@ -146,6 +147,7 @@ final class PreRebootLogger {
            return;
        }

        final long token = Binder.clearCallingIdentity();
        try {
            final File dumpFile = new File(dumpDir, serviceName);
            final ParcelFileDescriptor fd = ParcelFileDescriptor.open(dumpFile,
@@ -154,6 +156,8 @@ final class PreRebootLogger {
            binder.dump(fd.getFileDescriptor(), ArrayUtils.emptyArray(String.class));
        } catch (FileNotFoundException | RemoteException e) {
            Slog.e(TAG, String.format("Failed to dump %s service before reboot", serviceName), e);
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
}