Address API review feedback
Address API review feedback to: - Rename NetworkAgent#setTeardownDelayMs to NetworkAgent#setTeardownDelayMillis - Use getters instead of fields in VpnTransportInfo - Rename registerDefaultNetworkCallbackAsUid to registerDefaultNetworkCallbackForUid in ConnectiivityManager Bug: 183972850 Bug: 185246410 Fix: 184735863 Test: make update-api Test: atest FrameworksNetTests Test: atest CtsNetTestCasesLatestSdk Change-Id: I5e8c4bed8bda40d507afa894c359b5e24ee5d868 Merged-In: I5e8c4bed8bda40d507afa894c359b5e24ee5d868
This commit is contained in:
@@ -4407,7 +4407,7 @@ public class ConnectivityManager {
|
||||
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
|
||||
public void registerDefaultNetworkCallback(@NonNull NetworkCallback networkCallback,
|
||||
@NonNull Handler handler) {
|
||||
registerDefaultNetworkCallbackAsUid(Process.INVALID_UID, networkCallback, handler);
|
||||
registerDefaultNetworkCallbackForUid(Process.INVALID_UID, networkCallback, handler);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4437,7 +4437,7 @@ public class ConnectivityManager {
|
||||
@RequiresPermission(anyOf = {
|
||||
NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK,
|
||||
android.Manifest.permission.NETWORK_SETTINGS})
|
||||
public void registerDefaultNetworkCallbackAsUid(int uid,
|
||||
public void registerDefaultNetworkCallbackForUid(int uid,
|
||||
@NonNull NetworkCallback networkCallback, @NonNull Handler handler) {
|
||||
CallbackHandler cbHandler = new CallbackHandler(handler);
|
||||
sendRequestForNetwork(uid, null /* need */, networkCallback, 0 /* timeoutMs */,
|
||||
|
||||
@@ -879,11 +879,11 @@ public abstract class NetworkAgent {
|
||||
* This method may be called at any time while the network is connected. It has no effect if
|
||||
* the network is already disconnected and the teardown delay timer is running.
|
||||
*
|
||||
* @param teardownDelayMs the teardown delay to set, or 0 to disable teardown delay.
|
||||
* @param teardownDelayMillis the teardown delay to set, or 0 to disable teardown delay.
|
||||
*/
|
||||
public void setTeardownDelayMs(
|
||||
@IntRange(from = 0, to = MAX_TEARDOWN_DELAY_MS) int teardownDelayMs) {
|
||||
queueOrSendMessage(reg -> reg.sendTeardownDelayMs(teardownDelayMs));
|
||||
public void setTeardownDelayMillis(
|
||||
@IntRange(from = 0, to = MAX_TEARDOWN_DELAY_MS) int teardownDelayMillis) {
|
||||
queueOrSendMessage(reg -> reg.sendTeardownDelayMs(teardownDelayMillis));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,10 +40,10 @@ import java.util.Objects;
|
||||
@SystemApi(client = MODULE_LIBRARIES)
|
||||
public final class VpnTransportInfo implements TransportInfo, Parcelable {
|
||||
/** Type of this VPN. */
|
||||
public final int type;
|
||||
private final int mType;
|
||||
|
||||
@Nullable
|
||||
public final String sessionId;
|
||||
private final String mSessionId;
|
||||
|
||||
@Override
|
||||
public @RedactionType long getApplicableRedactions() {
|
||||
@@ -55,13 +55,28 @@ public final class VpnTransportInfo implements TransportInfo, Parcelable {
|
||||
*/
|
||||
@NonNull
|
||||
public VpnTransportInfo makeCopy(@RedactionType long redactions) {
|
||||
return new VpnTransportInfo(type,
|
||||
((redactions & REDACT_FOR_NETWORK_SETTINGS) != 0) ? null : sessionId);
|
||||
return new VpnTransportInfo(mType,
|
||||
((redactions & REDACT_FOR_NETWORK_SETTINGS) != 0) ? null : mSessionId);
|
||||
}
|
||||
|
||||
public VpnTransportInfo(int type, @Nullable String sessionId) {
|
||||
this.type = type;
|
||||
this.sessionId = sessionId;
|
||||
this.mType = type;
|
||||
this.mSessionId = sessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the session Id of this VpnTransportInfo.
|
||||
*/
|
||||
@Nullable
|
||||
public String getSessionId() {
|
||||
return mSessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of this VPN.
|
||||
*/
|
||||
public int getType() {
|
||||
return mType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,17 +84,17 @@ public final class VpnTransportInfo implements TransportInfo, Parcelable {
|
||||
if (!(o instanceof VpnTransportInfo)) return false;
|
||||
|
||||
VpnTransportInfo that = (VpnTransportInfo) o;
|
||||
return (this.type == that.type) && TextUtils.equals(this.sessionId, that.sessionId);
|
||||
return (this.mType == that.mType) && TextUtils.equals(this.mSessionId, that.mSessionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(type, sessionId);
|
||||
return Objects.hash(mType, mSessionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("VpnTransportInfo{type=%d, sessionId=%s}", type, sessionId);
|
||||
return String.format("VpnTransportInfo{type=%d, sessionId=%s}", mType, mSessionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,8 +104,8 @@ public final class VpnTransportInfo implements TransportInfo, Parcelable {
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeInt(type);
|
||||
dest.writeString(sessionId);
|
||||
dest.writeInt(mType);
|
||||
dest.writeString(mSessionId);
|
||||
}
|
||||
|
||||
public static final @NonNull Creator<VpnTransportInfo> CREATOR =
|
||||
|
||||
Reference in New Issue
Block a user