Adding support for loading workspace in the absence of Launcher.

> LoadWorkspace can be called with a LoaderResult which does not bind anything.
> Synchronous bind does not look for a valid page id, and will fallback to the
  current pageId similar to full load flow

Bug: 37616877
Change-Id: If14491dc79c5b85ae1019cc93e4e08759df3387d
This commit is contained in:
Sunny Goyal
2017-06-06 14:33:18 -07:00
parent 3a5b835297
commit e86f11fa38
11 changed files with 125 additions and 97 deletions

View File

@@ -116,11 +116,11 @@ public class LoaderTask implements Runnable {
mIconCache = mApp.getIconCache();
}
private synchronized void waitForIdle() {
protected synchronized void waitForIdle() {
// Wait until the either we're stopped or the other threads are done.
// This way we don't start loading all apps until the workspace has settled
// down.
LooperIdleLock idleLock = new LooperIdleLock(this, Looper.getMainLooper());
LooperIdleLock idleLock = mResults.newIdleLock(this);
// Just in case mFlushingWorkerThread changes but we aren't woken up,
// wait no longer than 1sec at a time
while (!mStopped && idleLock.awaitLocked(1000));
@@ -202,7 +202,10 @@ public class LoaderTask implements Runnable {
transaction.commit();
} catch (CancellationException e) {
// Loader stopped, ignore
// Loader stopped, ignore
if (DEBUG_LOADERS) {
Log.d(TAG, "Loader cancelled", e);
}
}
}