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

This commit is contained in:
Phil Weaver
2016-04-20 16:33:26 +00:00
committed by Android (Google) Code Review

View File

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