Merge "Clear calling identity when binding a11y services" into nyc-dev

am: b72c306

* commit 'b72c30653dc9652d9c6beba979e5ea194c1a4638':
  Clear calling identity when binding a11y services

Change-Id: I0bb94ebc66098ca173f3b46e1ebdc87aad937b3f
This commit is contained in:
Phil Weaver
2016-04-20 16:39:50 +00:00
committed by android-build-merger

View File

@@ -2296,11 +2296,16 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
public boolean bindLocked() { public boolean bindLocked() {
UserState userState = getUserStateLocked(mUserId); UserState userState = getUserStateLocked(mUserId);
if (!mIsAutomation) { if (!mIsAutomation) {
if (mService == null && mContext.bindServiceAsUser( final long identity = Binder.clearCallingIdentity();
mIntent, this, try {
Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE, if (mService == null && mContext.bindServiceAsUser(
new UserHandle(mUserId))) { mIntent, this,
userState.mBindingServices.add(mComponentName); Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE,
new UserHandle(mUserId))) {
userState.mBindingServices.add(mComponentName);
}
} finally {
Binder.restoreCallingIdentity(identity);
} }
} else { } else {
userState.mBindingServices.add(mComponentName); userState.mBindingServices.add(mComponentName);