From 9ec1a993c68520bd964af9e9963794332b3e10a3 Mon Sep 17 00:00:00 2001 From: Nathan Harold Date: Wed, 8 Apr 2020 14:37:16 -0700 Subject: [PATCH] Add warning about TelephonyManager Reliability Add a warning that TelephonyManager methods may not behave in a consistent way on devices that do not implement FEATURE_TELEPHONY. Methods may succeed, may fail loudly, may silently fail, depending on underlying device support and manufacturer-specific decisions. When FEATURE_TELEPHONY is not declared, CTS does not enforce any particular behavior. Bug: 150006590 Test: compilation (docstring-only change) Change-Id: I80f5031a43ccc8e5af97d341cf00e48afb80f63a --- .../java/android/telephony/TelephonyManager.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index d6cdaa6d8bc0c..f623649fb25ed 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -147,6 +147,10 @@ import java.util.regex.Pattern; * information unless it has the appropriate permissions declared in * its manifest file. Where permissions apply, they are noted in the * the methods through which you access the protected information. + * + *

TelephonyManager is intended for use on devices that implement + * {@link android.content.pm.PackageManager#FEATURE_TELEPHONY FEATURE_TELEPHONY}. On devices + * that do not implement this feature, the behavior is not reliable. */ @SystemService(Context.TELEPHONY_SERVICE) public class TelephonyManager { @@ -5842,6 +5846,10 @@ public class TelephonyManager { * {@link android.telephony.PhoneStateListener#onCellInfoChanged onCellInfoChanged()} * for each active subscription. * + *

This method returns valid data for devices with + * {@link android.content.pm.PackageManager#FEATURE_TELEPHONY FEATURE_TELEPHONY}. On devices + * that do not implement this feature, the behavior is not reliable. + * * @param executor the executor on which callback will be invoked. * @param callback a callback to receive CellInfo. */ @@ -5888,6 +5896,10 @@ public class TelephonyManager { * {@link android.telephony.PhoneStateListener#onCellInfoChanged onCellInfoChanged()} * for each active subscription. * + *

This method returns valid data for devices with + * {@link android.content.pm.PackageManager#FEATURE_TELEPHONY FEATURE_TELEPHONY}. On devices + * that do not implement this feature, the behavior is not reliable. + * * @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.