Merge "Address API review feedback" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6f7ac6860e
@@ -11,7 +11,7 @@ package android.net {
|
|||||||
method @Nullable public android.net.ProxyInfo getGlobalProxy();
|
method @Nullable public android.net.ProxyInfo getGlobalProxy();
|
||||||
method @NonNull public static android.util.Range<java.lang.Integer> getIpSecNetIdRange();
|
method @NonNull public static android.util.Range<java.lang.Integer> getIpSecNetIdRange();
|
||||||
method @NonNull public static String getPrivateDnsMode(@NonNull android.content.Context);
|
method @NonNull public static String getPrivateDnsMode(@NonNull android.content.Context);
|
||||||
method @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_SETTINGS}) public void registerDefaultNetworkCallbackAsUid(int, @NonNull android.net.ConnectivityManager.NetworkCallback, @NonNull android.os.Handler);
|
method @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_SETTINGS}) public void registerDefaultNetworkCallbackForUid(int, @NonNull android.net.ConnectivityManager.NetworkCallback, @NonNull android.os.Handler);
|
||||||
method @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_SETTINGS}) public void registerSystemDefaultNetworkCallback(@NonNull android.net.ConnectivityManager.NetworkCallback, @NonNull android.os.Handler);
|
method @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_SETTINGS}) public void registerSystemDefaultNetworkCallback(@NonNull android.net.ConnectivityManager.NetworkCallback, @NonNull android.os.Handler);
|
||||||
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK, android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public void requestBackgroundNetwork(@NonNull android.net.NetworkRequest, @NonNull android.net.ConnectivityManager.NetworkCallback, @NonNull android.os.Handler);
|
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK, android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public void requestBackgroundNetwork(@NonNull android.net.NetworkRequest, @NonNull android.net.ConnectivityManager.NetworkCallback, @NonNull android.os.Handler);
|
||||||
method @Deprecated public boolean requestRouteToHostAddress(int, java.net.InetAddress);
|
method @Deprecated public boolean requestRouteToHostAddress(int, java.net.InetAddress);
|
||||||
@@ -166,11 +166,11 @@ package android.net {
|
|||||||
public final class VpnTransportInfo implements android.os.Parcelable android.net.TransportInfo {
|
public final class VpnTransportInfo implements android.os.Parcelable android.net.TransportInfo {
|
||||||
ctor public VpnTransportInfo(int, @Nullable String);
|
ctor public VpnTransportInfo(int, @Nullable String);
|
||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
|
method @Nullable public String getSessionId();
|
||||||
|
method public int getType();
|
||||||
method @NonNull public android.net.VpnTransportInfo makeCopy(long);
|
method @NonNull public android.net.VpnTransportInfo makeCopy(long);
|
||||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||||
field @NonNull public static final android.os.Parcelable.Creator<android.net.VpnTransportInfo> CREATOR;
|
field @NonNull public static final android.os.Parcelable.Creator<android.net.VpnTransportInfo> CREATOR;
|
||||||
field @Nullable public final String sessionId;
|
|
||||||
field public final int type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ package android.net {
|
|||||||
method public final void sendSocketKeepaliveEvent(int, int);
|
method public final void sendSocketKeepaliveEvent(int, int);
|
||||||
method @Deprecated public void setLegacySubtype(int, @NonNull String);
|
method @Deprecated public void setLegacySubtype(int, @NonNull String);
|
||||||
method public void setLingerDuration(@NonNull java.time.Duration);
|
method public void setLingerDuration(@NonNull java.time.Duration);
|
||||||
method public void setTeardownDelayMs(@IntRange(from=0, to=0x1388) int);
|
method public void setTeardownDelayMillis(@IntRange(from=0, to=0x1388) int);
|
||||||
method public final void setUnderlyingNetworks(@Nullable java.util.List<android.net.Network>);
|
method public final void setUnderlyingNetworks(@Nullable java.util.List<android.net.Network>);
|
||||||
method public void unregister();
|
method public void unregister();
|
||||||
field public static final int VALIDATION_STATUS_NOT_VALID = 2; // 0x2
|
field public static final int VALIDATION_STATUS_NOT_VALID = 2; // 0x2
|
||||||
|
|||||||
@@ -4473,7 +4473,7 @@ public class ConnectivityManager {
|
|||||||
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
|
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
|
||||||
public void registerDefaultNetworkCallback(@NonNull NetworkCallback networkCallback,
|
public void registerDefaultNetworkCallback(@NonNull NetworkCallback networkCallback,
|
||||||
@NonNull Handler handler) {
|
@NonNull Handler handler) {
|
||||||
registerDefaultNetworkCallbackAsUid(Process.INVALID_UID, networkCallback, handler);
|
registerDefaultNetworkCallbackForUid(Process.INVALID_UID, networkCallback, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4503,7 +4503,7 @@ public class ConnectivityManager {
|
|||||||
@RequiresPermission(anyOf = {
|
@RequiresPermission(anyOf = {
|
||||||
NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK,
|
NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK,
|
||||||
android.Manifest.permission.NETWORK_SETTINGS})
|
android.Manifest.permission.NETWORK_SETTINGS})
|
||||||
public void registerDefaultNetworkCallbackAsUid(int uid,
|
public void registerDefaultNetworkCallbackForUid(int uid,
|
||||||
@NonNull NetworkCallback networkCallback, @NonNull Handler handler) {
|
@NonNull NetworkCallback networkCallback, @NonNull Handler handler) {
|
||||||
CallbackHandler cbHandler = new CallbackHandler(handler);
|
CallbackHandler cbHandler = new CallbackHandler(handler);
|
||||||
sendRequestForNetwork(uid, null /* need */, networkCallback, 0 /* timeoutMs */,
|
sendRequestForNetwork(uid, null /* need */, networkCallback, 0 /* timeoutMs */,
|
||||||
|
|||||||
@@ -892,11 +892,11 @@ public abstract class NetworkAgent {
|
|||||||
* This method may be called at any time while the network is connected. It has no effect if
|
* 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.
|
* 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(
|
public void setTeardownDelayMillis(
|
||||||
@IntRange(from = 0, to = MAX_TEARDOWN_DELAY_MS) int teardownDelayMs) {
|
@IntRange(from = 0, to = MAX_TEARDOWN_DELAY_MS) int teardownDelayMillis) {
|
||||||
queueOrSendMessage(reg -> reg.sendTeardownDelayMs(teardownDelayMs));
|
queueOrSendMessage(reg -> reg.sendTeardownDelayMs(teardownDelayMillis));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -40,10 +40,10 @@ import java.util.Objects;
|
|||||||
@SystemApi(client = MODULE_LIBRARIES)
|
@SystemApi(client = MODULE_LIBRARIES)
|
||||||
public final class VpnTransportInfo implements TransportInfo, Parcelable {
|
public final class VpnTransportInfo implements TransportInfo, Parcelable {
|
||||||
/** Type of this VPN. */
|
/** Type of this VPN. */
|
||||||
public final int type;
|
private final int mType;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public final String sessionId;
|
private final String mSessionId;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @RedactionType long getApplicableRedactions() {
|
public @RedactionType long getApplicableRedactions() {
|
||||||
@@ -55,13 +55,28 @@ public final class VpnTransportInfo implements TransportInfo, Parcelable {
|
|||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public VpnTransportInfo makeCopy(@RedactionType long redactions) {
|
public VpnTransportInfo makeCopy(@RedactionType long redactions) {
|
||||||
return new VpnTransportInfo(type,
|
return new VpnTransportInfo(mType,
|
||||||
((redactions & REDACT_FOR_NETWORK_SETTINGS) != 0) ? null : sessionId);
|
((redactions & REDACT_FOR_NETWORK_SETTINGS) != 0) ? null : mSessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VpnTransportInfo(int type, @Nullable String sessionId) {
|
public VpnTransportInfo(int type, @Nullable String sessionId) {
|
||||||
this.type = type;
|
this.mType = type;
|
||||||
this.sessionId = sessionId;
|
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
|
@Override
|
||||||
@@ -69,17 +84,17 @@ public final class VpnTransportInfo implements TransportInfo, Parcelable {
|
|||||||
if (!(o instanceof VpnTransportInfo)) return false;
|
if (!(o instanceof VpnTransportInfo)) return false;
|
||||||
|
|
||||||
VpnTransportInfo that = (VpnTransportInfo) o;
|
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
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(type, sessionId);
|
return Objects.hash(mType, mSessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("VpnTransportInfo{type=%d, sessionId=%s}", type, sessionId);
|
return String.format("VpnTransportInfo{type=%d, sessionId=%s}", mType, mSessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -89,8 +104,8 @@ public final class VpnTransportInfo implements TransportInfo, Parcelable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||||
dest.writeInt(type);
|
dest.writeInt(mType);
|
||||||
dest.writeString(sessionId);
|
dest.writeString(mSessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final @NonNull Creator<VpnTransportInfo> CREATOR =
|
public static final @NonNull Creator<VpnTransportInfo> CREATOR =
|
||||||
|
|||||||
Reference in New Issue
Block a user