Gracefully handle long fingerprints.
Otherwise derived fingerprints longer than the maximum system property
size put the device into a crash loop.
Bug: 13983493
Change-Id: I8a88e71b1fd396f1cd63b414e3a62bb25010430c
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 5846bb5..0336dd6 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -17,6 +17,7 @@
package android.os;
import android.text.TextUtils;
+import android.util.Slog;
import com.android.internal.telephony.TelephonyProperties;
@@ -24,6 +25,8 @@
* Information about the current build, extracted from system properties.
*/
public class Build {
+ private static final String TAG = "Build";
+
/** Value used for when a build property is unknown. */
public static final String UNKNOWN = "unknown";
@@ -541,7 +544,11 @@
*/
public static void ensureFingerprintProperty() {
if (TextUtils.isEmpty(SystemProperties.get("ro.build.fingerprint"))) {
- SystemProperties.set("ro.build.fingerprint", FINGERPRINT);
+ try {
+ SystemProperties.set("ro.build.fingerprint", FINGERPRINT);
+ } catch (IllegalArgumentException e) {
+ Slog.e(TAG, "Failed to set fingerprint property", e);
+ }
}
}