From 43fd2dc37f1162a75ac5106d50209a3aa3391a80 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Wed, 14 Dec 2011 13:53:38 -0800 Subject: [PATCH] Bug 708772 - (2/3) Add tablet flag to jar manifest parser and nsSystemInfo [r=bsmedberg] --- xpcom/base/nsSystemInfo.cpp | 6 +++--- xpcom/components/ManifestParser.cpp | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/xpcom/base/nsSystemInfo.cpp b/xpcom/base/nsSystemInfo.cpp index 0baff8c1e7f2..101452a042af 100644 --- a/xpcom/base/nsSystemInfo.cpp +++ b/xpcom/base/nsSystemInfo.cpp @@ -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; diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp index e1c3eb49f5d1..3d9dd7929883 100644 --- a/xpcom/components/ManifestParser.cpp +++ b/xpcom/components/ManifestParser.cpp @@ -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;