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

Commit 1029e500 authored by David Su's avatar David Su Committed by Android (Google) Code Review
Browse files

Merge changes from topics "framework-wifi-test-defaults",...

Merge changes from topics "framework-wifi-test-defaults", "frameworkwifiapitests-mk-to-bp", "wifitrackerlibtests-access-hidden-apis"

* changes:
  Formalize WifiConfiguration#getIpConfiguration()
  WifiTrackerLibTests: grant access to Wifi @hide APIs
  ConnectivityManagerTest: grant access to Wifi @hide APIs
  FrameworksWifiApiTests: build against framework-wifi
  framework-wifi: default build rule for tests
  Convert FrameworksWifiApiTests mk to bp
parents 27baafad 725e2d26
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5693,6 +5693,7 @@ package android.net.wifi {
  @Deprecated public class WifiConfiguration implements android.os.Parcelable {
    method @Deprecated public int getAuthType();
    method @Deprecated @NonNull public android.net.IpConfiguration.IpAssignment getIpAssignment();
    method @Deprecated @NonNull public android.net.IpConfiguration getIpConfiguration();
    method @Deprecated @NonNull public android.net.wifi.WifiConfiguration.NetworkSelectionStatus getNetworkSelectionStatus();
    method @Deprecated @NonNull public String getPrintableSsid();
    method @Deprecated @NonNull public android.net.IpConfiguration.ProxySettings getProxySettings();
+1 −1
Original line number Diff line number Diff line
@@ -21,6 +21,6 @@ android_test {
    static_libs: ["junit"],
    // Include all test java files.
    srcs: ["src/**/*.java"],
    platform_apis: true,
    defaults: ["framework-wifi-test-defaults"],
    certificate: "platform",
}
+31 −3
Original line number Diff line number Diff line
@@ -42,11 +42,22 @@ filegroup {
    srcs: ["java/android/net/wifi/WifiAnnotations.java"],
}

// list of tests that are allowed to access @hide APIs from framework-wifi
test_access_hidden_api_whitelist = [
    "//frameworks/base/wifi/tests",
    "//frameworks/opt/net/wifi/tests/wifitests:__subpackages__",

    "//frameworks/base/core/tests/ConnectivityManagerTest",
    "//frameworks/opt/net/wifi/libs/WifiTrackerLib/tests",
]

java_library {
    name: "framework-wifi",
    sdk_version: "core_platform", // TODO(b/140299412) should be core_current
    // TODO(b/140299412) should be core_current once we build against framework-system-stubs
    sdk_version: "core_platform",
    libs: [
        "framework-minus-apex", // TODO(b/140299412) should be framework-system-stubs
        // TODO(b/140299412) should be framework-system-stubs once we fix all @hide dependencies
        "framework-minus-apex",
    ],
    srcs: [
        ":framework-wifi-updatable-sources",
@@ -54,7 +65,11 @@ java_library {
    installable: true,
    optimize: {
        enabled: false
    }
    },
    visibility: [
        "//frameworks/base", // TODO(b/140299412) remove once all dependencies are fixed
        "//frameworks/opt/net/wifi/service:__subpackages__",
    ] + test_access_hidden_api_whitelist,
}

droidstubs {
@@ -84,3 +99,16 @@ java_library {
    installable: false,
}

// defaults for tests that need to build against framework-wifi's @hide APIs
java_defaults {
    name: "framework-wifi-test-defaults",
    sdk_version: "core_platform", // tests can use @CorePlatformApi's
    libs: [
        "framework-wifi",
        "framework-minus-apex",

        // if sdk_version="" this gets automatically included, but here we need to add manually.
        "framework-res",
    ],
    visibility: test_access_hidden_api_whitelist,
}
+7 −3
Original line number Diff line number Diff line
@@ -2446,10 +2446,14 @@ public class WifiConfiguration implements Parcelable {
        return key;
    }

    /** @hide */
    @UnsupportedAppUsage
    /**
     * Get the IpConfiguration object associated with this WifiConfiguration.
     * @hide
     */
    @NonNull
    @SystemApi
    public IpConfiguration getIpConfiguration() {
        return mIpConfiguration;
        return new IpConfiguration(mIpConfiguration);
    }

    /**

wifi/tests/Android.bp

0 → 100644
+68 −0
Original line number Diff line number Diff line
// Copyright (C) 2016 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.

// Make test APK
// ============================================================

// This list is generated from the java source files in this module
// The list is a comma separated list of class names with * matching zero or more characters.
// Example:
//   Input files: src/com/android/server/wifi/Test.java src/com/android/server/wifi/AnotherTest.java
//   Generated exclude list: com.android.server.wifi.Test*,com.android.server.wifi.AnotherTest*

// Filter all src files to just java files
local_java_files = ["__builtin_func:filter %.java <'LOCAL_SRC_FILES' unset>"]
// Transform java file names into full class names.
// This only works if the class name matches the file name and the directory structure
// matches the package.
local_classes = ["__builtin_func:subst / . __builtin_func:patsubst src/%.java % <'local_java_files' unset>"]
// Convert class name list to jacoco exclude list
// This appends a * to all classes and replace the space separators with commas.
// These patterns will match all classes in this module and their inner classes.
jacoco_exclude = ["__builtin_func:subst <'space' unset> <'comma' unset> __builtin_func:patsubst % %* <'local_classes' unset>"]

jacoco_include = ["android.net.wifi.*"]

android_test {
    name: "FrameworksWifiApiTests",

    defaults: ["framework-wifi-test-defaults"],

    srcs: ["**/*.java"],

    jacoco: {
        include_filter: jacoco_include,
        exclude_filter: jacoco_exclude,
    },

    static_libs: [
        "androidx.test.rules",
        "core-test-rules",
        "guava",
        "mockito-target-minus-junit4",
        "net-tests-utils",
        "frameworks-base-testutils",
        "truth-prebuilt",
    ],

    libs: [
        "android.test.runner",
        "android.test.base",
    ],

    test_suites: [
        "device-tests",
        "mts",
    ],
}
Loading