Merge "Fix tabLayout swipe direction"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 28ad81b..6dc4a4d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4773,6 +4773,8 @@
     <string name="accessibility_screen_magnification_title">Magnify</string>
     <!-- Title for the accessibility preference screen to edit magnification area. [CHAR LIMIT=35] -->
     <string name="accessibility_magnification_mode_title">Magnification area</string>
+    <!-- Title for the accessibility preference screen to edit magnification enable mode. [CHAR LIMIT=35] -->
+    <string name="accessibility_magnification_enable_mode_title">Magnification enable</string>
     <!-- Message for the accessibility preference screen to edit magnification area dialog. [CHAR LIMIT=none] -->
     <string name="accessibility_magnification_area_settings_message">Choose the magnification area(s) you want to use when magnifying the screen</string>
     <!-- Summary for the accessibility preference screen to edit full screen. [CHAR LIMIT=none] -->
@@ -4785,10 +4787,6 @@
     <string name="accessibility_magnification_area_settings_full_screen">Magnify entire screen</string>
     <!-- Message for the accessibility preference screen to edit part of screen. [CHAR LIMIT=none] -->
     <string name="accessibility_magnification_area_settings_window_screen">Magnify part of screen</string>
-    <!-- Title for the accessibility preference screen to show move controller. [CHAR LIMIT=35] -->
-    <string name="accessibility_magnification_window_control_switch_title">Show move controller</string>
-    <!-- Summary for the accessibility preference screen to show move controller. [CHAR LIMIT=none] -->
-    <string name="accessibility_magnification_window_control_switch_summary">Show a joystick-like controller to move the magnification area</string>
     <!-- Title for the accessibility preference screen to enable screen magnification settings. [CHAR LIMIT=35] -->
     <string name="accessibility_magnification_service_settings_title">Magnification settings</string>
     <!-- Title for the accessibility preference screen to enable triple-tap gesture screen magnification. [CHAR LIMIT=35] -->
diff --git a/res/xml/accessibility_magnification_service_settings.xml b/res/xml/accessibility_magnification_service_settings.xml
index d67fc66..74765b2 100644
--- a/res/xml/accessibility_magnification_service_settings.xml
+++ b/res/xml/accessibility_magnification_service_settings.xml
@@ -28,9 +28,11 @@
         settings:controller="com.android.settings.accessibility.MagnificationModePreferenceController" />
 
     <SwitchPreference
-        android:key="magnification_window_control_switch"
+        android:key="magnification_enable"
         android:persistent="false"
-        android:summary="@string/accessibility_magnification_window_control_switch_summary"
-        android:title="@string/accessibility_magnification_window_control_switch_title"
-        settings:controller="com.android.settings.accessibility.MagnificationWindowControlPreferenceController" />
+        android:title="@string/accessibility_magnification_enable_mode_title"
+        android:summaryOn="@string/accessibility_magnification_area_settings_full_screen_summary"
+        android:summaryOff="@string/accessibility_magnification_area_settings_window_screen_summary"
+        settings:controller="com.android.settings.accessibility.MagnificationEnablePreferenceController" />
+
 </PreferenceScreen>
diff --git a/src/com/android/settings/accessibility/MagnificationEnablePreferenceController.java b/src/com/android/settings/accessibility/MagnificationEnablePreferenceController.java
new file mode 100644
index 0000000..a21c024
--- /dev/null
+++ b/src/com/android/settings/accessibility/MagnificationEnablePreferenceController.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.accessibility;
+
+import android.content.Context;
+import android.os.UserHandle;
+import android.provider.Settings;
+
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreference;
+
+import com.android.settings.core.TogglePreferenceController;
+
+/** Controller that shows the magnification enable mode summary. */
+public class MagnificationEnablePreferenceController extends TogglePreferenceController {
+
+    private static final String KEY_ENABLE = Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE;
+
+    public MagnificationEnablePreferenceController(Context context, String preferenceKey) {
+        super(context, preferenceKey);
+    }
+
+    @Override
+    public boolean isChecked() {
+        final int enableMode = Settings.Secure.getIntForUser(mContext.getContentResolver(),
+                KEY_ENABLE,
+                Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN,
+                UserHandle.USER_CURRENT);
+        return enableMode == Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN;
+    }
+
+    @Override
+    public boolean setChecked(boolean isChecked) {
+        final int value = isChecked ? Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN
+                : Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW;
+        return Settings.Secure.putIntForUser(mContext.getContentResolver(), KEY_ENABLE, value,
+                UserHandle.USER_CURRENT);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return AVAILABLE;
+    }
+}
diff --git a/src/com/android/settings/accessibility/MagnificationWindowControlPreferenceController.java b/src/com/android/settings/accessibility/MagnificationWindowControlPreferenceController.java
deleted file mode 100644
index 4badc3f..0000000
--- a/src/com/android/settings/accessibility/MagnificationWindowControlPreferenceController.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-import android.content.Context;
-import android.os.UserHandle;
-import android.provider.Settings;
-
-import com.android.settings.core.TogglePreferenceController;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/** Controller that shows and updates the magnification window control switch. */
-public class MagnificationWindowControlPreferenceController extends TogglePreferenceController {
-
-    // TODO(b/146019459): Use magnification_window_control_enabled.
-    private static final String KEY_CONTROL = Settings.System.MASTER_MONO;
-
-    public MagnificationWindowControlPreferenceController(Context context, String preferenceKey) {
-        super(context, preferenceKey);
-    }
-
-    @Override
-    public boolean isChecked() {
-        return Settings.System.getIntForUser(mContext.getContentResolver(),
-                KEY_CONTROL, State.OFF, UserHandle.USER_CURRENT) == State.ON;
-    }
-
-    @Override
-    public boolean setChecked(boolean isChecked) {
-        return Settings.System.putIntForUser(mContext.getContentResolver(),
-                KEY_CONTROL, isChecked ? State.ON : State.OFF, UserHandle.USER_CURRENT);
-    }
-
-    @Override
-    public int getAvailabilityStatus() {
-        return AVAILABLE;
-    }
-
-    @Retention(RetentionPolicy.SOURCE)
-    private @interface State {
-        int OFF = 0;
-        int ON = 1;
-    }
-}
diff --git a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
index 2de2cb7..c0f6493 100644
--- a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
@@ -46,6 +46,7 @@
 import androidx.preference.PreferenceScreen;
 import androidx.preference.PreferenceViewHolder;
 
