diff options
-rw-r--r-- | core/java/android/webkit/WebView.java | 17 | ||||
-rw-r--r-- | core/java/android/webkit/WebViewCore.java | 10 | ||||
-rw-r--r-- | media/java/android/media/MtpCursor.java | 14 | ||||
-rw-r--r-- | media/mtp/MtpCursor.cpp | 3 | ||||
-rw-r--r-- | media/mtp/MtpCursor.h | 2 | ||||
-rwxr-xr-x | tests/DumpRenderTree2/assets/run_layout_tests.py | 12 |
6 files changed, 32 insertions, 26 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 29ebd3a..3735d32 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -607,7 +607,7 @@ public class WebView extends AbsoluteLayout static final int HIDE_FULLSCREEN = 121; static final int DOM_FOCUS_CHANGED = 122; static final int REPLACE_BASE_CONTENT = 123; - // 124; + static final int FORM_DID_BLUR = 124; static final int RETURN_LABEL = 125; static final int FIND_AGAIN = 126; static final int CENTER_FIT_RECT = 127; @@ -659,7 +659,7 @@ public class WebView extends AbsoluteLayout "HIDE_FULLSCREEN", // = 121; "DOM_FOCUS_CHANGED", // = 122; "REPLACE_BASE_CONTENT", // = 123; - "124", // = 124; + "FORM_DID_BLUR", // = 124; "RETURN_LABEL", // = 125; "FIND_AGAIN", // = 126; "CENTER_FIT_RECT", // = 127; @@ -3854,10 +3854,9 @@ public class WebView extends AbsoluteLayout // Called by WebKit to instruct the UI to hide the keyboard private void hideSoftKeyboard() { - InputMethodManager imm = (InputMethodManager) - getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - if (imm.isActive(this) - || (inEditingMode() && imm.isActive(mWebTextView))) { + InputMethodManager imm = InputMethodManager.peekInstance(); + if (imm != null && (imm.isActive(this) + || (inEditingMode() && imm.isActive(mWebTextView)))) { imm.hideSoftInputFromWindow(this.getWindowToken(), 0); } } @@ -6688,6 +6687,12 @@ public class WebView extends AbsoluteLayout updateTextSelectionFromMessage(msg.arg1, msg.arg2, (WebViewCore.TextSelectionData) msg.obj); break; + case FORM_DID_BLUR: + if (inEditingMode() + && mWebTextView.isSameTextField(msg.arg1)) { + hideSoftKeyboard(); + } + break; case RETURN_LABEL: if (inEditingMode() && mWebTextView.isSameTextField(msg.arg1)) { diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index a0c6974..7462668 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -273,6 +273,16 @@ final class WebViewCore { mCallbackProxy.onJsAlert(url, message); } + /** + * Called by JNI. Send a message to the UI thread to hide the soft keyboard + * if the node pointed to by nodePointer is still in focus. + * @param nodePointer The node which just blurred. + */ + private void formDidBlur(int nodePointer) { + if (mWebView == null) return; + Message.obtain(mWebView.mPrivateHandler, WebView.FORM_DID_BLUR, + nodePointer, 0).sendToTarget(); + } /** * Called by JNI. Open a file chooser to upload a file. diff --git a/media/java/android/media/MtpCursor.java b/media/java/android/media/MtpCursor.java index b9dd03e..ff8799a 100644 --- a/media/java/android/media/MtpCursor.java +++ b/media/java/android/media/MtpCursor.java @@ -31,7 +31,7 @@ public final class MtpCursor extends AbstractWindowedCursor { static final String TAG = "MtpCursor"; static final int NO_COUNT = -1; - /* constants for mQueryType */ + /* constants for queryType */ public static final int DEVICE = 1; public static final int DEVICE_ID = 2; public static final int STORAGE = 3; @@ -41,27 +41,15 @@ public final class MtpCursor extends AbstractWindowedCursor { public static final int STORAGE_CHILDREN = 7; public static final int OBJECT_CHILDREN = 8; - private int mQueryType; - private int mDeviceID; - private long mStorageID; - private long mQbjectID; - /** The names of the columns in the projection */ private String[] mColumns; /** The number of rows in the cursor */ private int mCount = NO_COUNT; - private final MtpClient mClient; public MtpCursor(MtpClient client, int queryType, int deviceID, long storageID, long objectID, String[] projection) { - - mClient = client; - mQueryType = queryType; - mDeviceID = deviceID; - mStorageID = storageID; - mQbjectID = objectID; mColumns = projection; HashMap<String, Integer> map; diff --git a/media/mtp/MtpCursor.cpp b/media/mtp/MtpCursor.cpp index 865a294..35d90dc 100644 --- a/media/mtp/MtpCursor.cpp +++ b/media/mtp/MtpCursor.cpp @@ -399,8 +399,7 @@ bool MtpCursor::prepareRow(CursorWindow* window) { } -bool MtpCursor::putLong(CursorWindow* window, int value, int row, int column) { - +bool MtpCursor::putLong(CursorWindow* window, int64_t value, int row, int column) { if (!window->putLong(row, column, value)) { window->freeLastRow(); LOGE("Failed allocating space for a long in column %d", column); diff --git a/media/mtp/MtpCursor.h b/media/mtp/MtpCursor.h index 9e9833f..2e03c29 100644 --- a/media/mtp/MtpCursor.h +++ b/media/mtp/MtpCursor.h @@ -67,7 +67,7 @@ private: MtpObjectHandle objectID, int row); bool prepareRow(CursorWindow* window); - bool putLong(CursorWindow* window, int value, int row, int column); + bool putLong(CursorWindow* window, int64_t value, int row, int column); bool putString(CursorWindow* window, const char* text, int row, int column); bool putThumbnail(CursorWindow* window, MtpObjectHandle objectID, MtpObjectFormat format, int row, int column); diff --git a/tests/DumpRenderTree2/assets/run_layout_tests.py b/tests/DumpRenderTree2/assets/run_layout_tests.py index fd76e4a..0c63e47 100755 --- a/tests/DumpRenderTree2/assets/run_layout_tests.py +++ b/tests/DumpRenderTree2/assets/run_layout_tests.py @@ -12,6 +12,7 @@ import logging import optparse import os +import re import sys import subprocess import tempfile @@ -47,10 +48,13 @@ def main(options, args): cmd = "adb shell am instrument " cmd += "-e class com.android.dumprendertree2.scriptsupport.Starter#startLayoutTests " cmd += "-e path \"" + path + "\" " - cmd +="-w com.android.dumprendertree2/com.android.dumprendertree2.scriptsupport.ScriptTestRunner" + cmd += "-w com.android.dumprendertree2/com.android.dumprendertree2.scriptsupport.ScriptTestRunner" logging.info("Running the tests...") - subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() + (stdoutdata, stderrdata) = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() + if re.search("^INSTRUMENTATION_STATUS_CODE: -1", stdoutdata, re.MULTILINE) != None: + logging.info("Failed to run the tests. Is DumpRenderTree2 installed on the device?") + return logging.info("Downloading the summaries...") @@ -58,13 +62,13 @@ def main(options, args): summary_txt_tmp_path = os.path.join(tmpdir, SUMMARY_TXT) cmd = "rm -f " + summary_txt_tmp_path + ";" cmd += "adb pull " + RESULTS_ABSOLUTE_PATH + SUMMARY_TXT + " " + summary_txt_tmp_path - subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() + subprocess.Popen(cmd, shell=True).wait() # Download the html summary to tmp folder details_html_tmp_path = os.path.join(tmpdir, DETAILS_HTML) cmd = "rm -f " + details_html_tmp_path + ";" cmd += "adb pull " + RESULTS_ABSOLUTE_PATH + DETAILS_HTML + " " + details_html_tmp_path - subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() + subprocess.Popen(cmd, shell=True).wait() # Print summary to console logging.info("All done.\n") |