diff options
| author | 2018-09-20 13:47:43 -0700 | |
|---|---|---|
| committer | 2018-09-21 10:08:14 -0700 | |
| commit | 0cecdf70dba754b3fc4a508589f41c44b08a1fb4 (patch) | |
| tree | 46ff534b2d317a79c18e14f360279b84f6dc2acd | |
| parent | 194170e7f7493c828235f325140dd860d31d077d (diff) | |
Update network selection API
Change the manual network selection api in TelephonyManager to support
the OperatorInfo.
Bug: 115401728
Test: manual test
Merged-In: I43dee55ce117873b699cb98c6eb6d41f5dee24ea
Change-Id: I43dee55ce117873b699cb98c6eb6d41f5dee24ea
3 files changed, 37 insertions, 10 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 723657120593..7f27009205c4 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -67,6 +67,7 @@ import com.android.internal.telephony.CellNetworkScanResult; import com.android.internal.telephony.IPhoneSubInfo; import com.android.internal.telephony.ITelephony; import com.android.internal.telephony.ITelephonyRegistry; +import com.android.internal.telephony.OperatorInfo; import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.RILConstants; import com.android.internal.telephony.TelephonyProperties; @@ -5833,21 +5834,46 @@ public class TelephonyManager { * @param persistSelection whether the selection will persist until reboot. If true, only allows * attaching to the selected PLMN until reboot; otherwise, attach to the chosen PLMN and resume * normal network selection next time. - * @return true on success; false on any failure. + * @return {@code true} on success; {@code false} on any failure. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setNetworkSelectionModeManual(String operatorNumeric, boolean persistSelection) { + return setNetworkSelectionModeManual( + new OperatorInfo( + "" /* operatorAlphaLong */, "" /* operatorAlphaShort */, operatorNumeric), + persistSelection); + } + + /** + * Ask the radio to connect to the input network and change selection mode to manual. + * + * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the + * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} + * + * <p>Requires Permission: + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling + * app has carrier privileges (see {@link #hasCarrierPrivileges}). + * + * @param operatorInfo included the PLMN id, long name, short name of the operator to attach to. + * @param persistSelection whether the selection will persist until reboot. If true, only allows + * attaching to the selected PLMN until reboot; otherwise, attach to the chosen PLMN and resume + * normal network selection next time. + * @return {@code true} on success; {@code true} on any failure. + * + * @hide + */ + @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + public boolean setNetworkSelectionModeManual( + OperatorInfo operatorInfo, boolean persistSelection) { try { ITelephony telephony = getITelephony(); if (telephony != null) { return telephony.setNetworkSelectionModeManual( - getSubId(), operatorNumeric, persistSelection); + getSubId(), operatorInfo, persistSelection); } } catch (RemoteException ex) { Rlog.e(TAG, "setNetworkSelectionModeManual RemoteException", ex); - } catch (NullPointerException ex) { - Rlog.e(TAG, "setNetworkSelectionModeManual NPE", ex); } return false; } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 066db1fca140..df3944018e3c 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -871,14 +871,15 @@ interface ITelephony { * Ask the radio to connect to the input network and change selection mode to manual. * * @param subId the id of the subscription. - * @param operatorNumeric the PLMN of the operator to attach to. - * @param persistSelection Whether the selection will persist until reboot. If true, only allows + * @param operatorInfo the operator inforamtion, included the PLMN, long name and short name of + * the operator to attach to. + * @param persistSelection whether the selection will persist until reboot. If true, only allows * attaching to the selected PLMN until reboot; otherwise, attach to the chosen PLMN and resume * normal network selection next time. - * @return true if the request suceeded. + * @return {@code true} on success; {@code true} on any failure. */ - boolean setNetworkSelectionModeManual(int subId, in String operatorNumeric, - boolean persistSelection); + boolean setNetworkSelectionModeManual( + int subId, in OperatorInfo operatorInfo, boolean persisSelection); /** * Set the preferred network type. diff --git a/telephony/java/com/android/internal/telephony/OperatorInfo.java b/telephony/java/com/android/internal/telephony/OperatorInfo.java index d0245a0a07b4..a47e2b026021 100644 --- a/telephony/java/com/android/internal/telephony/OperatorInfo.java +++ b/telephony/java/com/android/internal/telephony/OperatorInfo.java @@ -21,7 +21,7 @@ import android.os.Parcel; import android.os.Parcelable; /** - * {@hide} + * @hide */ public class OperatorInfo implements Parcelable { public enum State { |