Rename getBypassable to isBypassable
Bug: 262336021
Bug: 256775913
Test: atest FrameworksNetTests
Change-Id: I5ac8f4f9a2a64189fc66d3c14af6da201a35e3e2
diff --git a/framework/api/system-current.txt b/framework/api/system-current.txt
index 0b0f2bb..dd3404c 100644
--- a/framework/api/system-current.txt
+++ b/framework/api/system-current.txt
@@ -515,8 +515,8 @@
ctor public VpnTransportInfo(int, @Nullable String, boolean, boolean);
method public boolean areLongLivedTcpConnectionsExpensive();
method public int describeContents();
- method public boolean getBypassable();
method public int getType();
+ method public boolean isBypassable();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.net.VpnTransportInfo> CREATOR;
}
diff --git a/framework/src/android/net/VpnTransportInfo.java b/framework/src/android/net/VpnTransportInfo.java
index e335c0f..6bb00c8 100644
--- a/framework/src/android/net/VpnTransportInfo.java
+++ b/framework/src/android/net/VpnTransportInfo.java
@@ -86,7 +86,7 @@
// When the module runs on older SDKs, |bypassable| will always be false since the old Vpn
// code will call this constructor. For Settings VPNs, this is always correct as they are
// never bypassable. For VpnManager and VpnService types, this may be wrong since both of
- // them have a choice. However, on these SDKs VpnTransportInfo#getBypassable is not
+ // them have a choice. However, on these SDKs VpnTransportInfo#isBypassable is not
// available anyway, so this should be harmless. False is a better choice than true here
// regardless because it is the default value for both VpnManager and VpnService if the app
// does not do anything about it.
@@ -111,7 +111,7 @@
* {@code UnsupportedOperationException} if called.
*/
@RequiresApi(UPSIDE_DOWN_CAKE)
- public boolean getBypassable() {
+ public boolean isBypassable() {
if (!SdkLevel.isAtLeastU()) {
throw new UnsupportedOperationException("Not supported before U");
}
@@ -134,7 +134,7 @@
* VPNs can be bypassable or not. When the VPN is not bypassable, the user has
* expressed explicit intent to have no connection outside of the VPN, so even
* privileged apps with permission to bypass non-bypassable VPNs should not do
- * so. See {@link #getBypassable()}.
+ * so. See {@link #isBypassable()}.
* For bypassable VPNs however, the user expects apps choose reasonable tradeoffs
* about whether they use the VPN.
*
diff --git a/tests/common/java/android/net/VpnTransportInfoTest.java b/tests/common/java/android/net/VpnTransportInfoTest.java
index f32ab8b..2d01df7 100644
--- a/tests/common/java/android/net/VpnTransportInfoTest.java
+++ b/tests/common/java/android/net/VpnTransportInfoTest.java
@@ -94,20 +94,20 @@
@DevSdkIgnoreRule.IgnoreAfter(Build.VERSION_CODES.TIRAMISU)
@Test
- public void testGetBypassable_beforeU() {
+ public void testIsBypassable_beforeU() {
final VpnTransportInfo v = new VpnTransportInfo(VpnManager.TYPE_VPN_PLATFORM, "12345");
- assertThrows(UnsupportedOperationException.class, () -> v.getBypassable());
+ assertThrows(UnsupportedOperationException.class, () -> v.isBypassable());
}
@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.TIRAMISU)
@Test
- public void testGetBypassable_afterU() {
+ public void testIsBypassable_afterU() {
final VpnTransportInfo v = new VpnTransportInfo(VpnManager.TYPE_VPN_PLATFORM, "12345");
- assertFalse(v.getBypassable());
+ assertFalse(v.isBypassable());
final VpnTransportInfo v2 =
new VpnTransportInfo(VpnManager.TYPE_VPN_PLATFORM, "12345", true, false);
- assertTrue(v2.getBypassable());
+ assertTrue(v2.isBypassable());
}
@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.TIRAMISU)
diff --git a/tests/unit/java/com/android/server/connectivity/VpnTest.java b/tests/unit/java/com/android/server/connectivity/VpnTest.java
index 677e7b6..3f87ffd 100644
--- a/tests/unit/java/com/android/server/connectivity/VpnTest.java
+++ b/tests/unit/java/com/android/server/connectivity/VpnTest.java
@@ -1893,7 +1893,7 @@
// Check if allowBypass is set or not.
assertTrue(nacCaptor.getValue().isBypassableVpn());
- assertTrue(((VpnTransportInfo) ncCaptor.getValue().getTransportInfo()).getBypassable());
+ assertTrue(((VpnTransportInfo) ncCaptor.getValue().getTransportInfo()).isBypassable());
return new PlatformVpnSnapshot(vpn, nwCb, ikeCb, childCb);
}