Loading src/com/android/launcher3/InstallShortcutReceiver.java +1 −1 Original line number Diff line number Diff line Loading @@ -304,7 +304,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { // Add the new apps to the model and bind them if (!addShortcuts.isEmpty()) { LauncherAppState app = LauncherAppState.getInstance(); app.getModel().addAndBindAddedApps(context, addShortcuts, new ArrayList<AppInfo>()); app.getModel().addAndBindAddedWorkspaceApps(context, addShortcuts); } } } Loading src/com/android/launcher3/Launcher.java +5 −3 Original line number Diff line number Diff line Loading @@ -3852,15 +3852,17 @@ public class Launcher extends Activity } // Add the new screens if (newScreens != null) { bindAddScreens(newScreens); } // We add the items without animation on non-visible pages, and with // animations on the new page (which we will try and snap to). if (!addNotAnimated.isEmpty()) { if (addNotAnimated != null && !addNotAnimated.isEmpty()) { bindItems(addNotAnimated, 0, addNotAnimated.size(), false); } if (!addAnimated.isEmpty()) { if (addAnimated != null && !addAnimated.isEmpty()) { bindItems(addAnimated, 0, addAnimated.size(), true); } Loading src/com/android/launcher3/LauncherBackupHelper.java +2 −2 Original line number Diff line number Diff line Loading @@ -193,7 +193,7 @@ public class LauncherBackupHelper implements BackupHelper { Log.e(TAG, "launcher backup has failed", e); } out.key = keys.toArray(BackupProtos.Key.EMPTY_ARRAY); out.key = keys.toArray(new BackupProtos.Key[keys.size()]); writeJournal(newState, out); Log.v(TAG, "onBackup: wrote " + out.bytes + "b in " + out.rows + " rows."); } Loading Loading @@ -266,7 +266,7 @@ public class LauncherBackupHelper implements BackupHelper { // will catch any changes the restore process might have made Journal out = new Journal(); out.t = 0; out.key = mKeys.toArray(BackupProtos.Key.EMPTY_ARRAY); out.key = mKeys.toArray(new BackupProtos.Key[mKeys.size()]); writeJournal(newState, out); Log.v(TAG, "onRestore: read " + mKeys.size() + " rows"); mKeys.clear(); Loading src/com/android/launcher3/LauncherModel.java +40 −18 Original line number Diff line number Diff line Loading @@ -292,17 +292,40 @@ public class LauncherModel extends BroadcastReceiver { return null; } public void addAndBindAddedApps(final Context context, final ArrayList<ItemInfo> workspaceApps, final ArrayList<AppInfo> allAppsApps) { public void addAppsToAllApps(final Context ctx, final ArrayList<AppInfo> allAppsApps) { final Callbacks callbacks = mCallbacks != null ? mCallbacks.get() : null; if (allAppsApps == null) { throw new RuntimeException("allAppsApps must not be null"); } if (allAppsApps.isEmpty()) { return; } // Process the newly added applications and add them to the database first Runnable r = new Runnable() { public void run() { runOnMainThread(new Runnable() { public void run() { Callbacks cb = mCallbacks != null ? mCallbacks.get() : null; addAndBindAddedApps(context, workspaceApps, cb, allAppsApps); if (callbacks == cb && cb != null) { callbacks.bindAppsAdded(null, null, null, allAppsApps); } } }); } }; runOnWorkerThread(r); } public void addAndBindAddedApps(final Context context, final ArrayList<ItemInfo> workspaceApps, final Callbacks callbacks, final ArrayList<AppInfo> allAppsApps) { if (workspaceApps == null || allAppsApps == null) { public void addAndBindAddedWorkspaceApps(final Context context, final ArrayList<ItemInfo> workspaceApps) { final Callbacks callbacks = mCallbacks != null ? mCallbacks.get() : null; if (workspaceApps == null) { throw new RuntimeException("workspaceApps and allAppsApps must not be null"); } if (workspaceApps.isEmpty() && allAppsApps.isEmpty()) { if (workspaceApps.isEmpty()) { return; } // Process the newly added applications and add them to the database first Loading Loading @@ -385,7 +408,7 @@ public class LauncherModel extends BroadcastReceiver { // Update the workspace screens updateWorkspaceScreenOrder(context, workspaceScreens); if (!addedShortcutsFinal.isEmpty() || !allAppsApps.isEmpty()) { if (!addedShortcutsFinal.isEmpty()) { runOnMainThread(new Runnable() { public void run() { Callbacks cb = mCallbacks != null ? mCallbacks.get() : null; Loading @@ -404,7 +427,7 @@ public class LauncherModel extends BroadcastReceiver { } } callbacks.bindAppsAdded(addedWorkspaceScreensFinal, addNotAnimated, addAnimated, allAppsApps); addNotAnimated, addAnimated, null); } } }); Loading Loading @@ -1561,8 +1584,7 @@ public class LauncherModel extends BroadcastReceiver { } } if (!added.isEmpty()) { Callbacks cb = mCallbacks != null ? mCallbacks.get() : null; addAndBindAddedApps(context, added, cb, new ArrayList<AppInfo>()); addAndBindAddedWorkspaceApps(context, added); } } Loading Loading @@ -2642,14 +2664,14 @@ public class LauncherModel extends BroadcastReceiver { if (added != null) { // Ensure that we add all the workspace applications to the db Callbacks cb = mCallbacks != null ? mCallbacks.get() : null; if (!LauncherAppState.isDisableAllApps()) { addAndBindAddedApps(context, new ArrayList<ItemInfo>(), cb, added); } else { if (LauncherAppState.isDisableAllApps()) { final ArrayList<ItemInfo> addedInfos = new ArrayList<ItemInfo>(added); addAndBindAddedApps(context, addedInfos, cb, added); addAndBindAddedWorkspaceApps(context, addedInfos); } else { addAppsToAllApps(context, added); } } if (modified != null) { final ArrayList<AppInfo> modifiedFinal = modified; Loading Loading
src/com/android/launcher3/InstallShortcutReceiver.java +1 −1 Original line number Diff line number Diff line Loading @@ -304,7 +304,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { // Add the new apps to the model and bind them if (!addShortcuts.isEmpty()) { LauncherAppState app = LauncherAppState.getInstance(); app.getModel().addAndBindAddedApps(context, addShortcuts, new ArrayList<AppInfo>()); app.getModel().addAndBindAddedWorkspaceApps(context, addShortcuts); } } } Loading
src/com/android/launcher3/Launcher.java +5 −3 Original line number Diff line number Diff line Loading @@ -3852,15 +3852,17 @@ public class Launcher extends Activity } // Add the new screens if (newScreens != null) { bindAddScreens(newScreens); } // We add the items without animation on non-visible pages, and with // animations on the new page (which we will try and snap to). if (!addNotAnimated.isEmpty()) { if (addNotAnimated != null && !addNotAnimated.isEmpty()) { bindItems(addNotAnimated, 0, addNotAnimated.size(), false); } if (!addAnimated.isEmpty()) { if (addAnimated != null && !addAnimated.isEmpty()) { bindItems(addAnimated, 0, addAnimated.size(), true); } Loading
src/com/android/launcher3/LauncherBackupHelper.java +2 −2 Original line number Diff line number Diff line Loading @@ -193,7 +193,7 @@ public class LauncherBackupHelper implements BackupHelper { Log.e(TAG, "launcher backup has failed", e); } out.key = keys.toArray(BackupProtos.Key.EMPTY_ARRAY); out.key = keys.toArray(new BackupProtos.Key[keys.size()]); writeJournal(newState, out); Log.v(TAG, "onBackup: wrote " + out.bytes + "b in " + out.rows + " rows."); } Loading Loading @@ -266,7 +266,7 @@ public class LauncherBackupHelper implements BackupHelper { // will catch any changes the restore process might have made Journal out = new Journal(); out.t = 0; out.key = mKeys.toArray(BackupProtos.Key.EMPTY_ARRAY); out.key = mKeys.toArray(new BackupProtos.Key[mKeys.size()]); writeJournal(newState, out); Log.v(TAG, "onRestore: read " + mKeys.size() + " rows"); mKeys.clear(); Loading
src/com/android/launcher3/LauncherModel.java +40 −18 Original line number Diff line number Diff line Loading @@ -292,17 +292,40 @@ public class LauncherModel extends BroadcastReceiver { return null; } public void addAndBindAddedApps(final Context context, final ArrayList<ItemInfo> workspaceApps, final ArrayList<AppInfo> allAppsApps) { public void addAppsToAllApps(final Context ctx, final ArrayList<AppInfo> allAppsApps) { final Callbacks callbacks = mCallbacks != null ? mCallbacks.get() : null; if (allAppsApps == null) { throw new RuntimeException("allAppsApps must not be null"); } if (allAppsApps.isEmpty()) { return; } // Process the newly added applications and add them to the database first Runnable r = new Runnable() { public void run() { runOnMainThread(new Runnable() { public void run() { Callbacks cb = mCallbacks != null ? mCallbacks.get() : null; addAndBindAddedApps(context, workspaceApps, cb, allAppsApps); if (callbacks == cb && cb != null) { callbacks.bindAppsAdded(null, null, null, allAppsApps); } } }); } }; runOnWorkerThread(r); } public void addAndBindAddedApps(final Context context, final ArrayList<ItemInfo> workspaceApps, final Callbacks callbacks, final ArrayList<AppInfo> allAppsApps) { if (workspaceApps == null || allAppsApps == null) { public void addAndBindAddedWorkspaceApps(final Context context, final ArrayList<ItemInfo> workspaceApps) { final Callbacks callbacks = mCallbacks != null ? mCallbacks.get() : null; if (workspaceApps == null) { throw new RuntimeException("workspaceApps and allAppsApps must not be null"); } if (workspaceApps.isEmpty() && allAppsApps.isEmpty()) { if (workspaceApps.isEmpty()) { return; } // Process the newly added applications and add them to the database first Loading Loading @@ -385,7 +408,7 @@ public class LauncherModel extends BroadcastReceiver { // Update the workspace screens updateWorkspaceScreenOrder(context, workspaceScreens); if (!addedShortcutsFinal.isEmpty() || !allAppsApps.isEmpty()) { if (!addedShortcutsFinal.isEmpty()) { runOnMainThread(new Runnable() { public void run() { Callbacks cb = mCallbacks != null ? mCallbacks.get() : null; Loading @@ -404,7 +427,7 @@ public class LauncherModel extends BroadcastReceiver { } } callbacks.bindAppsAdded(addedWorkspaceScreensFinal, addNotAnimated, addAnimated, allAppsApps); addNotAnimated, addAnimated, null); } } }); Loading Loading @@ -1561,8 +1584,7 @@ public class LauncherModel extends BroadcastReceiver { } } if (!added.isEmpty()) { Callbacks cb = mCallbacks != null ? mCallbacks.get() : null; addAndBindAddedApps(context, added, cb, new ArrayList<AppInfo>()); addAndBindAddedWorkspaceApps(context, added); } } Loading Loading @@ -2642,14 +2664,14 @@ public class LauncherModel extends BroadcastReceiver { if (added != null) { // Ensure that we add all the workspace applications to the db Callbacks cb = mCallbacks != null ? mCallbacks.get() : null; if (!LauncherAppState.isDisableAllApps()) { addAndBindAddedApps(context, new ArrayList<ItemInfo>(), cb, added); } else { if (LauncherAppState.isDisableAllApps()) { final ArrayList<ItemInfo> addedInfos = new ArrayList<ItemInfo>(added); addAndBindAddedApps(context, addedInfos, cb, added); addAndBindAddedWorkspaceApps(context, addedInfos); } else { addAppsToAllApps(context, added); } } if (modified != null) { final ArrayList<AppInfo> modifiedFinal = modified; Loading