Call AppOpsService from the handler thread
Otherwise it may cause deadlocks, for instance if updateUserRestrictionsInternalLR is called with AMS lock held. Bug: 28888422 Change-Id: I455c7392f206ff0bb6c99ec5c4a531921a115070
This commit is contained in:
@@ -1303,14 +1303,16 @@ public class UserManagerService extends IUserManager.Stub {
|
||||
}
|
||||
|
||||
if (mAppOpsService != null) { // We skip it until system-ready.
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
mAppOpsService.setUserRestrictions(effective, mUserRestriconToken, userId);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(LOG_TAG, "Unable to notify AppOpsService of UserRestrictions");
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
mAppOpsService.setUserRestrictions(effective, mUserRestriconToken, userId);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(LOG_TAG, "Unable to notify AppOpsService of UserRestrictions");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
propagateUserRestrictionsLR(userId, effective, prevAppliedRestrictions);
|
||||
|
||||
Reference in New Issue
Block a user