Merge "Fix new NewApi lint warnings"
diff --git a/service/java/com/android/server/wifi/SoftApManager.java b/service/java/com/android/server/wifi/SoftApManager.java
index aa9c7a9..0f0299f 100644
--- a/service/java/com/android/server/wifi/SoftApManager.java
+++ b/service/java/com/android/server/wifi/SoftApManager.java
@@ -230,15 +230,8 @@
}
};
- private final CoexListener mCoexListener = new CoexListener() {
- @Override
- public void onCoexUnsafeChannelsChanged() {
- if (mCurrentSoftApConfiguration == null) {
- return;
- }
- mStateMachine.sendMessage(SoftApStateMachine.CMD_SAFE_CHANNEL_FREQUENCY_CHANGED);
- }
- };
+ // This will only be null if SdkLevel is not at least S
+ @Nullable private final CoexListener mCoexListener;
private void updateSafeChannelFrequencyList() {
if (!SdkLevel.isAtLeastS() || mCurrentSoftApConfiguration == null) {
@@ -323,6 +316,20 @@
mSoftApNotifier = softApNotifier;
mWifiNative = wifiNative;
mCoexManager = coexManager;
+ if (SdkLevel.isAtLeastS()) {
+ mCoexListener = new CoexListener() {
+ @Override
+ public void onCoexUnsafeChannelsChanged() {
+ if (mCurrentSoftApConfiguration == null) {
+ return;
+ }
+ mStateMachine.sendMessage(
+ SoftApStateMachine.CMD_SAFE_CHANNEL_FREQUENCY_CHANGED);
+ }
+ };
+ } else {
+ mCoexListener = null;
+ }
mCountryCode = countryCode;
mModeListener = listener;
mSoftApCallback = callback;
diff --git a/service/java/com/android/server/wifi/WifiShellCommand.java b/service/java/com/android/server/wifi/WifiShellCommand.java
index a86cd8f..0231764 100644
--- a/service/java/com/android/server/wifi/WifiShellCommand.java
+++ b/service/java/com/android/server/wifi/WifiShellCommand.java
@@ -55,6 +55,7 @@
import android.net.wifi.WifiScanner;
import android.net.wifi.WifiSsid;
import android.os.Binder;
+import android.os.Build;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
@@ -66,6 +67,7 @@
import android.util.Pair;
import androidx.annotation.NonNull;
+import androidx.annotation.RequiresApi;
import com.android.internal.annotations.VisibleForTesting;
import com.android.modules.utils.BasicShellCommandHandler;
@@ -1270,6 +1272,7 @@
.build();
}
+ @RequiresApi(Build.VERSION_CODES.S)
@NonNull
private List<CoexUtils.CoexCellChannel> buildCoexCellChannels() {
List<CoexUtils.CoexCellChannel> cellChannels = new ArrayList<>();