Internal API for system apps to determine default network for other apps
Callers with CONNECTIVITY_INTERNAL permission can read off the netId that an application is assigned to by default. Necessary for making connections as the default network for a client app eg. when downloading stuff on its behalf. Bug: 27074270 Change-Id: I8d35e8e99126875f55f3c545090326f3e9be43fb
This commit is contained in:
parent
fc254678ee
commit
da4d2e2b67
1 changed files with 36 additions and 1 deletions
|
|
@ -1006,7 +1006,16 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
@Override
|
||||
public Network getActiveNetwork() {
|
||||
enforceAccessPermission();
|
||||
final int uid = Binder.getCallingUid();
|
||||
return getActiveNetworkForUidInternal(Binder.getCallingUid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Network getActiveNetworkForUid(int uid) {
|
||||
enforceConnectivityInternalPermission();
|
||||
return getActiveNetworkForUidInternal(uid);
|
||||
}
|
||||
|
||||
private Network getActiveNetworkForUidInternal(final int uid) {
|
||||
final int user = UserHandle.getUserId(uid);
|
||||
int vpnNetId = NETID_UNSET;
|
||||
synchronized (mVpns) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue