summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp7
-rw-r--r--apishim/30/com/android/networkstack/apishim/api30/CaptivePortalDataShimImpl.java (renamed from apishim/30/com/android/networkstack/apishim/CaptivePortalDataShimImpl.java)2
-rw-r--r--apishim/30/com/android/networkstack/apishim/api30/ConstantsShim.java (renamed from apishim/30/com/android/networkstack/apishim/ConstantsShim.java)2
-rw-r--r--apishim/30/com/android/networkstack/apishim/api30/NetworkInformationShimImpl.java (renamed from apishim/30/com/android/networkstack/apishim/NetworkInformationShimImpl.java)2
-rw-r--r--apishim/30/com/android/networkstack/apishim/api30/NetworkShimImpl.java (renamed from apishim/30/com/android/networkstack/apishim/NetworkShimImpl.java)2
-rw-r--r--apishim/30/com/android/networkstack/apishim/api30/SocketUtilsShimImpl.java (renamed from apishim/30/com/android/networkstack/apishim/SocketUtilsShimImpl.java)2
-rw-r--r--apishim/31/com/android/networkstack/apishim/CaptivePortalDataShimImpl.java32
-rw-r--r--apishim/31/com/android/networkstack/apishim/ConstantsShim.java33
-rw-r--r--apishim/31/com/android/networkstack/apishim/NetworkInformationShimImpl.java26
-rw-r--r--apishim/31/com/android/networkstack/apishim/NetworkShimImpl.java31
-rw-r--r--apishim/31/com/android/networkstack/apishim/SocketUtilsShimImpl.java26
-rw-r--r--apishim/jarjar-rules-compat.txt8
12 files changed, 162 insertions, 11 deletions
diff --git a/Android.bp b/Android.bp
index 81a96a8..efe8ff1 100644
--- a/Android.bp
+++ b/Android.bp
@@ -48,9 +48,10 @@ java_defaults {
java_defaults {
name: "NetworkStackReleaseApiLevel",
- sdk_version: "system_29",
+ // TODO: use system_30 once a prebuilt SDK is available for R
+ sdk_version: "system_current",
min_sdk_version: "29",
- target_sdk_version: "29",
+ target_sdk_version: "30",
}
// Filegroups for the API shims
@@ -60,6 +61,7 @@ filegroup {
"apishim/common/**/*.java",
"apishim/29/**/*.java",
"apishim/30/**/*.java",
+ "apishim/31/**/*.java",
":networkstack-module-utils-srcs",
],
}
@@ -71,6 +73,7 @@ filegroup {
srcs: [
"apishim/common/**/*.java",
"apishim/29/**/*.java",
+ "apishim/30/**/*.java",
":networkstack-module-utils-srcs",
],
}
diff --git a/apishim/30/com/android/networkstack/apishim/CaptivePortalDataShimImpl.java b/apishim/30/com/android/networkstack/apishim/api30/CaptivePortalDataShimImpl.java
index dfe8833..0c75f27 100644
--- a/apishim/30/com/android/networkstack/apishim/CaptivePortalDataShimImpl.java
+++ b/apishim/30/com/android/networkstack/apishim/api30/CaptivePortalDataShimImpl.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.networkstack.apishim;
+package com.android.networkstack.apishim.api30;
import android.net.CaptivePortalData;
import android.net.INetworkMonitorCallbacks;
diff --git a/apishim/30/com/android/networkstack/apishim/ConstantsShim.java b/apishim/30/com/android/networkstack/apishim/api30/ConstantsShim.java
index cbbb3a7..eb4fc07 100644
--- a/apishim/30/com/android/networkstack/apishim/ConstantsShim.java
+++ b/apishim/30/com/android/networkstack/apishim/api30/ConstantsShim.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.networkstack.apishim;
+package com.android.networkstack.apishim.api30;
import static android.net.ConnectivityDiagnosticsManager.DataStallReport;
diff --git a/apishim/30/com/android/networkstack/apishim/NetworkInformationShimImpl.java b/apishim/30/com/android/networkstack/apishim/api30/NetworkInformationShimImpl.java
index c8c1949..5d9b013 100644
--- a/apishim/30/com/android/networkstack/apishim/NetworkInformationShimImpl.java
+++ b/apishim/30/com/android/networkstack/apishim/api30/NetworkInformationShimImpl.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.networkstack.apishim;
+package com.android.networkstack.apishim.api30;
import android.net.IpPrefix;
import android.net.LinkProperties;
diff --git a/apishim/30/com/android/networkstack/apishim/NetworkShimImpl.java b/apishim/30/com/android/networkstack/apishim/api30/NetworkShimImpl.java
index edb1cd5..0636d8a 100644
--- a/apishim/30/com/android/networkstack/apishim/NetworkShimImpl.java
+++ b/apishim/30/com/android/networkstack/apishim/api30/NetworkShimImpl.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.networkstack.apishim;
+package com.android.networkstack.apishim.api30;
import android.net.Network;
import android.os.Build;
diff --git a/apishim/30/com/android/networkstack/apishim/SocketUtilsShimImpl.java b/apishim/30/com/android/networkstack/apishim/api30/SocketUtilsShimImpl.java
index 903de79..61ce059 100644
--- a/apishim/30/com/android/networkstack/apishim/SocketUtilsShimImpl.java
+++ b/apishim/30/com/android/networkstack/apishim/api30/SocketUtilsShimImpl.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.networkstack.apishim;
+package com.android.networkstack.apishim.api30;
import android.net.util.SocketUtils;
import android.os.Build;
diff --git a/apishim/31/com/android/networkstack/apishim/CaptivePortalDataShimImpl.java b/apishim/31/com/android/networkstack/apishim/CaptivePortalDataShimImpl.java
new file mode 100644
index 0000000..6ff6adb
--- /dev/null
+++ b/apishim/31/com/android/networkstack/apishim/CaptivePortalDataShimImpl.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim;
+
+import android.net.CaptivePortalData;
+
+import androidx.annotation.NonNull;
+
+/**
+ * Compatibility implementation of {@link CaptivePortalDataShim}.
+ */
+public class CaptivePortalDataShimImpl
+ extends com.android.networkstack.apishim.api30.CaptivePortalDataShimImpl {
+ // Currently, this is the same as the API 30 shim, so inherit everything from that.
+ protected CaptivePortalDataShimImpl(@NonNull CaptivePortalData data) {
+ super(data);
+ }
+}
diff --git a/apishim/31/com/android/networkstack/apishim/ConstantsShim.java b/apishim/31/com/android/networkstack/apishim/ConstantsShim.java
new file mode 100644
index 0000000..a328720
--- /dev/null
+++ b/apishim/31/com/android/networkstack/apishim/ConstantsShim.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim;
+
+import androidx.annotation.VisibleForTesting;
+
+/**
+ * Utility class for defining and importing constants from the Android platform.
+ */
+public class ConstantsShim extends com.android.networkstack.apishim.api30.ConstantsShim {
+ /**
+ * Constant that callers can use to determine what version of the shim they are using.
+ * Must be the same as the version of the shims.
+ * This should only be used by test code. Production code that uses the shims should be using
+ * the shimmed objects and methods themselves.
+ */
+ @VisibleForTesting
+ public static final int VERSION = 31;
+}
diff --git a/apishim/31/com/android/networkstack/apishim/NetworkInformationShimImpl.java b/apishim/31/com/android/networkstack/apishim/NetworkInformationShimImpl.java
new file mode 100644
index 0000000..828063c
--- /dev/null
+++ b/apishim/31/com/android/networkstack/apishim/NetworkInformationShimImpl.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim;
+
+/**
+ * Compatibility implementation of {@link NetworkInformationShim}.
+ */
+public class NetworkInformationShimImpl
+ extends com.android.networkstack.apishim.api30.NetworkInformationShimImpl {
+ // Currently, this is the same as the API 30 shim, so inherit everything from that.
+ protected NetworkInformationShimImpl() {}
+}
diff --git a/apishim/31/com/android/networkstack/apishim/NetworkShimImpl.java b/apishim/31/com/android/networkstack/apishim/NetworkShimImpl.java
new file mode 100644
index 0000000..0c92391
--- /dev/null
+++ b/apishim/31/com/android/networkstack/apishim/NetworkShimImpl.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim;
+
+import android.net.Network;
+
+import androidx.annotation.NonNull;
+
+/**
+ * Implementation of {@link NetworkShim} for API 30.
+ */
+public class NetworkShimImpl extends com.android.networkstack.apishim.api30.NetworkShimImpl {
+ // Currently, this is the same as the API 30 shim, so inherit everything from that.
+ protected NetworkShimImpl(@NonNull Network network) {
+ super(network);
+ }
+}
diff --git a/apishim/31/com/android/networkstack/apishim/SocketUtilsShimImpl.java b/apishim/31/com/android/networkstack/apishim/SocketUtilsShimImpl.java
new file mode 100644
index 0000000..483bde0
--- /dev/null
+++ b/apishim/31/com/android/networkstack/apishim/SocketUtilsShimImpl.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.networkstack.apishim;
+
+/**
+ * Implementation of {@link NetworkShim} for API 30.
+ */
+public class SocketUtilsShimImpl
+ extends com.android.networkstack.apishim.api30.SocketUtilsShimImpl {
+ // Currently, this is the same as the API 30 shim, so inherit everything from that.
+ protected SocketUtilsShimImpl() {}
+}
diff --git a/apishim/jarjar-rules-compat.txt b/apishim/jarjar-rules-compat.txt
index 3e54c12..dba2b49 100644
--- a/apishim/jarjar-rules-compat.txt
+++ b/apishim/jarjar-rules-compat.txt
@@ -1,7 +1,7 @@
# jarjar rules to use on API stable builds.
# Use the latest stable apishim package as the main apishim package, to replace and avoid building
# the unstable, non-compatibility shims.
-# Once API 30 is stable, apishim/30/com.android.networkstack.apishim should be moved to the
-# com.android.networkstack.apishim.api30 package, a new apishim/31/com.android.networkstack.apishim
-# package should be created, and this rule should reference api30.
-rule com.android.networkstack.apishim.api29.** com.android.networkstack.apishim.@1 \ No newline at end of file
+# Once API 31 is stable, apishim/31/com.android.networkstack.apishim should be moved to the
+# com.android.networkstack.apishim.api31 package, a new apishim/32/com.android.networkstack.apishim
+# package should be created, and this rule should reference api31.
+rule com.android.networkstack.apishim.api30.** com.android.networkstack.apishim.@1 \ No newline at end of file