From d3b21f910a1f1b44be5c1f6dcf88c4b7502e1cb5 Mon Sep 17 00:00:00 2001 From: Yi Kong Date: Wed, 14 Sep 2022 14:25:32 +0800 Subject: [PATCH] profcollect: Fix possible NPE in ProfcollectBGJobService The native service might have died, in which case, abort. Test: presubmit Bug: 246660820 Change-Id: I171a0031db104d2c008ee7ef9709f15f76d70b1a --- .../server/profcollect/ProfcollectForwardingService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java index 3c6866205fdaa..f05b1d47ac0bf 100644 --- a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java +++ b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java @@ -218,6 +218,9 @@ public final class ProfcollectForwardingService extends SystemService { BackgroundThread.get().getThreadHandler().post( () -> { try { + if (sSelfService.mIProfcollect == null) { + return; + } sSelfService.mIProfcollect.process(); } catch (RemoteException e) { Log.e(LOG_TAG, "Failed to process profiles in background: "