summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHall Liu <hallliu@google.com>2020-10-13 19:19:12 -0700
committerHall Liu <hallliu@google.com>2020-10-22 17:01:04 -0700
commit644532e774f73d592ef68280ce6ca9b8112b5658 (patch)
tree826f8c3e0bd83f1fc109994f9f0d794e95d6858a
parent3a14c6bdcc973838660dd7eb89302e349b39daec (diff)
Expose methods to enumerate constants
Expose TelephonyManager#getAllNetworkTypes and CellSignalStrength#getNumSignalStrengthLevels as utility methods for other apps. Fixes: 170781542 Test: atest TelephonyManagerTest Change-Id: Ie516792a7522dd0df09d7b97f0b764d776559bf1 Merged-In: Ie516792a7522dd0df09d7b97f0b764d776559bf1
-rw-r--r--api/module-lib-current.txt12
-rw-r--r--non-updatable-api/module-lib-current.txt12
-rw-r--r--telephony/java/android/telephony/CellSignalStrength.java6
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java6
4 files changed, 32 insertions, 4 deletions
diff --git a/api/module-lib-current.txt b/api/module-lib-current.txt
index 2f0ae78f7e2d..3b32b535f0bc 100644
--- a/api/module-lib-current.txt
+++ b/api/module-lib-current.txt
@@ -71,6 +71,18 @@ package android.os {
}
+package android.telephony {
+
+ public abstract class CellSignalStrength {
+ method public static int getNumSignalStrengthLevels();
+ }
+
+ public class TelephonyManager {
+ method @NonNull public static int[] getAllNetworkTypes();
+ }
+
+}
+
package android.util {
public final class Log {
diff --git a/non-updatable-api/module-lib-current.txt b/non-updatable-api/module-lib-current.txt
index d4d9f62964c8..198134edbb5b 100644
--- a/non-updatable-api/module-lib-current.txt
+++ b/non-updatable-api/module-lib-current.txt
@@ -26,6 +26,18 @@ package android.os {
}
+package android.telephony {
+
+ public abstract class CellSignalStrength {
+ method public static int getNumSignalStrengthLevels();
+ }
+
+ public class TelephonyManager {
+ method @NonNull public static int[] getAllNetworkTypes();
+ }
+
+}
+
package android.util {
public final class Log {
diff --git a/telephony/java/android/telephony/CellSignalStrength.java b/telephony/java/android/telephony/CellSignalStrength.java
index 2e7bde3b3d89..e0896570d3ed 100644
--- a/telephony/java/android/telephony/CellSignalStrength.java
+++ b/telephony/java/android/telephony/CellSignalStrength.java
@@ -17,6 +17,7 @@
package android.telephony;
import android.annotation.IntRange;
+import android.annotation.SystemApi;
import android.os.PersistableBundle;
/**
@@ -155,11 +156,12 @@ public abstract class CellSignalStrength {
/**
* Returns the number of signal strength levels.
- * @return Number of signal strength levels, enforced to be 5
+ * @return Number of signal strength levels, currently defined in the HAL as 5.
*
* @hide
*/
- public static final int getNumSignalStrengthLevels() {
+ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
+ public static int getNumSignalStrengthLevels() {
return NUM_SIGNAL_STRENGTH_BINS;
}
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index ca47b83b20e7..fd6cf466354f 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -2827,11 +2827,13 @@ public class TelephonyManager {
};
/**
- * Return a collection of all network types
- * @return network types
+ * Returns an array of all valid network types.
+ *
+ * @return An integer array containing all valid network types in no particular order.
*
* @hide
*/
+ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
public static @NonNull @NetworkType int[] getAllNetworkTypes() {
return NETWORK_TYPES;
}