Merge "Make tetherChangePermission to be secured for AppOps permission"
This commit is contained in:
commit
fd01e5ee14
1 changed files with 44 additions and 25 deletions
|
|
@ -2949,8 +2949,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
|
||||
// javadoc from interface
|
||||
@Override
|
||||
public int tether(String iface) {
|
||||
ConnectivityManager.enforceTetherChangePermission(mContext);
|
||||
public int tether(String iface, String callerPkg) {
|
||||
ConnectivityManager.enforceTetherChangePermission(mContext, callerPkg);
|
||||
if (isTetheringSupported()) {
|
||||
final int status = mTethering.tether(iface);
|
||||
return status;
|
||||
|
|
@ -2961,8 +2961,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
|
||||
// javadoc from interface
|
||||
@Override
|
||||
public int untether(String iface) {
|
||||
ConnectivityManager.enforceTetherChangePermission(mContext);
|
||||
public int untether(String iface, String callerPkg) {
|
||||
ConnectivityManager.enforceTetherChangePermission(mContext, callerPkg);
|
||||
|
||||
if (isTetheringSupported()) {
|
||||
final int status = mTethering.untether(iface);
|
||||
|
|
@ -3016,8 +3016,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
}
|
||||
|
||||
@Override
|
||||
public int setUsbTethering(boolean enable) {
|
||||
ConnectivityManager.enforceTetherChangePermission(mContext);
|
||||
public int setUsbTethering(boolean enable, String callerPkg) {
|
||||
ConnectivityManager.enforceTetherChangePermission(mContext, callerPkg);
|
||||
if (isTetheringSupported()) {
|
||||
return mTethering.setUsbTethering(enable);
|
||||
} else {
|
||||
|
|
@ -3076,8 +3076,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
}
|
||||
|
||||
@Override
|
||||
public void startTethering(int type, ResultReceiver receiver, boolean showProvisioningUi) {
|
||||
ConnectivityManager.enforceTetherChangePermission(mContext);
|
||||
public void startTethering(int type, ResultReceiver receiver, boolean showProvisioningUi,
|
||||
String callerPkg) {
|
||||
ConnectivityManager.enforceTetherChangePermission(mContext, callerPkg);
|
||||
if (!isTetheringSupported()) {
|
||||
receiver.send(ConnectivityManager.TETHER_ERROR_UNSUPPORTED, null);
|
||||
return;
|
||||
|
|
@ -3086,8 +3087,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
}
|
||||
|
||||
@Override
|
||||
public void stopTethering(int type) {
|
||||
ConnectivityManager.enforceTetherChangePermission(mContext);
|
||||
public void stopTethering(int type, String callerPkg) {
|
||||
ConnectivityManager.enforceTetherChangePermission(mContext, callerPkg);
|
||||
mTethering.stopTethering(type);
|
||||
}
|
||||
|
||||
|
|
@ -5465,8 +5466,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
|
||||
if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) {
|
||||
// Untether
|
||||
String pkgName = mContext.getOpPackageName();
|
||||
for (String tether : getTetheredIfaces()) {
|
||||
untether(tether);
|
||||
untether(tether, pkgName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue