2011-01-06 07:54:31 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-01-06 07:54:31 +03:00
|
|
|
|
|
|
|
#include "GfxInfo.h"
|
|
|
|
#include "nsUnicharUtils.h"
|
|
|
|
#include "prenv.h"
|
|
|
|
#include "prprf.h"
|
2011-11-03 18:50:40 +04:00
|
|
|
#include "nsHashKeys.h"
|
2012-12-22 02:32:14 +04:00
|
|
|
#include "nsVersionComparator.h"
|
2011-01-06 07:54:31 +03:00
|
|
|
|
2011-01-06 07:54:32 +03:00
|
|
|
#include "AndroidBridge.h"
|
|
|
|
|
2011-05-23 20:54:47 +04:00
|
|
|
#if defined(MOZ_CRASHREPORTER)
|
2011-01-06 07:54:31 +03:00
|
|
|
#include "nsExceptionHandler.h"
|
|
|
|
#include "nsICrashReporter.h"
|
|
|
|
#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
using namespace mozilla::widget;
|
|
|
|
|
2011-12-15 09:04:35 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMPL_ISUPPORTS_INHERITED1(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
|
|
|
|
#endif
|
|
|
|
|
2012-07-05 18:12:33 +04:00
|
|
|
GfxInfo::GfxInfo()
|
|
|
|
: mInitializedFromJavaData(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-06 07:54:31 +03:00
|
|
|
/* GetD2DEnabled and GetDwriteEnabled shouldn't be called until after gfxPlatform initialization
|
|
|
|
* has occurred because they depend on it for information. (See bug 591561) */
|
|
|
|
nsresult
|
2011-09-29 10:19:26 +04:00
|
|
|
GfxInfo::GetD2DEnabled(bool *aEnabled)
|
2011-01-06 07:54:31 +03:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2011-09-29 10:19:26 +04:00
|
|
|
GfxInfo::GetDWriteEnabled(bool *aEnabled)
|
2011-01-06 07:54:31 +03:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
2011-06-24 21:41:18 +04:00
|
|
|
|
2011-01-14 15:57:17 +03:00
|
|
|
/* readonly attribute DOMString DWriteVersion; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
2011-05-11 04:30:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute DOMString cleartypeParameters; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetCleartypeParameters(nsAString & aCleartypeParams)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
2011-01-14 15:57:17 +03:00
|
|
|
}
|
|
|
|
|
2012-07-05 18:12:33 +04:00
|
|
|
void
|
|
|
|
GfxInfo::EnsureInitializedFromGfxInfoData()
|
2011-01-06 07:54:31 +03:00
|
|
|
{
|
2012-07-05 18:12:33 +04:00
|
|
|
if (mInitializedFromJavaData)
|
|
|
|
return;
|
|
|
|
mInitializedFromJavaData = true;
|
|
|
|
|
|
|
|
{
|
|
|
|
nsCString gfxInfoData;
|
|
|
|
mozilla::AndroidBridge::Bridge()->GetGfxInfoData(gfxInfoData);
|
|
|
|
|
|
|
|
// the code here is a mini-parser for the text that GfxInfoThread.java produces.
|
|
|
|
// Here, |stringToFill| is the parser state. If it's null, we are expecting
|
|
|
|
// the next line to tell us what is the next string we'll read, e.g. "VENDOR"
|
|
|
|
// means that the next string we'll read is |mVendor|. We record that knowledge
|
|
|
|
// in the |stringToFill| pointer. So when it's not null, we just copy the next
|
|
|
|
// input line into the string pointed to by |stringToFill|.
|
2012-07-30 18:20:58 +04:00
|
|
|
nsCString *stringToFill = nullptr;
|
2012-07-05 18:12:33 +04:00
|
|
|
char *bufptr = gfxInfoData.BeginWriting();
|
|
|
|
|
|
|
|
while(true) {
|
|
|
|
char *line = NS_strtok("\n", &bufptr);
|
|
|
|
if (!line)
|
|
|
|
break;
|
|
|
|
if (stringToFill) {
|
|
|
|
stringToFill->Assign(line);
|
2012-07-30 18:20:58 +04:00
|
|
|
stringToFill = nullptr;
|
2012-07-05 18:12:33 +04:00
|
|
|
} else if(!strcmp(line, "VENDOR")) {
|
|
|
|
stringToFill = &mVendor;
|
|
|
|
} else if(!strcmp(line, "RENDERER")) {
|
|
|
|
stringToFill = &mRenderer;
|
|
|
|
} else if(!strcmp(line, "VERSION")) {
|
|
|
|
stringToFill = &mVersion;
|
|
|
|
} else if(!strcmp(line, "ERROR")) {
|
|
|
|
stringToFill = &mError;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!mError.IsEmpty()) {
|
|
|
|
mAdapterDescription.AppendPrintf("An error occurred earlier while querying gfx info: %s. ",
|
|
|
|
mError.get());
|
|
|
|
printf_stderr("%s\n", mAdapterDescription.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *spoofedVendor = PR_GetEnv("MOZ_GFX_SPOOF_GL_VENDOR");
|
|
|
|
if (spoofedVendor)
|
|
|
|
mVendor.Assign(spoofedVendor);
|
|
|
|
const char *spoofedRenderer = PR_GetEnv("MOZ_GFX_SPOOF_GL_RENDERER");
|
|
|
|
if (spoofedRenderer)
|
|
|
|
mRenderer.Assign(spoofedRenderer);
|
|
|
|
const char *spoofedVersion = PR_GetEnv("MOZ_GFX_SPOOF_GL_VERSION");
|
|
|
|
if (spoofedVersion)
|
|
|
|
mVersion.Assign(spoofedVersion);
|
|
|
|
|
|
|
|
mAdapterDescription.AppendPrintf("%s -- %s -- %s",
|
|
|
|
mVendor.get(),
|
|
|
|
mRenderer.get(),
|
|
|
|
mVersion.get());
|
|
|
|
|
|
|
|
// Now we append general (non-gfx) device information. The only reason why this code is still here
|
|
|
|
// is that this used to be all we had in GfxInfo on Android, and we can't trivially remove it
|
|
|
|
// as it's useful information that isn't given anywhere else in about:support of in crash reports.
|
|
|
|
// But we should really move this out of GfxInfo.
|
2011-12-15 09:03:03 +04:00
|
|
|
if (mozilla::AndroidBridge::Bridge()) {
|
2012-11-02 01:13:10 +04:00
|
|
|
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MODEL", mModel)) {
|
|
|
|
mAdapterDescription.AppendPrintf(" -- Model: %s", NS_LossyConvertUTF16toASCII(mModel).get());
|
2011-12-15 09:03:03 +04:00
|
|
|
}
|
|
|
|
|
2012-11-02 01:13:10 +04:00
|
|
|
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "PRODUCT", mProduct)) {
|
|
|
|
mAdapterDescription.AppendPrintf(", Product: %s", NS_LossyConvertUTF16toASCII(mProduct).get());
|
2012-07-05 18:12:33 +04:00
|
|
|
}
|
2011-12-15 09:03:03 +04:00
|
|
|
|
2012-11-02 01:13:10 +04:00
|
|
|
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MANUFACTURER", mManufacturer)) {
|
|
|
|
mAdapterDescription.AppendPrintf(", Manufacturer: %s", NS_LossyConvertUTF16toASCII(mManufacturer).get());
|
2012-07-05 18:12:33 +04:00
|
|
|
}
|
2011-12-15 09:03:03 +04:00
|
|
|
|
2012-12-22 02:32:14 +04:00
|
|
|
int32_t sdkVersion;
|
|
|
|
if (!mozilla::AndroidBridge::Bridge()->GetStaticIntField("android/os/Build$VERSION", "SDK_INT", &sdkVersion))
|
|
|
|
sdkVersion = 0;
|
2011-12-15 09:03:03 +04:00
|
|
|
|
2012-11-02 01:13:10 +04:00
|
|
|
// the HARDWARE field isn't available on Android SDK < 8
|
2012-12-22 02:32:14 +04:00
|
|
|
if (sdkVersion >= 8 && mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", mHardware)) {
|
2012-11-02 01:13:10 +04:00
|
|
|
mAdapterDescription.AppendPrintf(", Hardware: %s", NS_LossyConvertUTF16toASCII(mHardware).get());
|
2011-12-15 09:03:03 +04:00
|
|
|
}
|
2012-12-22 02:32:14 +04:00
|
|
|
|
|
|
|
nsString release;
|
|
|
|
mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION", "RELEASE", release);
|
|
|
|
mOSVersion = NS_LossyConvertUTF16toASCII(release);
|
|
|
|
|
|
|
|
mOSVersionInteger = 0;
|
|
|
|
char a[5], b[5], c[5], d[5];
|
|
|
|
SplitDriverVersion(mOSVersion.get(), a, b, c, d);
|
|
|
|
uint8_t na = atoi(a);
|
|
|
|
uint8_t nb = atoi(b);
|
|
|
|
uint8_t nc = atoi(c);
|
|
|
|
uint8_t nd = atoi(d);
|
|
|
|
|
|
|
|
mOSVersionInteger = (uint32_t(na) << 24) |
|
|
|
|
(uint32_t(nb) << 16) |
|
|
|
|
(uint32_t(nc) << 8) |
|
|
|
|
uint32_t(nd);
|
2011-12-15 09:03:03 +04:00
|
|
|
}
|
|
|
|
|
2012-07-05 18:12:33 +04:00
|
|
|
AddCrashReportAnnotations();
|
2011-01-06 07:54:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute DOMString adapterDescription; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDescription(nsAString & aAdapterDescription)
|
|
|
|
{
|
2012-07-05 18:12:33 +04:00
|
|
|
aAdapterDescription = NS_ConvertASCIItoUTF16(mAdapterDescription);
|
2011-01-06 07:54:31 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
/* readonly attribute DOMString adapterDescription2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDescription2(nsAString & aAdapterDescription)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-06 07:54:31 +03:00
|
|
|
/* readonly attribute DOMString adapterRAM; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterRAM(nsAString & aAdapterRAM)
|
|
|
|
{
|
|
|
|
aAdapterRAM.AssignLiteral("");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
/* readonly attribute DOMString adapterRAM2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterRAM2(nsAString & aAdapterRAM)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-06 07:54:31 +03:00
|
|
|
/* readonly attribute DOMString adapterDriver; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriver(nsAString & aAdapterDriver)
|
|
|
|
{
|
|
|
|
aAdapterDriver.AssignLiteral("");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
/* readonly attribute DOMString adapterDriver2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriver2(nsAString & aAdapterDriver)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-06 07:54:31 +03:00
|
|
|
/* readonly attribute DOMString adapterDriverVersion; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverVersion(nsAString & aAdapterDriverVersion)
|
|
|
|
{
|
2012-07-05 18:12:33 +04:00
|
|
|
aAdapterDriverVersion = NS_ConvertASCIItoUTF16(mVersion);
|
2011-01-06 07:54:31 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
/* readonly attribute DOMString adapterDriverVersion2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-06 07:54:31 +03:00
|
|
|
/* readonly attribute DOMString adapterDriverDate; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate)
|
|
|
|
{
|
|
|
|
aAdapterDriverDate.AssignLiteral("");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-12 17:46:41 +04:00
|
|
|
/* readonly attribute DOMString adapterDriverDate2; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-12-15 09:03:01 +04:00
|
|
|
/* readonly attribute DOMString adapterVendorID; */
|
2011-01-06 07:54:31 +03:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 09:03:01 +04:00
|
|
|
GfxInfo::GetAdapterVendorID(nsAString & aAdapterVendorID)
|
2011-01-06 07:54:31 +03:00
|
|
|
{
|
2012-07-05 18:12:33 +04:00
|
|
|
aAdapterVendorID = NS_ConvertASCIItoUTF16(mVendor);
|
2011-01-06 07:54:31 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-12-15 09:03:01 +04:00
|
|
|
/* readonly attribute DOMString adapterVendorID2; */
|
2011-08-12 17:46:41 +04:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 09:03:01 +04:00
|
|
|
GfxInfo::GetAdapterVendorID2(nsAString & aAdapterVendorID)
|
2011-08-12 17:46:41 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-12-15 09:03:01 +04:00
|
|
|
/* readonly attribute DOMString adapterDeviceID; */
|
2011-01-06 07:54:31 +03:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 09:03:01 +04:00
|
|
|
GfxInfo::GetAdapterDeviceID(nsAString & aAdapterDeviceID)
|
2011-01-06 07:54:31 +03:00
|
|
|
{
|
2012-07-05 18:12:33 +04:00
|
|
|
aAdapterDeviceID = NS_ConvertASCIItoUTF16(mRenderer);
|
2011-01-06 07:54:31 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-12-15 09:03:01 +04:00
|
|
|
/* readonly attribute DOMString adapterDeviceID2; */
|
2011-08-12 17:46:41 +04:00
|
|
|
NS_IMETHODIMP
|
2011-12-15 09:03:01 +04:00
|
|
|
GfxInfo::GetAdapterDeviceID2(nsAString & aAdapterDeviceID)
|
2011-08-12 17:46:41 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute boolean isGPU2Active; */
|
|
|
|
NS_IMETHODIMP
|
2011-09-29 10:19:26 +04:00
|
|
|
GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active)
|
2011-08-12 17:46:41 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-01-06 07:54:31 +03:00
|
|
|
void
|
2012-07-05 18:12:33 +04:00
|
|
|
GfxInfo::AddCrashReportAnnotations()
|
2011-01-06 07:54:31 +03:00
|
|
|
{
|
2011-05-23 20:54:47 +04:00
|
|
|
#if defined(MOZ_CRASHREPORTER)
|
2011-01-06 07:54:31 +03:00
|
|
|
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"),
|
2012-07-05 18:12:33 +04:00
|
|
|
mVendor);
|
2011-01-06 07:54:31 +03:00
|
|
|
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"),
|
2012-07-05 18:12:33 +04:00
|
|
|
mRenderer);
|
2011-01-06 07:54:31 +03:00
|
|
|
|
|
|
|
/* Add an App Note for now so that we get the data immediately. These
|
|
|
|
* can go away after we store the above in the socorro db */
|
2012-09-02 06:35:17 +04:00
|
|
|
nsAutoCString note;
|
2012-07-05 18:12:33 +04:00
|
|
|
note.AppendPrintf("AdapterDescription: '%s'\n", mAdapterDescription.get());
|
2011-01-06 07:54:31 +03:00
|
|
|
|
|
|
|
CrashReporter::AppendAppNotesToCrashReport(note);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2011-12-15 09:02:59 +04:00
|
|
|
const nsTArray<GfxDriverInfo>&
|
2011-11-03 18:50:40 +04:00
|
|
|
GfxInfo::GetGfxDriverInfo()
|
|
|
|
{
|
2012-07-05 18:12:54 +04:00
|
|
|
if (mDriverInfo->IsEmpty()) {
|
2012-06-13 23:54:02 +04:00
|
|
|
APPEND_TO_DRIVER_BLOCKLIST2( DRIVER_OS_ALL,
|
|
|
|
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorAll), GfxDriverInfo::allDevices,
|
|
|
|
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_NO_INFO,
|
|
|
|
DRIVER_COMPARISON_IGNORED, GfxDriverInfo::allDriverVersions );
|
2011-12-15 09:03:06 +04:00
|
|
|
}
|
2012-07-05 18:12:54 +04:00
|
|
|
|
2011-12-15 09:02:59 +04:00
|
|
|
return *mDriverInfo;
|
2011-11-03 18:50:40 +04:00
|
|
|
}
|
|
|
|
|
2011-01-20 04:30:12 +03:00
|
|
|
nsresult
|
2012-08-22 19:56:38 +04:00
|
|
|
GfxInfo::GetFeatureStatusImpl(int32_t aFeature,
|
|
|
|
int32_t *aStatus,
|
2011-11-03 18:50:40 +04:00
|
|
|
nsAString & aSuggestedDriverVersion,
|
2011-12-15 09:02:59 +04:00
|
|
|
const nsTArray<GfxDriverInfo>& aDriverInfo,
|
2012-07-30 18:20:58 +04:00
|
|
|
OperatingSystem* aOS /* = nullptr */)
|
2011-01-06 07:54:31 +03:00
|
|
|
{
|
2011-12-15 09:03:08 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aStatus);
|
2011-10-17 18:59:28 +04:00
|
|
|
aSuggestedDriverVersion.SetIsVoid(true);
|
2011-12-15 09:03:08 +04:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
|
2012-11-02 01:13:10 +04:00
|
|
|
OperatingSystem os = mOS;
|
2011-12-15 09:03:08 +04:00
|
|
|
if (aOS)
|
|
|
|
*aOS = os;
|
2011-11-03 18:50:40 +04:00
|
|
|
|
2012-07-05 18:12:33 +04:00
|
|
|
EnsureInitializedFromGfxInfoData();
|
|
|
|
|
|
|
|
if (!mError.IsEmpty()) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
2011-01-12 07:50:45 +03:00
|
|
|
}
|
|
|
|
|
2012-07-05 18:13:04 +04:00
|
|
|
// Don't evaluate special cases when evaluating the downloaded blocklist.
|
|
|
|
if (aDriverInfo.IsEmpty()) {
|
|
|
|
if (aFeature == FEATURE_WEBGL_OPENGL) {
|
|
|
|
if (mRenderer.Find("Adreno 200") != -1 ||
|
|
|
|
mRenderer.Find("Adreno 205") != -1)
|
|
|
|
{
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2013-01-25 22:40:38 +04:00
|
|
|
|
2013-01-25 23:48:26 +04:00
|
|
|
if (mHardware.Equals(NS_LITERAL_STRING("ville"))) {
|
2013-01-25 22:40:38 +04:00
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-07-05 18:13:04 +04:00
|
|
|
}
|
2012-11-02 01:13:10 +04:00
|
|
|
|
|
|
|
if (aFeature == FEATURE_STAGEFRIGHT) {
|
|
|
|
NS_LossyConvertUTF16toASCII cManufacturer(mManufacturer);
|
|
|
|
NS_LossyConvertUTF16toASCII cModel(mModel);
|
2013-04-18 00:56:05 +04:00
|
|
|
NS_LossyConvertUTF16toASCII cHardware(mHardware);
|
|
|
|
|
|
|
|
if (cHardware.Equals("antares") ||
|
|
|
|
cHardware.Equals("endeavoru") ||
|
|
|
|
cHardware.Equals("harmony") ||
|
|
|
|
cHardware.Equals("picasso") ||
|
|
|
|
cHardware.Equals("picasso_e") ||
|
2013-04-20 18:22:51 +04:00
|
|
|
cHardware.Equals("ventana") ||
|
|
|
|
cHardware.Equals("rk30board"))
|
2013-04-18 00:56:05 +04:00
|
|
|
{
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-02-18 04:36:05 +04:00
|
|
|
if (CompareVersions(mOSVersion.get(), "2.2.0") >= 0 &&
|
|
|
|
CompareVersions(mOSVersion.get(), "2.3.0") < 0)
|
|
|
|
{
|
|
|
|
// Froyo LG devices are whitelisted.
|
|
|
|
// All other Froyo
|
|
|
|
bool isWhitelisted =
|
|
|
|
cManufacturer.Equals("lge", nsCaseInsensitiveCStringComparator());
|
|
|
|
|
|
|
|
if (!isWhitelisted) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (CompareVersions(mOSVersion.get(), "2.3.0") >= 0 &&
|
2013-02-18 04:36:01 +04:00
|
|
|
CompareVersions(mOSVersion.get(), "2.4.0") < 0)
|
|
|
|
{
|
|
|
|
// Gingerbread HTC devices are whitelisted.
|
2013-04-12 03:55:36 +04:00
|
|
|
// Gingerbread Samsung devices are whitelisted except for:
|
|
|
|
// Samsung devices identified in Bug 847837
|
2013-04-23 00:11:07 +04:00
|
|
|
// Samsung SGH-T989 (Bug 818363)
|
2013-02-18 04:36:09 +04:00
|
|
|
// All other Gingerbread devices are blacklisted.
|
2013-04-12 03:55:36 +04:00
|
|
|
bool isWhitelisted =
|
2013-02-18 04:36:09 +04:00
|
|
|
cManufacturer.Equals("htc", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cManufacturer.Equals("samsung", nsCaseInsensitiveCStringComparator());
|
2013-02-18 04:36:01 +04:00
|
|
|
|
2013-04-12 03:55:36 +04:00
|
|
|
if (cModel.Equals("GT-I8160", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("GT-I8160L", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("GT-I8530", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("GT-I9070", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("GT-I9070P", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("GT-I8160P", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("GT-S7500", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("GT-S7500T", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("GT-S7500L", nsCaseInsensitiveCStringComparator()) ||
|
2013-04-23 00:11:07 +04:00
|
|
|
cModel.Equals("GT-S6500T", nsCaseInsensitiveCStringComparator()) ||
|
2013-04-30 06:45:49 +04:00
|
|
|
cModel.Equals("SGH-T989", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("smdkc110", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("smdkc210", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("herring", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("shw-m110s", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("shw-m180s", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("n1", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("latona", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("aalto", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("atlas", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cHardware.Equals("qcom", nsCaseInsensitiveCStringComparator()))
|
2013-04-12 03:55:36 +04:00
|
|
|
{
|
|
|
|
isWhitelisted = false;
|
|
|
|
}
|
|
|
|
|
2013-02-18 04:36:01 +04:00
|
|
|
if (!isWhitelisted) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
2013-02-18 04:36:17 +04:00
|
|
|
else if (CompareVersions(mOSVersion.get(), "3.0.0") >= 0 &&
|
|
|
|
CompareVersions(mOSVersion.get(), "4.0.0") < 0)
|
|
|
|
{
|
|
|
|
// Honeycomb Samsung devices are whitelisted.
|
|
|
|
// All other Honeycomb devices are blacklisted.
|
|
|
|
bool isWhitelisted =
|
|
|
|
cManufacturer.Equals("samsung", nsCaseInsensitiveCStringComparator());
|
|
|
|
|
|
|
|
if (!isWhitelisted) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
2013-02-18 04:36:01 +04:00
|
|
|
else if (CompareVersions(mOSVersion.get(), "4.0.0") < 0)
|
2012-11-02 01:13:10 +04:00
|
|
|
{
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-12-22 02:32:14 +04:00
|
|
|
else if (CompareVersions(mOSVersion.get(), "4.1.0") < 0)
|
2012-11-02 01:13:10 +04:00
|
|
|
{
|
2013-03-05 05:42:22 +04:00
|
|
|
// Whitelist:
|
2013-04-23 00:10:31 +04:00
|
|
|
// All Samsung ICS devices, except for:
|
2013-05-03 03:00:23 +04:00
|
|
|
// Samsung SGH-I717 (Bug 845729)
|
|
|
|
// Samsung SGH-I727 (Bug 845729)
|
|
|
|
// Samsung SGH-I757 (Bug 845729)
|
|
|
|
// Samsung SGH-T989 (Bug 845729)
|
2013-03-05 05:42:22 +04:00
|
|
|
// All Galaxy nexus ICS devices
|
|
|
|
// Sony Xperia Ion (LT28) ICS devices
|
2012-11-02 01:13:10 +04:00
|
|
|
bool isWhitelisted =
|
2013-03-05 05:42:22 +04:00
|
|
|
cModel.Equals("LT28h", nsCaseInsensitiveCStringComparator()) ||
|
2012-11-02 01:13:10 +04:00
|
|
|
cManufacturer.Equals("samsung", nsCaseInsensitiveCStringComparator()) ||
|
|
|
|
cModel.Equals("galaxy nexus", nsCaseInsensitiveCStringComparator()); // some Galaxy Nexus have manufacturer=amazon
|
|
|
|
|
2013-05-03 03:00:23 +04:00
|
|
|
if (cModel.Find("SGH-I717", true) != -1 ||
|
|
|
|
cModel.Find("SGH-I727", true) != -1 ||
|
|
|
|
cModel.Find("SGH-I757", true) != -1 ||
|
|
|
|
cModel.Find("SGH-T989", true) != -1)
|
2013-04-23 00:10:31 +04:00
|
|
|
{
|
|
|
|
isWhitelisted = false;
|
|
|
|
}
|
|
|
|
|
2012-11-02 01:13:10 +04:00
|
|
|
if (!isWhitelisted) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
2013-03-25 02:58:07 +04:00
|
|
|
else if (CompareVersions(mOSVersion.get(), "4.2.0") < 0)
|
|
|
|
{
|
|
|
|
// Whitelist:
|
|
|
|
// All JB phones except for those in blocklist below
|
|
|
|
// Blocklist:
|
2013-05-03 23:08:24 +04:00
|
|
|
// Samsung devices from bug 812881 and 853522.
|
2013-04-23 00:11:48 +04:00
|
|
|
// All Sony devices (Bug 845734)
|
|
|
|
|
2013-03-25 02:58:07 +04:00
|
|
|
bool isBlocklisted =
|
2013-05-08 22:10:21 +04:00
|
|
|
cModel.Find("GT-P3100", true) != -1 ||
|
|
|
|
cModel.Find("GT-P3110", true) != -1 ||
|
|
|
|
cModel.Find("GT-P3113", true) != -1 ||
|
|
|
|
cModel.Find("GT-P5100", true) != -1 ||
|
|
|
|
cModel.Find("GT-P5110", true) != -1 ||
|
|
|
|
cModel.Find("GT-P5113", true) != -1 ||
|
2013-06-11 22:55:13 +04:00
|
|
|
cManufacturer.Find("Sony", true) != -1;
|
2013-03-25 02:58:07 +04:00
|
|
|
|
|
|
|
if (isBlocklisted) {
|
|
|
|
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
2012-11-02 01:13:10 +04:00
|
|
|
}
|
2012-07-05 18:13:04 +04:00
|
|
|
}
|
|
|
|
|
2011-12-15 09:02:59 +04:00
|
|
|
return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
|
2011-01-06 07:54:31 +03:00
|
|
|
}
|
2011-12-15 09:04:35 +04:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
// Implement nsIGfxInfoDebug
|
|
|
|
|
|
|
|
/* void spoofVendorID (in DOMString aVendorID); */
|
|
|
|
NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString & aVendorID)
|
|
|
|
{
|
2012-07-05 18:12:33 +04:00
|
|
|
EnsureInitializedFromGfxInfoData(); // initialization from GfxInfo data overwrites mVendor
|
|
|
|
mVendor = NS_LossyConvertUTF16toASCII(aVendorID);
|
2011-12-15 09:04:35 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* void spoofDeviceID (in unsigned long aDeviceID); */
|
|
|
|
NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString & aDeviceID)
|
|
|
|
{
|
2012-07-05 18:12:33 +04:00
|
|
|
EnsureInitializedFromGfxInfoData(); // initialization from GfxInfo data overwrites mRenderer
|
|
|
|
mRenderer = NS_LossyConvertUTF16toASCII(aDeviceID);
|
2011-12-15 09:04:35 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* void spoofDriverVersion (in DOMString aDriverVersion); */
|
|
|
|
NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString & aDriverVersion)
|
|
|
|
{
|
2012-07-05 18:12:33 +04:00
|
|
|
EnsureInitializedFromGfxInfoData(); // initialization from GfxInfo data overwrites mVersion
|
|
|
|
mVersion = NS_LossyConvertUTF16toASCII(aDriverVersion);
|
2011-12-15 09:04:35 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* void spoofOSVersion (in unsigned long aVersion); */
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP GfxInfo::SpoofOSVersion(uint32_t aVersion)
|
2011-12-15 09:04:35 +04:00
|
|
|
{
|
2012-11-02 01:13:10 +04:00
|
|
|
EnsureInitializedFromGfxInfoData(); // initialization from GfxInfo data overwrites mOSVersion
|
|
|
|
mOSVersion = aVersion;
|
2011-12-15 09:04:35 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2012-11-02 01:13:10 +04:00
|
|
|
|
2012-11-22 22:53:11 +04:00
|
|
|
nsString GfxInfo::Model() const
|
2012-11-02 01:13:10 +04:00
|
|
|
{
|
|
|
|
return mModel;
|
|
|
|
}
|
|
|
|
|
2012-11-22 22:53:11 +04:00
|
|
|
nsString GfxInfo::Hardware() const
|
2012-11-02 01:13:10 +04:00
|
|
|
{
|
|
|
|
return mHardware;
|
|
|
|
}
|
|
|
|
|
2012-11-22 22:53:11 +04:00
|
|
|
nsString GfxInfo::Product() const
|
2012-11-02 01:13:10 +04:00
|
|
|
{
|
|
|
|
return mProduct;
|
|
|
|
}
|
|
|
|
|
2012-11-22 22:53:11 +04:00
|
|
|
nsString GfxInfo::Manufacturer() const
|
2012-11-02 01:13:10 +04:00
|
|
|
{
|
|
|
|
return mManufacturer;
|
|
|
|
}
|
2012-12-22 02:32:14 +04:00
|
|
|
|
|
|
|
uint32_t GfxInfo::OperatingSystemVersion() const
|
|
|
|
{
|
|
|
|
return mOSVersionInteger;
|
|
|
|
}
|