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

Commit d470e927 authored by Yi Kong's avatar Yi Kong
Browse files

profcollect: Guard binder calls with null checks

In case of profcollectd dies, mIProfcollect will become null. Guard all calls to mIProfcollect with null checks to prevent NPE.

Change-Id: I0908bd2413f77a44a00e2692bb027ba580ecbec6
Test: presubmit
Bug: 354339294
parent debe12db
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -354,6 +354,9 @@ public final class ProfcollectForwardingService extends SystemService {

    private static void createAndUploadReport(ProfcollectForwardingService pfs) {
        BackgroundThread.get().getThreadHandler().post(() -> {
            if (pfs.mIProfcollect == null) {
                return;
            }
            String reportName;
            try {
                reportName = pfs.mIProfcollect.report(pfs.mUsageSetting) + ".zip";
@@ -401,6 +404,9 @@ public final class ProfcollectForwardingService extends SystemService {
                final int traceDuration = 5000;
                final String traceTag = "camera";
                BackgroundThread.get().getThreadHandler().post(() -> {
                    if (mIProfcollect == null) {
                        return;
                    }
                    try {
                        mIProfcollect.trace_process(traceTag, "android.hardware.camera.provider",
                                traceDuration);