diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/android/net/ip/IpClient.java | 28 | ||||
-rw-r--r-- | src/com/android/server/connectivity/ipmemorystore/IpMemoryStoreDatabase.java | 28 |
2 files changed, 31 insertions, 25 deletions
diff --git a/src/android/net/ip/IpClient.java b/src/android/net/ip/IpClient.java index f3dcdc8..4860ff3 100644 --- a/src/android/net/ip/IpClient.java +++ b/src/android/net/ip/IpClient.java @@ -381,7 +381,7 @@ public class IpClient extends StateMachine { private static final int EVENT_READ_PACKET_FILTER_COMPLETE = 12; private static final int CMD_ADD_KEEPALIVE_PACKET_FILTER_TO_APF = 13; private static final int CMD_REMOVE_KEEPALIVE_PACKET_FILTER_FROM_APF = 14; - private static final int CMD_UPDATE_L2KEY_GROUPHINT = 15; + private static final int CMD_UPDATE_L2KEY_CLUSTER = 15; private static final int CMD_COMPLETE_PRECONNECTION = 16; private static final int CMD_UPDATE_L2INFORMATION = 17; @@ -477,7 +477,7 @@ public class IpClient extends StateMachine { private ProxyInfo mHttpProxy; private ApfFilter mApfFilter; private String mL2Key; // The L2 key for this network, for writing into the memory store - private String mGroupHint; // The group hint for this network, for writing into the memory store + private String mCluster; // The cluster for this network, for writing into the memory store private boolean mMulticastFiltering; private long mStartTimeMillis; private MacAddress mCurrentBssid; @@ -686,9 +686,9 @@ public class IpClient extends StateMachine { IpClient.this.stop(); } @Override - public void setL2KeyAndGroupHint(String l2Key, String groupHint) { + public void setL2KeyAndGroupHint(String l2Key, String cluster) { enforceNetworkStackCallingPermission(); - IpClient.this.setL2KeyAndGroupHint(l2Key, groupHint); + IpClient.this.setL2KeyAndCluster(l2Key, cluster); } @Override public void setTcpBufferSizes(String tcpBufferSizes) { @@ -805,7 +805,7 @@ public class IpClient extends StateMachine { if (req.mLayer2Info != null) { mL2Key = req.mLayer2Info.mL2Key; - mGroupHint = req.mLayer2Info.mGroupHint; + mCluster = req.mLayer2Info.mCluster; } sendMessage(CMD_START, new android.net.shared.ProvisioningConfiguration(req)); } @@ -853,14 +853,14 @@ public class IpClient extends StateMachine { } /** - * Set the L2 key and group hint for storing info into the memory store. + * Set the L2 key and cluster for storing info into the memory store. * * This method is only supported on Q devices. For R or above releases, * caller should call #updateLayer2Information() instead. */ - public void setL2KeyAndGroupHint(String l2Key, String groupHint) { + public void setL2KeyAndCluster(String l2Key, String cluster) { if (!ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q)) { - sendMessage(CMD_UPDATE_L2KEY_GROUPHINT, new Pair<>(l2Key, groupHint)); + sendMessage(CMD_UPDATE_L2KEY_CLUSTER, new Pair<>(l2Key, cluster)); } } @@ -917,7 +917,7 @@ public class IpClient extends StateMachine { } /** - * Update the network bssid, L2Key and GroupHint on L2 roaming happened. + * Update the network bssid, L2Key and cluster on L2 roaming happened. */ public void updateLayer2Information(@NonNull Layer2InformationParcelable info) { sendMessage(CMD_UPDATE_L2INFORMATION, info); @@ -1545,7 +1545,7 @@ public class IpClient extends StateMachine { private void handleUpdateL2Information(@NonNull Layer2InformationParcelable info) { mL2Key = info.l2Key; - mGroupHint = info.groupHint; + mCluster = info.cluster; if (info.bssid == null || mCurrentBssid == null) { Log.wtf(mTag, "bssid in the parcelable or current tracked bssid should be non-null"); @@ -1619,10 +1619,10 @@ public class IpClient extends StateMachine { handleLinkPropertiesUpdate(NO_CALLBACKS); break; - case CMD_UPDATE_L2KEY_GROUPHINT: { + case CMD_UPDATE_L2KEY_CLUSTER: { final Pair<String, String> args = (Pair<String, String>) msg.obj; mL2Key = args.first; - mGroupHint = args.second; + mCluster = args.second; break; } @@ -1824,10 +1824,10 @@ public class IpClient extends StateMachine { transitionTo(mStoppingState); break; - case CMD_UPDATE_L2KEY_GROUPHINT: { + case CMD_UPDATE_L2KEY_CLUSTER: { final Pair<String, String> args = (Pair<String, String>) msg.obj; mL2Key = args.first; - mGroupHint = args.second; + mCluster = args.second; // TODO : attributes should be saved to the memory store with // these new values if they differ from the previous ones. // If the state machine is in pure StartedState, then the values to input diff --git a/src/com/android/server/connectivity/ipmemorystore/IpMemoryStoreDatabase.java b/src/com/android/server/connectivity/ipmemorystore/IpMemoryStoreDatabase.java index 834aa2d..be338e5 100644 --- a/src/com/android/server/connectivity/ipmemorystore/IpMemoryStoreDatabase.java +++ b/src/com/android/server/connectivity/ipmemorystore/IpMemoryStoreDatabase.java @@ -78,11 +78,17 @@ public class IpMemoryStoreDatabase { // is used to represent "infinite lease". public static final String COLTYPE_ASSIGNEDV4ADDRESSEXPIRY = "BIGINT"; - // Please note that the group hint is only a *hint*, hence its name. The client can offer - // this information to nudge the grouping in the decision it thinks is right, but it can't - // decide for the memory store what is the same L3 network. - public static final String COLNAME_GROUPHINT = "groupHint"; - public static final String COLTYPE_GROUPHINT = "TEXT"; + // An optional cluster representing a notion of group owned by the client. The memory + // store uses this as a hint for grouping, but not as an overriding factor. The client + // can then use this to find networks belonging to a cluster. An example of this could + // be the SSID for WiFi, where same SSID-networks may not be the same L3 networks but + // it's still useful for managing networks. + // Note that "groupHint" is the legacy name of the column. The column should be renamed + // in the database – ALTER TABLE ${NetworkAttributesContract.TABLENAME RENAME} COLUMN + // groupHint TO cluster – but this has been postponed to reduce risk as the Mainline + // release winter imposes a lot of changes be pushed at the same time in the next release. + public static final String COLNAME_CLUSTER = "groupHint"; + public static final String COLTYPE_CLUSTER = "TEXT"; public static final String COLNAME_DNSADDRESSES = "dnsAddresses"; // Stored in marshalled form as is @@ -97,7 +103,7 @@ public class IpMemoryStoreDatabase { + COLNAME_EXPIRYDATE + " " + COLTYPE_EXPIRYDATE + ", " + COLNAME_ASSIGNEDV4ADDRESS + " " + COLTYPE_ASSIGNEDV4ADDRESS + ", " + COLNAME_ASSIGNEDV4ADDRESSEXPIRY + " " + COLTYPE_ASSIGNEDV4ADDRESSEXPIRY + ", " - + COLNAME_GROUPHINT + " " + COLTYPE_GROUPHINT + ", " + + COLNAME_CLUSTER + " " + COLTYPE_CLUSTER + ", " + COLNAME_DNSADDRESSES + " " + COLTYPE_DNSADDRESSES + ", " + COLNAME_MTU + " " + COLTYPE_MTU + ")"; public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLENAME; @@ -165,7 +171,7 @@ public class IpMemoryStoreDatabase { try { if (oldVersion < 2) { // upgrade from version 1 to version 2 - // since we starts from version 2, do nothing here + // since we start from version 2, do nothing here } if (oldVersion < 3) { @@ -250,8 +256,8 @@ public class IpMemoryStoreDatabase { values.put(NetworkAttributesContract.COLNAME_ASSIGNEDV4ADDRESSEXPIRY, attributes.assignedV4AddressExpiry); } - if (null != attributes.groupHint) { - values.put(NetworkAttributesContract.COLNAME_GROUPHINT, attributes.groupHint); + if (null != attributes.cluster) { + values.put(NetworkAttributesContract.COLNAME_CLUSTER, attributes.cluster); } if (null != attributes.dnsAddresses) { values.put(NetworkAttributesContract.COLNAME_DNSADDRESSES, @@ -299,7 +305,7 @@ public class IpMemoryStoreDatabase { NetworkAttributesContract.COLNAME_ASSIGNEDV4ADDRESS, 0); final long assignedV4AddressExpiry = getLong(cursor, NetworkAttributesContract.COLNAME_ASSIGNEDV4ADDRESSEXPIRY, 0); - final String groupHint = getString(cursor, NetworkAttributesContract.COLNAME_GROUPHINT); + final String cluster = getString(cursor, NetworkAttributesContract.COLNAME_CLUSTER); final byte[] dnsAddressesBlob = getBlob(cursor, NetworkAttributesContract.COLNAME_DNSADDRESSES); final int mtu = getInt(cursor, NetworkAttributesContract.COLNAME_MTU, -1); @@ -309,7 +315,7 @@ public class IpMemoryStoreDatabase { if (0 != assignedV4AddressExpiry) { builder.setAssignedV4AddressExpiry(assignedV4AddressExpiry); } - builder.setGroupHint(groupHint); + builder.setCluster(cluster); if (null != dnsAddressesBlob) { builder.setDnsAddresses(decodeAddressList(dnsAddressesBlob)); } |