Loading core/java/android/widget/RemoteViews.java +2 −19 Original line number Diff line number Diff line Loading @@ -404,6 +404,7 @@ public class RemoteViews implements Parcelable, Filter { // Because pruning can remove the need for bitmaps, we reconstruct the bitmap cache mBitmapCache = new BitmapCache(); setBitmapCache(mBitmapCache); recalculateMemoryUsage(); } private class SetEmptyView extends Action { Loading Loading @@ -2117,26 +2118,8 @@ public class RemoteViews implements Parcelable, Filter { return mMemoryUsage; } @SuppressWarnings("deprecation") public void addBitmapMemory(Bitmap b) { final Bitmap.Config c = b.getConfig(); // If we don't know, be pessimistic and assume 4 int bpp = 4; if (c != null) { switch (c) { case ALPHA_8: bpp = 1; break; case RGB_565: case ARGB_4444: bpp = 2; break; case ARGB_8888: bpp = 4; break; } } increment(b.getWidth() * b.getHeight() * bpp); increment(b.getAllocationByteCount()); } int mMemoryUsage; Loading services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java +9 −8 Original line number Diff line number Diff line Loading @@ -1593,14 +1593,6 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku // Make sure the package runs under the caller uid. mSecurityPolicy.enforceCallFromPackage(callingPackage); final int bitmapMemoryUsage = (views != null) ? views.estimateMemoryUsage() : 0; if (bitmapMemoryUsage > mMaxWidgetBitmapMemory) { throw new IllegalArgumentException("RemoteViews for widget update exceeds" + " maximum bitmap memory usage (used: " + bitmapMemoryUsage + ", max: " + mMaxWidgetBitmapMemory + ")"); } synchronized (mLock) { ensureGroupStateLoadedLocked(userId); Loading Loading @@ -1812,6 +1804,15 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku // For a full update we replace the RemoteViews completely. widget.views = views; } int memoryUsage; if ((UserHandle.getAppId(Binder.getCallingUid()) != Process.SYSTEM_UID) && (widget.views != null) && ((memoryUsage = widget.views.estimateMemoryUsage()) > mMaxWidgetBitmapMemory)) { widget.views = null; throw new IllegalArgumentException("RemoteViews for widget update exceeds" + " maximum bitmap memory usage (used: " + memoryUsage + ", max: " + mMaxWidgetBitmapMemory + ")"); } scheduleNotifyUpdateAppWidgetLocked(widget, widget.getEffectiveViewsLocked()); } } Loading Loading
core/java/android/widget/RemoteViews.java +2 −19 Original line number Diff line number Diff line Loading @@ -404,6 +404,7 @@ public class RemoteViews implements Parcelable, Filter { // Because pruning can remove the need for bitmaps, we reconstruct the bitmap cache mBitmapCache = new BitmapCache(); setBitmapCache(mBitmapCache); recalculateMemoryUsage(); } private class SetEmptyView extends Action { Loading Loading @@ -2117,26 +2118,8 @@ public class RemoteViews implements Parcelable, Filter { return mMemoryUsage; } @SuppressWarnings("deprecation") public void addBitmapMemory(Bitmap b) { final Bitmap.Config c = b.getConfig(); // If we don't know, be pessimistic and assume 4 int bpp = 4; if (c != null) { switch (c) { case ALPHA_8: bpp = 1; break; case RGB_565: case ARGB_4444: bpp = 2; break; case ARGB_8888: bpp = 4; break; } } increment(b.getWidth() * b.getHeight() * bpp); increment(b.getAllocationByteCount()); } int mMemoryUsage; Loading
services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java +9 −8 Original line number Diff line number Diff line Loading @@ -1593,14 +1593,6 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku // Make sure the package runs under the caller uid. mSecurityPolicy.enforceCallFromPackage(callingPackage); final int bitmapMemoryUsage = (views != null) ? views.estimateMemoryUsage() : 0; if (bitmapMemoryUsage > mMaxWidgetBitmapMemory) { throw new IllegalArgumentException("RemoteViews for widget update exceeds" + " maximum bitmap memory usage (used: " + bitmapMemoryUsage + ", max: " + mMaxWidgetBitmapMemory + ")"); } synchronized (mLock) { ensureGroupStateLoadedLocked(userId); Loading Loading @@ -1812,6 +1804,15 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku // For a full update we replace the RemoteViews completely. widget.views = views; } int memoryUsage; if ((UserHandle.getAppId(Binder.getCallingUid()) != Process.SYSTEM_UID) && (widget.views != null) && ((memoryUsage = widget.views.estimateMemoryUsage()) > mMaxWidgetBitmapMemory)) { widget.views = null; throw new IllegalArgumentException("RemoteViews for widget update exceeds" + " maximum bitmap memory usage (used: " + memoryUsage + ", max: " + mMaxWidgetBitmapMemory + ")"); } scheduleNotifyUpdateAppWidgetLocked(widget, widget.getEffectiveViewsLocked()); } } Loading