From f3c06bb8b66cb91a1b9c3a0c7b8f73e80819a232 Mon Sep 17 00:00:00 2001
From: Andy McFadden
Date: Mon, 27 Apr 2009 10:38:50 -0700
Subject: [PATCH 1/5] Minor updates to DDMS doc.
Fixed typos, removed stale comment. Changed "service" to "server".
---
docs/html/guide/developing/tools/ddms.jd | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/docs/html/guide/developing/tools/ddms.jd b/docs/html/guide/developing/tools/ddms.jd
index fa04216c39bf4..f55940d18ae02 100644
--- a/docs/html/guide/developing/tools/ddms.jd
+++ b/docs/html/guide/developing/tools/ddms.jd
@@ -1,7 +1,7 @@
-page.title=Using Dalvik Debug Monitor Service (DDMS)
+page.title=Using the Dalvik Debug Monitor
@jd:body
-Android ships with a debugging tool called the Dalvik Debug Monitor Service (DDMS),
+
Android ships with a debugging tool called the Dalvik Debug Monitor Server (DDMS),
which provides port-forwarding services, screen capture on the device, thread
and heap information on the device, logcat, process, and radio state information,
incoming call and SMS spoofing, location data spoofing, and more. This page
@@ -106,7 +106,7 @@ and some pretty cool tools.
utime - cumulative time spent executing user code, in "jiffies" (usually
- 10ms). Only available under Linux.
+ 10ms).
stime - cumulative time spent executing system code, in "jiffies" (usually
10ms).
Name - the name of the thread
@@ -214,14 +214,15 @@ the emulator from command line, be sure to mount the sdcard again.)
Screen Capture
You can capture screen images on the device or emulator by selecting Device
- > Screen capture... in the menu bar, or press CTRL-S.
+ > Screen capture... in the menu bar, or press CTRL-S.
+ Be sure to select a device first.
Exploring Processes
You can see the output of ps -x for a specific VM by selecting Device
> Show process status... in the menu bar.
Cause a GC to Occur
-Cause garbage collection to occury by pressing the trash can button on the toolbar.
+Cause garbage collection to occur in the selected application by pressing the trash can button on the toolbar.
Running Dumpsys and Dumpstate on the Device (logcat)
@@ -239,7 +240,7 @@ the emulator from command line, be sure to mount the sdcard again.)
Stop a Virtual Machine
You can stop a virtual machine by selecting Actions > Halt
-VM. Pressing this button causes the VM to call System.exit(1).
+VM. Pressing this button causes the VM to call Runtime.halt(1).
Known issues with DDMS
DDMS has the following known limitations:
From 135e24c294884e009766e5b269424fcd07d83646 Mon Sep 17 00:00:00 2001
From: Patrick Scott
Date: Mon, 27 Apr 2009 16:33:36 -0400
Subject: [PATCH 2/5] Add '_' to the allowable characters in a host name.
This does not fix the underscore problem in host names but it moves it from a
Browser issue to a libc issue.
---
core/java/android/net/WebAddress.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/java/android/net/WebAddress.java b/core/java/android/net/WebAddress.java
index f4a2a6a943078..f6159def812bf 100644
--- a/core/java/android/net/WebAddress.java
+++ b/core/java/android/net/WebAddress.java
@@ -54,7 +54,7 @@ public class WebAddress {
static Pattern sAddressPattern = Pattern.compile(
/* scheme */ "(?:(http|HTTP|https|HTTPS|file|FILE)\\:\\/\\/)?" +
/* authority */ "(?:([-A-Za-z0-9$_.+!*'(),;?&=]+(?:\\:[-A-Za-z0-9$_.+!*'(),;?&=]+)?)@)?" +
- /* host */ "([-A-Za-z0-9%]+(?:\\.[-A-Za-z0-9%]+)*)?" +
+ /* host */ "([-A-Za-z0-9%_]+(?:\\.[-A-Za-z0-9%_]+)*)?" +
/* port */ "(?:\\:([0-9]+))?" +
/* path */ "(\\/?.*)?");
From 0eabf0228a17e07ef831bc1ee1951c9697d2a079 Mon Sep 17 00:00:00 2001
From: Fred Quintana
Date: Mon, 27 Apr 2009 15:08:17 -0700
Subject: [PATCH 3/5] change the IsolatedContext to have a test version of the
AccountManager that has no IBinder to the AccountManagerService.
---
.../java/android/accounts/AccountManager.java | 9 ++++++++
test-runner/android/test/IsolatedContext.java | 21 ++++++++++++++++++-
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index 3d21101ef1acd..4fcaa884b1c60 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -67,6 +67,15 @@ public class AccountManager {
mMainHandler = new Handler(mContext.getMainLooper());
}
+ /**
+ * @hide used for testing only
+ */
+ public AccountManager(Context context, IAccountManager service, Handler handler) {
+ mContext = context;
+ mService = service;
+ mMainHandler = handler;
+ }
+
public static AccountManager get(Context context) {
return (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE);
}
diff --git a/test-runner/android/test/IsolatedContext.java b/test-runner/android/test/IsolatedContext.java
index 286666684b887..03d95b722dcd6 100644
--- a/test-runner/android/test/IsolatedContext.java
+++ b/test-runner/android/test/IsolatedContext.java
@@ -2,6 +2,8 @@ package android.test;
import com.google.android.collect.Lists;
+import android.accounts.AccountManager;
+import android.accounts.OnAccountsUpdatedListener;
import android.content.ContextWrapper;
import android.content.ContentResolver;
import android.content.Intent;
@@ -11,6 +13,8 @@ import android.content.BroadcastReceiver;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.net.Uri;
+import android.os.Handler;
+import android.os.Looper;
import java.util.List;
@@ -21,6 +25,7 @@ import java.util.List;
public class IsolatedContext extends ContextWrapper {
private ContentResolver mResolver;
+ private final MockAccountManager mMockAccountManager;
private List mBroadcastIntents = Lists.newArrayList();
@@ -28,6 +33,7 @@ public class IsolatedContext extends ContextWrapper {
ContentResolver resolver, Context targetContext) {
super(targetContext);
mResolver = resolver;
+ mMockAccountManager = new MockAccountManager();
}
/** Returns the list of intents that were broadcast since the last call to this method. */
@@ -78,8 +84,21 @@ public class IsolatedContext extends ContextWrapper {
@Override
public Object getSystemService(String name) {
- // No services exist in this context.
+ if (Context.ACCOUNT_SERVICE.equals(name)) {
+ return mMockAccountManager;
+ }
+ // No other services exist in this context.
return null;
}
+ private class MockAccountManager extends AccountManager {
+ public MockAccountManager() {
+ super(IsolatedContext.this, null /* IAccountManager */, null /* handler */);
+ }
+
+ public void addOnAccountsUpdatedListener(OnAccountsUpdatedListener listener,
+ Handler handler, boolean updateImmediately) {
+ // do nothing
+ }
+ }
}
From f0c70a83562a27c424554f609eb1d4cdebf06df4 Mon Sep 17 00:00:00 2001
From: Patrick Scott
Date: Tue, 28 Apr 2009 11:21:28 -0400
Subject: [PATCH 4/5] Treat application/xhtml+xml as xhtml+xml instead of
text/html.
Previously we had converted application/xhtml+xml to text/html because of bad
server data. Now we need to treat xhtml as xhtml to get svg to be interpreted
correctly.
---
core/java/android/webkit/LoadListener.java | 22 ++++------------------
core/java/android/webkit/MimeTypeMap.java | 1 +
2 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/core/java/android/webkit/LoadListener.java b/core/java/android/webkit/LoadListener.java
index 716d504570f34..36aa14b06146d 100644
--- a/core/java/android/webkit/LoadListener.java
+++ b/core/java/android/webkit/LoadListener.java
@@ -324,13 +324,10 @@ class LoadListener extends Handler implements EventHandler {
// As we don't support wml, render it as plain text
mMimeType = "text/plain";
} else {
- // XXX: Until the servers send us either correct xhtml or
- // text/html, treat application/xhtml+xml as text/html.
// It seems that xhtml+xml and vnd.wap.xhtml+xml mime
// subtypes are used interchangeably. So treat them the same.
- if (mMimeType.equals("application/xhtml+xml") ||
- mMimeType.equals("application/vnd.wap.xhtml+xml")) {
- mMimeType = "text/html";
+ if (mMimeType.equals("application/vnd.wap.xhtml+xml")) {
+ mMimeType = "application/xhtml+xml";
}
}
} else {
@@ -1396,19 +1393,8 @@ class LoadListener extends Handler implements EventHandler {
Log.v(LOGTAG, "guessMimeTypeFromExtension: mURL = " + mUrl);
}
- String mimeType =
- MimeTypeMap.getSingleton().getMimeTypeFromExtension(
- MimeTypeMap.getFileExtensionFromUrl(mUrl));
-
- if (mimeType != null) {
- // XXX: Until the servers send us either correct xhtml or
- // text/html, treat application/xhtml+xml as text/html.
- if (mimeType.equals("application/xhtml+xml")) {
- mimeType = "text/html";
- }
- }
-
- return mimeType;
+ return MimeTypeMap.getSingleton().getMimeTypeFromExtension(
+ MimeTypeMap.getFileExtensionFromUrl(mUrl));
}
/**
diff --git a/core/java/android/webkit/MimeTypeMap.java b/core/java/android/webkit/MimeTypeMap.java
index 85c2275df9916..096f38add65b6 100644
--- a/core/java/android/webkit/MimeTypeMap.java
+++ b/core/java/android/webkit/MimeTypeMap.java
@@ -358,6 +358,7 @@ public /* package */ class MimeTypeMap {
sMimeTypeMap.loadEntry("application/x-x509-ca-cert", "crt", false);
sMimeTypeMap.loadEntry("application/x-xcf", "xcf", false);
sMimeTypeMap.loadEntry("application/x-xfig", "fig", false);
+ sMimeTypeMap.loadEntry("application/xhtml+xml", "xhtml", false);
sMimeTypeMap.loadEntry("audio/basic", "snd", false);
sMimeTypeMap.loadEntry("audio/midi", "mid", false);
sMimeTypeMap.loadEntry("audio/midi", "midi", false);
From 2ca912ec1350a8196abe4630e6c629ee8191926d Mon Sep 17 00:00:00 2001
From: Leon Scroggins
Date: Tue, 28 Apr 2009 16:51:55 -0400
Subject: [PATCH 5/5] Lazily initialize the TextDialog.
---
core/java/android/webkit/WebView.java | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 6e79bc9acb43a..935e928579ae9 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -2959,19 +2959,16 @@ public class WebView extends AbsoluteLayout
}
private void updateTextEntry() {
- if (mTextEntry == null) {
- mTextEntry = new TextDialog(mContext, WebView.this);
- // Initialize our generation number.
- mTextGeneration = 0;
- }
// If we do not have focus, do nothing until we gain focus.
- if (!hasFocus() && !mTextEntry.hasFocus()
+ if (!hasFocus() && (null == mTextEntry || !mTextEntry.hasFocus())
|| (mTouchMode >= FIRST_SCROLL_ZOOM
&& mTouchMode <= LAST_SCROLL_ZOOM)) {
mNeedsUpdateTextEntry = true;
return;
}
boolean alreadyThere = inEditingMode();
+ // inEditingMode can only return true if mTextEntry is non-null,
+ // so we can safely call remove() if (alreadyThere)
if (0 == mNativeClass || !nativeUpdateFocusNode()) {
if (alreadyThere) {
mTextEntry.remove();
@@ -2985,6 +2982,13 @@ public class WebView extends AbsoluteLayout
}
return;
}
+ // At this point, we know we have found an input field, so go ahead
+ // and create the TextDialog if necessary.
+ if (mTextEntry == null) {
+ mTextEntry = new TextDialog(mContext, WebView.this);
+ // Initialize our generation number.
+ mTextGeneration = 0;
+ }
mTextEntry.setTextSize(contentToView(node.mTextSize));
Rect visibleRect = sendOurVisibleRect();
// Note that sendOurVisibleRect calls viewToContent, so the coordinates