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

Commit 4a895309 authored by Jeremy Klein's avatar Jeremy Klein Committed by Gerrit Code Review
Browse files

Merge "In isTetheringSupported, call isAdmin user from system."

parents f0c963a5 246a1fee
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -3082,7 +3082,17 @@ public class ConnectivityService extends IConnectivityManager.Stub
        boolean tetherEnabledInSettings = (Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.TETHER_SUPPORTED, defaultVal) != 0)
                && !mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING);
        return tetherEnabledInSettings && mUserManager.isAdminUser() &&

        // Elevate to system UID to avoid caller requiring MANAGE_USERS permission.
        boolean adminUser = false;
        final long token = Binder.clearCallingIdentity();
        try {
            adminUser = mUserManager.isAdminUser();
        } finally {
            Binder.restoreCallingIdentity(token);
        }

        return tetherEnabledInSettings && adminUser &&
               mTethering.hasTetherableConfiguration();
    }