Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 77a13f2f authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 7550930 from cd8c8638 to...

Snap for 7550930 from cd8c8638 to mainline-captiveportallogin-release

Change-Id: Ibf284287378d803d2a2795a448c4e94cdaa1d882
parents 82e67685 cd8c8638
Loading
Loading
Loading
Loading
+49 −18
Original line number Diff line number Diff line
@@ -45,10 +45,6 @@ package {
    default_applicable_licenses: ["Android-Apache-2.0"],
}

// Whether to enable the targets in this file that target current SDKs.
// Set to false in branches like mainline-prod where API classes are too old to build current code.
enable_current_sdk_targets = false

java_defaults {
    name: "NetworkStackDevApiLevel",
    min_sdk_version: "29",
@@ -57,9 +53,14 @@ java_defaults {

java_defaults {
    name: "NetworkStackReleaseApiLevel",
    sdk_version: "system_30",
    sdk_version: "module_31",
    min_sdk_version: "29",
    target_sdk_version: "30",
    target_sdk_version: "31",
    libs: [
        "framework-connectivity",
        "framework-statsd",
        "framework-wifi",
    ]
}

// Libraries for the API shims
@@ -127,7 +128,6 @@ java_library {
// integer so if the next SDK release happens to use that integer, we don't need to rename them.
java_library {
    name: "NetworkStackApi31Shims",
    enabled: enable_current_sdk_targets,
    defaults: ["NetworkStackShimsDefaults"],
    srcs: [
        "apishim/31/**/*.java",
@@ -138,6 +138,27 @@ java_library {
        "NetworkStackApi30Shims",
        "framework-connectivity",
    ],
    sdk_version: "module_31",
    visibility: ["//visibility:private"],
}


// Shims for APIs being added to the current development version of Android. These APIs are not
// stable and have no defined version number. These could be called 10000, but they use the next
// integer so if the next SDK release happens to use that integer, we don't need to rename them.
java_library {
    name: "NetworkStackApi32Shims",
    defaults: ["NetworkStackShimsDefaults"],
    srcs: [
        "apishim/32/**/*.java",
    ],
    libs: [
        "NetworkStackShimsCommon",
        "NetworkStackApi29Shims",
        "NetworkStackApi30Shims",
        "NetworkStackApi31Shims",
        "framework-connectivity",
    ],
    sdk_version: "module_current",
    visibility: ["//visibility:private"],
}
@@ -147,13 +168,13 @@ java_library {
// called directly by the networkstack code.
java_library {
    name: "NetworkStackApiCurrentShims",
    enabled: enable_current_sdk_targets,
    defaults: ["NetworkStackShimsDefaults"],
    static_libs: [
        "NetworkStackShimsCommon",
        "NetworkStackApi29Shims",
        "NetworkStackApi30Shims",
        "NetworkStackApi31Shims",
        "NetworkStackApi32Shims",
    ],
    sdk_version: "module_current",
    visibility: [
@@ -172,9 +193,10 @@ java_library {
        "NetworkStackShimsCommon",
        "NetworkStackApi29Shims",
        "NetworkStackApi30Shims",
        "NetworkStackApi31Shims",
    ],
    jarjar_rules: "apishim/jarjar-rules-compat.txt",
    sdk_version: "system_30",
    sdk_version: "module_31",
    visibility: [
        "//packages/modules/Connectivity/Tethering",
        "//packages/modules/Connectivity/tests/cts/net",
@@ -192,6 +214,7 @@ java_defaults {
    libs: ["unsupportedappusage"],
    static_libs: [
        "androidx.annotation_annotation",
        "modules-utils-build_system",
        "netd_aidl_interface-lateststable-java",
        "netlink-client",
        "networkstack-client",
@@ -215,7 +238,6 @@ android_library {
    ],
    static_libs: ["NetworkStackApiCurrentShims"],
    manifest: "AndroidManifestBase.xml",
    enabled: enable_current_sdk_targets,
    visibility: [
        "//frameworks/base/tests/net/integration",
        "//packages/modules/Connectivity/Tethering/tests/integration",
@@ -290,8 +312,10 @@ android_app {
    // The permission configuration *must* be included to ensure security of the device
    // The InProcessNetworkStack goes together with the PlatformCaptivePortalLogin, which replaces
    // the default CaptivePortalLogin.
    required: ["PlatformNetworkPermissionConfig", "PlatformCaptivePortalLogin"],
    enabled: enable_current_sdk_targets,
    required: [
        "PlatformNetworkPermissionConfig",
        "PlatformCaptivePortalLogin",
    ],
}

// Pre-merge the AndroidManifest for NetworkStackNext, so that its manifest can be merged on top
@@ -299,8 +323,7 @@ android_library {
    name: "NetworkStackNextManifestBase",
    defaults: ["NetworkStackAppDefaults", "NetworkStackDevApiLevel"],
    static_libs: ["NetworkStackApiCurrentLib"],
    manifest: "AndroidManifest.xml",
    enabled: enable_current_sdk_targets,
    manifest: "AndroidManifest.xml"
}

// NetworkStack build targeting the current API release, for testing on in-development SDK
@@ -311,8 +334,10 @@ android_app {
    certificate: "networkstack",
    manifest: "AndroidManifest_Next.xml",
    // The permission configuration *must* be included to ensure security of the device
    required: ["NetworkPermissionConfig"],
    enabled: enable_current_sdk_targets,
    required: [
        "NetworkPermissionConfig",
        "privapp_whitelist_com.android.networkstack",
    ],
}

// Updatable network stack for finalized API
@@ -323,7 +348,10 @@ android_app {
    certificate: "networkstack",
    manifest: "AndroidManifest.xml",
    // The permission configuration *must* be included to ensure security of the device
    required: ["NetworkPermissionConfig"],
    required: [
        "NetworkPermissionConfig",
        "privapp_whitelist_com.android.networkstack",
    ],
    updatable: true,
}

@@ -400,7 +428,10 @@ android_app {
    certificate: "networkstack",
    manifest: ":NetworkStackTestAndroidManifest",
    // The permission configuration *must* be included to ensure security of the device
    required: ["NetworkPermissionConfig"],
    required: [
        "NetworkPermissionConfig",
        "privapp_whitelist_com.android.networkstack",
    ],
}

// When adding or modifying protos, the jarjar rules and possibly proguard rules need
+2 −2
Original line number Diff line number Diff line
@@ -19,8 +19,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.android.networkstack"
  android:sharedUserId="android.uid.networkstack"
  android:versionCode="309999900"
  android:versionName="r_aml_309999900"
  android:versionCode="319999900"
  android:versionName="s_aml_319999900"
>
    <!-- Permissions must be defined here, and not in the base manifest, as the network stack
         running in the system server process does not need any permission, and having privileged
+2 −2
Original line number Diff line number Diff line
@@ -17,6 +17,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.android.networkstack"
          android:sharedUserId="android.uid.networkstack"
          android:versionCode="300000000"
          android:versionName="R-next">
          android:versionCode="320000000"
          android:versionName="T-next">
</manifest>
+2 −1
Original line number Diff line number Diff line
@@ -40,7 +40,8 @@
    // We must specify at least one module here or the tests won't run. Use the same set as CTS
    // so in theory the infra would not need to reinstall/reboot devices to run both.
    {
      "name": "NetworkStackTests[CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex]"
      // TODO: add back tethering when it is updatable in this branch
      "name": "NetworkStackTests[CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex]"
    }
  ],
  "mainline-postsubmit": [
+33 −5
Original line number Diff line number Diff line
@@ -16,8 +16,14 @@

package com.android.networkstack.apishim.api29;

import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED;
import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_VPN;
import static android.net.NetworkCapabilities.NET_CAPABILITY_TRUSTED;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.ConnectivityManager.NetworkCallback;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.os.Handler;

@@ -30,7 +36,10 @@ import com.android.networkstack.apishim.common.UnsupportedApiLevelException;
 * Implementation of {@link ConnectivityManagerShim} for API 29.
 */
public class ConnectivityManagerShimImpl implements ConnectivityManagerShim {
    protected ConnectivityManagerShimImpl(Context context) {}
    protected final ConnectivityManager mCm;
    protected ConnectivityManagerShimImpl(Context context) {
        mCm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    }

    /**
     * Get a new instance of {@link ConnectivityManagerShim}.
@@ -52,12 +61,31 @@ public class ConnectivityManagerShimImpl implements ConnectivityManagerShim {

    /**
     * See android.net.ConnectivityManager#registerSystemDefaultNetworkCallback
     * @throws UnsupportedApiLevelException if API is not available in this API level.
     */
    @Override
    public void registerSystemDefaultNetworkCallback(@NonNull NetworkCallback networkCallback,
            @NonNull Handler handler) throws UnsupportedApiLevelException {
        // Not supported for API 29.
        throw new UnsupportedApiLevelException("Not supported in API 29.");
            @NonNull Handler handler) {
        // defaultNetworkRequest is not really a "request", just a way of tracking the system
        // default network. It's guaranteed not to actually bring up any networks because it
        // should be the same request as the ConnectivityService default request, and thus
        // shares fate with it.  In API <= R, registerSystemDefaultNetworkCallback is not
        // available, and registerDefaultNetworkCallback will not track the system default when
        // a VPN applies to the UID of this process.
        final NetworkRequest defaultNetworkRequest = makeEmptyCapabilitiesRequest()
                .addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_TRUSTED)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)
                .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
                .build();
        mCm.requestNetwork(defaultNetworkRequest, networkCallback, handler);
    }

    @NonNull
    protected NetworkRequest.Builder makeEmptyCapabilitiesRequest() {
        // Q does not have clearCapabilities(), so assume the default capabilities are as below
        return new NetworkRequest.Builder()
                .removeCapability(NET_CAPABILITY_NOT_RESTRICTED)
                .removeCapability(NET_CAPABILITY_TRUSTED)
                .removeCapability(NET_CAPABILITY_NOT_VPN);
    }
}
Loading