Add multipath preference, background status API
Add APIs for getMultipathPreference and getRestrictBackgroundStatus.
Both are used by Connectivity to back the external
ConnectivityManager.getRestrictBackgroundStatus, and
ConnectivityManager.getMultipathPreference APIs.
Test: atest CtsNetTestCases
atest ConnectivityServiceTests
atest NetworkPolicyManagerServiceTest
Bug: 176289731
Change-Id: I8a03162b2f6691086bb64e75ffd354cdfca7f86a
Merged-In: I8a03162b2f6691086bb64e75ffd354cdfca7f86a
This commit is contained in:
committed by
Lorenzo Colitti
parent
3a5b922890
commit
e62e7ff645
@@ -62,7 +62,6 @@ import android.os.PersistableBundle;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ResultReceiver;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.ServiceSpecificException;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
@@ -842,7 +841,6 @@ public class ConnectivityManager {
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
private INetworkPolicyManager mNPManager;
|
||||
private final TetheringManager mTetheringManager;
|
||||
|
||||
/**
|
||||
@@ -4794,17 +4792,6 @@ public class ConnectivityManager {
|
||||
public @interface RestrictBackgroundStatus {
|
||||
}
|
||||
|
||||
private INetworkPolicyManager getNetworkPolicyManager() {
|
||||
synchronized (this) {
|
||||
if (mNPManager != null) {
|
||||
return mNPManager;
|
||||
}
|
||||
mNPManager = INetworkPolicyManager.Stub.asInterface(ServiceManager
|
||||
.getService(Context.NETWORK_POLICY_SERVICE));
|
||||
return mNPManager;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the calling application is subject to metered network restrictions while
|
||||
* running on background.
|
||||
@@ -4815,7 +4802,7 @@ public class ConnectivityManager {
|
||||
*/
|
||||
public @RestrictBackgroundStatus int getRestrictBackgroundStatus() {
|
||||
try {
|
||||
return getNetworkPolicyManager().getRestrictBackgroundByCaller();
|
||||
return mService.getRestrictBackgroundStatusByCaller();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user