Merge "In isTetheringSupported, call isAdmin user from system." am: 4a8953094f am: 29ac9a546c
am: 0b8756e735 Change-Id: I76d02e97382c0332e3d93383d60e8e7fc9951a08
This commit is contained in:
@@ -3085,7 +3085,17 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
boolean tetherEnabledInSettings = (Settings.Global.getInt(mContext.getContentResolver(),
|
boolean tetherEnabledInSettings = (Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.TETHER_SUPPORTED, defaultVal) != 0)
|
Settings.Global.TETHER_SUPPORTED, defaultVal) != 0)
|
||||||
&& !mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING);
|
&& !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();
|
mTethering.hasTetherableConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user