diff --git a/embedding/android/AndroidManifest.xml.in b/embedding/android/AndroidManifest.xml.in index e85508e4210..9b35ff700f6 100644 --- a/embedding/android/AndroidManifest.xml.in +++ b/embedding/android/AndroidManifest.xml.in @@ -17,7 +17,8 @@ + android:windowSoftInputMode="stateUnspecified|adjustResize" + android:launchMode="singleInstance"> diff --git a/embedding/android/GeckoAppShell.java b/embedding/android/GeckoAppShell.java index 5deda1e82b9..351e72fc725 100644 --- a/embedding/android/GeckoAppShell.java +++ b/embedding/android/GeckoAppShell.java @@ -214,6 +214,10 @@ class GeckoAppShell } } + public static void moveTaskToBack() { + GeckoApp.mAppContext.moveTaskToBack(true); + } + public static void returnIMEQueryResult(String result, int selectionStart, int selectionEnd) { GeckoApp.surfaceView.inputConnection.mSelectionStart = selectionStart; GeckoApp.surfaceView.inputConnection.mSelectionEnd = selectionEnd; diff --git a/widget/src/android/AndroidBridge.cpp b/widget/src/android/AndroidBridge.cpp index b69c0f84a26..6906faed0b7 100644 --- a/widget/src/android/AndroidBridge.cpp +++ b/widget/src/android/AndroidBridge.cpp @@ -100,6 +100,7 @@ AndroidBridge::Init(JNIEnv *jEnv, jGetHandlersForMimeType = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getHandlersForMimeType", "(Ljava/lang/String;)[Ljava/lang/String;"); jOpenUriExternal = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "openUriExternal", "(Ljava/lang/String;Ljava/lang/String;)Z"); jGetMimeTypeFromExtension = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getMimeTypeFromExtension", "(Ljava/lang/String;)Ljava/lang/String;"); + jMoveTaskToBack = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "moveTaskToBack", "()V"); InitAndroidJavaWrappers(jEnv); // jEnv should NOT be cached here by anything -- the jEnv here @@ -260,6 +261,12 @@ AndroidBridge::GetMimeTypeFromExtension(const nsCString& aFileExt, nsCString& aM aMimeType.Assign(NS_ConvertUTF16toUTF8(jniStr.get())); } +void +AndroidBridge::MoveTaskToBack() +{ + mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jMoveTaskToBack); +} + void AndroidBridge::SetSurfaceView(jobject obj) { diff --git a/widget/src/android/AndroidBridge.h b/widget/src/android/AndroidBridge.h index f449018a8d7..b390621effd 100644 --- a/widget/src/android/AndroidBridge.h +++ b/widget/src/android/AndroidBridge.h @@ -110,6 +110,8 @@ public: void GetMimeTypeFromExtension(const nsCString& aFileExt, nsCString& aMimeType); + void MoveTaskToBack(); + struct AutoLocalJNIFrame { AutoLocalJNIFrame(int nEntries = 128) : mEntries(nEntries) { AndroidBridge::Bridge()->JNI()->PushLocalFrame(mEntries); @@ -159,6 +161,7 @@ protected: jmethodID jGetHandlersForMimeType; jmethodID jOpenUriExternal; jmethodID jGetMimeTypeFromExtension; + jmethodID jMoveTaskToBack; }; } diff --git a/widget/src/android/nsWindow.cpp b/widget/src/android/nsWindow.cpp index 4b7fe7955e3..523622ab51a 100644 --- a/widget/src/android/nsWindow.cpp +++ b/widget/src/android/nsWindow.cpp @@ -411,6 +411,11 @@ nsWindow::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, NS_IMETHODIMP nsWindow::SetSizeMode(PRInt32 aMode) { + switch (aMode) { + case nsSizeMode_Minimized: + AndroidBridge::Bridge()->MoveTaskToBack(); + break; + } return NS_OK; }