diff options
| author | 2009-04-28 15:24:01 -0700 | |
|---|---|---|
| committer | 2009-04-28 15:24:01 -0700 | |
| commit | d504605919a62902e10cd13536390ffce84a3326 (patch) | |
| tree | 07a80da48cc672800f881d80ba64dfe336243043 | |
| parent | bdbe6024a543bd740b0c194db9c12e4150c55c59 (diff) | |
| parent | 2ca912ec1350a8196abe4630e6c629ee8191926d (diff) | |
Merge commit 'goog/master' into merge_master
| -rw-r--r-- | core/java/android/accounts/AccountManager.java | 9 | ||||
| -rw-r--r-- | core/java/android/net/WebAddress.java | 2 | ||||
| -rw-r--r-- | core/java/android/webkit/LoadListener.java | 22 | ||||
| -rw-r--r-- | core/java/android/webkit/MimeTypeMap.java | 1 | ||||
| -rw-r--r-- | core/java/android/webkit/WebView.java | 16 | ||||
| -rw-r--r-- | docs/html/guide/developing/tools/ddms.jd | 13 | ||||
| -rw-r--r-- | test-runner/android/test/IsolatedContext.java | 21 |
7 files changed, 52 insertions, 32 deletions
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java index 3d21101ef1ac..4fcaa884b1c6 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/core/java/android/net/WebAddress.java b/core/java/android/net/WebAddress.java index f4a2a6a94307..f6159def812b 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 */ "(\\/?.*)?"); diff --git a/core/java/android/webkit/LoadListener.java b/core/java/android/webkit/LoadListener.java index 716d504570f3..36aa14b06146 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 85c2275df991..096f38add65b 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); diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 6e79bc9acb43..935e928579ae 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 diff --git a/docs/html/guide/developing/tools/ddms.jd b/docs/html/guide/developing/tools/ddms.jd index fa04216c39bf..f55940d18ae0 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 -<p>Android ships with a debugging tool called the Dalvik Debug Monitor Service (DDMS), +<p>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.</p> </ul> </li> <li> <strong>utime</strong> - cumulative time spent executing user code, in "jiffies" (usually - 10ms). Only available under Linux. </li> + 10ms). </li> <li> <strong>stime</strong> - cumulative time spent executing system code, in "jiffies" (usually 10ms). </li> <li> <strong>Name</strong> - the name of the thread</li> @@ -214,14 +214,15 @@ the emulator from command line, be sure to mount the sdcard again.)</p> <h2 id="screen-capture">Screen Capture</h2> <p>You can capture screen images on the device or emulator by selecting <strong>Device</strong> - > <strong>Screen capture...</strong> in the menu bar, or press CTRL-S.</p> + > <strong>Screen capture...</strong> in the menu bar, or press CTRL-S. + Be sure to select a device first.</p> <h2 id="exploring-processes">Exploring Processes</h2> <p>You can see the output of <code>ps -x</code> for a specific VM by selecting <strong>Device</strong> > <strong>Show process status</strong>... in the menu bar.</p> <h2 id="cause-a-gc-to-occur">Cause a GC to Occur</h2> -<p>Cause garbage collection to occury by pressing the trash can button on the toolbar. </p> +<p>Cause garbage collection to occur in the selected application by pressing the trash can button on the toolbar. </p> <h2 id="running-dumpsys-and-dumpstate">Running Dumpsys and Dumpstate on the Device (logcat)<a name="logcat" id="logcat"></a> </h2> <ul> @@ -239,7 +240,7 @@ the emulator from command line, be sure to mount the sdcard again.)</p> <h2 id="stop-a-vitrual-machine">Stop a Virtual Machine </h2> <p>You can stop a virtual machine by selecting <strong>Actions</strong> > <strong>Halt -VM</strong>. Pressing this button causes the VM to call <code>System.exit(1)</code>.</p> +VM</strong>. Pressing this button causes the VM to call <code>Runtime.halt(1)</code>.</p> <h2 id="known-issues" style="color:#FF0000">Known issues with DDMS </h2> <p>DDMS has the following known limitations:</p> diff --git a/test-runner/android/test/IsolatedContext.java b/test-runner/android/test/IsolatedContext.java index 286666684b88..03d95b722dcd 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<Intent> 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 + } + } } |