From a5df6ab5394613618b20947b8369b87f44fabccc Mon Sep 17 00:00:00 2001 From: Songchun Fan Date: Fri, 11 Dec 2020 15:22:54 -0800 Subject: [PATCH] [am/SettingsProvider] use ForUser method to get AnrShowBackground Settings Instead of using user 0, use the settings value for the correct user handle. BUG: 166312046 Test: builds Change-Id: I07291a27747c6067ffc73b92e6683ab61bdc19c2 --- .../java/com/android/server/am/AppErrors.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/am/AppErrors.java b/services/core/java/com/android/server/am/AppErrors.java index 0b4d27f4990b4..f2c1e90e24762 100644 --- a/services/core/java/com/android/server/am/AppErrors.java +++ b/services/core/java/com/android/server/am/AppErrors.java @@ -756,8 +756,9 @@ class AppErrors { boolean handleAppCrashLocked(ProcessRecord app, String reason, String shortMsg, String longMsg, String stackTrace, AppErrorDialog.Data data) { final long now = SystemClock.uptimeMillis(); - final boolean showBackground = Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0; + final boolean showBackground = Settings.Secure.getIntForUser(mContext.getContentResolver(), + Settings.Secure.ANR_SHOW_BACKGROUND, 0, + mService.mUserController.getCurrentUserId()) != 0; final boolean procIsBoundForeground = (app.getCurProcState() == ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE); @@ -889,8 +890,9 @@ class AppErrors { void handleShowAppErrorUi(Message msg) { AppErrorDialog.Data data = (AppErrorDialog.Data) msg.obj; - boolean showBackground = Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0; + boolean showBackground = Settings.Secure.getIntForUser(mContext.getContentResolver(), + Settings.Secure.ANR_SHOW_BACKGROUND, 0, + mService.mUserController.getCurrentUserId()) != 0; final int userId; synchronized (mService) { @@ -982,8 +984,9 @@ class AppErrors { return; } - boolean showBackground = Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0; + boolean showBackground = Settings.Secure.getIntForUser(mContext.getContentResolver(), + Settings.Secure.ANR_SHOW_BACKGROUND, 0, + mService.mUserController.getCurrentUserId()) != 0; if (mService.mAtmInternal.canShowErrorDialogs() || showBackground) { proc.getDialogController().showAnrDialogs(data); } else {