summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt2
-rw-r--r--core/java/android/app/FragmentManager.java9
-rw-r--r--core/java/android/webkit/WebSettings.java20
-rw-r--r--core/java/android/webkit/WebSettingsClassic.java20
-rw-r--r--core/java/com/android/internal/app/ResolverActivity.java2
-rw-r--r--libs/hwui/FontRenderer.cpp3
-rw-r--r--libs/hwui/FontRenderer.h5
-rw-r--r--libs/hwui/GammaFontRenderer.h1
-rw-r--r--libs/hwui/GradientCache.cpp9
-rw-r--r--libs/hwui/GradientCache.h4
-rw-r--r--libs/hwui/ResourceCache.cpp23
11 files changed, 80 insertions, 18 deletions
diff --git a/api/current.txt b/api/current.txt
index 093d4c358ea0..29e468b39307 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -26615,6 +26615,7 @@ package android.webkit {
method public boolean getLightTouchEnabled();
method public boolean getLoadWithOverviewMode();
method public synchronized boolean getLoadsImagesAutomatically();
+ method public boolean getMediaPlaybackRequiresUserGesture();
method public synchronized int getMinimumFontSize();
method public synchronized int getMinimumLogicalFontSize();
method public deprecated boolean getNavDump();
@@ -26664,6 +26665,7 @@ package android.webkit {
method public void setLightTouchEnabled(boolean);
method public void setLoadWithOverviewMode(boolean);
method public synchronized void setLoadsImagesAutomatically(boolean);
+ method public void setMediaPlaybackRequiresUserGesture(boolean);
method public synchronized void setMinimumFontSize(int);
method public synchronized void setMinimumLogicalFontSize(int);
method public deprecated void setNavDump(boolean);
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index b0cc37b90e85..1bf7785bc668 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -22,6 +22,8 @@ import android.animation.AnimatorListenerAdapter;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.os.Bundle;
+// TODO(cmautner): remove after fixing 6829431.
+import android.os.Debug;
import android.os.Handler;
import android.os.Looper;
import android.os.Parcel;
@@ -383,7 +385,8 @@ final class FragmentManagerState implements Parcelable {
* Container for fragments associated with an activity.
*/
final class FragmentManagerImpl extends FragmentManager {
- static boolean DEBUG = false;
+ // TODO(cmautner): restore to false after fixing 6829431.
+ static boolean DEBUG = true;
static final String TAG = "FragmentManager";
static final String TARGET_REQUEST_CODE_STATE_TAG = "android:target_req_state";
@@ -732,6 +735,10 @@ final class FragmentManagerImpl extends FragmentManager {
void moveToState(Fragment f, int newState, int transit, int transitionStyle,
boolean keepActive) {
+ // TODO(cmautner): remove after fixing 6829431.
+ if (DEBUG) Log.v(TAG, "moveToState: " + f
+ + " oldState=" + f.mState + " newState=" + newState
+ + " mRemoving=" + f.mRemoving + " Callers=" + Debug.getCallers(5));
// Fragments that are not currently added will sit in the onCreate() state.
if (!f.mAdded && newState > Fragment.CREATED) {
newState = Fragment.CREATED;
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 1a868d5b4bf9..7a67a146f0ff 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -199,6 +199,26 @@ public abstract class WebSettings {
}
/**
+ * Sets whether the WebView requires a user gesture to play media.
+ * The default is true.
+ *
+ * @param require whether the WebView requires a user gesture to play media
+ */
+ public void setMediaPlaybackRequiresUserGesture(boolean require) {
+ throw new MustOverrideException();
+ }
+
+ /**
+ * Gets whether the WebView requires a user gesture to play media.
+ *
+ * @return true if the WebView requires a user gesture to play media
+ * @see #setMediaPlaybackRequiresUserGesture
+ */
+ public boolean getMediaPlaybackRequiresUserGesture() {
+ throw new MustOverrideException();
+ }
+
+ /**
* Sets whether the WebView should use its built-in zoom mechanisms. The
* built-in zoom mechanisms comprise on-screen zoom controls, which are
* displayed over the WebView's content, and the use of a pinch gesture to
diff --git a/core/java/android/webkit/WebSettingsClassic.java b/core/java/android/webkit/WebSettingsClassic.java
index bd30464aa47c..66651f7be2a3 100644
--- a/core/java/android/webkit/WebSettingsClassic.java
+++ b/core/java/android/webkit/WebSettingsClassic.java
@@ -116,6 +116,7 @@ public class WebSettingsClassic extends WebSettings {
private boolean mNeedInitialFocus = true;
private boolean mNavDump = false;
private boolean mSupportZoom = true;
+ private boolean mMediaPlaybackRequiresUserGesture = true;
private boolean mBuiltInZoomControls = false;
private boolean mDisplayZoomControls = true;
private boolean mAllowFileAccess = true;
@@ -459,6 +460,25 @@ public class WebSettingsClassic extends WebSettings {
}
/**
+ * @see android.webkit.WebSettings#setMediaPlaybackRequiresUserGesture(boolean)
+ */
+ @Override
+ public void setMediaPlaybackRequiresUserGesture(boolean support) {
+ if (mMediaPlaybackRequiresUserGesture != support) {
+ mMediaPlaybackRequiresUserGesture = support;
+ postSync();
+ }
+ }
+
+ /**
+ * @see android.webkit.WebSettings#getMediaPlaybackRequiresUserGesture()
+ */
+ @Override
+ public boolean getMediaPlaybackRequiresUserGesture() {
+ return mMediaPlaybackRequiresUserGesture;
+ }
+
+ /**
* @see android.webkit.WebSettings#setBuiltInZoomControls(boolean)
*/
@Override
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index ff8a6d2d811b..84fe8cefa784 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -261,7 +261,7 @@ public class ResolverActivity extends AlertActivity implements AdapterView.OnIte
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
final int checkedPos = mGrid.getCheckedItemPosition();
final boolean hasValidSelection = checkedPos != GridView.INVALID_POSITION;
- if (!hasValidSelection || (mAlwaysUseOption && mLastSelected != checkedPos)) {
+ if (mAlwaysUseOption && (!hasValidSelection || mLastSelected != checkedPos)) {
mAlwaysButton.setEnabled(hasValidSelection);
mOnceButton.setEnabled(hasValidSelection);
if (hasValidSelection) {
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index 3b3691c637d1..eeb37cbe08c1 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -697,8 +697,7 @@ void FontRenderer::cacheBitmap(const SkGlyph& glyph, CachedGlyphInfo* cachedGlyp
}
CacheTexture* FontRenderer::createCacheTexture(int width, int height, bool allocate) {
- uint8_t* textureMemory = NULL;
- CacheTexture* cacheTexture = new CacheTexture(textureMemory, width, height);
+ CacheTexture* cacheTexture = new CacheTexture(width, height);
if (allocate) {
allocateTextureMemory(cacheTexture);
diff --git a/libs/hwui/FontRenderer.h b/libs/hwui/FontRenderer.h
index 2ab680e0e379..b7b4ec9683f9 100644
--- a/libs/hwui/FontRenderer.h
+++ b/libs/hwui/FontRenderer.h
@@ -61,9 +61,8 @@ class FontRenderer;
class CacheTexture {
public:
- CacheTexture() { }
- CacheTexture(uint8_t* texture, uint16_t width, uint16_t height) :
- mTexture(texture), mTextureId(0), mWidth(width), mHeight(height),
+ CacheTexture(uint16_t width, uint16_t height) :
+ mTexture(NULL), mTextureId(0), mWidth(width), mHeight(height),
mLinearFiltering(false) { }
~CacheTexture() {
if (mTexture) {
diff --git a/libs/hwui/GammaFontRenderer.h b/libs/hwui/GammaFontRenderer.h
index 9180778e9aa9..c4a50bed3ad2 100644
--- a/libs/hwui/GammaFontRenderer.h
+++ b/libs/hwui/GammaFontRenderer.h
@@ -59,6 +59,7 @@ public:
void clear() {
delete mRenderer;
+ mRenderer = NULL;
}
void flush() {
diff --git a/libs/hwui/GradientCache.cpp b/libs/hwui/GradientCache.cpp
index 0016b8145fda..c7ab9c5ad5cd 100644
--- a/libs/hwui/GradientCache.cpp
+++ b/libs/hwui/GradientCache.cpp
@@ -16,8 +16,6 @@
#define LOG_TAG "OpenGLRenderer"
-#include <GLES2/gl2.h>
-
#include <SkCanvas.h>
#include <SkGradientShader.h>
@@ -45,6 +43,8 @@ GradientCache::GradientCache():
INIT_LOGD(" Using default gradient cache size of %.2fMB", DEFAULT_GRADIENT_CACHE_SIZE);
}
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize);
+
mCache.setOnEntryRemovedListener(this);
}
@@ -116,8 +116,11 @@ void GradientCache::clear() {
Texture* GradientCache::addLinearGradient(GradientCacheEntry& gradient,
uint32_t* colors, float* positions, int count, SkShader::TileMode tileMode) {
+ int width = 256 * (count - 1);
+ width = width < mMaxTextureSize ? width : mMaxTextureSize;
+
SkBitmap bitmap;
- bitmap.setConfig(SkBitmap::kARGB_8888_Config, 256 * (count - 1), 1);
+ bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, 1);
bitmap.allocPixels();
bitmap.eraseColor(0);
diff --git a/libs/hwui/GradientCache.h b/libs/hwui/GradientCache.h
index ac346846ba99..59515a1ceefb 100644
--- a/libs/hwui/GradientCache.h
+++ b/libs/hwui/GradientCache.h
@@ -17,6 +17,8 @@
#ifndef ANDROID_HWUI_GRADIENT_CACHE_H
#define ANDROID_HWUI_GRADIENT_CACHE_H
+#include <GLES2/gl2.h>
+
#include <SkShader.h>
#include <utils/Mutex.h>
@@ -152,6 +154,8 @@ private:
uint32_t mSize;
uint32_t mMaxSize;
+ GLint mMaxTextureSize;
+
Vector<SkShader*> mGarbage;
mutable Mutex mLock;
}; // class GradientCache
diff --git a/libs/hwui/ResourceCache.cpp b/libs/hwui/ResourceCache.cpp
index cf5f82205e03..2153a8bb89ad 100644
--- a/libs/hwui/ResourceCache.cpp
+++ b/libs/hwui/ResourceCache.cpp
@@ -48,7 +48,8 @@ ResourceCache::~ResourceCache() {
void ResourceCache::incrementRefcount(void* resource, ResourceType resourceType) {
Mutex::Autolock _l(mLock);
- ResourceReference* ref = mCache->indexOfKey(resource) >= 0 ? mCache->valueFor(resource) : NULL;
+ ssize_t index = mCache->indexOfKey(resource);
+ ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : NULL;
if (ref == NULL || mCache->size() == 0) {
ref = new ResourceReference(resourceType);
mCache->add(resource, ref);
@@ -78,7 +79,8 @@ void ResourceCache::incrementRefcount(SkiaColorFilter* filterResource) {
void ResourceCache::decrementRefcount(void* resource) {
Mutex::Autolock _l(mLock);
- ResourceReference* ref = mCache->indexOfKey(resource) >= 0 ? mCache->valueFor(resource) : NULL;
+ ssize_t index = mCache->indexOfKey(resource);
+ ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : NULL;
if (ref == NULL) {
// Should not get here - shouldn't get a call to decrement if we're not yet tracking it
return;
@@ -111,12 +113,13 @@ void ResourceCache::decrementRefcount(SkiaColorFilter* filterResource) {
void ResourceCache::recycle(SkBitmap* resource) {
Mutex::Autolock _l(mLock);
- if (mCache->indexOfKey(resource) < 0) {
+ ssize_t index = mCache->indexOfKey(resource);
+ if (index < 0) {
// not tracking this resource; just recycle the pixel data
resource->setPixels(NULL, NULL);
return;
}
- ResourceReference* ref = mCache->indexOfKey(resource) >= 0 ? mCache->valueFor(resource) : NULL;
+ ResourceReference* ref = mCache->valueAt(index);
if (ref == NULL) {
// Should not get here - shouldn't get a call to recycle if we're not yet tracking it
return;
@@ -129,7 +132,8 @@ void ResourceCache::recycle(SkBitmap* resource) {
void ResourceCache::destructor(SkPath* resource) {
Mutex::Autolock _l(mLock);
- ResourceReference* ref = mCache->indexOfKey(resource) >= 0 ? mCache->valueFor(resource) : NULL;
+ ssize_t index = mCache->indexOfKey(resource);
+ ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : NULL;
if (ref == NULL) {
// If we're not tracking this resource, just delete it
if (Caches::hasInstance()) {
@@ -146,7 +150,8 @@ void ResourceCache::destructor(SkPath* resource) {
void ResourceCache::destructor(SkBitmap* resource) {
Mutex::Autolock _l(mLock);
- ResourceReference* ref = mCache->indexOfKey(resource) >= 0 ? mCache->valueFor(resource) : NULL;
+ ssize_t index = mCache->indexOfKey(resource);
+ ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : NULL;
if (ref == NULL) {
// If we're not tracking this resource, just delete it
if (Caches::hasInstance()) {
@@ -163,7 +168,8 @@ void ResourceCache::destructor(SkBitmap* resource) {
void ResourceCache::destructor(SkiaShader* resource) {
Mutex::Autolock _l(mLock);
- ResourceReference* ref = mCache->indexOfKey(resource) >= 0 ? mCache->valueFor(resource) : NULL;
+ ssize_t index = mCache->indexOfKey(resource);
+ ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : NULL;
if (ref == NULL) {
// If we're not tracking this resource, just delete it
delete resource;
@@ -177,7 +183,8 @@ void ResourceCache::destructor(SkiaShader* resource) {
void ResourceCache::destructor(SkiaColorFilter* resource) {
Mutex::Autolock _l(mLock);
- ResourceReference* ref = mCache->indexOfKey(resource) >= 0 ? mCache->valueFor(resource) : NULL;
+ ssize_t index = mCache->indexOfKey(resource);
+ ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : NULL;
if (ref == NULL) {
// If we're not tracking this resource, just delete it
delete resource;