Allow non-persistent manual network selection.

Allow the API to specify if the selection should be persisted across reboots.
This also has the side affect of not notifying the user when signal is lost.

Necessary becasue the API might be used transparent to the user and the
notifications will be bizarre.

Bug: 23971948
Change-Id: Ie3874352138cc6512d3b7afea35f1a7e23ff8e44
diff --git a/src/com/android/phone/NetworkSetting.java b/src/com/android/phone/NetworkSetting.java
index ad2fea3..5e66846 100644
--- a/src/com/android/phone/NetworkSetting.java
+++ b/src/com/android/phone/NetworkSetting.java
@@ -204,7 +204,7 @@
             Message msg = mHandler.obtainMessage(EVENT_NETWORK_SELECTION_DONE);
             Phone phone = PhoneFactory.getPhone(mPhoneId);
             if (phone != null) {
-                phone.selectNetworkManually(mNetworkMap.get(selectedCarrier), msg);
+                phone.selectNetworkManually(mNetworkMap.get(selectedCarrier), true, msg);
                 displayNetworkSeletionInProgress(networkStr);
                 handled = true;
             } else {
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 7e06fdf..d61ef59 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -176,6 +176,19 @@
     }
 
     /**
+     * A request object to use for transmitting data to an ICC.
+     */
+    private static final class ManualNetworkSelectionArgument {
+        public OperatorInfo operatorInfo;
+        public boolean persistSelection;
+
+        public ManualNetworkSelectionArgument(OperatorInfo operatorInfo, boolean persistSelection) {
+            this.operatorInfo = operatorInfo;
+            this.persistSelection = persistSelection;
+        }
+    }
+
+    /**
      * A request object for use with {@link MainThreadHandler}. Requesters should wait() on the
      * request after sending. The main thread will notify the request when it is complete.
      */
@@ -696,10 +709,12 @@
 
                 case CMD_SET_NETWORK_SELECTION_MODE_MANUAL:
                     request = (MainThreadRequest) msg.obj;
-                    OperatorInfo operator = (OperatorInfo) request.argument;
+                    ManualNetworkSelectionArgument selArg =
+                            (ManualNetworkSelectionArgument) request.argument;
                     onCompleted = obtainMessage(EVENT_SET_NETWORK_SELECTION_MODE_MANUAL_DONE,
                             request);
-                    getPhoneFromRequest(request).selectNetworkManually(operator, onCompleted);
+                    getPhoneFromRequest(request).selectNetworkManually(selArg.operatorInfo,
+                            selArg.persistSelection, onCompleted);
                     break;
 
                 case EVENT_SET_NETWORK_SELECTION_MODE_MANUAL_DONE:
@@ -2180,10 +2195,13 @@
      * Set the network selection mode to manual with the selected carrier.
      */
     @Override
-    public boolean setNetworkSelectionModeManual(int subId, OperatorInfo operator) {
+    public boolean setNetworkSelectionModeManual(int subId, OperatorInfo operator,
+            boolean persistSelection) {
         enforceModifyPermissionOrCarrierPrivilege();
         if (DBG) log("setNetworkSelectionModeManual: subId:" + subId + " operator:" + operator);
-        return (Boolean) sendRequest(CMD_SET_NETWORK_SELECTION_MODE_MANUAL, operator, subId);
+        ManualNetworkSelectionArgument arg = new ManualNetworkSelectionArgument(operator,
+                persistSelection);
+        return (Boolean) sendRequest(CMD_SET_NETWORK_SELECTION_MODE_MANUAL, arg, subId);
     }
 
     /**