diff options
| author | 2011-08-17 02:41:39 -0700 | |
|---|---|---|
| committer | 2011-08-17 02:41:39 -0700 | |
| commit | deed89a8d54070888d2c6ba06343d213efe01093 (patch) | |
| tree | 5c188b674ad72d2b4100423d8f669db1b68f4e44 | |
| parent | bd151dee646e3b476a8f8e494b7543526438a1eb (diff) | |
| parent | 9a1b3c9c99e5853a655c88ea785e6cf00820bdd6 (diff) | |
Merge "Fix for bug 3429537 Google voice (web version) does not play messages on HC"
| -rw-r--r-- | core/java/android/webkit/HTML5Audio.java | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/core/java/android/webkit/HTML5Audio.java b/core/java/android/webkit/HTML5Audio.java index 6fc0d119f9c9..1e958549809d 100644 --- a/core/java/android/webkit/HTML5Audio.java +++ b/core/java/android/webkit/HTML5Audio.java @@ -27,6 +27,8 @@ import android.os.Message; import android.util.Log; import java.io.IOException; +import java.util.HashMap; +import java.util.Map; import java.util.Timer; import java.util.TimerTask; @@ -46,6 +48,8 @@ class HTML5Audio extends Handler // The C++ MediaPlayerPrivateAndroid object. private int mNativePointer; + // The private status of the view that created this player + private boolean mIsPrivate; private static int IDLE = 0; private static int INITIALIZED = 1; @@ -64,6 +68,9 @@ class HTML5Audio extends Handler // Timer thread -> UI thread private static final int TIMEUPDATE = 100; + private static final String COOKIE = "Cookie"; + private static final String HIDE_URL_LOGS = "x-hide-urls-from-log"; + // The spec says the timer should fire every 250 ms or less. private static final int TIMEUPDATE_PERIOD = 250; // ms // The timer for timeupate events. @@ -138,10 +145,11 @@ class HTML5Audio extends Handler /** * @param nativePtr is the C++ pointer to the MediaPlayerPrivate object. */ - public HTML5Audio(int nativePtr) { + public HTML5Audio(WebViewCore webViewCore, int nativePtr) { // Save the native ptr mNativePointer = nativePtr; resetMediaPlayer(); + mIsPrivate = webViewCore.getWebView().isPrivateBrowsingEnabled(); } private void resetMediaPlayer() { @@ -169,7 +177,17 @@ class HTML5Audio extends Handler if (mState != IDLE) { resetMediaPlayer(); } - mMediaPlayer.setDataSource(url); + String cookieValue = CookieManager.getInstance().getCookie(url, mIsPrivate); + Map<String, String> headers = new HashMap<String, String>(); + + if (cookieValue != null) { + headers.put(COOKIE, cookieValue); + } + if (mIsPrivate) { + headers.put(HIDE_URL_LOGS, "true"); + } + + mMediaPlayer.setDataSource(url, headers); mState = INITIALIZED; mMediaPlayer.prepareAsync(); } catch (IOException e) { |