OSDN Git Service

clear calling identity before calling settings provider
authorTony Mak <tonymak@google.com>
Wed, 12 Apr 2017 11:59:38 +0000 (12:59 +0100)
committerTony Mak <tonymak@google.com>
Wed, 12 Apr 2017 12:01:34 +0000 (13:01 +0100)
Test: Run a instrumentation test
cts-tradefed run cts-dev --module DevicePolicyManager --test com.android.cts.devicepolicy.ManagedProfileTest#testPhoneAccountVisibility

Change-Id: I29b1dc307e9e127b919aebe4d83ab6311ce36f2d
Fix: 34320197

services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java

index cb6d4df..e778666 100644 (file)
@@ -2036,10 +2036,16 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
         }
         if (!shortcutServiceIsInstalled) {
             userState.mServiceToEnableWithShortcut = null;
-            Settings.Secure.putStringForUser(mContext.getContentResolver(),
-                    Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE, null, userState.mUserId);
-            Settings.Secure.putIntForUser(mContext.getContentResolver(),
-                    Settings.Secure.ACCESSIBILITY_SHORTCUT_ENABLED, 0, userState.mUserId);
+            final long identity = Binder.clearCallingIdentity();
+            try {
+                Settings.Secure.putStringForUser(mContext.getContentResolver(),
+                        Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE, null, userState.mUserId);
+
+                Settings.Secure.putIntForUser(mContext.getContentResolver(),
+                        Settings.Secure.ACCESSIBILITY_SHORTCUT_ENABLED, 0, userState.mUserId);
+            } finally {
+                Binder.restoreCallingIdentity(identity);
+            }
         }
     }