summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-11-11 02:11:48 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-11-11 02:11:48 +0000
commit5edd93298eb8aa296499e88034402ff7cfbaddf4 (patch)
tree558dcc69a4599f91347cf9d575ea8abf5573c0bc /core/java/android
parent6b99249727eba3a5ea891badcab486e456d4b369 (diff)
parent1b5e241b9217c4d8842925a29d1ca4228329538b (diff)
Merge "Use sysprop library for telephony props"
Diffstat (limited to 'core/java/android')
-rwxr-xr-xcore/java/android/os/Build.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 6a709b56f35a..123ed6f611f5 100755
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -26,17 +26,17 @@ import android.annotation.UnsupportedAppUsage;
import android.app.ActivityThread;
import android.app.Application;
import android.content.Context;
+import android.sysprop.TelephonyProperties;
import android.text.TextUtils;
import android.util.Slog;
import android.view.View;
-import com.android.internal.telephony.TelephonyProperties;
-
import dalvik.system.VMRuntime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
+import java.util.stream.Collectors;
/**
* Information about the current build, extracted from system properties.
@@ -99,7 +99,8 @@ public class Build {
* {@link #getRadioVersion} instead.
*/
@Deprecated
- public static final String RADIO = getString(TelephonyProperties.PROPERTY_BASEBAND_VERSION);
+ public static final String RADIO = joinListOrElse(
+ TelephonyProperties.baseband_version(), UNKNOWN);
/** The name of the hardware (from the kernel command line or /proc). */
public static final String HARDWARE = getString("ro.hardware");
@@ -1088,7 +1089,8 @@ public class Build {
final String requiredBootloader = SystemProperties.get("ro.build.expect.bootloader");
final String currentBootloader = SystemProperties.get("ro.bootloader");
final String requiredRadio = SystemProperties.get("ro.build.expect.baseband");
- final String currentRadio = SystemProperties.get("gsm.version.baseband");
+ final String currentRadio = joinListOrElse(
+ TelephonyProperties.baseband_version(), "");
if (TextUtils.isEmpty(system)) {
Slog.e(TAG, "Required ro.build.fingerprint is empty!");
@@ -1262,8 +1264,7 @@ public class Build {
* null (if, for instance, the radio is not currently on).
*/
public static String getRadioVersion() {
- String propVal = SystemProperties.get(TelephonyProperties.PROPERTY_BASEBAND_VERSION);
- return TextUtils.isEmpty(propVal) ? null : propVal;
+ return joinListOrElse(TelephonyProperties.baseband_version(), null);
}
@UnsupportedAppUsage
@@ -1288,4 +1289,10 @@ public class Build {
return -1;
}
}
+
+ private static <T> String joinListOrElse(List<T> list, String defaultValue) {
+ String ret = list.stream().map(elem -> elem == null ? "" : elem.toString())
+ .collect(Collectors.joining(","));
+ return ret.isEmpty() ? defaultValue : ret;
+ }
}