Loading services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +21 −16 Original line number Original line Diff line number Diff line Loading @@ -2224,6 +2224,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { AccessibilityServiceInfo mAccessibilityServiceInfo; AccessibilityServiceInfo mAccessibilityServiceInfo; // The service that's bound to this instance. Whenever this value is non-null, this // object is registered as a death recipient IBinder mService; IBinder mService; IAccessibilityServiceClient mServiceInterface; IAccessibilityServiceClient mServiceInterface; Loading Loading @@ -2358,14 +2360,14 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } } } else { } else { userState.mBindingServices.add(mComponentName); userState.mBindingServices.add(mComponentName); mService = userState.mUiAutomationServiceClient.asBinder(); mMainHandler.post(new Runnable() { mMainHandler.post(new Runnable() { @Override @Override public void run() { public void run() { // Simulate asynchronous connection since in onServiceConnected // Simulate asynchronous connection since in onServiceConnected // we may modify the state data in case of an error but bind is // we may modify the state data in case of an error but bind is // called while iterating over the data and bad things can happen. // called while iterating over the data and bad things can happen. onServiceConnected(mComponentName, mService); onServiceConnected(mComponentName, userState.mUiAutomationServiceClient.asBinder()); } } }); }); userState.mUiAutomationService = this; userState.mUiAutomationService = this; Loading Loading @@ -2457,7 +2459,19 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { @Override @Override public void onServiceConnected(ComponentName componentName, IBinder service) { public void onServiceConnected(ComponentName componentName, IBinder service) { synchronized (mLock) { synchronized (mLock) { if (mService != service) { if (mService != null) { mService.unlinkToDeath(this, 0); } mService = service; mService = service; try { mService.linkToDeath(this, 0); } catch (RemoteException re) { Slog.e(LOG_TAG, "Failed registering death link"); binderDied(); return; } } mServiceInterface = IAccessibilityServiceClient.Stub.asInterface(service); mServiceInterface = IAccessibilityServiceClient.Stub.asInterface(service); UserState userState = getUserStateLocked(mUserId); UserState userState = getUserStateLocked(mUserId); addServiceLocked(this, userState); addServiceLocked(this, userState); Loading Loading @@ -3091,7 +3105,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } } public void onAdded() throws RemoteException { public void onAdded() throws RemoteException { linkToOwnDeathLocked(); final long identity = Binder.clearCallingIdentity(); final long identity = Binder.clearCallingIdentity(); try { try { mWindowManagerService.addWindowToken(mOverlayWindowToken, mWindowManagerService.addWindowToken(mOverlayWindowToken, Loading @@ -3108,17 +3121,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } finally { } finally { Binder.restoreCallingIdentity(identity); Binder.restoreCallingIdentity(identity); } } unlinkToOwnDeathLocked(); } public void linkToOwnDeathLocked() throws RemoteException { mService.linkToDeath(this, 0); } public void unlinkToOwnDeathLocked() { if (mService != null) { mService.unlinkToDeath(this, 0); } } } public void resetLocked() { public void resetLocked() { Loading @@ -3131,7 +3133,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } catch (RemoteException re) { } catch (RemoteException re) { /* ignore */ /* ignore */ } } if (mService != null) { mService.unlinkToDeath(this, 0); mService = null; mService = null; } mServiceInterface = null; mServiceInterface = null; } } Loading Loading
services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +21 −16 Original line number Original line Diff line number Diff line Loading @@ -2224,6 +2224,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { AccessibilityServiceInfo mAccessibilityServiceInfo; AccessibilityServiceInfo mAccessibilityServiceInfo; // The service that's bound to this instance. Whenever this value is non-null, this // object is registered as a death recipient IBinder mService; IBinder mService; IAccessibilityServiceClient mServiceInterface; IAccessibilityServiceClient mServiceInterface; Loading Loading @@ -2358,14 +2360,14 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } } } else { } else { userState.mBindingServices.add(mComponentName); userState.mBindingServices.add(mComponentName); mService = userState.mUiAutomationServiceClient.asBinder(); mMainHandler.post(new Runnable() { mMainHandler.post(new Runnable() { @Override @Override public void run() { public void run() { // Simulate asynchronous connection since in onServiceConnected // Simulate asynchronous connection since in onServiceConnected // we may modify the state data in case of an error but bind is // we may modify the state data in case of an error but bind is // called while iterating over the data and bad things can happen. // called while iterating over the data and bad things can happen. onServiceConnected(mComponentName, mService); onServiceConnected(mComponentName, userState.mUiAutomationServiceClient.asBinder()); } } }); }); userState.mUiAutomationService = this; userState.mUiAutomationService = this; Loading Loading @@ -2457,7 +2459,19 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { @Override @Override public void onServiceConnected(ComponentName componentName, IBinder service) { public void onServiceConnected(ComponentName componentName, IBinder service) { synchronized (mLock) { synchronized (mLock) { if (mService != service) { if (mService != null) { mService.unlinkToDeath(this, 0); } mService = service; mService = service; try { mService.linkToDeath(this, 0); } catch (RemoteException re) { Slog.e(LOG_TAG, "Failed registering death link"); binderDied(); return; } } mServiceInterface = IAccessibilityServiceClient.Stub.asInterface(service); mServiceInterface = IAccessibilityServiceClient.Stub.asInterface(service); UserState userState = getUserStateLocked(mUserId); UserState userState = getUserStateLocked(mUserId); addServiceLocked(this, userState); addServiceLocked(this, userState); Loading Loading @@ -3091,7 +3105,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } } public void onAdded() throws RemoteException { public void onAdded() throws RemoteException { linkToOwnDeathLocked(); final long identity = Binder.clearCallingIdentity(); final long identity = Binder.clearCallingIdentity(); try { try { mWindowManagerService.addWindowToken(mOverlayWindowToken, mWindowManagerService.addWindowToken(mOverlayWindowToken, Loading @@ -3108,17 +3121,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } finally { } finally { Binder.restoreCallingIdentity(identity); Binder.restoreCallingIdentity(identity); } } unlinkToOwnDeathLocked(); } public void linkToOwnDeathLocked() throws RemoteException { mService.linkToDeath(this, 0); } public void unlinkToOwnDeathLocked() { if (mService != null) { mService.unlinkToDeath(this, 0); } } } public void resetLocked() { public void resetLocked() { Loading @@ -3131,7 +3133,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } catch (RemoteException re) { } catch (RemoteException re) { /* ignore */ /* ignore */ } } if (mService != null) { mService.unlinkToDeath(this, 0); mService = null; mService = null; } mServiceInterface = null; mServiceInterface = null; } } Loading