Simplfy getActive* calls in ConnectivityService
One had been simplified on GB, but somehow it didn't make it here. bug: 4463770 Change-Id: Ica51e836b1a7a489526a223168910b8e06c99c2b
This commit is contained in:
@@ -540,21 +540,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
* active
|
||||
*/
|
||||
public NetworkInfo getActiveNetworkInfo() {
|
||||
enforceAccessPermission();
|
||||
for (int type=0; type <= ConnectivityManager.MAX_NETWORK_TYPE; type++) {
|
||||
if (mNetConfigs[type] == null || !mNetConfigs[type].isDefault()) {
|
||||
continue;
|
||||
}
|
||||
NetworkStateTracker t = mNetTrackers[type];
|
||||
NetworkInfo info = t.getNetworkInfo();
|
||||
if (info.isConnected()) {
|
||||
if (DBG && type != mActiveDefaultNetwork) {
|
||||
loge("connected default network is not mActiveDefaultNetwork!");
|
||||
}
|
||||
return info;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return getNetworkInfo(mActiveDefaultNetwork);
|
||||
}
|
||||
|
||||
public NetworkInfo getNetworkInfo(int networkType) {
|
||||
@@ -586,18 +572,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
* none is active
|
||||
*/
|
||||
public LinkProperties getActiveLinkProperties() {
|
||||
enforceAccessPermission();
|
||||
for (int type=0; type <= ConnectivityManager.MAX_NETWORK_TYPE; type++) {
|
||||
if (mNetConfigs[type] == null || !mNetConfigs[type].isDefault()) {
|
||||
continue;
|
||||
}
|
||||
NetworkStateTracker t = mNetTrackers[type];
|
||||
NetworkInfo info = t.getNetworkInfo();
|
||||
if (info.isConnected()) {
|
||||
return t.getLinkProperties();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return getLinkProperties(mActiveDefaultNetwork);
|
||||
}
|
||||
|
||||
public LinkProperties getLinkProperties(int networkType) {
|
||||
|
||||
Reference in New Issue
Block a user