From bdd4491b322bebd96b99da508ec7b0b7d59d97ae Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Fri, 11 Apr 2014 16:30:14 -0700 Subject: [PATCH] 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 --- core/java/android/os/Build.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 5846bb5d38ee7..0336dd659ce1a 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 @@ import com.android.internal.telephony.TelephonyProperties; * 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 class Build { */ 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); + } } }