From e7b214ce34aa6e65e36055069bb4044bd635ef24 Mon Sep 17 00:00:00 2001 From: Daniel Rosenberg Date: Mon, 26 Aug 2019 19:29:45 -0700 Subject: [PATCH] Use mContext directly, and enforce via logging We already have the context saved, so we can just use that. Add a log statement so we can test for the existence of this patch from a CTS test. Test: Edited code to force expection path to be called, confirmed reboot happens Bug: 138952436 Bug: 140111727 Bug: 144312171 Change-Id: Iaceec82d4716837158d1233400b4a44cbf67a5e8 Merged-In: Iaceec82d4716837158d1233400b4a44cbf67a5e8 --- .../java/com/android/server/am/ActivityManagerService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 5af1480af94bb..d07ec48ea5854 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -5276,11 +5276,14 @@ public class ActivityManagerService extends IActivityManager.Stub // Inform checkpointing systems of success try { + // This line is needed to CTS test for the correct exception handling + // See b/138952436#comment36 for context + Slog.i(TAG, "About to commit checkpoint"); IStorageManager storageManager = PackageHelper.getStorageManager(); storageManager.commitChanges(); } catch (Exception e) { PowerManager pm = (PowerManager) - mInjector.getContext().getSystemService(Context.POWER_SERVICE); + mContext.getSystemService(Context.POWER_SERVICE); pm.reboot("Checkpoint commit failed"); }