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

Commit a2bfbe79 authored by Mark Chien's avatar Mark Chien Committed by android-build-merger
Browse files

Merge "[Tether02] Migrate TetheringConfiguration into module" am: 72d5460d am: c7ed6b4f

am: c95ca17d

Change-Id: Ifbcc8a81d4ea7521f0d3ae56e0951974b9355334
parents 792cab8b c95ca17d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -511,6 +511,12 @@ filegroup {
    ],
}

filegroup {
    name: "framework-tethering-shared-srcs",
    srcs: [
        "core/java/android/util/LocalLog.java",
    ],
}
// Build ext.jar
// ============================================================
java_library {
+10 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ java_defaults {
    platform_apis: true,
    srcs: [
        "src/**/*.java",
        ":framework-tethering-shared-srcs",
        ":services-tethering-shared-srcs",
    ],
    static_libs: [
        "androidx.annotation_annotation",
@@ -60,3 +62,11 @@ android_app {
    // The permission configuration *must* be included to ensure security of the device
    required: ["NetworkPermissionConfig"],
}

// This group will be removed when tethering migration is done.
filegroup {
    name: "tethering-services-srcs",
    srcs: [
        "src/com/android/server/connectivity/tethering/TetheringConfiguration.java",
    ],
}
+9 −2
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ public class TetheringConfiguration {
        "192.168.48.2", "192.168.48.254", "192.168.49.2", "192.168.49.254",
    };

    private final String[] DEFAULT_IPV4_DNS = {"8.8.4.4", "8.8.8.8"};
    private static final String[] DEFAULT_IPV4_DNS = {"8.8.4.4", "8.8.8.8"};

    public final String[] tetherableUsbRegexs;
    public final String[] tetherableWifiRegexs;
@@ -133,10 +133,12 @@ public class TetheringConfiguration {
        configLog.log(toString());
    }

    /** Check whether input interface belong to usb.*/
    public boolean isUsb(String iface) {
        return matchesDownstreamRegexs(iface, tetherableUsbRegexs);
    }

    /** Check whether input interface belong to wifi.*/
    public boolean isWifi(String iface) {
        return matchesDownstreamRegexs(iface, tetherableWifiRegexs);
    }
@@ -146,18 +148,22 @@ public class TetheringConfiguration {
        return matchesDownstreamRegexs(iface, tetherableWifiP2pRegexs);
    }

    /** Check whether using legacy mode for wifi P2P. */
    public boolean isWifiP2pLegacyTetheringMode() {
        return (tetherableWifiP2pRegexs == null || tetherableWifiP2pRegexs.length == 0);
    }

    /** Check whether input interface belong to bluetooth.*/
    public boolean isBluetooth(String iface) {
        return matchesDownstreamRegexs(iface, tetherableBluetoothRegexs);
    }

    /** Check whether no ui entitlement application is available.*/
    public boolean hasMobileHotspotProvisionApp() {
        return !TextUtils.isEmpty(provisioningAppNoUi);
    }

    /** Does the dumping.*/
    public void dump(PrintWriter pw) {
        pw.print("subId: ");
        pw.println(subId);
@@ -186,6 +192,7 @@ public class TetheringConfiguration {
        pw.println(enableLegacyDhcpServer);
    }

    /** Returns the string representation of this object.*/
    public String toString() {
        final StringJoiner sj = new StringJoiner(" ");
        sj.add(String.format("subId:%d", subId));
@@ -210,7 +217,7 @@ public class TetheringConfiguration {

        if (values != null) {
            final StringJoiner sj = new StringJoiner(", ", "[", "]");
            for (String value : values) { sj.add(value); }
            for (String value : values) sj.add(value);
            pw.print(sj.toString());
        } else {
            pw.print("null");
+47 −0
Original line number Diff line number Diff line
//
// Copyright (C) 2019 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.
//

android_test {
    name: "TetheringTests",
    certificate: "platform",
    srcs: ["src/**/*.java"],
    test_suites: ["device-tests"],
    static_libs: [
        "androidx.test.rules",
        "frameworks-base-testutils",
        "mockito-target-extended-minus-junit4",
        "TetheringApiCurrentLib",
        "testables",
    ],
    libs: [
        "android.test.runner",
        "android.test.base",
        "android.test.mock",
    ],
    jni_libs: [
        // For mockito extended
        "libdexmakerjvmtiagent",
        "libstaticjvmtiagent",
    ],
}

// This group would be removed when tethering migration is done.
filegroup {
    name: "tethering-tests-src",
    srcs: [
        "src/com/android/server/connectivity/tethering/TetheringConfigurationTest.java",
    ],
}
+26 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2019 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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.android.tethering.tests.unit">

    <application android:debuggable="true">
        <uses-library android:name="android.test.runner" />
    </application>
    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
        android:targetPackage="com.android.tethering.tests.unit"
        android:label="Tethering service tests">
    </instrumentation>
</manifest>
Loading