Merge "Enable strict_updatability_linting in connectivity src" am: 81bc609550
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1902533 Change-Id: I5cf42aa64a838f711cd1ecc589f86aecb19b358f
This commit is contained in:
@@ -56,6 +56,7 @@ java_defaults {
|
|||||||
],
|
],
|
||||||
plugins: ["java_api_finder"],
|
plugins: ["java_api_finder"],
|
||||||
manifest: "AndroidManifestBase.xml",
|
manifest: "AndroidManifestBase.xml",
|
||||||
|
lint: { strict_updatability_linting: true },
|
||||||
}
|
}
|
||||||
|
|
||||||
// build tethering static library, used to compile both variants of the tethering.
|
// build tethering static library, used to compile both variants of the tethering.
|
||||||
@@ -69,6 +70,7 @@ android_library {
|
|||||||
"NetworkStackApiCurrentShims",
|
"NetworkStackApiCurrentShims",
|
||||||
],
|
],
|
||||||
apex_available: ["com.android.tethering"],
|
apex_available: ["com.android.tethering"],
|
||||||
|
lint: { strict_updatability_linting: true },
|
||||||
}
|
}
|
||||||
|
|
||||||
android_library {
|
android_library {
|
||||||
@@ -81,6 +83,7 @@ android_library {
|
|||||||
"NetworkStackApiStableShims",
|
"NetworkStackApiStableShims",
|
||||||
],
|
],
|
||||||
apex_available: ["com.android.tethering"],
|
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).
|
// 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: {
|
optimize: {
|
||||||
proguard_flags_files: ["proguard.flags"],
|
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
|
// 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
|
// InProcessTethering is a replacement for Tethering
|
||||||
overrides: ["Tethering"],
|
overrides: ["Tethering"],
|
||||||
apex_available: ["com.android.tethering"],
|
apex_available: ["com.android.tethering"],
|
||||||
|
lint: { strict_updatability_linting: true },
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updatable tethering packaged for finalized API
|
// Updatable tethering packaged for finalized API
|
||||||
@@ -175,6 +180,7 @@ android_app {
|
|||||||
"privapp_whitelist_com.android.networkstack.tethering",
|
"privapp_whitelist_com.android.networkstack.tethering",
|
||||||
],
|
],
|
||||||
apex_available: ["com.android.tethering"],
|
apex_available: ["com.android.tethering"],
|
||||||
|
lint: { strict_updatability_linting: true },
|
||||||
}
|
}
|
||||||
|
|
||||||
android_app {
|
android_app {
|
||||||
@@ -194,6 +200,7 @@ android_app {
|
|||||||
"privapp_whitelist_com.android.networkstack.tethering",
|
"privapp_whitelist_com.android.networkstack.tethering",
|
||||||
],
|
],
|
||||||
apex_available: ["com.android.tethering"],
|
apex_available: ["com.android.tethering"],
|
||||||
|
lint: { strict_updatability_linting: true },
|
||||||
}
|
}
|
||||||
|
|
||||||
sdk {
|
sdk {
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ java_sdk_library {
|
|||||||
apex_available: ["com.android.tethering"],
|
apex_available: ["com.android.tethering"],
|
||||||
permitted_packages: ["android.net"],
|
permitted_packages: ["android.net"],
|
||||||
min_sdk_version: "30",
|
min_sdk_version: "30",
|
||||||
|
lint: { strict_updatability_linting: true },
|
||||||
}
|
}
|
||||||
|
|
||||||
filegroup {
|
filegroup {
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ java_sdk_library {
|
|||||||
apex_available: [
|
apex_available: [
|
||||||
"com.android.tethering",
|
"com.android.tethering",
|
||||||
],
|
],
|
||||||
|
lint: { strict_updatability_linting: true },
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_library_shared {
|
cc_library_shared {
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<issues format="5" by="lint 4.1.0" client="cli" variant="all" version="4.1.0">
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="Call requires API level 31 (current min is 30): `new android.net.ParseException`"
|
|
||||||
errorLine1=" ParseException pe = new ParseException(e.reason, e.getCause());"
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="packages/modules/Connectivity/framework/src/android/net/DnsResolver.java"
|
|
||||||
line="301"
|
|
||||||
column="37"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="Class requires API level 31 (current min is 30): `android.telephony.TelephonyCallback`"
|
|
||||||
errorLine1=" protected class ActiveDataSubscriptionIdListener extends TelephonyCallback"
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="packages/modules/Connectivity/framework/src/android/net/util/MultinetworkPolicyTracker.java"
|
|
||||||
line="96"
|
|
||||||
column="62"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="Class requires API level 31 (current min is 30): `android.telephony.TelephonyCallback.ActiveDataSubscriptionIdListener`"
|
|
||||||
errorLine1=" implements TelephonyCallback.ActiveDataSubscriptionIdListener {"
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="packages/modules/Connectivity/framework/src/android/net/util/MultinetworkPolicyTracker.java"
|
|
||||||
line="97"
|
|
||||||
column="24"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="Call requires API level 31 (current min is 30): `android.telephony.TelephonyManager#registerTelephonyCallback`"
|
|
||||||
errorLine1=" ctx.getSystemService(TelephonyManager.class).registerTelephonyCallback("
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="packages/modules/Connectivity/framework/src/android/net/util/MultinetworkPolicyTracker.java"
|
|
||||||
line="126"
|
|
||||||
column="54"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
</issues>
|
|
||||||
@@ -20,6 +20,7 @@ import static android.net.ConnectivitySettingsManager.NETWORK_AVOID_BAD_WIFI;
|
|||||||
import static android.net.ConnectivitySettingsManager.NETWORK_METERED_MULTIPATH_PREFERENCE;
|
import static android.net.ConnectivitySettingsManager.NETWORK_METERED_MULTIPATH_PREFERENCE;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.TargetApi;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -29,6 +30,7 @@ import android.content.res.Resources;
|
|||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
import android.net.ConnectivityResources;
|
import android.net.ConnectivityResources;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
@@ -92,8 +94,8 @@ public class MultinetworkPolicyTracker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// TODO: Set the mini sdk to 31 and remove @TargetApi annotation when b/205923322 is addressed.
|
||||||
@VisibleForTesting
|
@VisibleForTesting @TargetApi(Build.VERSION_CODES.S)
|
||||||
protected class ActiveDataSubscriptionIdListener extends TelephonyCallback
|
protected class ActiveDataSubscriptionIdListener extends TelephonyCallback
|
||||||
implements TelephonyCallback.ActiveDataSubscriptionIdListener {
|
implements TelephonyCallback.ActiveDataSubscriptionIdListener {
|
||||||
@Override
|
@Override
|
||||||
@@ -107,6 +109,8 @@ public class MultinetworkPolicyTracker {
|
|||||||
this(ctx, handler, null);
|
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) {
|
public MultinetworkPolicyTracker(Context ctx, Handler handler, Runnable avoidBadWifiCallback) {
|
||||||
mContext = ctx;
|
mContext = ctx;
|
||||||
mResources = new ConnectivityResources(ctx);
|
mResources = new ConnectivityResources(ctx);
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ java_library {
|
|||||||
apex_available: [
|
apex_available: [
|
||||||
"com.android.tethering",
|
"com.android.tethering",
|
||||||
],
|
],
|
||||||
|
lint: { strict_updatability_linting: true },
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
@@ -95,6 +96,7 @@ java_library {
|
|||||||
apex_available: [
|
apex_available: [
|
||||||
"com.android.tethering",
|
"com.android.tethering",
|
||||||
],
|
],
|
||||||
|
lint: { strict_updatability_linting: true },
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
@@ -109,6 +111,7 @@ java_library {
|
|||||||
apex_available: [
|
apex_available: [
|
||||||
"com.android.tethering",
|
"com.android.tethering",
|
||||||
],
|
],
|
||||||
|
lint: { strict_updatability_linting: true },
|
||||||
}
|
}
|
||||||
|
|
||||||
filegroup {
|
filegroup {
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<issues format="5" by="lint 4.1.0" client="cli" variant="all" version="4.1.0">
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="Call requires API level 31 (current min is 30): `android.telephony.TelephonyManager#isDataCapable`"
|
|
||||||
errorLine1=" if (tm.isDataCapable()) {"
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java"
|
|
||||||
line="787"
|
|
||||||
column="20"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="Call requires API level 31 (current min is 30): `android.content.Context#sendStickyBroadcast`"
|
|
||||||
errorLine1=" mUserAllContext.sendStickyBroadcast(intent, options);"
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java"
|
|
||||||
line="2681"
|
|
||||||
column="33"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="Call requires API level 31 (current min is 30): `android.content.pm.PackageManager#getTargetSdkVersion`"
|
|
||||||
errorLine1=" final int callingVersion = pm.getTargetSdkVersion(callingPackageName);"
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java"
|
|
||||||
line="5851"
|
|
||||||
column="43"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
</issues>
|
|
||||||
@@ -98,6 +98,7 @@ import static java.util.Map.Entry;
|
|||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
|
import android.annotation.TargetApi;
|
||||||
import android.app.AppOpsManager;
|
import android.app.AppOpsManager;
|
||||||
import android.app.BroadcastOptions;
|
import android.app.BroadcastOptions;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
@@ -853,6 +854,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
mTypeLists = new ArrayList[ConnectivityManager.MAX_NETWORK_TYPE + 1];
|
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) {
|
public void loadSupportedTypes(@NonNull Context ctx, @NonNull TelephonyManager tm) {
|
||||||
final PackageManager pm = ctx.getPackageManager();
|
final PackageManager pm = ctx.getPackageManager();
|
||||||
if (pm.hasSystemFeature(FEATURE_WIFI)) {
|
if (pm.hasSystemFeature(FEATURE_WIFI)) {
|
||||||
@@ -2781,6 +2785,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
sendStickyBroadcast(makeGeneralIntent(info, bcastType));
|
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) {
|
private void sendStickyBroadcast(Intent intent) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (!mSystemReady
|
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,
|
private boolean isTargetSdkAtleast(int version, int callingUid,
|
||||||
@NonNull String callingPackageName) {
|
@NonNull String callingPackageName) {
|
||||||
final UserHandle user = UserHandle.getUserHandleForUid(callingUid);
|
final UserHandle user = UserHandle.getUserHandleForUid(callingUid);
|
||||||
|
|||||||
Reference in New Issue
Block a user