Loading src/com/android/launcher3/Launcher.java +14 −10 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; import static com.android.launcher3.AbstractFloatingView.TYPE_ICON_SURFACE; import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import static com.android.launcher3.AbstractFloatingView.TYPE_SNACKBAR; import static com.android.launcher3.InstallShortcutReceiver.FLAG_DRAG_AND_DROP; import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.FLAG_CLOSE_POPUPS; Loading @@ -42,6 +41,9 @@ import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKG import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONRESUME; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONSTOP; import static com.android.launcher3.logging.StatsLogManager.containerTypeToAtomState; import static com.android.launcher3.model.ItemInstallQueue.FLAG_ACTIVITY_PAUSED; import static com.android.launcher3.model.ItemInstallQueue.FLAG_DRAG_AND_DROP; import static com.android.launcher3.model.ItemInstallQueue.FLAG_LOADER_RUNNING; import static com.android.launcher3.popup.SystemShortcut.APP_INFO; import static com.android.launcher3.popup.SystemShortcut.INSTALL; import static com.android.launcher3.popup.SystemShortcut.WIDGETS; Loading Loading @@ -119,6 +121,7 @@ import com.android.launcher3.logging.FileLog; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.logging.UserEventDispatcher; import com.android.launcher3.model.BgDataModel.Callbacks; import com.android.launcher3.model.ItemInstallQueue; import com.android.launcher3.model.ModelUtils; import com.android.launcher3.model.ModelWriter; import com.android.launcher3.model.data.AppInfo; Loading Loading @@ -911,8 +914,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche getUserEventDispatcher().startSession(); // Process any items that were added while Launcher was away. InstallShortcutReceiver.disableAndFlushInstallQueue( InstallShortcutReceiver.FLAG_ACTIVITY_PAUSED, this); ItemInstallQueue.INSTANCE.get(this) .resumeModelPush(FLAG_ACTIVITY_PAUSED); // Refresh shortcuts if the permission changed. mModel.validateModelDataOnResume(); Loading Loading @@ -1006,7 +1009,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche if (state == SPRING_LOADED) { // Prevent any Un/InstallShortcutReceivers from updating the db while we are // not on homescreen InstallShortcutReceiver.enableInstallQueue(FLAG_DRAG_AND_DROP); ItemInstallQueue.INSTANCE.get(this).pauseModelPush(FLAG_DRAG_AND_DROP); getRotationHelper().setCurrentStateRequest(REQUEST_LOCK); mWorkspace.showPageIndicatorAtCurrentScroll(); Loading @@ -1031,7 +1034,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche if (state == NORMAL) { // Re-enable any Un/InstallShortcutReceiver and now process any queued items InstallShortcutReceiver.disableAndFlushInstallQueue(FLAG_DRAG_AND_DROP, this); ItemInstallQueue.INSTANCE.get(this) .resumeModelPush(FLAG_DRAG_AND_DROP); // Clear any rotation locks when going to normal state getRotationHelper().setCurrentStateRequest(REQUEST_NONE); Loading Loading @@ -1065,7 +1069,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche @Override protected void onPause() { // Ensure that items added to Launcher are queued until Launcher returns InstallShortcutReceiver.enableInstallQueue(InstallShortcutReceiver.FLAG_ACTIVITY_PAUSED); ItemInstallQueue.INSTANCE.get(this).pauseModelPush(FLAG_ACTIVITY_PAUSED); super.onPause(); mDragController.cancelDrag(); Loading Loading @@ -2420,8 +2424,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche mPendingActivityResult = null; } InstallShortcutReceiver.disableAndFlushInstallQueue( InstallShortcutReceiver.FLAG_LOADER_RUNNING, this); ItemInstallQueue.INSTANCE.get(this) .resumeModelPush(FLAG_LOADER_RUNNING); // When undoing the removal of the last item on a page, return to that page. // Since we are just resetting the current page without user interaction, Loading @@ -2448,8 +2452,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche private ValueAnimator createNewAppBounceAnimation(View v, int i) { ValueAnimator bounceAnim = new PropertyListBuilder().alpha(1).scale(1).build(v) .setDuration(InstallShortcutReceiver.NEW_SHORTCUT_BOUNCE_DURATION); bounceAnim.setStartDelay(i * InstallShortcutReceiver.NEW_SHORTCUT_STAGGER_DELAY); .setDuration(ItemInstallQueue.NEW_SHORTCUT_BOUNCE_DURATION); bounceAnim.setStartDelay(i * ItemInstallQueue.NEW_SHORTCUT_STAGGER_DELAY); bounceAnim.setInterpolator(new OvershootInterpolator(BOUNCE_ANIMATION_TENSION)); return bounceAnim; } Loading src/com/android/launcher3/LauncherModel.java +3 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import com.android.launcher3.model.BaseModelUpdateTask; 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.LoaderTask; import com.android.launcher3.model.ModelDelegate; Loading Loading @@ -328,7 +329,8 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi */ public boolean startLoader() { // Enable queue before starting loader. It will get disabled in Launcher#finishBindingItems InstallShortcutReceiver.enableInstallQueue(InstallShortcutReceiver.FLAG_LOADER_RUNNING); ItemInstallQueue.INSTANCE.get(mApp.getContext()) .pauseModelPush(ItemInstallQueue.FLAG_LOADER_RUNNING); synchronized (mLock) { // Don't bother to start the thread if we know it's not going to do anything final Callbacks[] callbacksList = getCallbacks(); Loading src/com/android/launcher3/SessionCommitReceiver.java +3 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.content.pm.PackageManager; import android.os.UserHandle; import android.text.TextUtils; import com.android.launcher3.model.ItemInstallQueue; import com.android.launcher3.pm.InstallSessionHelper; /** Loading Loading @@ -59,7 +60,8 @@ public class SessionCommitReceiver extends BroadcastReceiver { return; } InstallShortcutReceiver.queueApplication(info.getAppPackageName(), user, context); ItemInstallQueue.INSTANCE.get(context) .queueItem(info.getAppPackageName(), user); } public static boolean isEnabled(Context context) { Loading src/com/android/launcher3/dragndrop/AddItemActivity.java +4 −3 Original line number Diff line number Diff line Loading @@ -43,13 +43,13 @@ import android.view.View.OnLongClickListener; import android.view.View.OnTouchListener; import com.android.launcher3.BaseActivity; import com.android.launcher3.InstallShortcutReceiver; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherAppWidgetHost; import com.android.launcher3.LauncherAppWidgetProviderInfo; import com.android.launcher3.R; import com.android.launcher3.model.ItemInstallQueue; import com.android.launcher3.model.WidgetItem; import com.android.launcher3.pm.PinRequestHelper; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; Loading Loading @@ -249,7 +249,7 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener */ public void onPlaceAutomaticallyClick(View v) { if (mRequest.getRequestType() == PinItemRequest.REQUEST_TYPE_SHORTCUT) { InstallShortcutReceiver.queueShortcut(mRequest.getShortcutInfo(), this); ItemInstallQueue.INSTANCE.get(this).queueItem(mRequest.getShortcutInfo()); logCommand(Action.Command.CONFIRM); mRequest.accept(); finish(); Loading @@ -270,7 +270,8 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener } private void acceptWidget(int widgetId) { InstallShortcutReceiver.queueWidget(mRequest.getAppWidgetProviderInfo(this), widgetId, this); ItemInstallQueue.INSTANCE.get(this) .queueItem(mRequest.getAppWidgetProviderInfo(this), widgetId); mWidgetOptions.putInt(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId); mRequest.accept(mWidgetOptions); logCommand(Action.Command.CONFIRM); Loading src/com/android/launcher3/model/BgDataModel.java +1 −2 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import android.text.TextUtils; import android.util.ArraySet; import android.util.Log; import com.android.launcher3.InstallShortcutReceiver; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.Workspace; Loading Loading @@ -298,7 +297,7 @@ public class BgDataModel { .filter(wi -> wi.itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT) .map(ShortcutKey::fromItemInfo), // Pending shortcuts InstallShortcutReceiver.getPendingShortcuts(context) ItemInstallQueue.INSTANCE.get(context).getPendingShortcuts() .stream().filter(si -> si.user.equals(user))) .collect(groupingBy(ShortcutKey::getPackageName, mapping(ShortcutKey::getId, Collectors.toSet()))); Loading Loading
src/com/android/launcher3/Launcher.java +14 −10 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; import static com.android.launcher3.AbstractFloatingView.TYPE_ICON_SURFACE; import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import static com.android.launcher3.AbstractFloatingView.TYPE_SNACKBAR; import static com.android.launcher3.InstallShortcutReceiver.FLAG_DRAG_AND_DROP; import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.FLAG_CLOSE_POPUPS; Loading @@ -42,6 +41,9 @@ import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKG import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONRESUME; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONSTOP; import static com.android.launcher3.logging.StatsLogManager.containerTypeToAtomState; import static com.android.launcher3.model.ItemInstallQueue.FLAG_ACTIVITY_PAUSED; import static com.android.launcher3.model.ItemInstallQueue.FLAG_DRAG_AND_DROP; import static com.android.launcher3.model.ItemInstallQueue.FLAG_LOADER_RUNNING; import static com.android.launcher3.popup.SystemShortcut.APP_INFO; import static com.android.launcher3.popup.SystemShortcut.INSTALL; import static com.android.launcher3.popup.SystemShortcut.WIDGETS; Loading Loading @@ -119,6 +121,7 @@ import com.android.launcher3.logging.FileLog; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.logging.UserEventDispatcher; import com.android.launcher3.model.BgDataModel.Callbacks; import com.android.launcher3.model.ItemInstallQueue; import com.android.launcher3.model.ModelUtils; import com.android.launcher3.model.ModelWriter; import com.android.launcher3.model.data.AppInfo; Loading Loading @@ -911,8 +914,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche getUserEventDispatcher().startSession(); // Process any items that were added while Launcher was away. InstallShortcutReceiver.disableAndFlushInstallQueue( InstallShortcutReceiver.FLAG_ACTIVITY_PAUSED, this); ItemInstallQueue.INSTANCE.get(this) .resumeModelPush(FLAG_ACTIVITY_PAUSED); // Refresh shortcuts if the permission changed. mModel.validateModelDataOnResume(); Loading Loading @@ -1006,7 +1009,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche if (state == SPRING_LOADED) { // Prevent any Un/InstallShortcutReceivers from updating the db while we are // not on homescreen InstallShortcutReceiver.enableInstallQueue(FLAG_DRAG_AND_DROP); ItemInstallQueue.INSTANCE.get(this).pauseModelPush(FLAG_DRAG_AND_DROP); getRotationHelper().setCurrentStateRequest(REQUEST_LOCK); mWorkspace.showPageIndicatorAtCurrentScroll(); Loading @@ -1031,7 +1034,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche if (state == NORMAL) { // Re-enable any Un/InstallShortcutReceiver and now process any queued items InstallShortcutReceiver.disableAndFlushInstallQueue(FLAG_DRAG_AND_DROP, this); ItemInstallQueue.INSTANCE.get(this) .resumeModelPush(FLAG_DRAG_AND_DROP); // Clear any rotation locks when going to normal state getRotationHelper().setCurrentStateRequest(REQUEST_NONE); Loading Loading @@ -1065,7 +1069,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche @Override protected void onPause() { // Ensure that items added to Launcher are queued until Launcher returns InstallShortcutReceiver.enableInstallQueue(InstallShortcutReceiver.FLAG_ACTIVITY_PAUSED); ItemInstallQueue.INSTANCE.get(this).pauseModelPush(FLAG_ACTIVITY_PAUSED); super.onPause(); mDragController.cancelDrag(); Loading Loading @@ -2420,8 +2424,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche mPendingActivityResult = null; } InstallShortcutReceiver.disableAndFlushInstallQueue( InstallShortcutReceiver.FLAG_LOADER_RUNNING, this); ItemInstallQueue.INSTANCE.get(this) .resumeModelPush(FLAG_LOADER_RUNNING); // When undoing the removal of the last item on a page, return to that page. // Since we are just resetting the current page without user interaction, Loading @@ -2448,8 +2452,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche private ValueAnimator createNewAppBounceAnimation(View v, int i) { ValueAnimator bounceAnim = new PropertyListBuilder().alpha(1).scale(1).build(v) .setDuration(InstallShortcutReceiver.NEW_SHORTCUT_BOUNCE_DURATION); bounceAnim.setStartDelay(i * InstallShortcutReceiver.NEW_SHORTCUT_STAGGER_DELAY); .setDuration(ItemInstallQueue.NEW_SHORTCUT_BOUNCE_DURATION); bounceAnim.setStartDelay(i * ItemInstallQueue.NEW_SHORTCUT_STAGGER_DELAY); bounceAnim.setInterpolator(new OvershootInterpolator(BOUNCE_ANIMATION_TENSION)); return bounceAnim; } Loading
src/com/android/launcher3/LauncherModel.java +3 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import com.android.launcher3.model.BaseModelUpdateTask; 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.LoaderTask; import com.android.launcher3.model.ModelDelegate; Loading Loading @@ -328,7 +329,8 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi */ public boolean startLoader() { // Enable queue before starting loader. It will get disabled in Launcher#finishBindingItems InstallShortcutReceiver.enableInstallQueue(InstallShortcutReceiver.FLAG_LOADER_RUNNING); ItemInstallQueue.INSTANCE.get(mApp.getContext()) .pauseModelPush(ItemInstallQueue.FLAG_LOADER_RUNNING); synchronized (mLock) { // Don't bother to start the thread if we know it's not going to do anything final Callbacks[] callbacksList = getCallbacks(); Loading
src/com/android/launcher3/SessionCommitReceiver.java +3 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.content.pm.PackageManager; import android.os.UserHandle; import android.text.TextUtils; import com.android.launcher3.model.ItemInstallQueue; import com.android.launcher3.pm.InstallSessionHelper; /** Loading Loading @@ -59,7 +60,8 @@ public class SessionCommitReceiver extends BroadcastReceiver { return; } InstallShortcutReceiver.queueApplication(info.getAppPackageName(), user, context); ItemInstallQueue.INSTANCE.get(context) .queueItem(info.getAppPackageName(), user); } public static boolean isEnabled(Context context) { Loading
src/com/android/launcher3/dragndrop/AddItemActivity.java +4 −3 Original line number Diff line number Diff line Loading @@ -43,13 +43,13 @@ import android.view.View.OnLongClickListener; import android.view.View.OnTouchListener; import com.android.launcher3.BaseActivity; import com.android.launcher3.InstallShortcutReceiver; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherAppWidgetHost; import com.android.launcher3.LauncherAppWidgetProviderInfo; import com.android.launcher3.R; import com.android.launcher3.model.ItemInstallQueue; import com.android.launcher3.model.WidgetItem; import com.android.launcher3.pm.PinRequestHelper; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; Loading Loading @@ -249,7 +249,7 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener */ public void onPlaceAutomaticallyClick(View v) { if (mRequest.getRequestType() == PinItemRequest.REQUEST_TYPE_SHORTCUT) { InstallShortcutReceiver.queueShortcut(mRequest.getShortcutInfo(), this); ItemInstallQueue.INSTANCE.get(this).queueItem(mRequest.getShortcutInfo()); logCommand(Action.Command.CONFIRM); mRequest.accept(); finish(); Loading @@ -270,7 +270,8 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener } private void acceptWidget(int widgetId) { InstallShortcutReceiver.queueWidget(mRequest.getAppWidgetProviderInfo(this), widgetId, this); ItemInstallQueue.INSTANCE.get(this) .queueItem(mRequest.getAppWidgetProviderInfo(this), widgetId); mWidgetOptions.putInt(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId); mRequest.accept(mWidgetOptions); logCommand(Action.Command.CONFIRM); Loading
src/com/android/launcher3/model/BgDataModel.java +1 −2 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import android.text.TextUtils; import android.util.ArraySet; import android.util.Log; import com.android.launcher3.InstallShortcutReceiver; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.Workspace; Loading Loading @@ -298,7 +297,7 @@ public class BgDataModel { .filter(wi -> wi.itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT) .map(ShortcutKey::fromItemInfo), // Pending shortcuts InstallShortcutReceiver.getPendingShortcuts(context) ItemInstallQueue.INSTANCE.get(context).getPendingShortcuts() .stream().filter(si -> si.user.equals(user))) .collect(groupingBy(ShortcutKey::getPackageName, mapping(ShortcutKey::getId, Collectors.toSet()))); Loading