am db6dab35: Merge "Clear binder identity before dispatching ap op mode changes." into mnc-dev

* commit 'db6dab359c0ab6e5ef3d2702c717e6f5908b8e3b':
  Clear binder identity before dispatching ap op mode changes.
This commit is contained in:
Svet Ganov
2015-05-19 20:04:19 +00:00
committed by Android Git Automerger

View File

@@ -408,11 +408,19 @@ public class AppOpsService extends IAppOpsService.Stub {
}
}
if (repCbs != null) {
for (int i=0; i<repCbs.size(); i++) {
try {
repCbs.get(i).mCallback.opChanged(code, packageName);
} catch (RemoteException e) {
// There are components watching for mode changes such as window manager
// and location manager which are in our process. The callbacks in these
// components may require permissions our remote caller does not have.
final long identity = Binder.clearCallingIdentity();
try {
for (int i = 0; i < repCbs.size(); i++) {
try {
repCbs.get(i).mCallback.opChanged(code, packageName);
} catch (RemoteException e) {
}
}
} finally {
Binder.restoreCallingIdentity(identity);
}
}
}