diff --git a/Tethering/Android.bp b/Tethering/Android.bp index bf28a14a9a..0b54783d13 100644 --- a/Tethering/Android.bp +++ b/Tethering/Android.bp @@ -56,6 +56,7 @@ java_defaults { ], plugins: ["java_api_finder"], manifest: "AndroidManifestBase.xml", + lint: { strict_updatability_linting: true }, } // build tethering static library, used to compile both variants of the tethering. @@ -69,6 +70,7 @@ android_library { "NetworkStackApiCurrentShims", ], apex_available: ["com.android.tethering"], + lint: { strict_updatability_linting: true }, } android_library { @@ -81,6 +83,7 @@ android_library { "NetworkStackApiStableShims", ], apex_available: ["com.android.tethering"], + lint: { strict_updatability_linting: true }, } // Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK). @@ -147,6 +150,7 @@ java_defaults { optimize: { proguard_flags_files: ["proguard.flags"], }, + lint: { strict_updatability_linting: true }, } // Non-updatable tethering running in the system server process for devices not using the module @@ -159,6 +163,7 @@ android_app { // InProcessTethering is a replacement for Tethering overrides: ["Tethering"], apex_available: ["com.android.tethering"], + lint: { strict_updatability_linting: true }, } // Updatable tethering packaged for finalized API @@ -175,6 +180,7 @@ android_app { "privapp_whitelist_com.android.networkstack.tethering", ], apex_available: ["com.android.tethering"], + lint: { strict_updatability_linting: true }, } android_app { @@ -194,6 +200,7 @@ android_app { "privapp_whitelist_com.android.networkstack.tethering", ], apex_available: ["com.android.tethering"], + lint: { strict_updatability_linting: true }, } sdk { diff --git a/Tethering/common/TetheringLib/Android.bp b/Tethering/common/TetheringLib/Android.bp index 6e645704ca..c82a9937bf 100644 --- a/Tethering/common/TetheringLib/Android.bp +++ b/Tethering/common/TetheringLib/Android.bp @@ -53,6 +53,7 @@ java_sdk_library { apex_available: ["com.android.tethering"], permitted_packages: ["android.net"], min_sdk_version: "30", + lint: { strict_updatability_linting: true }, } filegroup { diff --git a/framework/Android.bp b/framework/Android.bp index d31f74fe0d..e765ee8bd2 100644 --- a/framework/Android.bp +++ b/framework/Android.bp @@ -112,6 +112,7 @@ java_sdk_library { apex_available: [ "com.android.tethering", ], + lint: { strict_updatability_linting: true }, } cc_library_shared { diff --git a/framework/lint-baseline.xml b/framework/lint-baseline.xml deleted file mode 100644 index 099202f97c..0000000000 --- a/framework/lint-baseline.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/framework/src/android/net/util/MultinetworkPolicyTracker.java b/framework/src/android/net/util/MultinetworkPolicyTracker.java index 3e7cb80258..c1790c992c 100644 --- a/framework/src/android/net/util/MultinetworkPolicyTracker.java +++ b/framework/src/android/net/util/MultinetworkPolicyTracker.java @@ -20,6 +20,7 @@ import static android.net.ConnectivitySettingsManager.NETWORK_AVOID_BAD_WIFI; import static android.net.ConnectivitySettingsManager.NETWORK_METERED_MULTIPATH_PREFERENCE; import android.annotation.NonNull; +import android.annotation.TargetApi; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; @@ -29,6 +30,7 @@ import android.content.res.Resources; import android.database.ContentObserver; import android.net.ConnectivityResources; import android.net.Uri; +import android.os.Build; import android.os.Handler; import android.provider.Settings; import android.telephony.SubscriptionManager; @@ -92,8 +94,8 @@ public class MultinetworkPolicyTracker { } } } - - @VisibleForTesting + // TODO: Set the mini sdk to 31 and remove @TargetApi annotation when b/205923322 is addressed. + @VisibleForTesting @TargetApi(Build.VERSION_CODES.S) protected class ActiveDataSubscriptionIdListener extends TelephonyCallback implements TelephonyCallback.ActiveDataSubscriptionIdListener { @Override @@ -107,6 +109,8 @@ public class MultinetworkPolicyTracker { this(ctx, handler, null); } + // TODO: Set the mini sdk to 31 and remove @TargetApi annotation when b/205923322 is addressed. + @TargetApi(Build.VERSION_CODES.S) public MultinetworkPolicyTracker(Context ctx, Handler handler, Runnable avoidBadWifiCallback) { mContext = ctx; mResources = new ConnectivityResources(ctx); diff --git a/service/Android.bp b/service/Android.bp index 02717f7be7..b595ef2727 100644 --- a/service/Android.bp +++ b/service/Android.bp @@ -79,6 +79,7 @@ java_library { apex_available: [ "com.android.tethering", ], + lint: { strict_updatability_linting: true }, } java_library { @@ -95,6 +96,7 @@ java_library { apex_available: [ "com.android.tethering", ], + lint: { strict_updatability_linting: true }, } java_library { @@ -109,6 +111,7 @@ java_library { apex_available: [ "com.android.tethering", ], + lint: { strict_updatability_linting: true }, } filegroup { diff --git a/service/lint-baseline.xml b/service/lint-baseline.xml deleted file mode 100644 index 119b64ff95..0000000000 --- a/service/lint-baseline.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/service/src/com/android/server/ConnectivityService.java b/service/src/com/android/server/ConnectivityService.java index f89141db85..d507b4b331 100644 --- a/service/src/com/android/server/ConnectivityService.java +++ b/service/src/com/android/server/ConnectivityService.java @@ -98,6 +98,7 @@ import static java.util.Map.Entry; import android.Manifest; import android.annotation.NonNull; import android.annotation.Nullable; +import android.annotation.TargetApi; import android.app.AppOpsManager; import android.app.BroadcastOptions; import android.app.PendingIntent; @@ -853,6 +854,9 @@ public class ConnectivityService extends IConnectivityManager.Stub mTypeLists = new ArrayList[ConnectivityManager.MAX_NETWORK_TYPE + 1]; } + // TODO: Set the mini sdk to 31 and remove @TargetApi annotation when b/205923322 is + // addressed. + @TargetApi(Build.VERSION_CODES.S) public void loadSupportedTypes(@NonNull Context ctx, @NonNull TelephonyManager tm) { final PackageManager pm = ctx.getPackageManager(); if (pm.hasSystemFeature(FEATURE_WIFI)) { @@ -2781,6 +2785,8 @@ public class ConnectivityService extends IConnectivityManager.Stub sendStickyBroadcast(makeGeneralIntent(info, bcastType)); } + // TODO: Set the mini sdk to 31 and remove @TargetApi annotation when b/205923322 is addressed. + @TargetApi(Build.VERSION_CODES.S) private void sendStickyBroadcast(Intent intent) { synchronized (this) { if (!mSystemReady @@ -6130,6 +6136,8 @@ public class ConnectivityService extends IConnectivityManager.Stub } } + // TODO: Set the mini sdk to 31 and remove @TargetApi annotation when b/205923322 is addressed. + @TargetApi(Build.VERSION_CODES.S) private boolean isTargetSdkAtleast(int version, int callingUid, @NonNull String callingPackageName) { final UserHandle user = UserHandle.getUserHandleForUid(callingUid);