[Settings] Revert the test for using mPhoneStateListener since the Robolectric test is broken

Bug: 183066948
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=AirplaneModeEnablerTest
Change-Id: Ic5c67a9a2996f40fcb07d0840f5c677494e1dc0a
diff --git a/src/com/android/settings/AirplaneModeEnabler.java b/src/com/android/settings/AirplaneModeEnabler.java
index 8b29d67..735ae23 100644
--- a/src/com/android/settings/AirplaneModeEnabler.java
+++ b/src/com/android/settings/AirplaneModeEnabler.java
@@ -24,7 +24,6 @@
 import android.provider.Settings;
 import android.telephony.PhoneStateListener;
 import android.telephony.SubscriptionInfo;
-import android.telephony.TelephonyCallback;
 import android.telephony.TelephonyManager;
 import android.util.Log;
 
@@ -62,7 +61,7 @@
 
     private TelephonyManager mTelephonyManager;
     @VisibleForTesting
-    AirplaneModeTelephonyCallback mTelephonyCallback;
+    PhoneStateListener mPhoneStateListener;
 
     public AirplaneModeEnabler(Context context, OnAirplaneModeChangedListener listener) {
         super(context, Settings.Global.AIRPLANE_MODE_ON);
@@ -72,18 +71,16 @@
         mOnAirplaneModeChangedListener = listener;
 
         mTelephonyManager = context.getSystemService(TelephonyManager.class);
-        mTelephonyCallback = new AirplaneModeTelephonyCallback();
-    }
 
-    class AirplaneModeTelephonyCallback extends TelephonyCallback implements
-            TelephonyCallback.RadioPowerStateListener {
-        @Override
-        public void onRadioPowerStateChanged(int state) {
-            if (DEBUG) {
-                Log.d(LOG_TAG, "RadioPower: " + state);
+        mPhoneStateListener = new PhoneStateListener(Looper.getMainLooper()) {
+            @Override
+            public void onRadioPowerStateChanged(int state) {
+                if (DEBUG) {
+                    Log.d(LOG_TAG, "RadioPower: " + state);
+                }
+                onAirplaneModeChanged();
             }
-            onAirplaneModeChanged();
-        }
+        };
     }
 
     /**
@@ -101,14 +98,16 @@
      * Start listening to the phone state change
      */
     public void start() {
-        mTelephonyManager.registerTelephonyCallback(mContext.getMainExecutor(), mTelephonyCallback);
+        mTelephonyManager.listen(mPhoneStateListener,
+                PhoneStateListener.LISTEN_RADIO_POWER_STATE_CHANGED);
     }
 
     /**
      * Stop listening to the phone state change
      */
     public void stop() {
-        mTelephonyManager.unregisterTelephonyCallback(mTelephonyCallback);
+        mTelephonyManager.listen(mPhoneStateListener,
+                PhoneStateListener.LISTEN_NONE);
     }
 
     private void setAirplaneModeOn(boolean enabling) {
@@ -193,3 +192,4 @@
         return WirelessUtils.isAirplaneModeOn(mContext);
     }
 }
+