Loading Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -512,6 +512,7 @@ java_defaults { "telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl", "telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl", "telephony/java/android/telephony/mbms/vendor/IMbmsGroupCallService.aidl", "telephony/java/android/telephony/ICellInfoCallback.aidl", "telephony/java/android/telephony/INetworkService.aidl", "telephony/java/android/telephony/INetworkServiceCallback.aidl", "telephony/java/com/android/ims/internal/IImsCallSession.aidl", Loading api/current.txt +6 −0 Original line number Diff line number Diff line Loading @@ -42978,6 +42978,7 @@ package android.telephony { method public boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle); method public boolean isWorldPhone(); method public void listen(android.telephony.PhoneStateListener, int); method public void requestCellInfoUpdate(java.util.concurrent.Executor, android.telephony.TelephonyManager.CellInfoCallback); method public android.telephony.NetworkScan requestNetworkScan(android.telephony.NetworkScanRequest, java.util.concurrent.Executor, android.telephony.TelephonyScanManager.NetworkScanCallback); method public void sendDialerSpecialCode(java.lang.String); method public java.lang.String sendEnvelopeWithStatus(java.lang.String); Loading Loading @@ -43078,6 +43079,11 @@ package android.telephony { field public static final java.lang.String VVM_TYPE_OMTP = "vvm_type_omtp"; } public static abstract class TelephonyManager.CellInfoCallback { ctor public TelephonyManager.CellInfoCallback(); method public abstract void onCellInfo(java.util.List<android.telephony.CellInfo>); } public static abstract class TelephonyManager.UssdResponseCallback { ctor public TelephonyManager.UssdResponseCallback(); method public void onReceiveUssdResponse(android.telephony.TelephonyManager, java.lang.String, java.lang.CharSequence); api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5329,6 +5329,7 @@ package android.telephony { method public deprecated boolean isVisualVoicemailEnabled(android.telecom.PhoneAccountHandle); method public boolean needsOtaServiceProvisioning(); method public boolean rebootRadio(); method public void requestCellInfoUpdate(android.os.WorkSource, java.util.concurrent.Executor, android.telephony.TelephonyManager.CellInfoCallback); method public boolean resetRadioConfig(); method public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>); method public void setCarrierDataEnabled(boolean); Loading telephony/java/android/telephony/ICellInfoCallback.aidl 0 → 100644 +30 −0 Original line number Diff line number Diff line /* * Copyright 2018 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 android.telephony; import android.telephony.CellInfo; import java.util.List; /** * Callback to provide asynchronous CellInfo. * @hide */ oneway interface ICellInfoCallback { void onCellInfo(in List<CellInfo> state); } telephony/java/android/telephony/TelephonyManager.java +117 −28 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.content.Context.TELECOM_SERVICE; import static com.android.internal.util.Preconditions.checkNotNull; import android.Manifest; import android.annotation.CallbackExecutor; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; Loading @@ -43,6 +44,7 @@ import android.net.NetworkStats; import android.net.Uri; import android.os.AsyncTask; import android.os.BatteryStats; import android.os.Binder; import android.os.Build; import android.os.Bundle; import android.os.Handler; Loading @@ -52,6 +54,7 @@ import android.os.RemoteException; import android.os.ResultReceiver; import android.os.ServiceManager; import android.os.SystemProperties; import android.os.WorkSource; import android.provider.Settings.SettingNotFoundException; import android.service.carrier.CarrierIdentifier; import android.telecom.PhoneAccount; Loading Loading @@ -4728,37 +4731,42 @@ public class TelephonyManager { } /** * Returns all observed cell information from all radios on the * device including the primary and neighboring cells. Calling this method does * not trigger a call to {@link android.telephony.PhoneStateListener#onCellInfoChanged * onCellInfoChanged()}, or change the rate at which * {@link android.telephony.PhoneStateListener#onCellInfoChanged * onCellInfoChanged()} is called. * Requests all available cell information from all radios on the device including the * camped/registered, serving, and neighboring cells. * *<p> * The list can include one or more {@link android.telephony.CellInfoGsm CellInfoGsm}, * <p>The response can include one or more {@link android.telephony.CellInfoGsm CellInfoGsm}, * {@link android.telephony.CellInfoCdma CellInfoCdma}, * {@link android.telephony.CellInfoTdscdma CellInfoTdscdma}, * {@link android.telephony.CellInfoLte CellInfoLte}, and * {@link android.telephony.CellInfoWcdma CellInfoWcdma} objects, in any combination. * On devices with multiple radios it is typical to see instances of * one or more of any these in the list. In addition, zero, one, or more * of the returned objects may be considered registered; that is, their * It is typical to see instances of one or more of any these in the list. In addition, zero * or more of the returned objects may be considered registered; that is, their * {@link android.telephony.CellInfo#isRegistered CellInfo.isRegistered()} * methods may return true. * * <p>This method returns valid data for registered cells on devices with * {@link android.content.pm.PackageManager#FEATURE_TELEPHONY}. In cases where only * partial information is available for a particular CellInfo entry, unavailable fields * will be reported as Integer.MAX_VALUE. All reported cells will include at least a * valid set of technology-specific identification info and a power level measurement. * *<p> * This method is preferred over using {@link * methods may return true, indicating that the cell is being used or would be used for * signaling communication if necessary. * * <p>Beginning with {@link android.os.Build.VERSION_CODES#Q Android Q}, * if this API results in a change of the cached CellInfo, that change will be reported via * {@link android.telephony.PhoneStateListener#onCellInfoChanged onCellInfoChanged()}. * * <p>Apps targeting {@link android.os.Build.VERSION_CODES#Q Android Q} or higher will no * longer trigger a refresh of the cached CellInfo by invoking this API. Instead, those apps * will receive the latest cached results. Apps targeting * {@link android.os.Build.VERSION_CODES#Q Android Q} or higher that wish to request updated * CellInfo should call * {android.telephony.TelephonyManager#requestCellInfoUpdate requestCellInfoUpdate()} and * listen for responses via {@link android.telephony.PhoneStateListener#onCellInfoChanged * onCellInfoChanged()}. * * <p>This method returns valid data for devices with * {@link android.content.pm.PackageManager#FEATURE_TELEPHONY FEATURE_TELEPHONY}. In cases * where only partial information is available for a particular CellInfo entry, unavailable * fields will be reported as {@link android.telephony.CellInfo#UNAVAILABLE}. All reported * cells will include at least a valid set of technology-specific identification info and a * power level measurement. * * <p>This method is preferred over using {@link * android.telephony.TelephonyManager#getCellLocation getCellLocation()}. * However, for older devices, <code>getAllCellInfo()</code> may return * null. In these cases, you should call {@link * android.telephony.TelephonyManager#getCellLocation getCellLocation()} * instead. * * @return List of {@link android.telephony.CellInfo}; null if cell * information is unavailable. Loading @@ -4769,12 +4777,93 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return null; return telephony.getAllCellInfo(getOpPackageName()); return telephony.getAllCellInfo( getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { } return null; } /** Callback for providing asynchronous {@link CellInfo} on request */ public abstract static class CellInfoCallback { /** * Response to * {@link android.telephony.TelephonyManager#requestCellInfoUpdate requestCellInfoUpdate()}. * * <p>Invoked when there is a response to * {@link android.telephony.TelephonyManager#requestCellInfoUpdate requestCellInfoUpdate()} * to provide a list of {@link CellInfo}. If no {@link CellInfo} is available then an empty * list will be provided. If an error occurs, null will be provided. * * @param cellInfo a list of {@link CellInfo}, an empty list, or null. * * {@see android.telephony.TelephonyManager#getAllCellInfo getAllCellInfo()} */ public abstract void onCellInfo(List<CellInfo> cellInfo); }; /** * Requests all available cell information from the current subscription for observed * camped/registered, serving, and neighboring cells. * * <p>Any available results from this request will be provided by calls to * {@link android.telephony.PhoneStateListener#onCellInfoChanged onCellInfoChanged()} * for each active subscription. * * @param executor the executor on which callback will be invoked. * @param callback a callback to receive CellInfo. */ @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION) public void requestCellInfoUpdate( @NonNull Executor executor, @NonNull CellInfoCallback callback) { try { ITelephony telephony = getITelephony(); if (telephony == null) return; telephony.requestCellInfoUpdate( getSubId(), new ICellInfoCallback.Stub() { public void onCellInfo(List<CellInfo> cellInfo) { Binder.withCleanCallingIdentity(() -> executor.execute(() -> callback.onCellInfo(cellInfo))); } }, getOpPackageName()); } catch (RemoteException ex) { } } /** * Requests all available cell information from the current subscription for observed * camped/registered, serving, and neighboring cells. * * <p>Any available results from this request will be provided by calls to * {@link android.telephony.PhoneStateListener#onCellInfoChanged onCellInfoChanged()} * for each active subscription. * * @param workSource the requestor to whom the power consumption for this should be attributed. * @param executor the executor on which callback will be invoked. * @param callback a callback to receive CellInfo. * @hide */ @SystemApi @RequiresPermission(allOf = {android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.MODIFY_PHONE_STATE}) public void requestCellInfoUpdate(@NonNull WorkSource workSource, @NonNull @CallbackExecutor Executor executor, @NonNull CellInfoCallback callback) { try { ITelephony telephony = getITelephony(); if (telephony == null) return; telephony.requestCellInfoUpdateWithWorkSource( getSubId(), new ICellInfoCallback.Stub() { public void onCellInfo(List<CellInfo> cellInfo) { Binder.withCleanCallingIdentity(() -> executor.execute(() -> callback.onCellInfo(cellInfo))); } }, getOpPackageName(), workSource); } catch (RemoteException ex) { } } /** Loading Loading
Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -512,6 +512,7 @@ java_defaults { "telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl", "telephony/java/android/telephony/mbms/vendor/IMbmsStreamingService.aidl", "telephony/java/android/telephony/mbms/vendor/IMbmsGroupCallService.aidl", "telephony/java/android/telephony/ICellInfoCallback.aidl", "telephony/java/android/telephony/INetworkService.aidl", "telephony/java/android/telephony/INetworkServiceCallback.aidl", "telephony/java/com/android/ims/internal/IImsCallSession.aidl", Loading
api/current.txt +6 −0 Original line number Diff line number Diff line Loading @@ -42978,6 +42978,7 @@ package android.telephony { method public boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle); method public boolean isWorldPhone(); method public void listen(android.telephony.PhoneStateListener, int); method public void requestCellInfoUpdate(java.util.concurrent.Executor, android.telephony.TelephonyManager.CellInfoCallback); method public android.telephony.NetworkScan requestNetworkScan(android.telephony.NetworkScanRequest, java.util.concurrent.Executor, android.telephony.TelephonyScanManager.NetworkScanCallback); method public void sendDialerSpecialCode(java.lang.String); method public java.lang.String sendEnvelopeWithStatus(java.lang.String); Loading Loading @@ -43078,6 +43079,11 @@ package android.telephony { field public static final java.lang.String VVM_TYPE_OMTP = "vvm_type_omtp"; } public static abstract class TelephonyManager.CellInfoCallback { ctor public TelephonyManager.CellInfoCallback(); method public abstract void onCellInfo(java.util.List<android.telephony.CellInfo>); } public static abstract class TelephonyManager.UssdResponseCallback { ctor public TelephonyManager.UssdResponseCallback(); method public void onReceiveUssdResponse(android.telephony.TelephonyManager, java.lang.String, java.lang.CharSequence);
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5329,6 +5329,7 @@ package android.telephony { method public deprecated boolean isVisualVoicemailEnabled(android.telecom.PhoneAccountHandle); method public boolean needsOtaServiceProvisioning(); method public boolean rebootRadio(); method public void requestCellInfoUpdate(android.os.WorkSource, java.util.concurrent.Executor, android.telephony.TelephonyManager.CellInfoCallback); method public boolean resetRadioConfig(); method public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>); method public void setCarrierDataEnabled(boolean); Loading
telephony/java/android/telephony/ICellInfoCallback.aidl 0 → 100644 +30 −0 Original line number Diff line number Diff line /* * Copyright 2018 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 android.telephony; import android.telephony.CellInfo; import java.util.List; /** * Callback to provide asynchronous CellInfo. * @hide */ oneway interface ICellInfoCallback { void onCellInfo(in List<CellInfo> state); }
telephony/java/android/telephony/TelephonyManager.java +117 −28 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.content.Context.TELECOM_SERVICE; import static com.android.internal.util.Preconditions.checkNotNull; import android.Manifest; import android.annotation.CallbackExecutor; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; Loading @@ -43,6 +44,7 @@ import android.net.NetworkStats; import android.net.Uri; import android.os.AsyncTask; import android.os.BatteryStats; import android.os.Binder; import android.os.Build; import android.os.Bundle; import android.os.Handler; Loading @@ -52,6 +54,7 @@ import android.os.RemoteException; import android.os.ResultReceiver; import android.os.ServiceManager; import android.os.SystemProperties; import android.os.WorkSource; import android.provider.Settings.SettingNotFoundException; import android.service.carrier.CarrierIdentifier; import android.telecom.PhoneAccount; Loading Loading @@ -4728,37 +4731,42 @@ public class TelephonyManager { } /** * Returns all observed cell information from all radios on the * device including the primary and neighboring cells. Calling this method does * not trigger a call to {@link android.telephony.PhoneStateListener#onCellInfoChanged * onCellInfoChanged()}, or change the rate at which * {@link android.telephony.PhoneStateListener#onCellInfoChanged * onCellInfoChanged()} is called. * Requests all available cell information from all radios on the device including the * camped/registered, serving, and neighboring cells. * *<p> * The list can include one or more {@link android.telephony.CellInfoGsm CellInfoGsm}, * <p>The response can include one or more {@link android.telephony.CellInfoGsm CellInfoGsm}, * {@link android.telephony.CellInfoCdma CellInfoCdma}, * {@link android.telephony.CellInfoTdscdma CellInfoTdscdma}, * {@link android.telephony.CellInfoLte CellInfoLte}, and * {@link android.telephony.CellInfoWcdma CellInfoWcdma} objects, in any combination. * On devices with multiple radios it is typical to see instances of * one or more of any these in the list. In addition, zero, one, or more * of the returned objects may be considered registered; that is, their * It is typical to see instances of one or more of any these in the list. In addition, zero * or more of the returned objects may be considered registered; that is, their * {@link android.telephony.CellInfo#isRegistered CellInfo.isRegistered()} * methods may return true. * * <p>This method returns valid data for registered cells on devices with * {@link android.content.pm.PackageManager#FEATURE_TELEPHONY}. In cases where only * partial information is available for a particular CellInfo entry, unavailable fields * will be reported as Integer.MAX_VALUE. All reported cells will include at least a * valid set of technology-specific identification info and a power level measurement. * *<p> * This method is preferred over using {@link * methods may return true, indicating that the cell is being used or would be used for * signaling communication if necessary. * * <p>Beginning with {@link android.os.Build.VERSION_CODES#Q Android Q}, * if this API results in a change of the cached CellInfo, that change will be reported via * {@link android.telephony.PhoneStateListener#onCellInfoChanged onCellInfoChanged()}. * * <p>Apps targeting {@link android.os.Build.VERSION_CODES#Q Android Q} or higher will no * longer trigger a refresh of the cached CellInfo by invoking this API. Instead, those apps * will receive the latest cached results. Apps targeting * {@link android.os.Build.VERSION_CODES#Q Android Q} or higher that wish to request updated * CellInfo should call * {android.telephony.TelephonyManager#requestCellInfoUpdate requestCellInfoUpdate()} and * listen for responses via {@link android.telephony.PhoneStateListener#onCellInfoChanged * onCellInfoChanged()}. * * <p>This method returns valid data for devices with * {@link android.content.pm.PackageManager#FEATURE_TELEPHONY FEATURE_TELEPHONY}. In cases * where only partial information is available for a particular CellInfo entry, unavailable * fields will be reported as {@link android.telephony.CellInfo#UNAVAILABLE}. All reported * cells will include at least a valid set of technology-specific identification info and a * power level measurement. * * <p>This method is preferred over using {@link * android.telephony.TelephonyManager#getCellLocation getCellLocation()}. * However, for older devices, <code>getAllCellInfo()</code> may return * null. In these cases, you should call {@link * android.telephony.TelephonyManager#getCellLocation getCellLocation()} * instead. * * @return List of {@link android.telephony.CellInfo}; null if cell * information is unavailable. Loading @@ -4769,12 +4777,93 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return null; return telephony.getAllCellInfo(getOpPackageName()); return telephony.getAllCellInfo( getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { } return null; } /** Callback for providing asynchronous {@link CellInfo} on request */ public abstract static class CellInfoCallback { /** * Response to * {@link android.telephony.TelephonyManager#requestCellInfoUpdate requestCellInfoUpdate()}. * * <p>Invoked when there is a response to * {@link android.telephony.TelephonyManager#requestCellInfoUpdate requestCellInfoUpdate()} * to provide a list of {@link CellInfo}. If no {@link CellInfo} is available then an empty * list will be provided. If an error occurs, null will be provided. * * @param cellInfo a list of {@link CellInfo}, an empty list, or null. * * {@see android.telephony.TelephonyManager#getAllCellInfo getAllCellInfo()} */ public abstract void onCellInfo(List<CellInfo> cellInfo); }; /** * Requests all available cell information from the current subscription for observed * camped/registered, serving, and neighboring cells. * * <p>Any available results from this request will be provided by calls to * {@link android.telephony.PhoneStateListener#onCellInfoChanged onCellInfoChanged()} * for each active subscription. * * @param executor the executor on which callback will be invoked. * @param callback a callback to receive CellInfo. */ @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION) public void requestCellInfoUpdate( @NonNull Executor executor, @NonNull CellInfoCallback callback) { try { ITelephony telephony = getITelephony(); if (telephony == null) return; telephony.requestCellInfoUpdate( getSubId(), new ICellInfoCallback.Stub() { public void onCellInfo(List<CellInfo> cellInfo) { Binder.withCleanCallingIdentity(() -> executor.execute(() -> callback.onCellInfo(cellInfo))); } }, getOpPackageName()); } catch (RemoteException ex) { } } /** * Requests all available cell information from the current subscription for observed * camped/registered, serving, and neighboring cells. * * <p>Any available results from this request will be provided by calls to * {@link android.telephony.PhoneStateListener#onCellInfoChanged onCellInfoChanged()} * for each active subscription. * * @param workSource the requestor to whom the power consumption for this should be attributed. * @param executor the executor on which callback will be invoked. * @param callback a callback to receive CellInfo. * @hide */ @SystemApi @RequiresPermission(allOf = {android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.MODIFY_PHONE_STATE}) public void requestCellInfoUpdate(@NonNull WorkSource workSource, @NonNull @CallbackExecutor Executor executor, @NonNull CellInfoCallback callback) { try { ITelephony telephony = getITelephony(); if (telephony == null) return; telephony.requestCellInfoUpdateWithWorkSource( getSubId(), new ICellInfoCallback.Stub() { public void onCellInfo(List<CellInfo> cellInfo) { Binder.withCleanCallingIdentity(() -> executor.execute(() -> callback.onCellInfo(cellInfo))); } }, getOpPackageName(), workSource); } catch (RemoteException ex) { } } /** Loading