diff options
| author | Nathan Harold <nharold@google.com> | 2020-03-18 23:41:57 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-03-18 23:41:57 +0000 |
| commit | 2ea0b56cff0ec1c99a6f3a1660dd5b4d801eb5bf (patch) | |
| tree | aded5bafcc8d455506beaaa9b516ba6148b91911 /core/java/android | |
| parent | 055e616bd3e24a2943ac27396e60989883ab530c (diff) | |
| parent | 4ad89fb9554764a5920132341d75eab9a7e7f63d (diff) | |
Merge changes from topics "barring-cp", "nri-rplmn"
* changes:
Allow Nullable Registered PLMN
Return the RPLMN from NetworkRegistrationInfo
Expose PreciseDataConnectionstate#getApnSetting()
Skip sanitizing location info for Null Barring CID
Remove BarringInfo#isServiceBarred()
Introduce a new RIL request constant to support getBarringInfo.
Update BarringInfo as Barring HAL date stuctures updated
Add a BARRING_TYPE_UNKNOWN for Unreported Barring
Add Callback to notify changes of barring status
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/telephony/PhoneStateListener.java | 33 | ||||
| -rw-r--r-- | core/java/android/telephony/TelephonyRegistryManager.java | 17 |
2 files changed, 50 insertions, 0 deletions
diff --git a/core/java/android/telephony/PhoneStateListener.java b/core/java/android/telephony/PhoneStateListener.java index 1dca7fd0e444..ab31d247bb73 100644 --- a/core/java/android/telephony/PhoneStateListener.java +++ b/core/java/android/telephony/PhoneStateListener.java @@ -427,6 +427,17 @@ public class PhoneStateListener { @RequiresPermission(Manifest.permission.READ_PHONE_STATE) public static final int LISTEN_REGISTRATION_FAILURE = 0x40000000; + /** + * Listen for Barring Information for the current registered / camped cell. + * + * <p>Requires permission {@link android.Manifest.permission#READ_PHONE_STATE} or the calling + * app has carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges}). + * + * @see #onBarringInfoChanged() + */ + @RequiresPermission(Manifest.permission.READ_PHONE_STATE) + public static final int LISTEN_BARRING_INFO = 0x80000000; + /* * Subscription used to listen to the phone state changes * @hide @@ -1036,6 +1047,20 @@ public class PhoneStateListener { } /** + * Report updated barring information for the current camped/registered cell. + * + * <p>Barring info is provided for all services applicable to the current camped/registered + * cell, for the registered PLMN and current access class/access category. + * + * @param barringInfo for all services on the current cell. + * + * @see android.telephony.BarringInfo + */ + public void onBarringInfoChanged(@NonNull BarringInfo barringInfo) { + // default implementation empty + } + + /** * The callback methods need to be called on the handler thread where * this object was created. If the binder did that for us it'd be nice. * @@ -1328,6 +1353,14 @@ public class PhoneStateListener { cellIdentity, chosenPlmn, domain, causeCode, additionalCauseCode))); // default implementation empty } + + public void onBarringInfoChanged(BarringInfo barringInfo) { + PhoneStateListener psl = mPhoneStateListenerWeakRef.get(); + if (psl == null) return; + + Binder.withCleanCallingIdentity( + () -> mExecutor.execute(() -> psl.onBarringInfoChanged(barringInfo))); + } } diff --git a/core/java/android/telephony/TelephonyRegistryManager.java b/core/java/android/telephony/TelephonyRegistryManager.java index c4b4c43056b1..73cd708f43f7 100644 --- a/core/java/android/telephony/TelephonyRegistryManager.java +++ b/core/java/android/telephony/TelephonyRegistryManager.java @@ -729,4 +729,21 @@ public class TelephonyRegistryManager { } catch (RemoteException ex) { } } + + /** + * Notify {@link BarringInfo} has changed for a specific subscription. + * + * @param slotIndex for the phone object that got updated barring info. + * @param subId for which the BarringInfo changed. + * @param barringInfo updated BarringInfo. + */ + public void notifyBarringInfoChanged( + int slotIndex, int subId, @NonNull BarringInfo barringInfo) { + try { + sRegistry.notifyBarringInfoChanged(slotIndex, subId, barringInfo); + } catch (RemoteException ex) { + // system server crash + } + } + } |
