Bug 799228 - Clean up shellVersion and shellName and their users. r=blassey
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Wed, 10 Oct 2012 17:10:39 +0200
changeset 109987 644a8fff5615a5d4737054f847df9240c71941a8
parent 109986 8b849f99923dd112a19fe1f89ecdef6ff1a2ba8b
child 109988 a0ef4a2d8caab592c68c20b6025b6fa7ad27f41f
push id84
push usernmatsakis@mozilla.com
push dateThu, 11 Oct 2012 23:26:24 +0000
reviewersblassey
bugs799228
milestone19.0a1
Bug 799228 - Clean up shellVersion and shellName and their users. r=blassey
accessible/src/jsat/Utils.jsm
mobile/xul/chrome/content/Util.js
xpcom/base/nsSystemInfo.cpp
--- a/accessible/src/jsat/Utils.jsm
+++ b/accessible/src/jsat/Utils.jsm
@@ -49,22 +49,22 @@ var Utils = {
     if (!this._ScriptName)
       this._ScriptName =
         (Services.appinfo.processType == 2) ? 'AccessFuContent' : 'AccessFu';
     return this._ScriptName;
   },
 
   get AndroidSdkVersion() {
     if (!this._AndroidSdkVersion) {
-      let shellVersion = Services.sysinfo.get('shellVersion') || '';
-      let matches = shellVersion.match(/\((\d+)\)$/);
-      if (matches)
-        this._AndroidSdkVersion = parseInt(matches[1]);
-      else
-        this._AndroidSdkVersion = 15; // Most useful in desktop debugging.
+      if (Services.appinfo.OS == 'Android') {
+        this._AndroidSdkVersion = Services.sysinfo.getPropertyAsInt32('version');
+      } else {
+        // Most useful in desktop debugging.
+        this._AndroidSdkVersion = 15;
+      }
     }
     return this._AndroidSdkVersion;
   },
 
   set AndroidSdkVersion(value) {
     // When we want to mimic another version.
     this._AndroidSdkVersion = value;
   },
--- a/mobile/xul/chrome/content/Util.js
+++ b/mobile/xul/chrome/content/Util.js
@@ -137,28 +137,25 @@ let Util = {
     // explicitly disabled or enabled.
     if (tabletPref == 0)
       return this._isTablet = false;
     else if (tabletPref == 1)
       return this._isTablet = true;
 
 #ifdef ANDROID
     let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
-    let shellVersion = sysInfo.get("shellVersion") || "";
-    let matches = shellVersion.match(/\((\d+)\)$/);
-    if (matches) {
-      let sdkVersion = parseInt(matches[1]);
-      // Disable tablet mode on pre-honeycomb devices because of theme bugs (bug 705026)
-      if (sdkVersion < 11)
-        return this._isTablet = false;
+    let sdkVersion = sysInfo.getPropertyAsInt32("version");
+    // Disable tablet mode on pre-honeycomb devices because of theme bugs (bug 705026)
+    if (sdkVersion < 11)
+      return this._isTablet = false;
 
-      // Always enable tablet mode on honeycomb devices.
-      if (sdkVersion < 14)
-        return this._isTablet = true;
-    }
+    // Always enable tablet mode on honeycomb devices.
+    if (sdkVersion < 14)
+      return this._isTablet = true;
+
     // On Ice Cream Sandwich devices, switch modes based on screen size.
     return this._isTablet = sysInfo.get("tablet");
 #endif
 
     let dpi = this.displayDPI;
     if (dpi <= 96)
       return this._isTablet = (window.innerWidth > 1024);
 
--- a/xpcom/base/nsSystemInfo.cpp
+++ b/xpcom/base/nsSystemInfo.cpp
@@ -174,25 +174,16 @@ nsSystemInfo::Init()
         if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MANUFACTURER", str))
             SetPropertyAsAString(NS_LITERAL_STRING("manufacturer"), str);
         int32_t version;
         if (!mozilla::AndroidBridge::Bridge()->GetStaticIntField("android/os/Build$VERSION", "SDK_INT", &version))
             version = 0;
         android_sdk_version = version;
         if (version >= 8 && mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str))
             SetPropertyAsAString(NS_LITERAL_STRING("hardware"), str);
-        SetPropertyAsAString(NS_LITERAL_STRING("shellName"), NS_LITERAL_STRING("Android"));
-        if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION", "CODENAME", str)) {
-            if (version) {
-                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("tablet"), isTablet);
         // NSPR "version" is the kernel version. For Android we want the Android version.
         // Rename SDK version to version and put the kernel version into kernel_version.
         rv = GetPropertyAsAString(NS_LITERAL_STRING("version"), str);
         if (NS_SUCCEEDED(rv)) {
             SetPropertyAsAString(NS_LITERAL_STRING("kernel_version"), str);
         }