Merge "Implement the new requestNetworkScan API with current modem API."
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index f51422c..b7c913c 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -82,6 +82,7 @@
import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.MccTable;
+import com.android.internal.telephony.NetworkScanRequestTracker;
import com.android.internal.telephony.OperatorInfo;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstantConversions;
@@ -186,6 +187,8 @@
private static final String PREF_CARRIERS_NUMBER_PREFIX = "carrier_number_";
private static final String PREF_CARRIERS_SUBSCRIBER_PREFIX = "carrier_subscriber_";
+ private NetworkScanRequestTracker mNetworkScanRequestTracker;
+
/**
* A request object to use for transmitting data to an ICC.
*/
@@ -1028,6 +1031,7 @@
mTelephonySharedPreferences =
PreferenceManager.getDefaultSharedPreferences(mPhone.getContext());
mSubscriptionController = SubscriptionController.getInstance();
+ mNetworkScanRequestTracker = new NetworkScanRequestTracker();
publish();
}
@@ -2642,24 +2646,32 @@
}
/**
- * Performs a new network scan and returns the id of this scan.
+ * Starts a new network scan and returns the id of this scan.
*
+ * @param subId id of the subscription
+ * @param request contains the radio access networks with bands/channels to scan
+ * @param messenger callback messenger for scan results or errors
+ * @param binder for the purpose of auto clean when the user thread crashes
* @return the id of the requested scan which can be used to stop the scan.
*/
@Override
public int requestNetworkScan(int subId, NetworkScanRequest request, Messenger messenger,
IBinder binder) {
- // TODO(yinxu): Implement this method.
- throw new UnsupportedOperationException("To be implemented...");
+ enforceModifyPermissionOrCarrierPrivilege(subId);
+ return mNetworkScanRequestTracker.startNetworkScan(
+ request, messenger, binder, getPhone(subId));
}
/**
* Stops an existing network scan with the given scanId.
+ *
+ * @param subId id of the subscription
+ * @param scanId id of the scan that needs to be stopped
*/
@Override
public void stopNetworkScan(int subId, int scanId) {
- // TODO(yinxu): Implement this method.
- throw new UnsupportedOperationException("To be implemented...");
+ enforceModifyPermissionOrCarrierPrivilege(subId);
+ mNetworkScanRequestTracker.stopNetworkScan(scanId);
}
/**