diff options
| -rw-r--r-- | cmds/dumpstate/dumpstate.c | 5 | ||||
| -rw-r--r-- | core/java/android/speech/RecognizerResultsIntent.java | 19 | ||||
| -rw-r--r-- | core/java/android/webkit/CookieManager.java | 29 | ||||
| -rw-r--r-- | core/java/android/webkit/FrameLoader.java | 66 | ||||
| -rw-r--r-- | core/tests/coretests/src/android/provider/SettingsProviderTest.java | 2 | ||||
| -rw-r--r-- | libs/audioflinger/AudioPolicyManagerBase.cpp | 14 |
6 files changed, 92 insertions, 43 deletions
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c index adec5a4fa25c..eaa34c8c33d3 100644 --- a/cmds/dumpstate/dumpstate.c +++ b/cmds/dumpstate/dumpstate.c @@ -110,6 +110,9 @@ static void dumpstate() { dump_file("KERNEL WAKELOCKS", "/proc/wakelocks"); dump_file("KERNEL CPUFREQ", "/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state"); + run_command("SECURE CONTAINERS", 10, "vdc", "asec", "list", NULL); + run_command("MOUNTED FILESYSTEMS", 10, "df", NULL); + run_command("PROCESSES", 10, "ps", "-P", NULL); run_command("PROCESSES AND THREADS", 10, "ps", "-t", "-p", "-P", NULL); run_command("LIBRANK", 10, "librank", NULL); @@ -208,7 +211,7 @@ int main(int argc, char *argv[]) { } /* switch to non-root user and group */ - gid_t groups[] = { AID_LOG, AID_SDCARD_RW }; + gid_t groups[] = { AID_LOG, AID_SDCARD_RW, AID_MOUNT }; setgroups(sizeof(groups)/sizeof(groups[0]), groups); setuid(AID_SHELL); diff --git a/core/java/android/speech/RecognizerResultsIntent.java b/core/java/android/speech/RecognizerResultsIntent.java index 228258ee1580..4997d5046b46 100644 --- a/core/java/android/speech/RecognizerResultsIntent.java +++ b/core/java/android/speech/RecognizerResultsIntent.java @@ -16,6 +16,8 @@ package android.speech; +import android.os.Bundle; + import java.util.ArrayList; /** @@ -119,7 +121,22 @@ public class RecognizerResultsIntent { */ public static final String EXTRA_VOICE_SEARCH_RESULT_HTML_BASE_URLS = "android.speech.extras.VOICE_SEARCH_RESULT_HTML_BASE_URLS"; - + + /** + * The key to an extra {@link ArrayList} of {@link Bundle}s that contains key/value pairs. + * All the values and the keys are {@link String}s. Each key/value pair represents an extra HTTP + * header. The keys can't be the standard HTTP headers as they are set by the WebView. + * + * A list of size 1 may be provided to apply the same HTTP headers to all html results. A list + * of the same size as {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS} may be provided to apply + * different HTTP headers to each different html result in the + * {@link #EXTRA_VOICE_SEARCH_RESULT_HTML} list. + * + * @hide not to be exposed immediately as the implementation details may change + */ + public static final String EXTRA_VOICE_SEARCH_RESULT_HTTP_HEADERS = + "android.speech.extras.EXTRA_VOICE_SEARCH_RESULT_HTTP_HEADERS"; + /** * The scheme used currently for html content in {@link #EXTRA_VOICE_SEARCH_RESULT_HTML}. * diff --git a/core/java/android/webkit/CookieManager.java b/core/java/android/webkit/CookieManager.java index 1d287317718c..427ce76150e8 100644 --- a/core/java/android/webkit/CookieManager.java +++ b/core/java/android/webkit/CookieManager.java @@ -216,19 +216,23 @@ public final class CookieManager { diff = cookie2.domain.length() - cookie1.domain.length(); if (diff != 0) return diff; - diff = cookie2.name.hashCode() - cookie1.name.hashCode(); - if (diff != 0) return diff; - // If cookie2 has a null value, it should come later in // the list. if (cookie2.value == null) { - return -1; + // If both cookies have null values, fall back to using the name + // difference. + if (cookie1.value != null) { + return -1; + } } else if (cookie1.value == null) { // Now we know that cookie2 does not have a null value, if // cookie1 has a null value, place it later in the list. return 1; } + diff = cookie2.name.hashCode() - cookie1.name.hashCode(); + if (diff != 0) return diff; + // cookie1 and cookie2 both have non-null values so we emit a // warning and treat them as the same. Log.w(LOGTAG, "Found two cookies with the same value." @@ -804,9 +808,13 @@ public final class CookieManager { cookie = new Cookie(host, path); // Cookies like "testcookie; path=/;" are valid and used - // (lovefilm.se). Check for equal as in the string "testcookie" - // Check for equalIndex == -1 as in the string "testcookie;" - if (semicolonIndex <= equalIndex || equalIndex == -1) { + // (lovefilm.se). + // Look for 2 cases: + // 1. "foo" or "foo;" where equalIndex is -1 + // 2. "foo; path=..." where the first semicolon is before an equal + // and a semicolon exists. + if ((semicolonIndex != -1 && (semicolonIndex < equalIndex)) || + equalIndex == -1) { // Fix up the index in case we have a string like "testcookie" if (semicolonIndex == -1) { semicolonIndex = length; @@ -815,7 +823,10 @@ public final class CookieManager { cookie.value = null; } else { cookie.name = cookieString.substring(index, equalIndex); - if (cookieString.charAt(equalIndex + 1) == QUOTATION) { + // Make sure we do not throw an exception if the cookie is like + // "foo=" + if ((equalIndex < length - 1) && + (cookieString.charAt(equalIndex + 1) == QUOTATION)) { index = cookieString.indexOf(QUOTATION, equalIndex + 2); if (index == -1) { // bad format, force return @@ -834,7 +845,7 @@ public final class CookieManager { equalIndex + 1 + MAX_COOKIE_LENGTH); } else if (equalIndex + 1 == semicolonIndex || semicolonIndex < equalIndex) { - // this is an unusual case like foo=; + // this is an unusual case like "foo=;" or "foo=" cookie.value = ""; } else { cookie.value = cookieString.substring(equalIndex + 1, diff --git a/core/java/android/webkit/FrameLoader.java b/core/java/android/webkit/FrameLoader.java index dacb33f9b2ea..303e4176281d 100644 --- a/core/java/android/webkit/FrameLoader.java +++ b/core/java/android/webkit/FrameLoader.java @@ -111,11 +111,10 @@ class FrameLoader { } mNetwork = Network.getInstance(mListener.getContext()); if (mListener.isSynchronous()) { - handleHTTPLoad(); - } else { - WebViewWorker.getHandler().obtainMessage( - WebViewWorker.MSG_ADD_HTTPLOADER, this).sendToTarget(); + return handleHTTPLoad(); } + WebViewWorker.getHandler().obtainMessage( + WebViewWorker.MSG_ADD_HTTPLOADER, this).sendToTarget(); return true; } else if (handleLocalFile(url, mListener, mSettings)) { return true; @@ -147,34 +146,53 @@ class FrameLoader { return true; } if (URLUtil.isAssetUrl(url)) { - // load asset in a separate thread as it involves IO - WebViewWorker.getHandler().obtainMessage( - WebViewWorker.MSG_ADD_STREAMLOADER, - new FileLoader(url, loadListener, FileLoader.TYPE_ASSET, - true)).sendToTarget(); + if (loadListener.isSynchronous()) { + new FileLoader(url, loadListener, FileLoader.TYPE_ASSET, + true).load(); + } else { + // load asset in a separate thread as it involves IO + WebViewWorker.getHandler().obtainMessage( + WebViewWorker.MSG_ADD_STREAMLOADER, + new FileLoader(url, loadListener, FileLoader.TYPE_ASSET, + true)).sendToTarget(); + } return true; } else if (URLUtil.isResourceUrl(url)) { - // load resource in a separate thread as it involves IO - WebViewWorker.getHandler().obtainMessage( - WebViewWorker.MSG_ADD_STREAMLOADER, - new FileLoader(url, loadListener, FileLoader.TYPE_RES, - true)).sendToTarget(); + if (loadListener.isSynchronous()) { + new FileLoader(url, loadListener, FileLoader.TYPE_RES, + true).load(); + } else { + // load resource in a separate thread as it involves IO + WebViewWorker.getHandler().obtainMessage( + WebViewWorker.MSG_ADD_STREAMLOADER, + new FileLoader(url, loadListener, FileLoader.TYPE_RES, + true)).sendToTarget(); + } return true; } else if (URLUtil.isFileUrl(url)) { - // load file in a separate thread as it involves IO - WebViewWorker.getHandler().obtainMessage( - WebViewWorker.MSG_ADD_STREAMLOADER, - new FileLoader(url, loadListener, FileLoader.TYPE_FILE, - settings.getAllowFileAccess())).sendToTarget(); + if (loadListener.isSynchronous()) { + new FileLoader(url, loadListener, FileLoader.TYPE_FILE, + settings.getAllowFileAccess()).load(); + } else { + // load file in a separate thread as it involves IO + WebViewWorker.getHandler().obtainMessage( + WebViewWorker.MSG_ADD_STREAMLOADER, + new FileLoader(url, loadListener, FileLoader.TYPE_FILE, + settings.getAllowFileAccess())).sendToTarget(); + } return true; } else if (URLUtil.isContentUrl(url)) { // Send the raw url to the ContentLoader because it will do a // permission check and the url has to match. - // load content in a separate thread as it involves IO - WebViewWorker.getHandler().obtainMessage( - WebViewWorker.MSG_ADD_STREAMLOADER, - new ContentLoader(loadListener.url(), loadListener)) - .sendToTarget(); + if (loadListener.isSynchronous()) { + new ContentLoader(loadListener.url(), loadListener).load(); + } else { + // load content in a separate thread as it involves IO + WebViewWorker.getHandler().obtainMessage( + WebViewWorker.MSG_ADD_STREAMLOADER, + new ContentLoader(loadListener.url(), loadListener)) + .sendToTarget(); + } return true; } else if (URLUtil.isDataUrl(url)) { // load data in the current thread to reduce the latency diff --git a/core/tests/coretests/src/android/provider/SettingsProviderTest.java b/core/tests/coretests/src/android/provider/SettingsProviderTest.java index f82d79ad728b..370ae78b146e 100644 --- a/core/tests/coretests/src/android/provider/SettingsProviderTest.java +++ b/core/tests/coretests/src/android/provider/SettingsProviderTest.java @@ -59,7 +59,7 @@ public class SettingsProviderTest extends AndroidTestCase { assertEquals("content://settings/system/test_setting", Settings.System.getUriFor("test_setting").toString()); - assertEquals("content://settings/gservices/test_service", + assertEquals("content://settings/secure/test_service", Settings.Secure.getUriFor("test_service").toString()); // These tables use the row name (not ID) as their content URI. diff --git a/libs/audioflinger/AudioPolicyManagerBase.cpp b/libs/audioflinger/AudioPolicyManagerBase.cpp index 7b866c7737fd..cfcc3ea9e2ee 100644 --- a/libs/audioflinger/AudioPolicyManagerBase.cpp +++ b/libs/audioflinger/AudioPolicyManagerBase.cpp @@ -1290,7 +1290,7 @@ void AudioPolicyManagerBase::checkOutputForStrategy(routing_strategy strategy, u a2dpOutputDesc->changeRefCount((AudioSystem::stream_type)i,-refCount); } } - // do not change newDevice is it was already set before this call by a previous call to + // do not change newDevice if it was already set before this call by a previous call to // getNewDevice() or checkOutputForStrategy() for a strategy with higher priority if (newDevice == 0 && hwOutputDesc->isUsedByStrategy(strategy)) { newDevice = getDeviceForStrategy(strategy, false); @@ -1466,6 +1466,12 @@ uint32_t AudioPolicyManagerBase::getDeviceForStrategy(routing_strategy strategy, case STRATEGY_MEDIA: { uint32_t device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_AUX_DIGITAL; + if (device2 == 0) { + device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE; + } + if (device2 == 0) { + device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET; + } #ifdef WITH_A2DP if (mA2dpOutput != 0) { if (strategy == STRATEGY_SONIFICATION && !a2dpUsedForSonification()) { @@ -1483,12 +1489,6 @@ uint32_t AudioPolicyManagerBase::getDeviceForStrategy(routing_strategy strategy, } #endif if (device2 == 0) { - device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE; - } - if (device2 == 0) { - device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET; - } - if (device2 == 0) { device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER; } |