#############################################
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 41e2fd9..7389f34 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -338,6 +338,10 @@
Allow multiple tabs per app
Load images
+
+ Load audio
+ Play audio on web pages
+
Display images on web pages
diff --git a/res/xml/bandwidth_preferences.xml b/res/xml/bandwidth_preferences.xml
index 1762b80..ae00881 100644
--- a/res/xml/bandwidth_preferences.xml
+++ b/res/xml/bandwidth_preferences.xml
@@ -37,7 +37,13 @@
android:defaultValue="true"
android:title="@string/pref_content_load_images"
android:summary="@string/pref_content_load_images_summary" />
-
+
+
+
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index aa68904..da2c61e 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -848,6 +848,12 @@ public abstract class WebSettings {
throw new MustOverrideException();
}
+ // -- add by chao
+ public synchronized void setLoadsAudioAutomatically(boolean flag) {
+ throw new MustOverrideException();
+ }
+
+ // add by chao
/**
* Gets whether the WebView loads image resources. This includes
* images embedded using the data URI scheme.*/
@@ -859,6 +865,12 @@ public abstract class WebSettings {
throw new MustOverrideException();
}
+ // -- add by chao
+ public synchronized boolean getLoadsAudioAutomatically() {
+ throw new MustOverrideException();
+ }
+ // add by chao --
+
/**
* Sets whether the WebView should not load image resources from the
* network (resources accessed via http and https URI schemes). Note*/
diff --git a/core/java/android/webkit/WebSettingsClassic.java b/core/java/android/webkit/WebSettingsClassic.java
index 73968a7..0614c5a 100644
--- a/core/java/android/webkit/WebSettingsClassic.java
+++ b/core/java/android/webkit/WebSettingsClassic.java
@@ -62,6 +62,7 @@ import android.os.Message;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.util.EventLog;
+import android.util.Log;
import android.os.SystemProperties;
import java.util.Locale;
@@ -116,6 +117,9 @@ public class WebSettingsClassic extends WebSettings {
private int mDefaultFixedFontSize = 13;
private int mPageCacheCapacity = 0;
private boolean mLoadsImagesAutomatically = true;
+ // -- add by chao
+ private boolean mLoadsAudioAutomatically = true;
+ // add by chao --
private boolean mBlockNetworkImage = false;
private boolean mBlockNetworkLoads;
private boolean mJavaScriptEnabled = false;
@@ -1142,6 +1146,16 @@ public class WebSettingsClassic extends WebSettings {
}
}
+ // -- add by chao
+ @Override
+ public synchronized void setLoadsAudioAutomatically(boolean flag) {
+ if (mLoadsAudioAutomatically != flag) {
+ Log.d("chao","setLoadsAudioAutomatically flag = " + flag);
+ mLoadsAudioAutomatically = flag;
+ postSync();
+ }
+ }
+ // add by chao --
/**
* @see android.webkit.WebSettings#getLoadsImagesAutomatically()
*/
@@ -1149,6 +1163,13 @@ public class WebSettingsClassic extends WebSettings {
public synchronized boolean getLoadsImagesAutomatically() {
return mLoadsImagesAutomatically;
}
+
+ // -- add by chao
+ @Override
+ public synchronized boolean getLoadsAudioAutomatically() {
+ return mLoadsAudioAutomatically;
+ }
+ // add by chao
/**
* @see android.webkit.WebSettings#setBlockNetworkImage(boolean)
diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp
index 79e38d1..6dfc878 100644
--- a/Source/WebCore/page/Settings.cpp
+++ b/Source/WebCore/page/Settings.cpp
@@ -40,7 +40,7 @@
#include "ResourceHandle.h"
#include "StorageMap.h"
#include
-
+#include "AndroidLog.h"
using namespace std;
namespace WebCore {
@@ -917,6 +917,7 @@ void Settings::setShouldUseHighResolutionTimers(bool shouldUseHighResolutionTime
void Settings::setWebAudioEnabled(bool enabled)
{
+ ALOGE("setWebAudioEnable = %d --chao\n", enabled);
m_webAudioEnabled = enabled;
}
diff --git a/Source/WebKit/android/jni/WebSettings.cpp b/Source/WebKit/android/jni/WebSettings.cpp
index fe5ae0b..8348f6b 100644
--- a/Source/WebKit/android/jni/WebSettings.cpp
+++ b/Source/WebKit/android/jni/WebSettings.cpp
@@ -61,6 +61,7 @@
#include
#include
+#include "AndroidLog.h"
#include "ApplicationCacheStorage.h"
#include "BitmapAllocatorAndroid.h"
#include "CachedResourceLoader.h"
@@ -127,6 +128,9 @@ struct FieldIds {
mDefaultFontSize = env->GetFieldID(clazz, "mDefaultFontSize", "I");
mDefaultFixedFontSize = env->GetFieldID(clazz, "mDefaultFixedFontSize", "I");
mLoadsImagesAutomatically = env->GetFieldID(clazz, "mLoadsImagesAutomatically", "Z");
+// add by chao
+ mLoadsAudioAutomatically = env->GetFieldID(clazz, "mLoadsAudioAutomatically", "Z");
+// add by chao end
#ifdef ANDROID_BLOCK_NETWORK_IMAGE
mBlockNetworkImage = env->GetFieldID(clazz, "mBlockNetworkImage", "Z");
#endif
@@ -216,6 +220,9 @@ struct FieldIds {
ALOG_ASSERT(mDefaultFontSize, "Could not find field mDefaultFontSize");
ALOG_ASSERT(mDefaultFixedFontSize, "Could not find field mDefaultFixedFontSize");
ALOG_ASSERT(mLoadsImagesAutomatically, "Could not find field mLoadsImagesAutomatically");
+// add by chao
+ ALOG_ASSERT(mLoadsAudioAutomatically, "Could not find field mLoadsAudioAutomatically");
+// add by chao --
#ifdef ANDROID_BLOCK_NETWORK_IMAGE
ALOG_ASSERT(mBlockNetworkImage, "Could not find field mBlockNetworkImage");
#endif
@@ -277,6 +284,9 @@ struct FieldIds {
jfieldID mDefaultFontSize;
jfieldID mDefaultFixedFontSize;
jfieldID mLoadsImagesAutomatically;
+// --add by chao
+ jfieldID mLoadsAudioAutomatically;
+// add by chao --
#ifdef ANDROID_BLOCK_NETWORK_IMAGE
jfieldID mBlockNetworkImage;
#endif
@@ -471,6 +481,11 @@ public:
if (flag)
cachedResourceLoader->setAutoLoadImages(true);
+// -- add by chao
+ flag = env->GetBooleanField(obj, gFieldIds->mLoadsAudioAutomatically);
+ ALOGE("setWebAudioEnabled = %d --chao \n", flag);
+ s->setWebAudioEnabled(flag);
+// add by chao --
#ifdef ANDROID_BLOCK_NETWORK_IMAGE
flag = env->GetBooleanField(obj, gFieldIds->mBlockNetworkImage);
s->setBlockNetworkImage(flag);