зеркало из https://github.com/mozilla/gecko-dev.git
Backout 31d345404c98 (bug 671634) due to missing privacy review and necko peer review; a=dao
This commit is contained in:
Родитель
1fe3dee652
Коммит
0e555c3378
|
@ -1631,17 +1631,4 @@ public class GeckoAppShell
|
|||
public static float[] getCurrentBatteryInformation() {
|
||||
return GeckoBatteryManager.getCurrentInformation();
|
||||
}
|
||||
|
||||
public static boolean isTablet() {
|
||||
if (android.os.Build.VERSION.SDK_INT >= 9) {
|
||||
Configuration config = GeckoApp.mAppContext.getResources().getConfiguration();
|
||||
// xlarge is defined by android as screens larger than 960dp x 720dp
|
||||
// and should include most devices ~7in and up.
|
||||
// http://developer.android.com/guide/practices/screens_support.html
|
||||
if ((config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -615,8 +615,6 @@ nsHttpHandler::BuildUserAgent()
|
|||
mAppName.Length() +
|
||||
mAppVersion.Length() +
|
||||
mCompatFirefox.Length() +
|
||||
mDeviceType.Length() +
|
||||
mDeviceName.Length() +
|
||||
13);
|
||||
|
||||
// Application portion
|
||||
|
@ -634,10 +632,6 @@ nsHttpHandler::BuildUserAgent()
|
|||
mUserAgent += mOscpu;
|
||||
mUserAgent.AppendLiteral("; ");
|
||||
mUserAgent += mMisc;
|
||||
if (!mDeviceName.IsEmpty()) {
|
||||
mUserAgent.AppendLiteral("; ");
|
||||
mUserAgent += mDeviceName;
|
||||
}
|
||||
mUserAgent += ')';
|
||||
|
||||
// Product portion
|
||||
|
@ -652,11 +646,6 @@ nsHttpHandler::BuildUserAgent()
|
|||
mUserAgent += mCompatFirefox;
|
||||
}
|
||||
|
||||
if (!mDeviceType.IsEmpty()) {
|
||||
mUserAgent += ' ';
|
||||
mUserAgent += mDeviceType;
|
||||
}
|
||||
|
||||
// App portion
|
||||
mUserAgent += ' ';
|
||||
mUserAgent += mAppName;
|
||||
|
@ -694,32 +683,6 @@ nsHttpHandler::InitUserAgentComponents()
|
|||
#endif
|
||||
);
|
||||
|
||||
#if defined(ANDROID)
|
||||
nsCOMPtr<nsIPropertyBag2> infoService = do_GetService("@mozilla.org/system-info;1");
|
||||
NS_ASSERTION(infoService, "Could not find a system info service");
|
||||
|
||||
bool isTablet;
|
||||
infoService->GetPropertyAsBool(NS_LITERAL_STRING("isTablet"), &isTablet);
|
||||
if (!isTablet) {
|
||||
mDeviceType.AssignLiteral("Mobile");
|
||||
}
|
||||
infoService->GetPropertyAsACString(NS_LITERAL_STRING("device"),
|
||||
mDeviceName);
|
||||
nsXPIDLCString buildid;
|
||||
infoService->GetPropertyAsACString(NS_LITERAL_STRING("buildid"),
|
||||
buildid);
|
||||
if (!buildid.IsEmpty()) {
|
||||
mDeviceName += " Build/";
|
||||
mDeviceName += buildid;
|
||||
}
|
||||
|
||||
nsXPIDLCString shellVersion;
|
||||
infoService->GetPropertyAsACString(NS_LITERAL_STRING("shellVersion"),
|
||||
shellVersion);
|
||||
mPlatform += " ";
|
||||
mPlatform += shellVersion;
|
||||
#endif
|
||||
|
||||
// Gather OS/CPU.
|
||||
#if defined(XP_OS2)
|
||||
ULONG os2ver = 0;
|
||||
|
|
|
@ -313,8 +313,6 @@ private:
|
|||
nsXPIDLCString mProductSub;
|
||||
nsXPIDLCString mAppName;
|
||||
nsXPIDLCString mAppVersion;
|
||||
nsXPIDLCString mDeviceType;
|
||||
nsXPIDLCString mDeviceName;
|
||||
nsCString mCompatFirefox;
|
||||
|
||||
nsCString mUserAgent;
|
||||
|
|
|
@ -157,7 +157,6 @@ AndroidBridge::Init(JNIEnv *jEnv,
|
|||
jPostToJavaThread = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "postToJavaThread", "(Z)V");
|
||||
jInitCamera = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "initCamera", "(Ljava/lang/String;III)[I");
|
||||
jCloseCamera = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "closeCamera", "()V");
|
||||
jIsTablet = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "isTablet", "()Z");
|
||||
jEnableBatteryNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableBatteryNotifications", "()V");
|
||||
jDisableBatteryNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "disableBatteryNotifications", "()V");
|
||||
jGetCurrentBatteryInformation = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getCurrentBatteryInformation", "()[F");
|
||||
|
@ -1377,9 +1376,3 @@ AndroidBridge::UnlockWindow(void* window)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidBridge::IsTablet()
|
||||
{
|
||||
return mJNIEnv->CallStaticBooleanMethod(mGeckoAppShellClass, jIsTablet);
|
||||
}
|
||||
|
|
|
@ -298,8 +298,6 @@ public:
|
|||
void DisableBatteryNotifications();
|
||||
void GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo);
|
||||
|
||||
bool IsTablet();
|
||||
|
||||
protected:
|
||||
static AndroidBridge *sBridge;
|
||||
|
||||
|
@ -374,7 +372,6 @@ protected:
|
|||
jmethodID jPostToJavaThread;
|
||||
jmethodID jInitCamera;
|
||||
jmethodID jCloseCamera;
|
||||
jmethodID jIsTablet;
|
||||
jmethodID jEnableBatteryNotifications;
|
||||
jmethodID jDisableBatteryNotifications;
|
||||
jmethodID jGetCurrentBatteryInformation;
|
||||
|
|
|
@ -181,20 +181,22 @@ nsSystemInfo::Init()
|
|||
SetPropertyAsAString(NS_LITERAL_STRING("device"), str);
|
||||
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MANUFACTURER", str))
|
||||
SetPropertyAsAString(NS_LITERAL_STRING("manufacturer"), str);
|
||||
|
||||
PRInt32 version;
|
||||
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))
|
||||
SetPropertyAsAString(NS_LITERAL_STRING("hardware"), str);
|
||||
if (version >= 8 && mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "ID", str))
|
||||
SetPropertyAsAString(NS_LITERAL_STRING("buildid"), str);
|
||||
|
||||
SetPropertyAsAString(NS_LITERAL_STRING("shellName"), NS_LITERAL_STRING("Android"));
|
||||
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION", "RELEASE", str))
|
||||
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);
|
||||
SetPropertyAsBool(NS_LITERAL_STRING("isTablet"),
|
||||
mozilla::AndroidBridge::Bridge()->IsTablet());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче