summaryrefslogtreecommitdiff
path: root/packages/Connectivity
diff options
context:
space:
mode:
authorChalard Jean <jchalard@google.com>2021-01-20 20:47:32 +0900
committerChalard Jean <jchalard@google.com>2021-03-19 13:50:56 +0900
commit395bde4d5ffd42a43d40143e723b0bae06aad4be (patch)
treeeaad22e5b76297bf0c3da781de61f92257be8e35 /packages/Connectivity
parentb5dbd7f46da55029d72ff11ece039ae00514b7ef (diff)
[NS03] Mix in other CS-managed properties
These properties are necessary to figure out the maximum score of a network. Test: FrameworksNetTests Change-Id: I48dce20ad4a80597039393dca607e8da829b2a61
Diffstat (limited to 'packages/Connectivity')
-rw-r--r--packages/Connectivity/framework/src/android/net/NetworkAgentConfig.java3
-rw-r--r--packages/Connectivity/framework/src/android/net/NetworkScore.java14
2 files changed, 16 insertions, 1 deletions
diff --git a/packages/Connectivity/framework/src/android/net/NetworkAgentConfig.java b/packages/Connectivity/framework/src/android/net/NetworkAgentConfig.java
index 664c2650ff0c..5e50a6404acb 100644
--- a/packages/Connectivity/framework/src/android/net/NetworkAgentConfig.java
+++ b/packages/Connectivity/framework/src/android/net/NetworkAgentConfig.java
@@ -50,7 +50,8 @@ public final class NetworkAgentConfig implements Parcelable {
* ap in the wifi settings to trigger a connection is explicit. A 3rd party app asking to
* connect to a particular access point is also explicit, though this may change in the future
* as we want apps to use the multinetwork apis.
- *
+ * TODO : this is a bad name, because it sounds like the user just tapped on the network.
+ * It's not necessarily the case ; auto-reconnection to WiFi has this true for example.
* @hide
*/
public boolean explicitlySelected;
diff --git a/packages/Connectivity/framework/src/android/net/NetworkScore.java b/packages/Connectivity/framework/src/android/net/NetworkScore.java
index e640737168a3..eadcb2d0a7f4 100644
--- a/packages/Connectivity/framework/src/android/net/NetworkScore.java
+++ b/packages/Connectivity/framework/src/android/net/NetworkScore.java
@@ -20,6 +20,8 @@ import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
+import com.android.internal.annotations.VisibleForTesting;
+
/**
* Object representing the quality of a network as perceived by the user.
*
@@ -35,6 +37,10 @@ public final class NetworkScore implements Parcelable {
// Agent-managed policies
// TODO : add them here, starting from 1
+ /** @hide */
+ public static final int MIN_AGENT_MANAGED_POLICY = 0;
+ /** @hide */
+ public static final int MAX_AGENT_MANAGED_POLICY = -1;
// Bitmask of all the policies applied to this score.
private final long mPolicies;
@@ -54,6 +60,14 @@ public final class NetworkScore implements Parcelable {
return mLegacyInt;
}
+ /**
+ * @return whether this score has a particular policy.
+ */
+ @VisibleForTesting
+ public boolean hasPolicy(final int policy) {
+ return 0 != (mPolicies & (1L << policy));
+ }
+
@Override
public String toString() {
return "Score(" + mLegacyInt + ")";