Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec30ca35 authored by Fyodor Kupolov's avatar Fyodor Kupolov
Browse files

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
parent d430f1a0
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -1303,15 +1303,17 @@ public class UserManagerService extends IUserManager.Stub {
        }

        if (mAppOpsService != null) { // We skip it until system-ready.
            final long token = Binder.clearCallingIdentity();
            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");
            } finally {
                Binder.restoreCallingIdentity(token);
                    }
                }
            });
        }

        propagateUserRestrictionsLR(userId, effective, prevAppliedRestrictions);