diff options
| author | 2023-11-07 12:26:03 +0800 | |
|---|---|---|
| committer | 2023-11-09 12:14:16 +0000 | |
| commit | 9e87fc384a03c0091e19b58b63a495e83145c296 (patch) | |
| tree | 58113409ca782fe575347ff457f4f9aae0e03726 | |
| parent | 731829eccff2890aa1157eae708a70904254c088 (diff) | |
Add hidden API getDataSaverViaCmFlag() for CTS
The CtsHostsideNetworkTests:com.android.cts.net.
HostsideNetworkCallbackTests needs to know whether trunk flag is enabled
or not. But there is no stable way to read the flag from CTS for module.
So adds this hidden API in platform.
Bug: 288340533
Test: atest
CtsHostsideNetworkTests: com.android.cts.net.HostsideNetworkCallbackTests
Change-Id: I02cea917a3f75f11d6ea5754a6ea0d460f1372c9
| -rw-r--r-- | core/java/android/net/NetworkStack.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/java/android/net/NetworkStack.java b/core/java/android/net/NetworkStack.java index dbb312720373..19ba6a1d22ed 100644 --- a/core/java/android/net/NetworkStack.java +++ b/core/java/android/net/NetworkStack.java @@ -23,6 +23,7 @@ import android.content.Context; import android.os.IBinder; import android.os.ServiceManager; +import com.android.net.flags.Flags; import com.android.net.module.util.PermissionUtils; /** * Constants and utilities for client code communicating with the network stack service. @@ -103,4 +104,16 @@ public class NetworkStack { final @NonNull String... otherPermissions) { PermissionUtils.enforceNetworkStackPermissionOr(context, otherPermissions); } + + /** + * Get setting of the "set_data_saver_via_cm" flag. + * + * @hide + */ + // A workaround for aconfig. Currently, aconfig value read from platform and mainline code can + // be inconsistent. To avoid the problem, CTS for mainline code can get the flag value by this + // method. + public static boolean getDataSaverViaCmFlag() { + return Flags.setDataSaverViaCm(); + } } |