Merge commit 'goog/master' into merge_master
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 */ "(\\/?.*)?");
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user