Use framework-tethering-stub instead of framework-tethering

The non-updatable part of the platform now is built with
framework-tethering-stub, which is a stub library of
framework-tethering.

Bug: 147200698
Test: m
Change-Id: I97ef83f7f9b4c1376f373713036f5256318f1050
This commit is contained in:
markchien
2020-02-06 19:23:26 +08:00
parent d2ab0eeb13
commit 44fc26d19e
5 changed files with 55 additions and 17 deletions

View File

@@ -59,16 +59,33 @@ java_library {
],
hostdex: true, // for hiddenapi check
visibility: [
"//frameworks/base/packages/Tethering:__subpackages__",
//TODO(b/147200698) remove below lines when the platform is built with stubs
"//frameworks/base",
"//frameworks/base/services",
"//frameworks/base/services/core",
],
visibility: ["//frameworks/base/packages/Tethering:__subpackages__"],
apex_available: ["com.android.tethering"],
}
droidstubs {
name: "framework-tethering-stubs-sources",
defaults: ["framework-module-stubs-defaults-module_libs_api"],
srcs: [
"src/android/net/TetheredClient.java",
"src/android/net/TetheringManager.java",
"src/android/net/TetheringConstants.java",
],
libs: [
"tethering-aidl-interfaces-java",
"framework-all",
],
sdk_version: "core_platform",
}
java_library {
name: "framework-tethering-stubs",
srcs: [":framework-tethering-stubs-sources"],
libs: ["framework-all"],
static_libs: ["tethering-aidl-interfaces-java"],
sdk_version: "core_platform",
}
filegroup {
name: "framework-tethering-srcs",
srcs: [

View File

@@ -16,6 +16,8 @@
package android.net;
import static android.annotation.SystemApi.Client.MODULE_LIBRARIES;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
@@ -34,6 +36,7 @@ import java.util.Objects;
* @hide
*/
@SystemApi
@SystemApi(client = MODULE_LIBRARIES)
@TestApi
public final class TetheredClient implements Parcelable {
@NonNull

View File

@@ -16,6 +16,9 @@
package android.net;
import static android.annotation.SystemApi.Client.MODULE_LIBRARIES;
import android.annotation.SystemApi;
import android.os.ResultReceiver;
/**
@@ -28,39 +31,30 @@ import android.os.ResultReceiver;
* symbols from framework-tethering even when they are in a non-hidden class.
* @hide
*/
@SystemApi(client = MODULE_LIBRARIES)
public class TetheringConstants {
/**
* Extra used for communicating with the TetherService. Includes the type of tethering to
* enable if any.
*
* {@hide}
*/
public static final String EXTRA_ADD_TETHER_TYPE = "extraAddTetherType";
/**
* Extra used for communicating with the TetherService. Includes the type of tethering for
* which to cancel provisioning.
*
* {@hide}
*/
public static final String EXTRA_REM_TETHER_TYPE = "extraRemTetherType";
/**
* Extra used for communicating with the TetherService. True to schedule a recheck of tether
* provisioning.
*
* {@hide}
*/
public static final String EXTRA_SET_ALARM = "extraSetAlarm";
/**
* Tells the TetherService to run a provision check now.
*
* {@hide}
*/
public static final String EXTRA_RUN_PROVISION = "extraRunProvision";
/**
* Extra used for communicating with the TetherService. Contains the {@link ResultReceiver}
* which will receive provisioning results. Can be left empty.
*
* {@hide}
*/
public static final String EXTRA_PROVISION_CALLBACK = "extraProvisionCallback";
}

View File

@@ -15,6 +15,8 @@
*/
package android.net;
import static android.annotation.SystemApi.Client.MODULE_LIBRARIES;
import android.Manifest;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -50,6 +52,7 @@ import java.util.function.Supplier;
* @hide
*/
@SystemApi
@SystemApi(client = MODULE_LIBRARIES)
@TestApi
public class TetheringManager {
private static final String TAG = TetheringManager.class.getSimpleName();
@@ -177,6 +180,7 @@ public class TetheringManager {
* service is not connected.
* {@hide}
*/
@SystemApi(client = MODULE_LIBRARIES)
public TetheringManager(@NonNull final Context context,
@NonNull Supplier<IBinder> connectorSupplier) {
mContext = context;
@@ -395,6 +399,7 @@ public class TetheringManager {
* {@hide}
*/
@Deprecated
@SystemApi(client = MODULE_LIBRARIES)
public int tether(@NonNull final String iface) {
final String callerPkg = mContext.getOpPackageName();
Log.i(TAG, "tether caller:" + callerPkg);
@@ -418,6 +423,7 @@ public class TetheringManager {
* {@hide}
*/
@Deprecated
@SystemApi(client = MODULE_LIBRARIES)
public int untether(@NonNull final String iface) {
final String callerPkg = mContext.getOpPackageName();
Log.i(TAG, "untether caller:" + callerPkg);
@@ -444,6 +450,7 @@ public class TetheringManager {
* {@hide}
*/
@Deprecated
@SystemApi(client = MODULE_LIBRARIES)
public int setUsbTethering(final boolean enable) {
final String callerPkg = mContext.getOpPackageName();
Log.i(TAG, "setUsbTethering caller:" + callerPkg);
@@ -702,6 +709,7 @@ public class TetheringManager {
* {@hide}
*/
// TODO: improve the usage of ResultReceiver, b/145096122
@SystemApi(client = MODULE_LIBRARIES)
public void requestLatestTetheringEntitlementResult(final int type,
@NonNull final ResultReceiver receiver, final boolean showEntitlementUi) {
final String callerPkg = mContext.getOpPackageName();
@@ -982,6 +990,7 @@ public class TetheringManager {
* interface
* @hide
*/
@SystemApi(client = MODULE_LIBRARIES)
public int getLastTetherError(@NonNull final String iface) {
mCallback.waitForStarted();
if (mTetherStatesParcel == null) return TETHER_ERROR_NO_ERROR;
@@ -1004,6 +1013,7 @@ public class TetheringManager {
* what interfaces are considered tetherable usb interfaces.
* @hide
*/
@SystemApi(client = MODULE_LIBRARIES)
public @NonNull String[] getTetherableUsbRegexs() {
mCallback.waitForStarted();
return mTetheringConfiguration.tetherableUsbRegexs;
@@ -1018,6 +1028,7 @@ public class TetheringManager {
* what interfaces are considered tetherable wifi interfaces.
* @hide
*/
@SystemApi(client = MODULE_LIBRARIES)
public @NonNull String[] getTetherableWifiRegexs() {
mCallback.waitForStarted();
return mTetheringConfiguration.tetherableWifiRegexs;
@@ -1032,6 +1043,7 @@ public class TetheringManager {
* what interfaces are considered tetherable bluetooth interfaces.
* @hide
*/
@SystemApi(client = MODULE_LIBRARIES)
public @NonNull String[] getTetherableBluetoothRegexs() {
mCallback.waitForStarted();
return mTetheringConfiguration.tetherableBluetoothRegexs;
@@ -1044,6 +1056,7 @@ public class TetheringManager {
* @return an array of 0 or more Strings of tetherable interface names.
* @hide
*/
@SystemApi(client = MODULE_LIBRARIES)
public @NonNull String[] getTetherableIfaces() {
mCallback.waitForStarted();
if (mTetherStatesParcel == null) return new String[0];
@@ -1057,6 +1070,7 @@ public class TetheringManager {
* @return an array of 0 or more String of currently tethered interface names.
* @hide
*/
@SystemApi(client = MODULE_LIBRARIES)
public @NonNull String[] getTetheredIfaces() {
mCallback.waitForStarted();
if (mTetherStatesParcel == null) return new String[0];
@@ -1076,6 +1090,7 @@ public class TetheringManager {
* which failed to tether.
* @hide
*/
@SystemApi(client = MODULE_LIBRARIES)
public @NonNull String[] getTetheringErroredIfaces() {
mCallback.waitForStarted();
if (mTetherStatesParcel == null) return new String[0];
@@ -1103,6 +1118,7 @@ public class TetheringManager {
* @return a boolean - {@code true} indicating Tethering is supported.
* @hide
*/
@SystemApi(client = MODULE_LIBRARIES)
public boolean isTetheringSupported() {
final String callerPkg = mContext.getOpPackageName();

View File

@@ -34,7 +34,15 @@ android_test {
"TetheringApiCurrentLib",
"testables",
],
// TODO(b/147200698) change sdk_version to module-current and
// remove framework-minus-apex, ext, and framework-res
sdk_version: "core_platform",
libs: [
"framework-minus-apex",
"ext",
"framework-res",
"framework-wifi-stubs",
"framework-telephony-stubs",
"android.test.runner",
"android.test.base",
"android.test.mock",