OSDN Git Service

Fix issue #79541100: [Blueline][PI][SPT]: Watchdog killing process and SIGSEGV
authorDianne Hackborn <hackbod@google.com>
Fri, 11 May 2018 16:46:13 +0000 (09:46 -0700)
committerDianne Hackborn <hackbod@google.com>
Fri, 11 May 2018 16:56:04 +0000 (09:56 -0700)
Bug: 79541100
Test: manual
Change-Id: I1456d27938d99d8ee56e5cde843f505a46c9fc72

services/core/java/com/android/server/AppOpsService.java

index 7f26575..169f2a8 100644 (file)
@@ -228,7 +228,7 @@ public class AppOpsService extends IAppOpsService.Stub {
         public void startMonitoring(ContentResolver resolver) {
             mResolver = resolver;
             mResolver.registerContentObserver(
-                    Settings.Global.getUriFor(Settings.Global.DEVICE_IDLE_CONSTANTS),
+                    Settings.Global.getUriFor(Settings.Global.APP_OPS_CONSTANTS),
                     false, this);
             updateConstants();
         }
@@ -239,20 +239,17 @@ public class AppOpsService extends IAppOpsService.Stub {
         }
 
         private void updateConstants() {
+            String value = mResolver != null ? Settings.Global.getString(mResolver,
+                    Settings.Global.APP_OPS_CONSTANTS) : "";
+
             synchronized (AppOpsService.this) {
                 try {
-                    if (mResolver != null) {
-                        mParser.setString(Settings.Global.getString(mResolver,
-                                Settings.Global.APP_OPS_CONSTANTS));
-                    } else {
-                        mParser.setString("");
-                    }
+                    mParser.setString(value);
                 } catch (IllegalArgumentException e) {
                     // Failed to parse the settings string, log this and move on
                     // with defaults.
                     Slog.e(TAG, "Bad app ops settings", e);
                 }
-
                 STATE_SETTLE_TIME = mParser.getDurationMillis(
                         KEY_STATE_SETTLE_TIME, 10 * 1000L);
             }
@@ -557,8 +554,9 @@ public class AppOpsService extends IAppOpsService.Stub {
     }
 
     public void systemReady() {
+        mConstants.startMonitoring(mContext.getContentResolver());
+
         synchronized (this) {
-            mConstants.startMonitoring(mContext.getContentResolver());
             boolean changed = false;
             for (int i = mUidStates.size() - 1; i >= 0; i--) {
                 UidState uidState = mUidStates.valueAt(i);