+import com.android.internal.annotations.VisibleForTesting;
 import com.android.settings.R;
 import com.android.settings.accessibility.AccessibilityUtil.UserShortcutType;
 
@@ -256,6 +257,11 @@
         updateAlertDialogCheckState();
         updateAlertDialogEnableState();
 
+        // Window magnification mode doesn't support advancedView.
+        if (isWindowMagnification(getPrefContext())) {
+            advancedView.setVisibility(View.GONE);
+            return;
+        }
         // Shows the triple tap checkbox directly if clicked.
         if (mTripleTapTypeCheckBox.isChecked()) {
             advancedView.setVisibility(View.GONE);
@@ -509,7 +515,8 @@
         int EDIT_SHORTCUT = 3;
     }
 
-    private static void optInAllMagnificationValuesToSettings(Context context, int shortcutTypes) {
+    @VisibleForTesting
+    static void optInAllMagnificationValuesToSettings(Context context, int shortcutTypes) {
         if ((shortcutTypes & UserShortcutType.SOFTWARE) == UserShortcutType.SOFTWARE) {
             optInMagnificationValueToSettings(context, UserShortcutType.SOFTWARE);
         }
@@ -532,7 +539,7 @@
         }
 
         final StringJoiner joiner = new StringJoiner(String.valueOf(COMPONENT_NAME_SEPARATOR));
-        if (TextUtils.isEmpty(targetString)) {
+        if (!TextUtils.isEmpty(targetString)) {
             joiner.add(targetString);
         }
         joiner.add(MAGNIFICATION_CONTROLLER_NAME);
@@ -540,7 +547,8 @@
         Settings.Secure.putString(context.getContentResolver(), targetKey, joiner.toString());
     }
 
-    private static void optOutAllMagnificationValuesFromSettings(Context context,
+    @VisibleForTesting
+    static void optOutAllMagnificationValuesFromSettings(Context context,
             int shortcutTypes) {
         if ((shortcutTypes & UserShortcutType.SOFTWARE) == UserShortcutType.SOFTWARE) {
             optOutMagnificationValueFromSettings(context, UserShortcutType.SOFTWARE);
@@ -576,7 +584,8 @@
         Settings.Secure.putString(context.getContentResolver(), targetKey, joiner.toString());
     }
 
-    private static boolean hasMagnificationValuesInSettings(Context context, int shortcutTypes) {
+    @VisibleForTesting
+    static boolean hasMagnificationValuesInSettings(Context context, int shortcutTypes) {
         boolean exist = false;
 
         if ((shortcutTypes & UserShortcutType.SOFTWARE) == UserShortcutType.SOFTWARE) {
@@ -610,4 +619,13 @@
         }
         return false;
     }
+
+    private boolean isWindowMagnification(Context context) {
+        final int mode = Settings.Secure.getIntForUser(
+                context.getContentResolver(),
+                Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE,
+                Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN,
+                context.getContentResolver().getUserId());
+        return mode == Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW;
+    }
 }
diff --git a/src/com/android/settings/network/telephony/CellInfoUtil.java b/src/com/android/settings/network/telephony/CellInfoUtil.java
index ab172c8..7412428 100644
--- a/src/com/android/settings/network/telephony/CellInfoUtil.java
+++ b/src/com/android/settings/network/telephony/CellInfoUtil.java
@@ -33,8 +33,6 @@
 import android.text.TextDirectionHeuristics;
 import android.text.TextUtils;
 
-import com.android.internal.telephony.OperatorInfo;
-
 import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
@@ -101,34 +99,6 @@
         return cellId;
     }
 
-    /**
-     * Creates a CellInfo object from OperatorInfo. GsmCellInfo is used here only because
-     * operatorInfo does not contain technology type while CellInfo is an abstract object that
-     * requires to specify technology type. It doesn't matter which CellInfo type to use here, since
-     * we only want to wrap the operator info and PLMN to a CellInfo object.
-     */
-    public static CellInfo convertOperatorInfoToCellInfo(OperatorInfo operatorInfo) {
-        final String operatorNumeric = operatorInfo.getOperatorNumeric();
-        String mcc = null;
-        String mnc = null;
-        if (operatorNumeric != null && operatorNumeric.matches("^[0-9]{5,6}$")) {
-            mcc = operatorNumeric.substring(0, 3);
-            mnc = operatorNumeric.substring(3);
-        }
-        final CellIdentityGsm cig = new CellIdentityGsm(
-                Integer.MAX_VALUE /* lac */,
-                Integer.MAX_VALUE /* cid */,
-                Integer.MAX_VALUE /* arfcn */,
-                Integer.MAX_VALUE /* bsic */,
-                mcc,
-                mnc,
-                operatorInfo.getOperatorAlphaLong(),
-                operatorInfo.getOperatorAlphaShort());
-
-        final CellInfoGsm ci = new CellInfoGsm();
-        ci.setCellIdentity(cig);
-        return ci;
-    }
 
     /** Convert a list of cellInfos to readable string without sensitive info. */
     public static String cellInfoListToString(List<CellInfo> cellInfos) {
diff --git a/src/com/android/settings/network/telephony/NetworkOperatorPreference.java b/src/com/android/settings/network/telephony/NetworkOperatorPreference.java
index 97894b1..7173ccc 100644
--- a/src/com/android/settings/network/telephony/NetworkOperatorPreference.java
+++ b/src/com/android/settings/network/telephony/NetworkOperatorPreference.java
@@ -57,7 +57,6 @@
     private List<String> mForbiddenPlmns;
     private int mLevel = LEVEL_NONE;
     private boolean mShow4GForLTE;
-    private boolean mUseNewApi;
 
     public NetworkOperatorPreference(Context context, CellInfo cellinfo,
             List<String> forbiddenPlmns, boolean show4GForLTE) {
@@ -76,8 +75,6 @@
         super(context);
         mForbiddenPlmns = forbiddenPlmns;
         mShow4GForLTE = show4GForLTE;
-        mUseNewApi = context.getResources().getBoolean(
-                com.android.internal.R.bool.config_enableNewAutoSelectNetworkUI);
     }
 
     /**
@@ -218,7 +215,7 @@
     }
 
     private void updateIcon(int level) {
-        if (!mUseNewApi || level < 0 || level >= NUM_SIGNAL_STRENGTH_BINS) {
+        if (level < 0 || level >= NUM_SIGNAL_STRENGTH_BINS) {
             return;
         }
         final Context context = getContext();
diff --git a/src/com/android/settings/network/telephony/NetworkScanHelper.java b/src/com/android/settings/network/telephony/NetworkScanHelper.java
index 185090b..eb0d020 100644
--- a/src/com/android/settings/network/telephony/NetworkScanHelper.java
+++ b/src/com/android/settings/network/telephony/NetworkScanHelper.java
@@ -16,7 +16,6 @@
 
 package com.android.settings.network.telephony;
 
-import android.annotation.IntDef;
 import android.telephony.AccessNetworkConstants.AccessNetworkType;
 import android.telephony.CellInfo;
 import android.telephony.NetworkScan;
@@ -26,20 +25,8 @@
 import android.telephony.TelephonyScanManager;
 import android.util.Log;
 
-import com.android.internal.telephony.CellNetworkScanResult;
-
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.MoreExecutors;
-import com.google.common.util.concurrent.SettableFuture;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
 import java.util.List;
-import java.util.concurrent.CancellationException;
 import java.util.concurrent.Executor;
-import java.util.stream.Collectors;
 
 /**
  * A helper class that builds the common interface and performs the network scan for two different
@@ -82,33 +69,6 @@
         void onError(int errorCode);
     }
 
-    @Retention(RetentionPolicy.SOURCE)
-    @IntDef({NETWORK_SCAN_TYPE_WAIT_FOR_ALL_RESULTS, NETWORK_SCAN_TYPE_INCREMENTAL_RESULTS})
-    public @interface NetworkQueryType {}
-
-    /**
-     * Performs the network scan using {@link TelephonyManager#getAvailableNetworks()}. The network
-     * scan results won't be returned to the caller until the network scan is completed.
-     *
-     * <p> This is typically used when the modem doesn't support the new network scan api
-     * {@link TelephonyManager#requestNetworkScan(
-     * NetworkScanRequest, Executor, TelephonyScanManager.NetworkScanCallback)}.
-     */
-    public static final int NETWORK_SCAN_TYPE_WAIT_FOR_ALL_RESULTS = 1;
-
-    /**
-     * Performs the network scan using {@link TelephonyManager#requestNetworkScan(
-     * NetworkScanRequest, Executor, TelephonyScanManager.NetworkScanCallback)} The network scan
-     * results will be returned to the caller periodically in a small time window until the network
-     * scan is completed. The complete results should be returned in the last called of
-     * {@link NetworkScanCallback#onResults(List)}.
-     *
-     * <p> This is recommended to be used if modem supports the new network scan api
-     * {@link TelephonyManager#requestNetworkScan(
-     * NetworkScanRequest, Executor, TelephonyScanManager.NetworkScanCallback)}
-     */
-    public static final int NETWORK_SCAN_TYPE_INCREMENTAL_RESULTS = 2;
-
     /** The constants below are used in the async network scan. */
     private static final boolean INCREMENTAL_RESULTS = true;
     private static final int SEARCH_PERIODICITY_SEC = 5;
@@ -138,7 +98,7 @@
                             new RadioAccessSpecifier(
                                     AccessNetworkType.NGRAN,
                                     null /* bands */,
-                                    null /* channels */),
+                                    null /* channels */)
                     },
                     SEARCH_PERIODICITY_SEC,
                     MAX_SEARCH_TIME_SEC,
@@ -153,9 +113,6 @@
 
     private NetworkScan mNetworkScanRequester;
 
-    /** Callbacks for sync network scan */
-    private ListenableFuture<List<CellInfo>> mNetworkScanFuture;
-
     public NetworkScanHelper(TelephonyManager tm, NetworkScanCallback callback, Executor executor) {
         mTelephonyManager = tm;
         mNetworkScanCallback = callback;
@@ -164,63 +121,38 @@
     }
 
     /**
-     * Performs a network scan for the given type {@code type}.
-     * {@link #NETWORK_SCAN_TYPE_INCREMENTAL_RESULTS} is recommended if modem supports
-     * {@link TelephonyManager#requestNetworkScan(
-     * NetworkScanRequest, Executor, TelephonyScanManager.NetworkScanCallback)}.
+     * Request a network scan.
      *
-     * @param type used to tell which network scan API should be used.
+     * Performs the network scan using {@link TelephonyManager#requestNetworkScan(
+     * NetworkScanRequest, Executor, TelephonyScanManager.NetworkScanCallback)} The network scan
+     * results will be returned to the caller periodically in a small time window until the network
+     * scan is completed. The complete results should be returned in the last called of
+     * {@link NetworkScanCallback#onResults(List)}.
      */
-    public void startNetworkScan(@NetworkQueryType int type) {
-        if (type == NETWORK_SCAN_TYPE_WAIT_FOR_ALL_RESULTS) {
-            mNetworkScanFuture = SettableFuture.create();
-            Futures.addCallback(mNetworkScanFuture, new FutureCallback<List<CellInfo>>() {
-                @Override
-                public void onSuccess(List<CellInfo> result) {
-                    onResults(result);
-                    onComplete();
-                }
-
-                @Override
-                public void onFailure(Throwable t) {
-                    if (t instanceof CancellationException) {
-                        return;
-                    }
-                    int errCode = Integer.parseInt(t.getMessage());
-                    onError(errCode);
-                }
-            }, MoreExecutors.directExecutor());
-            mExecutor.execute(new NetworkScanSyncTask(
-                    mTelephonyManager, (SettableFuture) mNetworkScanFuture));
-        } else if (type == NETWORK_SCAN_TYPE_INCREMENTAL_RESULTS) {
-            if (mNetworkScanRequester != null) {
-                return;
-            }
-            mNetworkScanRequester = mTelephonyManager.requestNetworkScan(
-                    NETWORK_SCAN_REQUEST,
-                    mExecutor,
-                    mInternalNetworkScanCallback);
-            if (mNetworkScanRequester == null) {
-                onError(NetworkScan.ERROR_RADIO_INTERFACE_ERROR);
-            }
+    public void startNetworkScan() {
+        if (mNetworkScanRequester != null) {
+            return;
+        }
+        mNetworkScanRequester = mTelephonyManager.requestNetworkScan(
+                NETWORK_SCAN_REQUEST,
+                mExecutor,
+                mInternalNetworkScanCallback);
+        if (mNetworkScanRequester == null) {
+            onError(NetworkScan.ERROR_RADIO_INTERFACE_ERROR);
         }
     }
 
     /**
-     * The network scan of type {@link #NETWORK_SCAN_TYPE_WAIT_FOR_ALL_RESULTS} can't be stopped,
-     * however, the result of the current network scan won't be returned to the callback after
-     * calling this method.
+     * Stops the network scan.
+     *
+     * Use this method to stop an ongoing scan. When user requests a new scan, a {@link NetworkScan}
+     * object will be returned, and the user can stop the scan by calling this method.
      */
     public void stopNetworkQuery() {
         if (mNetworkScanRequester != null) {
             mNetworkScanRequester.stopScan();
             mNetworkScanRequester = null;
         }
-
-        if (mNetworkScanFuture != null) {
-            mNetworkScanFuture.cancel(true /* mayInterruptIfRunning */);
-            mNetworkScanFuture = null;
-        }
     }
 
     private void onResults(List<CellInfo> cellInfos) {
@@ -235,23 +167,6 @@
         mNetworkScanCallback.onError(errCode);
     }
 
-    /**
-     * Converts the status code of {@link CellNetworkScanResult} to one of the
-     * {@link NetworkScan.ScanErrorCode}.
-     * @param errCode status code from {@link CellNetworkScanResult}.
-     *
-     * @return one of the scan error code from {@link NetworkScan.ScanErrorCode}.
-     */
-    private static int convertToScanErrorCode(int errCode) {
-        switch (errCode) {
-            case CellNetworkScanResult.STATUS_RADIO_NOT_AVAILABLE:
-                return NetworkScan.ERROR_RADIO_INTERFACE_ERROR;
-            case CellNetworkScanResult.STATUS_RADIO_GENERIC_FAILURE:
-            default:
-                return NetworkScan.ERROR_MODEM_ERROR;
-        }
-    }
-
     private final class NetworkScanCallbackImpl extends TelephonyScanManager.NetworkScanCallback {
         public void onResults(List<CellInfo> results) {
             Log.d(TAG, "Async scan onResults() results = "
@@ -269,35 +184,4 @@
             NetworkScanHelper.this.onError(errCode);
         }
     }
-
-    private static final class NetworkScanSyncTask implements Runnable {
-        private final SettableFuture<List<CellInfo>> mCallback;
-        private final TelephonyManager mTelephonyManager;
-
-        NetworkScanSyncTask(
-                TelephonyManager telephonyManager, SettableFuture<List<CellInfo>> callback) {
-            mTelephonyManager = telephonyManager;
-            mCallback = callback;
-        }
-
-        @Override
-        public void run() {
-            final CellNetworkScanResult result = mTelephonyManager.getAvailableNetworks();
-            if (result.getStatus() == CellNetworkScanResult.STATUS_SUCCESS) {
-                final List<CellInfo> cellInfos = result.getOperators()
-                        .stream()
-                        .map(operatorInfo
-                                -> CellInfoUtil.convertOperatorInfoToCellInfo(operatorInfo))
-                        .collect(Collectors.toList());
-                Log.d(TAG, "Sync network scan completed, cellInfos = "
-                        + CellInfoUtil.cellInfoListToString(cellInfos));
-                mCallback.set(cellInfos);
-            } else {
-                final Throwable error = new Throwable(
-                        Integer.toString(convertToScanErrorCode(result.getStatus())));
-                mCallback.setException(error);
-                Log.d(TAG, "Sync network scan error, ex = " + error);
-            }
-        }
-    }
 }
diff --git a/src/com/android/settings/network/telephony/NetworkSelectSettings.java b/src/com/android/settings/network/telephony/NetworkSelectSettings.java
index 8b3e913..584848f 100644
--- a/src/com/android/settings/network/telephony/NetworkSelectSettings.java
+++ b/src/com/android/settings/network/telephony/NetworkSelectSettings.java
@@ -93,8 +93,6 @@
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
 
-        mUseNewApi = getContext().getResources().getBoolean(
-                com.android.internal.R.bool.config_enableNewAutoSelectNetworkUI);
         mSubId = getArguments().getInt(Settings.EXTRA_SUB_ID);
 
         mPreferenceCategory = findPreference(PREF_KEY_NETWORK_OPERATORS);
@@ -468,10 +466,7 @@
         if (mNetworkScanHelper != null) {
             mRequestIdManualNetworkScan = getNewRequestId();
             mWaitingForNumberOfScanResults = MIN_NUMBER_OF_SCAN_REQUIRED;
-            mNetworkScanHelper.startNetworkScan(
-                    mUseNewApi
-                            ? NetworkScanHelper.NETWORK_SCAN_TYPE_INCREMENTAL_RESULTS
-                            : NetworkScanHelper.NETWORK_SCAN_TYPE_WAIT_FOR_ALL_RESULTS);
+            mNetworkScanHelper.startNetworkScan();
         }
     }
 
diff --git a/tests/robotests/src/com/android/settings/accessibility/MagnificationEnablePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/MagnificationEnablePreferenceControllerTest.java
new file mode 100644
index 0000000..a34e04a
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/MagnificationEnablePreferenceControllerTest.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.accessibility;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+import android.os.UserHandle;
+import android.provider.Settings;
+
+import androidx.preference.SwitchPreference;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class MagnificationEnablePreferenceControllerTest {
+    private static final String PREF_KEY = "screen_magnification_enable";
+    private static final String KEY_ENABLE = Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE;
+    private static final int UNKNOWN = -1;
+    private Context mContext;
+    private SwitchPreference mPreference;
+    private MagnificationEnablePreferenceController mController;
+
+    @Before
+    public void setUp() {
+        mContext = RuntimeEnvironment.application;
+        mPreference = new SwitchPreference(mContext);
+        mController = new MagnificationEnablePreferenceController(mContext, PREF_KEY);
+    }
+
+    @Test
+    public void isChecked_enabledFullscreenMagnificationMode_shouldReturnTrue() {
+        Settings.Secure.putIntForUser(mContext.getContentResolver(),
+                KEY_ENABLE, Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN,
+                UserHandle.USER_CURRENT);
+
+        mController.updateState(mPreference);
+
+        assertThat(mController.isChecked()).isTrue();
+        assertThat(mPreference.isChecked()).isTrue();
+    }
+
+    @Test
+    public void isChecked_enabledWindowMagnificationMode_shouldReturnFalse() {
+        Settings.Secure.putIntForUser(mContext.getContentResolver(),
+                KEY_ENABLE, Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW,
+                UserHandle.USER_CURRENT);
+
+        mController.updateState(mPreference);
+
+        assertThat(mController.isChecked()).isFalse();
+        assertThat(mPreference.isChecked()).isFalse();
+    }
+
+
+    @Test
+    public void setChecked_setTrue_shouldEnableFullscreenMagnificationMode() {
+        mController.setChecked(true);
+
+        assertThat(Settings.Secure.getIntForUser(mContext.getContentResolver(),
+                KEY_ENABLE, UNKNOWN,
+                UserHandle.USER_CURRENT)).isEqualTo(
+                Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN);
+    }
+
+    @Test
+    public void setChecked_setFalse_shouldEnableWindowMagnificationMode() {
+        mController.setChecked(false);
+
+        assertThat(Settings.Secure.getIntForUser(mContext.getContentResolver(),
+                KEY_ENABLE, UNKNOWN,
+                UserHandle.USER_CURRENT)).isEqualTo(
+                Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/accessibility/MagnificationWindowControlPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/MagnificationWindowControlPreferenceControllerTest.java
deleted file mode 100644
index 05dbb57..0000000
--- a/tests/robotests/src/com/android/settings/accessibility/MagnificationWindowControlPreferenceControllerTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.content.Context;
-import android.os.UserHandle;
-import android.provider.Settings;
-
-import androidx.preference.SwitchPreference;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-@RunWith(RobolectricTestRunner.class)
-public class MagnificationWindowControlPreferenceControllerTest {
-    private static final String PREF_KEY = "screen_magnification_window_control_switch";
-    // TODO(b/146019459): Use magnification_window_control_enabled.
-    private static final String KEY_CONTROL = Settings.System.MASTER_MONO;
-    private Context mContext;
-    private SwitchPreference mPreference;
-    private MagnificationWindowControlPreferenceController mController;
-
-    @Before
-    public void setUp() {
-        mContext = RuntimeEnvironment.application;
-        mPreference = new SwitchPreference(mContext);
-        mController = new MagnificationWindowControlPreferenceController(mContext, PREF_KEY);
-    }
-
-    @Test
-    public void isChecked_enabledWindowControl_shouldReturnTrue() {
-        Settings.System.putIntForUser(mContext.getContentResolver(),
-                KEY_CONTROL, State.ON, UserHandle.USER_CURRENT);
-
-        mController.updateState(mPreference);
-
-        assertThat(mController.isChecked()).isTrue();
-        assertThat(mPreference.isChecked()).isTrue();
-    }
-
-    @Test
-    public void isChecked_disabledWindowControl_shouldReturnFalse() {
-        Settings.System.putIntForUser(mContext.getContentResolver(),
-                KEY_CONTROL, State.OFF, UserHandle.USER_CURRENT);
-
-        mController.updateState(mPreference);
-
-        assertThat(mController.isChecked()).isFalse();
-        assertThat(mPreference.isChecked()).isFalse();
-    }
-
-    @Test
-    public void setChecked_setTrue_shouldEnableWindowControl() {
-        mController.setChecked(true);
-
-        assertThat(Settings.System.getIntForUser(mContext.getContentResolver(),
-                KEY_CONTROL, State.UNKNOWN, UserHandle.USER_CURRENT)).isEqualTo(State.ON);
-    }
-
-    @Test
-    public void setChecked_setFalse_shouldDisableWindowControl() {
-        mController.setChecked(false);
-
-        assertThat(Settings.System.getIntForUser(mContext.getContentResolver(),
-                KEY_CONTROL, State.UNKNOWN, UserHandle.USER_CURRENT)).isEqualTo(State.OFF);
-    }
-
-    @Retention(RetentionPolicy.SOURCE)
-    private @interface State {
-        int UNKNOWN = -1;
-        int OFF = 0;
-        int ON = 1;
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragmentTest.java
new file mode 100644
index 0000000..3a2aa4c
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragmentTest.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.accessibility;
+
+import static com.android.settings.accessibility.AccessibilityUtil.UserShortcutType;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.provider.Settings;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class ToggleScreenMagnificationPreferenceFragmentTest {
+
+    private static final String DUMMY_PACKAGE_NAME = "com.dummy.example";
+    private static final String DUMMY_CLASS_NAME = DUMMY_PACKAGE_NAME + ".dummy_a11y_service";
+    private static final ComponentName DUMMY_COMPONENT_NAME = new ComponentName(DUMMY_PACKAGE_NAME,
+            DUMMY_CLASS_NAME);
+    private static final String SOFTWARE_SHORTCUT_KEY =
+            Settings.Secure.ACCESSIBILITY_BUTTON_TARGET_COMPONENT;
+    private static final String HARDWARE_SHORTCUT_KEY =
+            Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE;
+    private static final String TRIPLETAP_SHORTCUT_KEY =
+            Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED;
+    private static final String MAGNIFICATION_CONTROLLER_NAME =
+            "com.android.server.accessibility.MagnificationController";
+
+    private Context mContext;
+
+    @Before
+    public void setUp() {
+        mContext = RuntimeEnvironment.application;
+    }
+
+    @Test
+    public void hasValueInSettings_putValue_hasValue() {
+        putStringIntoSettings(TRIPLETAP_SHORTCUT_KEY, MAGNIFICATION_CONTROLLER_NAME);
+
+        assertThat(ToggleScreenMagnificationPreferenceFragment.hasMagnificationValuesInSettings(
+                mContext, UserShortcutType.TRIPLETAP)).isTrue();
+    }
+
+    @Test
+    public void optInAllValuesToSettings_optInValue_haveMatchString() {
+        int shortcutTypes = UserShortcutType.SOFTWARE | UserShortcutType.TRIPLETAP;
+
+        ToggleScreenMagnificationPreferenceFragment.optInAllMagnificationValuesToSettings(mContext,
+                shortcutTypes);
+
+        assertThat(getStringFromSettings(SOFTWARE_SHORTCUT_KEY)).isEqualTo(
+                MAGNIFICATION_CONTROLLER_NAME);
+        assertThat(getStringFromSettings(TRIPLETAP_SHORTCUT_KEY)).isEqualTo(
+                MAGNIFICATION_CONTROLLER_NAME);
+
+    }
+
+    @Test
+    public void optInAllValuesToSettings_existOtherValue_optInValue_haveMatchString() {
+        putStringIntoSettings(SOFTWARE_SHORTCUT_KEY, DUMMY_COMPONENT_NAME.flattenToString());
+
+        ToggleScreenMagnificationPreferenceFragment.optInAllMagnificationValuesToSettings(mContext,
+                UserShortcutType.SOFTWARE);
+
+        assertThat(getStringFromSettings(SOFTWARE_SHORTCUT_KEY)).isEqualTo(
+                DUMMY_COMPONENT_NAME.flattenToString() + ":" + MAGNIFICATION_CONTROLLER_NAME);
+
+    }
+
+    @Test
+    public void optOutAllValuesToSettings_optOutValue_emptyString() {
+        putStringIntoSettings(SOFTWARE_SHORTCUT_KEY, MAGNIFICATION_CONTROLLER_NAME);
+        putStringIntoSettings(HARDWARE_SHORTCUT_KEY, MAGNIFICATION_CONTROLLER_NAME);
+        putStringIntoSettings(TRIPLETAP_SHORTCUT_KEY, MAGNIFICATION_CONTROLLER_NAME);
+        int shortcutTypes =
+                UserShortcutType.SOFTWARE | UserShortcutType.HARDWARE | UserShortcutType.TRIPLETAP;
+
+        ToggleScreenMagnificationPreferenceFragment.optOutAllMagnificationValuesFromSettings(
+                mContext, shortcutTypes);
+
+        assertThat(getStringFromSettings(SOFTWARE_SHORTCUT_KEY)).isEmpty();
+        assertThat(getStringFromSettings(HARDWARE_SHORTCUT_KEY)).isEmpty();
+        assertThat(getStringFromSettings(TRIPLETAP_SHORTCUT_KEY)).isEmpty();
+    }
+
+    @Test
+    public void optOutValueFromSettings_existOtherValue_optOutValue_haveMatchString() {
+        putStringIntoSettings(SOFTWARE_SHORTCUT_KEY,
+                DUMMY_COMPONENT_NAME.flattenToString() + ":" + MAGNIFICATION_CONTROLLER_NAME);
+        putStringIntoSettings(HARDWARE_SHORTCUT_KEY,
+                DUMMY_COMPONENT_NAME.flattenToString() + ":" + MAGNIFICATION_CONTROLLER_NAME);
+        int shortcutTypes = UserShortcutType.SOFTWARE | UserShortcutType.HARDWARE;
+
+        ToggleScreenMagnificationPreferenceFragment.optOutAllMagnificationValuesFromSettings(
+                mContext, shortcutTypes);
+
+        assertThat(getStringFromSettings(SOFTWARE_SHORTCUT_KEY)).isEqualTo(
+                DUMMY_COMPONENT_NAME.flattenToString());
+        assertThat(getStringFromSettings(HARDWARE_SHORTCUT_KEY)).isEqualTo(
+                DUMMY_COMPONENT_NAME.flattenToString());
+    }
+
+    private void putStringIntoSettings(String key, String componentName) {
+        Settings.Secure.putString(mContext.getContentResolver(), key, componentName);
+    }
+
+    private String getStringFromSettings(String key) {
+        return Settings.Secure.getString(mContext.getContentResolver(), key);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/network/telephony/NetworkOperatorPreferenceTest.java b/tests/robotests/src/com/android/settings/network/telephony/NetworkOperatorPreferenceTest.java
index 3a61195..0c772b7 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/NetworkOperatorPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/NetworkOperatorPreferenceTest.java
@@ -16,35 +16,25 @@
 
 package com.android.settings.network.telephony;
 
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
 import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
-import android.telephony.CellInfo;
 
 import org.junit.Before;
-import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
 
-import java.util.ArrayList;
-
 @RunWith(RobolectricTestRunner.class)
 public class NetworkOperatorPreferenceTest {
     private static final int LEVEL = 2;
 
     @Mock
     private Resources mResources;
-    @Mock
-    private CellInfo mCellInfo;
     private Context mContext;
 
     @Before
@@ -55,16 +45,5 @@
         when(mContext.getResources()).thenReturn(mResources);
     }
 
-    @Test
-    public void setIcon_useOldApi_doNothing() {
-        when(mResources.getBoolean(com.android.internal.R.bool.config_enableNewAutoSelectNetworkUI))
-                .thenReturn(false);
-        final NetworkOperatorPreference preference = spy(
-                new NetworkOperatorPreference(mContext, mCellInfo,
-                        new ArrayList<>() /* forbiddenPlmns */, false /* show4GForLTE */));
-
-        preference.setIcon(LEVEL);
-
-        verify(preference, never()).setIcon(any(Drawable.class));
-    }
+    //TODO: add test cases.
 }
diff --git a/tests/robotests/src/com/android/settings/network/telephony/NetworkScanHelperTest.java b/tests/robotests/src/com/android/settings/network/telephony/NetworkScanHelperTest.java
index f87a459..b90f0cf 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/NetworkScanHelperTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/NetworkScanHelperTest.java
@@ -33,9 +33,6 @@
 import android.telephony.TelephonyManager;
 import android.telephony.TelephonyScanManager;
 
-import com.android.internal.telephony.CellNetworkScanResult;
-import com.android.internal.telephony.OperatorInfo;
-
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -47,12 +44,10 @@
 import org.mockito.stubbing.Answer;
 import org.robolectric.RobolectricTestRunner;
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Executor;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
 
 @RunWith(RobolectricTestRunner.class)
 public class NetworkScanHelperTest {
@@ -61,7 +56,7 @@
     private TelephonyManager mTelephonyManager;
 
     @Mock
-    private CellNetworkScanResult mCellNetworkScanResult;
+    private List<CellInfo> mCellInfos;
 
     @Mock
     private NetworkScanHelper.NetworkScanCallback mNetworkScanCallback;
@@ -75,7 +70,6 @@
     private static final int SUB_ID = 1;
 
     private NetworkScan mNetworkScan;
-    private OperatorInfo mOperatorInfo;
 
     @Before
     public void setUp() {
@@ -87,62 +81,11 @@
                 mNetworkScanCallback, mNetworkScanExecutor);
 
         mNetworkScan = spy(new NetworkScan(SCAN_ID, SUB_ID));
-        mOperatorInfo = new OperatorInfo("Testing", "Test", "12345", "unknown");
-    }
-
-    @Test
-    public void startNetworkScan_scanOnceAndSuccess_completionWithResult() {
-        ArrayList<OperatorInfo> expectedResult = new ArrayList<OperatorInfo>();
-        expectedResult.add(mOperatorInfo);
-
-        when(mTelephonyManager.getAvailableNetworks()).thenReturn(mCellNetworkScanResult);
-        when(mCellNetworkScanResult.getStatus()).thenReturn(
-                CellNetworkScanResult.STATUS_SUCCESS);
-        when(mCellNetworkScanResult.getOperators()).thenReturn(expectedResult);
-
-        ArgumentCaptor<List<CellInfo>> argument = ArgumentCaptor.forClass(List.class);
-
-        startNetworkScan_waitForAll(true);
-
-        verify(mNetworkScanCallback, times(1)).onResults(argument.capture());
-        List<CellInfo> actualResult = argument.getValue();
-        assertThat(actualResult.size()).isEqualTo(expectedResult.size());
-        verify(mNetworkScanCallback, times(1)).onComplete();
-    }
-
-    @Test
-    public void startNetworkScan_scanOnceAndFail_failureWithErrorCode() {
-        when(mTelephonyManager.getAvailableNetworks()).thenReturn(mCellNetworkScanResult);
-        when(mCellNetworkScanResult.getStatus()).thenReturn(
-                CellNetworkScanResult.STATUS_RADIO_GENERIC_FAILURE);
-
-        startNetworkScan_waitForAll(true);
-
-        verify(mNetworkScanCallback, times(1)).onError(anyInt());
-    }
-
-    @Test
-    public void startNetworkScan_scanOnceAndAbort_withoutCrash() {
-        when(mCellNetworkScanResult.getStatus()).thenReturn(
-                CellNetworkScanResult.STATUS_RADIO_GENERIC_FAILURE);
-
-        doAnswer(new Answer() {
-            @Override
-            public Object answer(InvocationOnMock invocation) throws Throwable {
-                Thread.sleep(THREAD_EXECUTION_TIMEOUT_MS);
-                return mCellNetworkScanResult;
-            }
-        }).when(mTelephonyManager).getAvailableNetworks();
-
-        startNetworkScan_waitForAll(false);
-
-        verify(mNetworkScanCallback, times(0)).onError(anyInt());
     }
 
     @Test
     public void startNetworkScan_incrementalAndSuccess_completionWithResult() {
-        ArrayList<CellInfo> expectedResult = new ArrayList<CellInfo>();
-        expectedResult.add(CellInfoUtil.convertOperatorInfoToCellInfo(mOperatorInfo));
+        when(mCellInfos.size()).thenReturn(1);
 
         doAnswer(new Answer() {
             @Override
@@ -150,7 +93,7 @@
                 TelephonyScanManager.NetworkScanCallback callback =
                         (TelephonyScanManager.NetworkScanCallback)
                         (invocation.getArguments()[2]);
-                callback.onResults(expectedResult);
+                callback.onResults(mCellInfos);
                 callback.onComplete();
                 return mNetworkScan;
             }
@@ -164,7 +107,7 @@
 
         verify(mNetworkScanCallback, times(1)).onResults(argument.capture());
         List<CellInfo> actualResult = argument.getValue();
-        assertThat(actualResult.size()).isEqualTo(expectedResult.size());
+        assertThat(actualResult.size()).isEqualTo(mCellInfos.size());
         verify(mNetworkScanCallback, times(1)).onComplete();
     }
 
@@ -187,7 +130,7 @@
                 TelephonyScanManager.NetworkScanCallback callback =
                         (TelephonyScanManager.NetworkScanCallback)
                         (invocation.getArguments()[2]);
-                callback.onError(CellNetworkScanResult.STATUS_RADIO_GENERIC_FAILURE);
+                callback.onError(NetworkScan.ERROR_MODEM_ERROR);
                 return mNetworkScan;
             }
         }).when(mTelephonyManager).requestNetworkScan(
@@ -211,28 +154,8 @@
         verify(mNetworkScan, times(1)).stopScan();
     }
 
-    private void startNetworkScan_waitForAll(boolean waitForCompletion) {
-        mNetworkScanHelper.startNetworkScan(
-                NetworkScanHelper.NETWORK_SCAN_TYPE_WAIT_FOR_ALL_RESULTS);
-        if (!waitForCompletion) {
-            mNetworkScanHelper.stopNetworkQuery();
-        }
-
-        mNetworkScanExecutor.shutdown();
-
-        boolean executorTerminate = false;
-        try {
-            executorTerminate = mNetworkScanExecutor.awaitTermination(
-                    THREAD_EXECUTION_TIMEOUT_MS, TimeUnit.MILLISECONDS);
-        } catch (Exception ex) {
-        }
-
-        assertThat(executorTerminate).isEqualTo(waitForCompletion);
-    }
-
     private void startNetworkScan_incremental(boolean waitForCompletion) {
-        mNetworkScanHelper.startNetworkScan(
-                NetworkScanHelper.NETWORK_SCAN_TYPE_INCREMENTAL_RESULTS);
+        mNetworkScanHelper.startNetworkScan();
         if (!waitForCompletion) {
             mNetworkScanHelper.stopNetworkQuery();
         }