am 6dc003a7: Merge "Reduce footprint of Signature from ~7000 to ~1448" into gingerbread

Merge commit '6dc003a73f7f01aa5dd5831e777e2aa44f65b032' into gingerbread-plus-aosp

* commit '6dc003a73f7f01aa5dd5831e777e2aa44f65b032':
  Reduce footprint of Signature from ~7000 to ~1448
This commit is contained in:
Kenny Root
2010-09-03 17:07:15 -07:00
committed by Android Git Automerger

View File

@@ -20,6 +20,7 @@ import android.content.ComponentName;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.ref.SoftReference;
import java.util.Arrays;
/**
@@ -30,7 +31,7 @@ public class Signature implements Parcelable {
private final byte[] mSignature;
private int mHashCode;
private boolean mHaveHashCode;
private String mString;
private SoftReference<String> mStringRef;
/**
* Create Signature from an existing raw byte array.
@@ -96,10 +97,13 @@ public class Signature implements Parcelable {
* cached so future calls will return the same String.
*/
public String toCharsString() {
if (mString != null) return mString;
String str = new String(toChars());
mString = str;
return mString;
String str = mStringRef == null ? null : mStringRef.get();
if (str != null) {
return str;
}
str = new String(toChars());
mStringRef = new SoftReference<String>(str);
return str;
}
/**