Merge "In isTetheringSupported, call isAdmin user from system." am: 4a8953094f

am: 23d6ba12f1

Change-Id: I35f45927c564773c10da78e1476814f0a1c7f1be
This commit is contained in:
Jeremy Klein
2017-03-21 00:04:11 +00:00
committed by android-build-merger

View File

@@ -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();
}