Fix a race condition where the extra view may not update timely.

Previously, we queried for the extra view's stats during the rebuild.
The full rebuild can take an arduous amount of time. By moving the
background calculation outside of the rebuild code path, we can
load the stats in the background and update the view outside of the
app loading cycle.

Bug: 35144044
Test: Manual -- this was race condition-y, so I just tested several
times.

Change-Id: Id2f92e32c3b3f9c5d5cf4a7308cca38c2e52789c
This commit is contained in:
Daniel Nishi
2017-02-08 12:29:24 -08:00
parent bbd80517f0
commit a412c30d90
3 changed files with 32 additions and 9 deletions

View File

@@ -66,7 +66,8 @@ public class MusicViewHolderControllerTest {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mVolume = new VolumeInfo("id", 0, null, "id");
mController = new MusicViewHolderController(mContext, mSource, mVolume.fsUuid);
mController = new MusicViewHolderController(mContext, mSource, mVolume.fsUuid,
new UserHandle(0));
LayoutInflater inflater = LayoutInflater.from(mContext);
mHolder = AppViewHolder.createOrRecycle(inflater, null);