Make NewApi to error in Tethering
Bug: 293971841 Test: TH Change-Id: Iae92b171abe8a4620325bd7ce0f7f76912d6d1d8
This commit is contained in:
parent
3171a0bb8e
commit
ac7c5723c3
3 changed files with 16 additions and 5 deletions
|
|
@ -81,7 +81,10 @@ java_defaults {
|
|||
"framework-tethering.impl",
|
||||
],
|
||||
manifest: "AndroidManifestBase.xml",
|
||||
lint: { strict_updatability_linting: true },
|
||||
lint: {
|
||||
strict_updatability_linting: true,
|
||||
error_checks: ["NewApi"],
|
||||
},
|
||||
}
|
||||
|
||||
// build tethering static library, used to compile both variants of the tethering.
|
||||
|
|
@ -215,7 +218,10 @@ android_app {
|
|||
use_embedded_native_libs: true,
|
||||
privapp_allowlist: ":privapp_allowlist_com.android.tethering",
|
||||
apex_available: ["com.android.tethering"],
|
||||
lint: { strict_updatability_linting: true },
|
||||
lint: {
|
||||
strict_updatability_linting: true,
|
||||
error_checks: ["NewApi"],
|
||||
},
|
||||
}
|
||||
|
||||
sdk {
|
||||
|
|
|
|||
|
|
@ -838,7 +838,7 @@ public class IpServer extends StateMachineShim {
|
|||
|
||||
private void addInterfaceToNetwork(final int netId, @NonNull final String ifaceName) {
|
||||
try {
|
||||
if (null != mRoutingCoordinator.value) {
|
||||
if (SdkLevel.isAtLeastS() && null != mRoutingCoordinator.value) {
|
||||
// TODO : remove this call in favor of using the LocalNetworkConfiguration
|
||||
// correctly, which will let ConnectivityService do it automatically.
|
||||
mRoutingCoordinator.value.addInterfaceToNetwork(netId, ifaceName);
|
||||
|
|
@ -852,7 +852,7 @@ public class IpServer extends StateMachineShim {
|
|||
|
||||
private void addInterfaceForward(@NonNull final String fromIface,
|
||||
@NonNull final String toIface) throws ServiceSpecificException, RemoteException {
|
||||
if (null != mRoutingCoordinator.value) {
|
||||
if (SdkLevel.isAtLeastS() && null != mRoutingCoordinator.value) {
|
||||
mRoutingCoordinator.value.addInterfaceForward(fromIface, toIface);
|
||||
} else {
|
||||
mNetd.tetherAddForward(fromIface, toIface);
|
||||
|
|
@ -862,7 +862,7 @@ public class IpServer extends StateMachineShim {
|
|||
|
||||
private void removeInterfaceForward(@NonNull final String fromIface,
|
||||
@NonNull final String toIface) {
|
||||
if (null != mRoutingCoordinator.value) {
|
||||
if (SdkLevel.isAtLeastS() && null != mRoutingCoordinator.value) {
|
||||
try {
|
||||
mRoutingCoordinator.value.removeInterfaceForward(fromIface, toIface);
|
||||
} catch (ServiceSpecificException e) {
|
||||
|
|
|
|||
|
|
@ -19,18 +19,21 @@ package com.android.networkstack.tethering;
|
|||
import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_AIDL;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.TargetApi;
|
||||
import android.hardware.tetheroffload.ForwardedStats;
|
||||
import android.hardware.tetheroffload.IOffload;
|
||||
import android.hardware.tetheroffload.ITetheringOffloadCallback;
|
||||
import android.hardware.tetheroffload.NatTimeoutUpdate;
|
||||
import android.hardware.tetheroffload.NetworkProtocol;
|
||||
import android.hardware.tetheroffload.OffloadCallbackEvent;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.NativeHandle;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.os.ServiceManager;
|
||||
import android.system.OsConstants;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.modules.utils.build.SdkLevel;
|
||||
import com.android.net.module.util.SharedLog;
|
||||
import com.android.networkstack.tethering.OffloadHardwareInterface.OffloadHalCallback;
|
||||
|
|
@ -40,6 +43,7 @@ import java.util.ArrayList;
|
|||
/**
|
||||
* The implementation of IOffloadHal which based on Stable AIDL interface
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
|
||||
public class OffloadHalAidlImpl implements IOffloadHal {
|
||||
private static final String TAG = OffloadHalAidlImpl.class.getSimpleName();
|
||||
private static final String HAL_INSTANCE_NAME = IOffload.DESCRIPTOR + "/default";
|
||||
|
|
@ -52,6 +56,7 @@ public class OffloadHalAidlImpl implements IOffloadHal {
|
|||
|
||||
private TetheringOffloadCallback mTetheringOffloadCallback;
|
||||
|
||||
@VisibleForTesting
|
||||
public OffloadHalAidlImpl(int version, @NonNull IOffload offload, @NonNull Handler handler,
|
||||
@NonNull SharedLog log) {
|
||||
mOffloadVersion = version;
|
||||
|
|
|
|||
Loading…
Reference in a new issue