Bug 700931 - Avoid using the HARDWARE field on Android SDK versions <8. r=dougt

This commit is contained in:
Josh Matthews 2011-11-24 17:46:29 -05:00
parent 88cee3b620
commit 6ea3a93652

View File

@ -109,6 +109,10 @@ GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription)
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MANUFACTURER", str))
aAdapterDescription.Append(str);
aAdapterDescription.Append(NS_LITERAL_STRING("', Hardware: '"));
PRInt32 version; // the HARDWARE field isn't available on Android SDK < 8
if (!mozilla::AndroidBridge::Bridge()->GetStaticIntField("android/os/Build$VERSION", "SDK_INT", &version))
version = 0;
if (version >= 8 && mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str))
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str))
aAdapterDescription.Append(str);
aAdapterDescription.Append(NS_LITERAL_STRING("'"));
@ -189,7 +193,10 @@ NS_IMETHODIMP
GfxInfo::GetAdapterVendorID(PRUint32 *aAdapterVendorID)
{
nsAutoString str;
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str)) {
PRInt32 version; // the HARDWARE field isn't available on Android SDK < 8
if (!mozilla::AndroidBridge::Bridge()->GetStaticIntField("android/os/Build$VERSION", "SDK_INT", &version))
version = 0;
if (version >= 8 && mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str)) {
*aAdapterVendorID = HashString(str);
return NS_OK;
}