Hi, I have xposed module which makes statusbar icons smaller.
This is the scaling function:
And since I'm not recycling any resource I got a question. What will be with memory?
Is memory for Bitmaps being reused or is it just accumulating?
If I try to recycle any resource I got "Canvas: trying to use a recycled bitmap" error in log and watch statusbar FC.
I've red this article but still have a doubt about memory...
Thanks in advance.
PHP Code:
XposedHelpers.findAndHookMethod("com.android.systemui.statusbar.StatusBarIconView", lpparam.classLoader, "getIconMz", Context.class, "com.android.internal.statusbar.StatusBarIcon", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
context = (Context) param.args[0];
...
param.setResult(scaleIcon(context, (Drawable) param.getResult(), scale));
} });
PHP Code:
public static BitmapDrawable scaleIcon(Context ctx, Drawable icon, int scale){
Bitmap src = ((BitmapDrawable) icon).getBitmap();
Bitmap dest = Bitmap.createScaledBitmap(src, scale, scale, true);
return new BitmapDrawable(context.getResources(), dest);
}
Is memory for Bitmaps being reused or is it just accumulating?
If I try to recycle any resource I got "Canvas: trying to use a recycled bitmap" error in log and watch statusbar FC.
I've red this article but still have a doubt about memory...
Thanks in advance.
via xda-developers http://ift.tt/1nrRdGS
Put the internet to work for you.
No comments:
Post a Comment