From ca0a1292b2a1caccce7575289b109690b902e09c Mon Sep 17 00:00:00 2001 From: Chiachang Wang Date: Mon, 21 Sep 2020 16:31:53 +0800 Subject: [PATCH] Remove CONNECTIVITY_ACTION and INET_CONDITION_ACTION CONNECTIVITY_ACTION is deprecated. The usage should be either replaced by using networkcallback or removed. The intent is used in DataConnectionStats for noting the phone connection state. The related data and information update should be able to be covered by PhoneStateListener and ACTION_SIM_STATE_CHANGED intent. Thus, remove the connectivity intents directly instead of replacing by NetworkCallback. Bug: 169029216 Bug: 110246171 Test: atest FrameworkNetTests Test: adb shell dumpsys batterystats and check the data connection stats Change-Id: I520c5cf224716faa333e479e06b6134ee7d81630 --- .../android/server/connectivity/DataConnectionStats.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/services/core/java/com/android/server/connectivity/DataConnectionStats.java b/services/core/java/com/android/server/connectivity/DataConnectionStats.java index 3e619200d4146..0304cdc475153 100644 --- a/services/core/java/com/android/server/connectivity/DataConnectionStats.java +++ b/services/core/java/com/android/server/connectivity/DataConnectionStats.java @@ -23,7 +23,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.net.ConnectivityManager; import android.os.Handler; import android.os.Looper; import android.os.RemoteException; @@ -70,8 +69,6 @@ public class DataConnectionStats extends BroadcastReceiver { IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_SIM_STATE_CHANGED); - filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); - filter.addAction(ConnectivityManager.INET_CONDITION_ACTION); mContext.registerReceiver(this, filter, null /* broadcastPermission */, mListenerHandler); } @@ -81,10 +78,7 @@ public class DataConnectionStats extends BroadcastReceiver { if (action.equals(Intent.ACTION_SIM_STATE_CHANGED)) { updateSimState(intent); notePhoneDataConnectionState(); - } else if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION) || - action.equals(ConnectivityManager.INET_CONDITION_ACTION)) { - notePhoneDataConnectionState(); - } + } } private void notePhoneDataConnectionState() {