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

Commit 7ba7715c authored by Baligh Uddin's avatar Baligh Uddin Committed by Android (Google) Code Review
Browse files

Merge "Restructure Module code [ com.android.tethering ]" into stage-aosp-master

parents 6ae77124 4924b8e7
Loading
Loading
Loading
Loading

packages/Tethering/Android.bp

deleted100644 → 0
+0 −137
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.
//

java_defaults {
    name: "TetheringAndroidLibraryDefaults",
    sdk_version: "module_current",
    srcs: [
        "src/**/*.java",
        ":framework-tethering-shared-srcs",
        ":tethering-module-utils-srcs",
        ":services-tethering-shared-srcs",
    ],
    static_libs: [
        "androidx.annotation_annotation",
        "netd_aidl_interface-unstable-java",
        "netlink-client",
        // TODO: use networkstack-client instead of just including the AIDL interface
        "networkstack-aidl-interfaces-unstable-java",
        "android.hardware.tetheroffload.config-V1.0-java",
        "android.hardware.tetheroffload.control-V1.0-java",
        "net-utils-framework-common",
        "net-utils-device-common",
    ],
    libs: [
        "framework-statsd.stubs.module_lib",
        "framework-tethering.impl",
        "framework-wifi",
        "unsupportedappusage",
    ],
    plugins: ["java_api_finder"],
    manifest: "AndroidManifestBase.xml",
}

// Build tethering static library, used to compile both variants of the tethering.
android_library {
    name: "TetheringApiCurrentLib",
    defaults: ["TetheringAndroidLibraryDefaults"],
}

// Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK).
cc_library {
    name: "libtetherutilsjni",
    sdk_version: "current",
    apex_available: [
        "//apex_available:platform", // Used by InProcessTethering
        "com.android.tethering",
    ],
    min_sdk_version: "current",
    srcs: [
        "jni/android_net_util_TetheringUtils.cpp",
    ],
    shared_libs: [
        "liblog",
        "libnativehelper_compat_libc++",
    ],

    // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
    //   java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
    // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
    // build because soong complains of:
    //   module Tethering missing dependencies: libc++_shared
    //
    // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
    // we depend on do not dynamically link libc++. This is currently the case, because liblog is
    // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
    stl: "c++_static",

    cflags: [
        "-Wall",
        "-Werror",
        "-Wno-unused-parameter",
        "-Wthread-safety",
    ],

    ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"],
}

// Common defaults for compiling the actual APK.
java_defaults {
    name: "TetheringAppDefaults",
    sdk_version: "module_current",
    privileged: true,
    jni_libs: [
        "libtetherutilsjni",
    ],
    resource_dirs: [
        "res",
    ],
    libs: [
        "framework-tethering",
        "framework-wifi",
    ],
    jarjar_rules: "jarjar-rules.txt",
    optimize: {
        proguard_flags_files: ["proguard.flags"],
    },
}

// Non-updatable tethering running in the system server process for devices not using the module
android_app {
    name: "InProcessTethering",
    defaults: ["TetheringAppDefaults"],
    static_libs: ["TetheringApiCurrentLib"],
    certificate: "platform",
    manifest: "AndroidManifest_InProcess.xml",
    // InProcessTethering is a replacement for Tethering
    overrides: ["Tethering"],
    apex_available: ["com.android.tethering"],
    min_sdk_version: "current",
}

// Updatable tethering packaged as an application
android_app {
    name: "Tethering",
    defaults: ["TetheringAppDefaults"],
    static_libs: ["TetheringApiCurrentLib"],
    certificate: "networkstack",
    manifest: "AndroidManifest.xml",
    use_embedded_native_libs: true,
    // The permission configuration *must* be included to ensure security of the device
    required: ["NetworkPermissionConfig"],
    apex_available: ["com.android.tethering"],
    min_sdk_version: "current",
}
+0 −57
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.networkstack.tethering"
          android:sharedUserId="android.uid.networkstack">
    <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29" />

    <!-- Permissions must be defined here, and not in the base manifest, as the tethering
         running in the system server process does not need any permission, and having
         privileged permissions added would cause crashes on startup unless they are also
         added to the privileged permissions allowlist for that package. -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
    <uses-permission android:name="android.permission.BROADCAST_STICKY" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.MANAGE_USB" />
    <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
    <uses-permission android:name="android.permission.READ_NETWORK_USAGE_HISTORY" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.TETHER_PRIVILEGED" />
    <uses-permission android:name="android.permission.UPDATE_APP_OPS_STATS" />
    <uses-permission android:name="android.permission.UPDATE_DEVICE_STATS" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />

    <protected-broadcast android:name="com.android.server.connectivity.tethering.DISABLE_TETHERING" />

    <application
        android:process="com.android.networkstack.process"
        android:extractNativeLibs="false"
        android:persistent="true">
        <service android:name="com.android.networkstack.tethering.TetheringService"
                 android:permission="android.permission.MAINLINE_NETWORK_STACK"
                 android:exported="true">
            <intent-filter>
                <action android:name="android.net.ITetheringConnector"/>
            </intent-filter>
        </service>
    </application>
</manifest>
+0 −29
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.networkstack.tethering"
          android:versionCode="1"
          android:versionName="R-initial">
    <application
        android:label="Tethering"
        android:defaultToDeviceProtectedStorage="true"
        android:directBootAware="true"
        android:usesCleartextTraffic="true">
    </application>
</manifest>
+0 −34
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.networkstack.tethering.inprocess"
          android:sharedUserId="android.uid.system"
          android:process="system">
    <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29" />
    <application>
        <service android:name="com.android.networkstack.tethering.TetheringService"
                 android:process="system"
                 android:permission="android.permission.MAINLINE_NETWORK_STACK"
                 android:exported="true">
            <intent-filter>
                <action android:name="android.net.ITetheringConnector.InProcess"/>
            </intent-filter>
        </service>
    </application>
</manifest>

packages/Tethering/OWNERS

deleted100644 → 0
+0 −2
Original line number Diff line number Diff line
set noparent # while performing migration - b/167962976
baligh@google.com
Loading