Bug 708772 - (2/3) Add tablet flag to jar manifest parser and nsSystemInfo [r=bsmedberg]

This commit is contained in:
Matt Brubeck 2011-12-14 13:53:38 -08:00
parent 1de8999cca
commit cf63d241d6
2 changed files with 22 additions and 3 deletions

View File

@ -197,11 +197,11 @@ nsSystemInfo::Init()
str.Append(NS_LITERAL_STRING(" ("));
str.AppendInt(version);
str.Append(NS_LITERAL_STRING(")"));
}
}
SetPropertyAsAString(NS_LITERAL_STRING("shellVersion"), str);
}
bool isTablet = mozilla::AndroidBridge::Bridge()->IsTablet();
SetPropertyAsBool(NS_LITERAL_STRING("isTablet"), isTablet);
}
#endif
return NS_OK;

View File

@ -434,6 +434,9 @@ ParseManifest(NSLocationType type, FileLocation &file, char* buf, bool aChromeOn
NS_NAMED_LITERAL_STRING(kOs, "os");
NS_NAMED_LITERAL_STRING(kOsVersion, "osversion");
NS_NAMED_LITERAL_STRING(kABI, "abi");
#if defined(MOZ_WIDGET_ANDROID)
NS_NAMED_LITERAL_STRING(kTablet, "tablet");
#endif
// Obsolete
NS_NAMED_LITERAL_STRING(kXPCNativeWrappers, "xpcnativewrappers");
@ -498,8 +501,10 @@ ParseManifest(NSLocationType type, FileLocation &file, char* buf, bool aChromeOn
gtk_major_version,
gtk_minor_version);
#elif defined(MOZ_WIDGET_ANDROID)
bool isTablet = false;
if (mozilla::AndroidBridge::Bridge()) {
mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION", "RELEASE", osVersion);
isTablet = mozilla::AndroidBridge::Bridge()->IsTablet();
}
#endif
@ -587,6 +592,9 @@ ParseManifest(NSLocationType type, FileLocation &file, char* buf, bool aChromeOn
TriState stOsVersion = eUnspecified;
TriState stOs = eUnspecified;
TriState stABI = eUnspecified;
#if defined(MOZ_WIDGET_ANDROID)
TriState stTablet = eUnspecified;
#endif
bool platform = false;
bool contentAccessible = false;
@ -602,6 +610,14 @@ ParseManifest(NSLocationType type, FileLocation &file, char* buf, bool aChromeOn
CheckVersionFlag(kGeckoVersion, wtoken, geckoVersion, stGeckoVersion))
continue;
#if defined(MOZ_WIDGET_ANDROID)
bool tablet = false;
if (CheckFlag(kTablet, wtoken, tablet)) {
stTablet = (tablet == isTablet) ? eOK : eBad;
continue;
}
#endif
if (directive->contentflags &&
(CheckFlag(kPlatform, wtoken, platform) ||
CheckFlag(kContentAccessible, wtoken, contentAccessible)))
@ -627,6 +643,9 @@ ParseManifest(NSLocationType type, FileLocation &file, char* buf, bool aChromeOn
stGeckoVersion == eBad ||
stOs == eBad ||
stOsVersion == eBad ||
#ifdef MOZ_WIDGET_ANDROID
stTablet == eBad ||
#endif
stABI == eBad)
continue;