Loading go/src/com/android/launcher3/model/LoaderResults.java→go/src/com/android/launcher3/model/LauncherBinder.java +3 −3 Original line number Diff line number Diff line Loading @@ -22,11 +22,11 @@ import com.android.launcher3.LauncherAppState; import com.android.launcher3.model.BgDataModel.Callbacks; /** * Helper class to handle results of {@link com.android.launcher3.model.LoaderTask}. * Binds the results of {@link com.android.launcher3.model.LoaderTask} to the Callbacks objects. */ public class LoaderResults extends BaseLoaderResults { public class LauncherBinder extends BaseLauncherBinder { public LoaderResults(LauncherAppState app, BgDataModel dataModel, public LauncherBinder(LauncherAppState app, BgDataModel dataModel, AllAppsList allAppsList, Callbacks[] callbacks) { super(app, dataModel, allAppsList, callbacks, MAIN_EXECUTOR); } Loading src/com/android/launcher3/LauncherModel.java +7 −7 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ import com.android.launcher3.model.BgDataModel; import com.android.launcher3.model.BgDataModel.Callbacks; import com.android.launcher3.model.CacheDataUpdatedTask; import com.android.launcher3.model.ItemInstallQueue; import com.android.launcher3.model.LoaderResults; import com.android.launcher3.model.LauncherBinder; import com.android.launcher3.model.LoaderTask; import com.android.launcher3.model.ModelDelegate; import com.android.launcher3.model.ModelWriter; Loading Loading @@ -405,22 +405,22 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi MAIN_EXECUTOR.execute(cb::clearPendingBinds); } LoaderResults loaderResults = new LoaderResults( LauncherBinder launcherBinder = new LauncherBinder( mApp, mBgDataModel, mBgAllAppsList, callbacksList); if (bindDirectly) { // Divide the set of loaded items into those that we are binding synchronously, // and everything else that is to be bound normally (asynchronously). loaderResults.bindWorkspace(bindAllCallbacks); launcherBinder.bindWorkspace(bindAllCallbacks); // For now, continue posting the binding of AllApps as there are other // issues that arise from that. loaderResults.bindAllApps(); loaderResults.bindDeepShortcuts(); loaderResults.bindWidgets(); launcherBinder.bindAllApps(); launcherBinder.bindDeepShortcuts(); launcherBinder.bindWidgets(); return true; } else { stopLoader(); mLoaderTask = new LoaderTask( mApp, mBgAllAppsList, mBgDataModel, mModelDelegate, loaderResults); mApp, mBgAllAppsList, mBgDataModel, mModelDelegate, launcherBinder); // Always post the loader task, instead of running directly // (even on same thread) so that we exit any nested synchronized blocks Loading src/com/android/launcher3/model/BaseLoaderResults.java→src/com/android/launcher3/model/BaseLauncherBinder.java +16 −5 Original line number Diff line number Diff line Loading @@ -47,12 +47,11 @@ import java.util.Objects; import java.util.concurrent.Executor; /** * Base Helper class to handle results of {@link com.android.launcher3.model.LoaderTask}. * Binds the results of {@link com.android.launcher3.model.LoaderTask} to the Callbacks objects. */ public abstract class BaseLoaderResults { public abstract class BaseLauncherBinder { protected static final String TAG = "LoaderResults"; protected static final int INVALID_SCREEN_ID = -1; protected static final String TAG = "LauncherBinder"; private static final int ITEMS_CHUNK = 6; // batch size for the workspace icons protected final LooperExecutor mUiExecutor; Loading @@ -65,7 +64,7 @@ public abstract class BaseLoaderResults { private int mMyBindingId; public BaseLoaderResults(LauncherAppState app, BgDataModel dataModel, public BaseLauncherBinder(LauncherAppState app, BgDataModel dataModel, AllAppsList allAppsList, Callbacks[] callbacksList, LooperExecutor uiExecutor) { mUiExecutor = uiExecutor; mApp = app; Loading Loading @@ -101,8 +100,14 @@ public abstract class BaseLoaderResults { } } /** * BindDeepShortcuts is abstract because it is a no-op for the go launcher. */ public abstract void bindDeepShortcuts(); /** * Binds the all apps results from LoaderTask to the callbacks UX. */ public void bindAllApps() { // shallow copy AppInfo[] apps = mBgAllAppsList.copyData(); Loading @@ -110,6 +115,9 @@ public abstract class BaseLoaderResults { executeCallbacksTask(c -> c.bindAllApplications(apps, flags), mUiExecutor); } /** * bindWidgets is abstract because it is a no-op for the go launcher. */ public abstract void bindWidgets(); /** Loading Loading @@ -160,6 +168,9 @@ public abstract class BaseLoaderResults { }); } /** * Only used in LoaderTask. */ public LooperIdleLock newIdleLock(Object lock) { LooperIdleLock idleLock = new LooperIdleLock(lock, mUiExecutor.getLooper()); // If we are not binding or if the main looper is already idle, there is no reason to wait Loading src/com/android/launcher3/model/LoaderTask.java +8 −8 Original line number Diff line number Diff line Loading @@ -125,7 +125,7 @@ public class LoaderTask implements Runnable { private FirstScreenBroadcast mFirstScreenBroadcast; private final LoaderResults mResults; private final LauncherBinder mLauncherBinder; private final LauncherApps mLauncherApps; private final UserManager mUserManager; Loading @@ -145,12 +145,12 @@ public class LoaderTask implements Runnable { private String mDbName; public LoaderTask(LauncherAppState app, AllAppsList bgAllAppsList, BgDataModel dataModel, ModelDelegate modelDelegate, LoaderResults results) { ModelDelegate modelDelegate, LauncherBinder launcherBinder) { mApp = app; mBgAllAppsList = bgAllAppsList; mBgDataModel = dataModel; mModelDelegate = modelDelegate; mResults = results; mLauncherBinder = launcherBinder; mLauncherApps = mApp.getContext().getSystemService(LauncherApps.class); mUserManager = mApp.getContext().getSystemService(UserManager.class); Loading @@ -163,7 +163,7 @@ public class LoaderTask implements Runnable { // 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 = mResults.newIdleLock(this); LooperIdleLock idleLock = mLauncherBinder.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)); Loading Loading @@ -221,7 +221,7 @@ public class LoaderTask implements Runnable { } verifyNotStopped(); mResults.bindWorkspace(true /* incrementBindId */); mLauncherBinder.bindWorkspace(true /* incrementBindId */); logASplit(logger, "bindWorkspace"); mModelDelegate.workspaceLoadComplete(); Loading @@ -245,7 +245,7 @@ public class LoaderTask implements Runnable { logASplit(logger, "loadAllApps"); verifyNotStopped(); mResults.bindAllApps(); mLauncherBinder.bindAllApps(); logASplit(logger, "bindAllApps"); verifyNotStopped(); Loading @@ -271,7 +271,7 @@ public class LoaderTask implements Runnable { logASplit(logger, "loadDeepShortcuts"); verifyNotStopped(); mResults.bindDeepShortcuts(); mLauncherBinder.bindDeepShortcuts(); logASplit(logger, "bindDeepShortcuts"); verifyNotStopped(); Loading @@ -290,7 +290,7 @@ public class LoaderTask implements Runnable { logASplit(logger, "load widgets"); verifyNotStopped(); mResults.bindWidgets(); mLauncherBinder.bindWidgets(); logASplit(logger, "bindWidgets"); verifyNotStopped(); Loading src_shortcuts_overrides/com/android/launcher3/model/LoaderResults.java→src_shortcuts_overrides/com/android/launcher3/model/LauncherBinder.java +3 −3 Original line number Diff line number Diff line Loading @@ -27,11 +27,11 @@ import java.util.HashMap; import java.util.List; /** * Helper class to handle results of {@link com.android.launcher3.model.LoaderTask}. * Binds the results of {@link com.android.launcher3.model.LoaderTask} to the Callbacks objects. */ public class LoaderResults extends BaseLoaderResults { public class LauncherBinder extends BaseLauncherBinder { public LoaderResults(LauncherAppState app, BgDataModel dataModel, public LauncherBinder(LauncherAppState app, BgDataModel dataModel, AllAppsList allAppsList, Callbacks[] callbacks) { super(app, dataModel, allAppsList, callbacks, MAIN_EXECUTOR); } Loading Loading
go/src/com/android/launcher3/model/LoaderResults.java→go/src/com/android/launcher3/model/LauncherBinder.java +3 −3 Original line number Diff line number Diff line Loading @@ -22,11 +22,11 @@ import com.android.launcher3.LauncherAppState; import com.android.launcher3.model.BgDataModel.Callbacks; /** * Helper class to handle results of {@link com.android.launcher3.model.LoaderTask}. * Binds the results of {@link com.android.launcher3.model.LoaderTask} to the Callbacks objects. */ public class LoaderResults extends BaseLoaderResults { public class LauncherBinder extends BaseLauncherBinder { public LoaderResults(LauncherAppState app, BgDataModel dataModel, public LauncherBinder(LauncherAppState app, BgDataModel dataModel, AllAppsList allAppsList, Callbacks[] callbacks) { super(app, dataModel, allAppsList, callbacks, MAIN_EXECUTOR); } Loading
src/com/android/launcher3/LauncherModel.java +7 −7 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ import com.android.launcher3.model.BgDataModel; import com.android.launcher3.model.BgDataModel.Callbacks; import com.android.launcher3.model.CacheDataUpdatedTask; import com.android.launcher3.model.ItemInstallQueue; import com.android.launcher3.model.LoaderResults; import com.android.launcher3.model.LauncherBinder; import com.android.launcher3.model.LoaderTask; import com.android.launcher3.model.ModelDelegate; import com.android.launcher3.model.ModelWriter; Loading Loading @@ -405,22 +405,22 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi MAIN_EXECUTOR.execute(cb::clearPendingBinds); } LoaderResults loaderResults = new LoaderResults( LauncherBinder launcherBinder = new LauncherBinder( mApp, mBgDataModel, mBgAllAppsList, callbacksList); if (bindDirectly) { // Divide the set of loaded items into those that we are binding synchronously, // and everything else that is to be bound normally (asynchronously). loaderResults.bindWorkspace(bindAllCallbacks); launcherBinder.bindWorkspace(bindAllCallbacks); // For now, continue posting the binding of AllApps as there are other // issues that arise from that. loaderResults.bindAllApps(); loaderResults.bindDeepShortcuts(); loaderResults.bindWidgets(); launcherBinder.bindAllApps(); launcherBinder.bindDeepShortcuts(); launcherBinder.bindWidgets(); return true; } else { stopLoader(); mLoaderTask = new LoaderTask( mApp, mBgAllAppsList, mBgDataModel, mModelDelegate, loaderResults); mApp, mBgAllAppsList, mBgDataModel, mModelDelegate, launcherBinder); // Always post the loader task, instead of running directly // (even on same thread) so that we exit any nested synchronized blocks Loading
src/com/android/launcher3/model/BaseLoaderResults.java→src/com/android/launcher3/model/BaseLauncherBinder.java +16 −5 Original line number Diff line number Diff line Loading @@ -47,12 +47,11 @@ import java.util.Objects; import java.util.concurrent.Executor; /** * Base Helper class to handle results of {@link com.android.launcher3.model.LoaderTask}. * Binds the results of {@link com.android.launcher3.model.LoaderTask} to the Callbacks objects. */ public abstract class BaseLoaderResults { public abstract class BaseLauncherBinder { protected static final String TAG = "LoaderResults"; protected static final int INVALID_SCREEN_ID = -1; protected static final String TAG = "LauncherBinder"; private static final int ITEMS_CHUNK = 6; // batch size for the workspace icons protected final LooperExecutor mUiExecutor; Loading @@ -65,7 +64,7 @@ public abstract class BaseLoaderResults { private int mMyBindingId; public BaseLoaderResults(LauncherAppState app, BgDataModel dataModel, public BaseLauncherBinder(LauncherAppState app, BgDataModel dataModel, AllAppsList allAppsList, Callbacks[] callbacksList, LooperExecutor uiExecutor) { mUiExecutor = uiExecutor; mApp = app; Loading Loading @@ -101,8 +100,14 @@ public abstract class BaseLoaderResults { } } /** * BindDeepShortcuts is abstract because it is a no-op for the go launcher. */ public abstract void bindDeepShortcuts(); /** * Binds the all apps results from LoaderTask to the callbacks UX. */ public void bindAllApps() { // shallow copy AppInfo[] apps = mBgAllAppsList.copyData(); Loading @@ -110,6 +115,9 @@ public abstract class BaseLoaderResults { executeCallbacksTask(c -> c.bindAllApplications(apps, flags), mUiExecutor); } /** * bindWidgets is abstract because it is a no-op for the go launcher. */ public abstract void bindWidgets(); /** Loading Loading @@ -160,6 +168,9 @@ public abstract class BaseLoaderResults { }); } /** * Only used in LoaderTask. */ public LooperIdleLock newIdleLock(Object lock) { LooperIdleLock idleLock = new LooperIdleLock(lock, mUiExecutor.getLooper()); // If we are not binding or if the main looper is already idle, there is no reason to wait Loading
src/com/android/launcher3/model/LoaderTask.java +8 −8 Original line number Diff line number Diff line Loading @@ -125,7 +125,7 @@ public class LoaderTask implements Runnable { private FirstScreenBroadcast mFirstScreenBroadcast; private final LoaderResults mResults; private final LauncherBinder mLauncherBinder; private final LauncherApps mLauncherApps; private final UserManager mUserManager; Loading @@ -145,12 +145,12 @@ public class LoaderTask implements Runnable { private String mDbName; public LoaderTask(LauncherAppState app, AllAppsList bgAllAppsList, BgDataModel dataModel, ModelDelegate modelDelegate, LoaderResults results) { ModelDelegate modelDelegate, LauncherBinder launcherBinder) { mApp = app; mBgAllAppsList = bgAllAppsList; mBgDataModel = dataModel; mModelDelegate = modelDelegate; mResults = results; mLauncherBinder = launcherBinder; mLauncherApps = mApp.getContext().getSystemService(LauncherApps.class); mUserManager = mApp.getContext().getSystemService(UserManager.class); Loading @@ -163,7 +163,7 @@ public class LoaderTask implements Runnable { // 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 = mResults.newIdleLock(this); LooperIdleLock idleLock = mLauncherBinder.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)); Loading Loading @@ -221,7 +221,7 @@ public class LoaderTask implements Runnable { } verifyNotStopped(); mResults.bindWorkspace(true /* incrementBindId */); mLauncherBinder.bindWorkspace(true /* incrementBindId */); logASplit(logger, "bindWorkspace"); mModelDelegate.workspaceLoadComplete(); Loading @@ -245,7 +245,7 @@ public class LoaderTask implements Runnable { logASplit(logger, "loadAllApps"); verifyNotStopped(); mResults.bindAllApps(); mLauncherBinder.bindAllApps(); logASplit(logger, "bindAllApps"); verifyNotStopped(); Loading @@ -271,7 +271,7 @@ public class LoaderTask implements Runnable { logASplit(logger, "loadDeepShortcuts"); verifyNotStopped(); mResults.bindDeepShortcuts(); mLauncherBinder.bindDeepShortcuts(); logASplit(logger, "bindDeepShortcuts"); verifyNotStopped(); Loading @@ -290,7 +290,7 @@ public class LoaderTask implements Runnable { logASplit(logger, "load widgets"); verifyNotStopped(); mResults.bindWidgets(); mLauncherBinder.bindWidgets(); logASplit(logger, "bindWidgets"); verifyNotStopped(); Loading
src_shortcuts_overrides/com/android/launcher3/model/LoaderResults.java→src_shortcuts_overrides/com/android/launcher3/model/LauncherBinder.java +3 −3 Original line number Diff line number Diff line Loading @@ -27,11 +27,11 @@ import java.util.HashMap; import java.util.List; /** * Helper class to handle results of {@link com.android.launcher3.model.LoaderTask}. * Binds the results of {@link com.android.launcher3.model.LoaderTask} to the Callbacks objects. */ public class LoaderResults extends BaseLoaderResults { public class LauncherBinder extends BaseLauncherBinder { public LoaderResults(LauncherAppState app, BgDataModel dataModel, public LauncherBinder(LauncherAppState app, BgDataModel dataModel, AllAppsList allAppsList, Callbacks[] callbacks) { super(app, dataModel, allAppsList, callbacks, MAIN_EXECUTOR); } Loading