Merge "Use sysprop library for telephony props" am: afb16fa9d4 am: dc4de88fec

Change-Id: Iae5ca6c30dd3a72d5da921cf45d9c282bcff2703
This commit is contained in:
Automerger Merge Worker
2019-12-20 02:22:19 +00:00
7 changed files with 144 additions and 110 deletions

View File

@@ -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");
@@ -1089,7 +1090,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.system.build.fingerprint is empty!");
@@ -1263,8 +1265,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
@@ -1289,4 +1290,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;
}
}