Improve AyncTask throughput inside WidgetPreviewLoader

b/21133230
> Synchronized block was creating a bottleneck for the AsyncTasks.
> Remove calls that doesn't need to be synchronized outside synchronized block.
> Also removed setAlpha call as after the bottleneck was removed,
Inefficient alpha view usage alert started popping up in traceview.
Due to less jankness, removing the fadein animation doesn't have any
visible effect.

Link to lock congestion visualization:
https://x20web.corp.google.com/~hyunyoungs/no_crawl/traceview/traceview_lockcontention.html

Result: gfx-avg-jank delta = "-1"
Change-Id: If12817df0730f346cdba7e2f38f232eb9a4336c0
This commit is contained in:
Hyunyoung Song
2015-06-05 13:30:19 -07:00
parent a56eab41fb
commit f00d02b254
3 changed files with 21 additions and 11 deletions

View File

@@ -26,6 +26,7 @@ import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnLayoutChangeListener;
import android.view.ViewPropertyAnimator;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -175,7 +176,8 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
if (bitmap != null) {
mWidgetImage.setBitmap(bitmap);
mWidgetImage.setAlpha(0f);
mWidgetImage.animate().alpha(1.0f).setDuration(FADE_IN_DURATION_MS);
ViewPropertyAnimator anim = mWidgetImage.animate();
anim.alpha(1.0f).setDuration(FADE_IN_DURATION_MS);
}
}