aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYing Xu <yinxu@google.com>2017-05-16 23:04:39 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-05-16 23:04:42 +0000
commitf90dc6160becbfee66c01439253811e13fdb7f63 (patch)
treec97e73d0139f4c3a90ddbdc7e545f0e1c573c68b
parentf30e41f366ec6bbe955941385728173448f38fe3 (diff)
parentc8c651f856047c6c761de788a14097600701cdab (diff)
downloadtelephony-n-iot-preview-4.tar.gz
Merge "Add the new RIL requests to start/stop network scan"android-n-iot-preview-4n-iot-preview-4
-rw-r--r--src/java/com/android/internal/telephony/BaseCommands.java12
-rw-r--r--src/java/com/android/internal/telephony/CommandsInterface.java37
-rw-r--r--src/java/com/android/internal/telephony/GsmCdmaPhone.java10
-rw-r--r--src/java/com/android/internal/telephony/PhoneInternalInterface.java42
-rw-r--r--src/java/com/android/internal/telephony/RIL.java96
-rw-r--r--src/java/com/android/internal/telephony/RadioIndication.java18
-rw-r--r--src/java/com/android/internal/telephony/RadioResponse.java26
-rw-r--r--src/java/com/android/internal/telephony/imsphone/ImsPhoneBase.java12
-rw-r--r--src/java/com/android/internal/telephony/imsphone/ImsPhoneCommandInterface.java8
-rw-r--r--src/java/com/android/internal/telephony/sip/SipCommandInterface.java8
-rwxr-xr-xsrc/java/com/android/internal/telephony/sip/SipPhoneBase.java16
-rw-r--r--src/java/com/android/internal/telephony/test/SimulatedCommands.java20
-rw-r--r--src/java/com/android/internal/telephony/test/SimulatedCommandsVerifier.java18
-rw-r--r--tests/telephonytests/src/com/android/internal/telephony/NetworkScanResultTest.java75
-rw-r--r--tests/telephonytests/src/com/android/internal/telephony/mocks/PhoneMock.java13
15 files changed, 383 insertions, 28 deletions
diff --git a/src/java/com/android/internal/telephony/BaseCommands.java b/src/java/com/android/internal/telephony/BaseCommands.java
index 5400ae2287..5e09c35330 100644
--- a/src/java/com/android/internal/telephony/BaseCommands.java
+++ b/src/java/com/android/internal/telephony/BaseCommands.java
@@ -72,6 +72,7 @@ public abstract class BaseCommands implements CommandsInterface {
new RegistrantList();
protected RegistrantList mPcoDataRegistrants = new RegistrantList();
protected RegistrantList mCarrierInfoForImsiEncryptionRegistrants = new RegistrantList();
+ protected RegistrantList mRilNetworkScanResultRegistrants = new RegistrantList();
protected Registrant mGsmSmsRegistrant;
@@ -730,6 +731,17 @@ public abstract class BaseCommands implements CommandsInterface {
mHardwareConfigChangeRegistrants.remove(h);
}
+ @Override
+ public void registerForNetworkScanResult(Handler h, int what, Object obj) {
+ Registrant r = new Registrant(h, what, obj);
+ mRilNetworkScanResultRegistrants.add(r);
+ }
+
+ @Override
+ public void unregisterForNetworkScanResult(Handler h) {
+ mRilNetworkScanResultRegistrants.remove(h);
+ }
+
/**
* {@inheritDoc}
*/
diff --git a/src/java/com/android/internal/telephony/CommandsInterface.java b/src/java/com/android/internal/telephony/CommandsInterface.java
index 1b94cec609..a5e4c7be55 100644
--- a/src/java/com/android/internal/telephony/CommandsInterface.java
+++ b/src/java/com/android/internal/telephony/CommandsInterface.java
@@ -1284,12 +1284,29 @@ public interface CommandsInterface {
/**
* Queries the currently available networks
*
- * ((AsyncResult)response.obj).result is a List of NetworkInfo objects
+ * ((AsyncResult)response.obj).result is a List of NetworkInfo objects
*/
void getAvailableNetworks(Message response);
- void getBasebandVersion (Message response);
+ /**
+ * Starts a radio network scan
+ *
+ * ((AsyncResult)response.obj).result is a NetworkScanResult object
+ */
+ void startNetworkScan(Message response);
+ /**
+ * Stops the ongoing network scan
+ *
+ * ((AsyncResult)response.obj).result is a NetworkScanResult object
+ *
+ */
+ void stopNetworkScan(Message response);
+
+ /**
+ * Gets the baseband version
+ */
+ void getBasebandVersion(Message response);
/**
* (AsyncResult)response.obj).result will be an Integer representing
@@ -2102,6 +2119,22 @@ public interface CommandsInterface {
*/
void unregisterForCarrierInfoForImsiEncryption(Handler h);
+ /**
+ * Register for unsolicited Network Scan result.
+ *
+ * @param h Handler for notificaiton message.
+ * @param what User-defined message code.
+ * @param obj User object.
+ */
+ void registerForNetworkScanResult(Handler h, int what, Object obj);
+
+ /**
+ * DeRegister for unsolicited Network Scan result.
+ *
+ * @param h Handler for notificaiton message.
+ */
+ void unregisterForNetworkScanResult(Handler h);
+
default public List<ClientRequestStats> getClientRequestStats() {
return null;
}
diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
index 840a57d0aa..27cbd77d7f 100644
--- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java
+++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
@@ -1779,6 +1779,16 @@ public class GsmCdmaPhone extends Phone {
}
@Override
+ public void startNetworkScan(Message response) {
+ mCi.startNetworkScan(response);
+ }
+
+ @Override
+ public void stopNetworkScan(Message response) {
+ mCi.stopNetworkScan(response);
+ }
+
+ @Override
public void getNeighboringCids(Message response, WorkSource workSource) {
if (isPhoneTypeGsm()) {
mCi.getNeighboringCids(response, workSource);
diff --git a/src/java/com/android/internal/telephony/PhoneInternalInterface.java b/src/java/com/android/internal/telephony/PhoneInternalInterface.java
index 1983169ef9..849cf992c6 100644
--- a/src/java/com/android/internal/telephony/PhoneInternalInterface.java
+++ b/src/java/com/android/internal/telephony/PhoneInternalInterface.java
@@ -16,32 +16,18 @@
package com.android.internal.telephony;
-import android.content.Context;
-import android.net.LinkProperties;
-import android.net.NetworkCapabilities;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
-import android.os.WorkSource;
import android.os.ResultReceiver;
-import android.telephony.CellInfo;
-import android.telephony.CellLocation;
+import android.os.WorkSource;
import android.telephony.CarrierConfigManager;
-import android.telephony.PhoneStateListener;
+import android.telephony.CellLocation;
import android.telephony.ServiceState;
-import android.telephony.SignalStrength;
-
-import com.android.internal.telephony.imsphone.ImsPhone;
-import com.android.internal.telephony.RadioCapability;
-import com.android.internal.telephony.test.SimulatedRadioControl;
-import com.android.internal.telephony.uicc.IsimRecords;
-import com.android.internal.telephony.uicc.UiccCard;
-import com.android.internal.telephony.uicc.UsimServiceTable;
import com.android.internal.telephony.PhoneConstants.*; // ????
import java.util.List;
-import java.util.Locale;
/**
* Internal interface used to control the phone; SDK developers cannot
@@ -657,6 +643,30 @@ public interface PhoneInternalInterface {
void getAvailableNetworks(Message response);
/**
+ * Start a network scan. This method is asynchronous; .
+ * On completion, <code>response.obj</code> is set to an AsyncResult with
+ * one of the following members:.<p>
+ * <ul>
+ * <li><code>response.obj.result</code> will be a <code>NetworkScanResult</code> object, or</li>
+ * <li><code>response.obj.exception</code> will be set with an exception
+ * on failure.</li>
+ * </ul>
+ */
+ void startNetworkScan(Message response);
+
+ /**
+ * Stop ongoing network scan. This method is asynchronous; .
+ * On completion, <code>response.obj</code> is set to an AsyncResult with
+ * one of the following members:.<p>
+ * <ul>
+ * <li><code>response.obj.result</code> will be a <code>NetworkScanResult</code> object, or</li>
+ * <li><code>response.obj.exception</code> will be set with an exception
+ * on failure.</li>
+ * </ul>
+ */
+ void stopNetworkScan(Message response);
+
+ /**
* Query neighboring cell IDs. <code>response</code> is dispatched when
* this is complete. <code>response.obj</code> will be an AsyncResult,
* and <code>response.obj.exception</code> will be non-null on failure.
diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java
index 6724065ff2..ee0f31d9a2 100644
--- a/src/java/com/android/internal/telephony/RIL.java
+++ b/src/java/com/android/internal/telephony/RIL.java
@@ -69,14 +69,18 @@ import android.telephony.CellInfo;
import android.telephony.ClientRequestStats;
import android.telephony.ModemActivityInfo;
import android.telephony.NeighboringCellInfo;
+import android.telephony.NetworkScanRequest;
import android.telephony.PhoneNumberUtils;
import android.telephony.RadioAccessFamily;
+import android.telephony.RadioAccessSpecifier;
+import android.telephony.RadioNetworkConstants.RadioAccessNetworks;
import android.telephony.Rlog;
import android.telephony.SignalStrength;
import android.telephony.SmsManager;
import android.telephony.TelephonyHistogram;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
+import android.util.Log;
import android.util.SparseArray;
import com.android.internal.telephony.TelephonyProto.SmsSession;
@@ -1774,6 +1778,98 @@ public final class RIL extends BaseCommands implements CommandsInterface {
}
@Override
+ public void startNetworkScan(Message result) {
+ IRadio radioProxy = getRadioProxy(result);
+ if (radioProxy != null) {
+ android.hardware.radio.V1_1.IRadio radioProxy11 =
+ android.hardware.radio.V1_1.IRadio.castFrom(radioProxy);
+ if (radioProxy11 == null) {
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ result.sendToTarget();
+ }
+ } else {
+ NetworkScanRequest nsr = (NetworkScanRequest) result.obj;
+ android.hardware.radio.V1_1.NetworkScanRequest request =
+ new android.hardware.radio.V1_1.NetworkScanRequest();
+ request.type = nsr.scanType;
+ request.interval = 60;
+ for (RadioAccessSpecifier ras : nsr.specifiers) {
+ android.hardware.radio.V1_1.RadioAccessSpecifier s =
+ new android.hardware.radio.V1_1.RadioAccessSpecifier();
+ s.radioAccessNetwork = ras.radioAccessNetwork;
+ List<Integer> bands = null;
+ switch (ras.radioAccessNetwork) {
+ case RadioAccessNetworks.GERAN:
+ bands = s.geranBands;
+ break;
+ case RadioAccessNetworks.UTRAN:
+ bands = s.utranBands;
+ break;
+ case RadioAccessNetworks.EUTRAN:
+ bands = s.eutranBands;
+ break;
+ default:
+ Log.wtf(RILJ_LOG_TAG, "radioAccessNetwork " + ras.radioAccessNetwork
+ + " not supported!");
+ return;
+ }
+ for (int band : ras.bands) {
+ bands.add(band);
+ }
+ for (int channel : ras.channels) {
+ s.channels.add(channel);
+ }
+ request.specifiers.add(s);
+ }
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_START_NETWORK_SCAN, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
+ }
+
+ try {
+ radioProxy11.startNetworkScan(rr.mSerial, request);
+ } catch (RemoteException | RuntimeException e) {
+ handleRadioProxyExceptionForRR(rr, "startNetworkScan", e);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void stopNetworkScan(Message result) {
+ IRadio radioProxy = getRadioProxy(result);
+ if (radioProxy != null) {
+ android.hardware.radio.V1_1.IRadio radioProxy11 =
+ android.hardware.radio.V1_1.IRadio.castFrom(radioProxy);
+ if (radioProxy11 == null) {
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ result.sendToTarget();
+ }
+ } else {
+ RILRequest rr = obtainRequest(RIL_REQUEST_STOP_NETWORK_SCAN, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
+ }
+
+ try {
+ radioProxy11.stopNetworkScan(rr.mSerial);
+ } catch (RemoteException | RuntimeException e) {
+ handleRadioProxyExceptionForRR(rr, "stopNetworkScan", e);
+ }
+ }
+ }
+ }
+
+ @Override
public void startDtmf(char c, Message result) {
IRadio radioProxy = getRadioProxy(result);
if (radioProxy != null) {
diff --git a/src/java/com/android/internal/telephony/RadioIndication.java b/src/java/com/android/internal/telephony/RadioIndication.java
index 924dc105d2..8c09b4b6bf 100644
--- a/src/java/com/android/internal/telephony/RadioIndication.java
+++ b/src/java/com/android/internal/telephony/RadioIndication.java
@@ -30,6 +30,7 @@ import static com.android.internal.telephony.RILConstants.RIL_UNSOL_EXIT_EMERGEN
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_HARDWARE_CONFIG_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_LCEDATA_RECV;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_MODEM_RESTART;
+import static com.android.internal.telephony.RILConstants.RIL_UNSOL_NETWORK_SCAN_RESULT;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_NITZ_TIME_RECEIVED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_ON_SS;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_ON_USSD;
@@ -632,6 +633,12 @@ public class RadioIndication extends IRadioIndication.Stub {
mRil.mRilCellInfoListRegistrants.notifyRegistrants(new AsyncResult (null, response, null));
}
+ /** Incremental network scan results */
+ public void networkScanResult(int indicationType,
+ android.hardware.radio.V1_1.NetworkScanResult result) {
+ responseCellInfos(indicationType, result);
+ }
+
public void imsNetworkStateChanged(int indicationType) {
mRil.processIndication(indicationType);
@@ -813,4 +820,15 @@ public class RadioIndication extends IRadioIndication.Stub {
}
return state;
}
+
+ private void responseCellInfos(int indicationType,
+ android.hardware.radio.V1_1.NetworkScanResult result) {
+ mRil.processIndication(indicationType);
+
+ NetworkScanResult nsr = null;
+ ArrayList<CellInfo> infos = RIL.convertHalCellInfoList(result.networkInfos);
+ nsr = new NetworkScanResult(result.status, result.error, infos);
+ if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_NETWORK_SCAN_RESULT, nsr);
+ mRil.mRilNetworkScanResultRegistrants.notifyRegistrants(new AsyncResult(null, nsr, null));
+ }
}
diff --git a/src/java/com/android/internal/telephony/RadioResponse.java b/src/java/com/android/internal/telephony/RadioResponse.java
index 6edf45cd37..914a60a438 100644
--- a/src/java/com/android/internal/telephony/RadioResponse.java
+++ b/src/java/com/android/internal/telephony/RadioResponse.java
@@ -494,6 +494,22 @@ public class RadioResponse extends IRadioResponse.Stub {
}
/**
+ *
+ * @param responseInfo Response info struct containing response type, serial no. and error
+ */
+ public void startNetworkScanResponse(RadioResponseInfo responseInfo) {
+ responseScanStatus(responseInfo);
+ }
+
+ /**
+ *
+ * @param responseInfo Response info struct containing response type, serial no. and error
+ */
+ public void stopNetworkScanResponse(RadioResponseInfo responseInfo) {
+ responseScanStatus(responseInfo);
+ }
+
+ /**
* @param responseInfo Response info struct containing response type, serial no. and error
*/
public void startDtmfResponse(RadioResponseInfo responseInfo) {
@@ -1531,6 +1547,16 @@ public class RadioResponse extends IRadioResponse.Stub {
}
}
+ private void responseScanStatus(RadioResponseInfo responseInfo) {
+ RILRequest rr = mRil.processResponse(responseInfo);
+
+ if (rr != null) {
+ NetworkScanResult nsr = new NetworkScanResult(0, responseInfo.error, null);
+ sendMessageResponse(rr.mResult, nsr);
+ mRil.processResponseDone(rr, responseInfo, nsr);
+ }
+ }
+
private void responseDataCallList(RadioResponseInfo responseInfo,
ArrayList<SetupDataCallResult> dataCallResultList) {
RILRequest rr = mRil.processResponse(responseInfo);
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhoneBase.java b/src/java/com/android/internal/telephony/imsphone/ImsPhoneBase.java
index 5eeadbe0d7..c5e0c781aa 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhoneBase.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhoneBase.java
@@ -26,14 +26,13 @@ import android.os.SystemProperties;
import android.os.WorkSource;
import android.telephony.CellInfo;
import android.telephony.CellLocation;
+import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
-import android.telephony.Rlog;
import android.util.Pair;
import com.android.internal.telephony.Call;
import com.android.internal.telephony.Connection;
-import com.android.internal.telephony.dataconnection.DataConnection;
import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.IccPhoneBookInterfaceManager;
import com.android.internal.telephony.MmiCode;
@@ -42,6 +41,7 @@ import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneNotifier;
import com.android.internal.telephony.TelephonyProperties;
+import com.android.internal.telephony.dataconnection.DataConnection;
import com.android.internal.telephony.uicc.IccFileHandler;
import java.util.ArrayList;
@@ -427,6 +427,14 @@ abstract class ImsPhoneBase extends Phone {
}
@Override
+ public void startNetworkScan(Message response) {
+ }
+
+ @Override
+ public void stopNetworkScan(Message response) {
+ }
+
+ @Override
public void setNetworkSelectionModeAutomatic(Message response) {
}
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCommandInterface.java b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCommandInterface.java
index 632363a207..0f6c68df33 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCommandInterface.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCommandInterface.java
@@ -334,6 +334,14 @@ class ImsPhoneCommandInterface extends BaseCommands implements CommandsInterface
}
@Override
+ public void startNetworkScan(Message response) {
+ }
+
+ @Override
+ public void stopNetworkScan(Message response) {
+ }
+
+ @Override
public void setCallForward(int action, int cfReason, int serviceClass,
String number, int timeSeconds, Message response) {
}
diff --git a/src/java/com/android/internal/telephony/sip/SipCommandInterface.java b/src/java/com/android/internal/telephony/sip/SipCommandInterface.java
index 1f3a1a5ad2..e72496aa26 100644
--- a/src/java/com/android/internal/telephony/sip/SipCommandInterface.java
+++ b/src/java/com/android/internal/telephony/sip/SipCommandInterface.java
@@ -335,6 +335,14 @@ class SipCommandInterface extends BaseCommands implements CommandsInterface {
}
@Override
+ public void startNetworkScan(Message response) {
+ }
+
+ @Override
+ public void stopNetworkScan(Message response) {
+ }
+
+ @Override
public void setCallForward(int action, int cfReason, int serviceClass,
String number, int timeSeconds, Message response) {
}
diff --git a/src/java/com/android/internal/telephony/sip/SipPhoneBase.java b/src/java/com/android/internal/telephony/sip/SipPhoneBase.java
index 1cd2a152c7..966e952f50 100755
--- a/src/java/com/android/internal/telephony/sip/SipPhoneBase.java
+++ b/src/java/com/android/internal/telephony/sip/SipPhoneBase.java
@@ -21,29 +21,29 @@ import android.net.LinkProperties;
import android.os.AsyncResult;
import android.os.Bundle;
import android.os.Handler;
-import android.os.ResultReceiver;
import android.os.Message;
import android.os.RegistrantList;
+import android.os.ResultReceiver;
import android.os.SystemProperties;
import android.os.WorkSource;
import android.telephony.CellLocation;
+import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
-import android.telephony.Rlog;
import com.android.internal.telephony.Call;
import com.android.internal.telephony.CallStateException;
import com.android.internal.telephony.Connection;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.dataconnection.DataConnection;
import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.IccPhoneBookInterfaceManager;
import com.android.internal.telephony.MmiCode;
import com.android.internal.telephony.OperatorInfo;
+import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneNotifier;
import com.android.internal.telephony.TelephonyProperties;
import com.android.internal.telephony.UUSInfo;
+import com.android.internal.telephony.dataconnection.DataConnection;
import com.android.internal.telephony.uicc.IccFileHandler;
import java.util.ArrayList;
@@ -394,6 +394,14 @@ abstract class SipPhoneBase extends Phone {
}
@Override
+ public void startNetworkScan(Message response) {
+ }
+
+ @Override
+ public void stopNetworkScan(Message response) {
+ }
+
+ @Override
public void setNetworkSelectionModeAutomatic(Message response) {
}
diff --git a/src/java/com/android/internal/telephony/test/SimulatedCommands.java b/src/java/com/android/internal/telephony/test/SimulatedCommands.java
index 09b002778e..0fb50a63b6 100644
--- a/src/java/com/android/internal/telephony/test/SimulatedCommands.java
+++ b/src/java/com/android/internal/telephony/test/SimulatedCommands.java
@@ -1355,7 +1355,25 @@ public class SimulatedCommands extends BaseCommands
* ((AsyncResult)response.obj).result is a List of NetworkInfo objects
*/
@Override
- public void getAvailableNetworks(Message result) {unimplemented(result);}
+ public void getAvailableNetworks(Message result) {
+ unimplemented(result);
+ }
+
+ /**
+ * Starts a network scan
+ */
+ @Override
+ public void startNetworkScan(Message result) {
+ unimplemented(result);
+ }
+
+ /**
+ * Stops an ongoing network scan
+ */
+ @Override
+ public void stopNetworkScan(Message result) {
+ unimplemented(result);
+ }
@Override
public void getBasebandVersion (Message result) {
diff --git a/src/java/com/android/internal/telephony/test/SimulatedCommandsVerifier.java b/src/java/com/android/internal/telephony/test/SimulatedCommandsVerifier.java
index 990d7c5b10..c5da1e0a1d 100644
--- a/src/java/com/android/internal/telephony/test/SimulatedCommandsVerifier.java
+++ b/src/java/com/android/internal/telephony/test/SimulatedCommandsVerifier.java
@@ -946,6 +946,16 @@ public class SimulatedCommandsVerifier implements CommandsInterface {
}
@Override
+ public void startNetworkScan(Message response) {
+
+ }
+
+ @Override
+ public void stopNetworkScan(Message response) {
+
+ }
+
+ @Override
public void getBasebandVersion(Message response) {
}
@@ -1379,6 +1389,14 @@ public class SimulatedCommandsVerifier implements CommandsInterface {
}
@Override
+ public void registerForNetworkScanResult(Handler h, int what, Object obj) {
+ }
+
+ @Override
+ public void unregisterForNetworkScanResult(Handler h) {
+ }
+
+ @Override
public void unregisterForCarrierInfoForImsiEncryption(Handler h) {
}
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/NetworkScanResultTest.java b/tests/telephonytests/src/com/android/internal/telephony/NetworkScanResultTest.java
new file mode 100644
index 0000000000..f1492110e0
--- /dev/null
+++ b/tests/telephonytests/src/com/android/internal/telephony/NetworkScanResultTest.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2017 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.internal.telephony;
+
+import static org.junit.Assert.assertEquals;
+
+import android.os.Parcel;
+import android.support.test.filters.SmallTest;
+import android.telephony.CellIdentityGsm;
+import android.telephony.CellIdentityLte;
+import android.telephony.CellInfo;
+import android.telephony.CellInfoGsm;
+import android.telephony.CellInfoLte;
+import android.telephony.CellSignalStrengthGsm;
+import android.telephony.CellSignalStrengthLte;
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+
+/** Unit tests for {@link NetworkScanResult}. */
+
+public class NetworkScanResultTest {
+
+ @Test
+ @SmallTest
+ public void testParcel() {
+ ArrayList<CellInfo> infos = new ArrayList<CellInfo>();
+
+ CellIdentityGsm cig = new CellIdentityGsm(310, 310, 1, 2, 3, 4);
+ CellSignalStrengthGsm cssg = new CellSignalStrengthGsm();
+ cssg.initialize(5, 6, 7);
+ CellInfoGsm gsm = new CellInfoGsm();
+ gsm.setRegistered(true);
+ gsm.setTimeStampType(8);
+ gsm.setTimeStamp(9);
+ gsm.setCellIdentity(cig);
+ gsm.setCellSignalStrength(cssg);
+ infos.add(gsm);
+
+ CellIdentityLte cil = new CellIdentityLte(320, 320, 11, 12, 13, 14);
+ CellSignalStrengthLte cssl = new CellSignalStrengthLte();
+ cssl.initialize(15, 16, 17, 18, 19, 20);
+ CellInfoLte lte = new CellInfoLte();
+ lte.setRegistered(false);
+ lte.setTimeStampType(21);
+ lte.setTimeStamp(22);
+ lte.setCellIdentity(cil);
+ lte.setCellSignalStrength(cssl);
+ infos.add(lte);
+
+ NetworkScanResult nsr = new NetworkScanResult(0, 0, infos);
+
+ Parcel p = Parcel.obtain();
+ nsr.writeToParcel(p, 0);
+ p.setDataPosition(0);
+
+ NetworkScanResult newNsr = NetworkScanResult.CREATOR.createFromParcel(p);
+ assertEquals(nsr, newNsr);
+ }
+}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/mocks/PhoneMock.java b/tests/telephonytests/src/com/android/internal/telephony/mocks/PhoneMock.java
index 68b9b11288..cfba328e4e 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/mocks/PhoneMock.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/mocks/PhoneMock.java
@@ -17,17 +17,16 @@
package com.android.internal.telephony;
import android.content.Context;
+import android.net.LinkProperties;
+import android.net.NetworkCapabilities;
import android.os.AsyncResult;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
-import android.os.Messenger;
import android.os.Registrant;
import android.os.RegistrantList;
import android.os.ResultReceiver;
import android.os.WorkSource;
-import android.net.LinkProperties;
-import android.net.NetworkCapabilities;
import android.service.carrier.CarrierIdentifier;
import android.telephony.CellInfo;
import android.telephony.CellLocation;
@@ -1240,6 +1239,14 @@ public class PhoneMock extends Phone {
throw new RuntimeException("not implemented");
}
+ public void startNetworkScan(Message response) {
+ throw new RuntimeException("not implemented");
+ }
+
+ public void stopNetworkScan(Message response) {
+ throw new RuntimeException("not implemented");
+ }
+
public void getNeighboringCids(Message response) {
throw new RuntimeException("not implemented");
}