Change the behavior of notifyAllowedNetworkTypesChanged.

Bug: 180903931
Test: atest AllowedNetworkTypesListenerTest.java
Change-Id: Ic94816415920bf25896ef2b198e228f369039c94
This commit is contained in:
SongFerngWang
2021-03-02 22:04:10 +08:00
parent 0b29ebd420
commit 4ccbe5d785
2 changed files with 7 additions and 11 deletions

View File

@@ -24,7 +24,6 @@ import android.util.Log;
import androidx.annotation.VisibleForTesting;
import java.util.Map;
import java.util.concurrent.Executor;
@@ -72,9 +71,10 @@ public class AllowedNetworkTypesListener extends TelephonyCallback implements
}
@Override
public void onAllowedNetworkTypesChanged(Map<Integer, Long> allowedNetworkTypesList) {
long newAllowedNetworkType = allowedNetworkTypesList.get(
TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_USER);
public void onAllowedNetworkTypesChanged(int reason, long newAllowedNetworkType) {
if (reason != TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_USER) {
return;
}
if (mListener != null && mAllowedNetworkType != newAllowedNetworkType) {
mListener.onAllowedNetworkTypesChanged();
Log.d(LOG_TAG, "onAllowedNetworkChanged: " + mAllowedNetworkType);