diff options
author | Winson Chung <winsonc@google.com> | 2013-08-20 22:13:43 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-08-20 22:13:44 +0000 |
commit | 81d6f6ecca788e6c300dfbc7d732a3867859fbd8 (patch) | |
tree | b0bd636b178e4f827f349d9493f59e8b8322bbbc | |
parent | 89bddfaa6d1dbd1534c5f5c5f3163c10f627209e (diff) | |
parent | d64d1763c590b1c954b759156683abf39ff22945 (diff) | |
download | android_packages_apps_Trebuchet-81d6f6ecca788e6c300dfbc7d732a3867859fbd8.tar.gz android_packages_apps_Trebuchet-81d6f6ecca788e6c300dfbc7d732a3867859fbd8.tar.bz2 android_packages_apps_Trebuchet-81d6f6ecca788e6c300dfbc7d732a3867859fbd8.zip |
Merge "Removing workspace screens on load and ensuring we don't bind on new apps until returning to Launcher." into jb-ub-gel-agar
-rwxr-xr-x | print_db.py | 30 | ||||
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 99 | ||||
-rw-r--r-- | src/com/android/launcher3/LauncherModel.java | 22 | ||||
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 2 |
4 files changed, 107 insertions, 46 deletions
diff --git a/print_db.py b/print_db.py index 6caa7bb87..05237d0b9 100755 --- a/print_db.py +++ b/print_db.py @@ -34,6 +34,10 @@ def make_dir(): shutil.rmtree(DIR, True) os.makedirs(DIR) +def adb_root_remount(): + os.system("adb root") + os.system("adb remount") + def pull_file(fn): print "pull_file: " + fn rv = os.system("adb pull" @@ -52,6 +56,15 @@ def get_favorites(conn): rows.append(row) return columns,rows +def get_screens(conn): + c = conn.cursor() + c.execute("SELECT * FROM workspaceScreens") + columns = [d[0] for d in c.description] + rows = [] + for row in c: + rows.append(row) + return columns,rows + def print_intent(out, id, i, cell): if cell: out.write("""<span class="intent" title="%s">shortcut</span>""" % ( @@ -127,13 +140,21 @@ def render_cell_info(out, cell, occupied): out.write("<b>unknown type: %d</b>" % itemType) out.write("</td>\n") +def render_screen_info(out, screen): + out.write("<tr>") + out.write("<td>%s</td>" % (screen["_id"])) + out.write("<td>%s</td>" % (screen["screenRank"])) + out.write("</tr>") + def process_file(fn): global SCREENS, COLUMNS, ROWS, HOTSEAT_SIZE print "process_file: " + fn conn = sqlite3.connect(fn) columns,rows = get_favorites(conn) + screenCols, screenRows = get_screens(conn) data = [dict(zip(columns,row)) for row in rows] + screenData = [dict(zip(screenCols, screenRow)) for screenRow in screenRows] # Calculate the proper number of screens, columns, and rows in this db screensIdMap = [] @@ -198,6 +219,14 @@ def process_file(fn): out.write("""</table> """) + # Screens + out.write("<br/><b>Screens</b><br/>\n") + out.write("<table class=layout border=1 cellspacing=0 cellpadding=4>\n") + out.write("<tr><td>Screen ID</td><td>Rank</td></tr>\n") + for screen in screenData: + render_screen_info(out, screen) + out.write("</table>\n") + # Hotseat hotseat = [] for i in range(0, HOTSEAT_SIZE): @@ -274,6 +303,7 @@ def updateDeviceClassConstants(str): def main(argv): if len(argv) == 1 or (len(argv) == 2 and updateDeviceClassConstants(argv[1])): make_dir() + adb_root_remount() pull_file(AUTO_FILE) process_file(AUTO_FILE) elif len(argv) == 2 or (len(argv) == 3 and updateDeviceClassConstants(argv[2])): diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index b1d835512..88046e4e0 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -3518,14 +3518,10 @@ public class Launcher extends Activity // from scratch again mBindOnResumeCallbacks.clear(); - final Workspace workspace = mWorkspace; + // Clear the workspace because it's going to be rebound mWorkspace.clearDropTargets(); - int count = workspace.getChildCount(); - for (int i = 0; i < count; i++) { - // Use removeAllViewsInLayout() to avoid an extra requestLayout() and invalidate(). - final CellLayout layoutParent = (CellLayout) workspace.getChildAt(i); - layoutParent.removeAllViewsInLayout(); - } + mWorkspace.removeAllViews(); + mWidgetsToAdvance.clear(); if (mHotseat != null) { mHotseat.resetLayout(); @@ -3571,6 +3567,35 @@ public class Launcher extends Activity } } + public void bindAppsAdded(final ArrayList<Long> newScreens, + final ArrayList<ItemInfo> addNotAnimated, + final ArrayList<ItemInfo> addAnimated) { + Runnable r = new Runnable() { + public void run() { + bindAppsAdded(newScreens, addNotAnimated, addAnimated); + } + }; + if (waitUntilResume(r)) { + return; + } + + Log.w(TAG, "10249126 - bindAppsAdded(" + newScreens.size() + ")"); + + // Add the new screens + 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()) { + bindItems(addNotAnimated, 0, + addNotAnimated.size(), false); + } + if (!addAnimated.isEmpty()) { + bindItems(addAnimated, 0, + addAnimated.size(), true); + } + } + /** * Bind the items start-end from the list. * @@ -3578,11 +3603,12 @@ public class Launcher extends Activity */ public void bindItems(final ArrayList<ItemInfo> shortcuts, final int start, final int end, final boolean forceAnimateIcons) { - if (waitUntilResume(new Runnable() { - public void run() { - bindItems(shortcuts, start, end, forceAnimateIcons); - } - })) { + Runnable r = new Runnable() { + public void run() { + bindItems(shortcuts, start, end, forceAnimateIcons); + } + }; + if (waitUntilResume(r)) { return; } @@ -3666,11 +3692,12 @@ public class Launcher extends Activity * Implementation of the method from LauncherModel.Callbacks. */ public void bindFolders(final HashMap<Long, FolderInfo> folders) { - if (waitUntilResume(new Runnable() { - public void run() { - bindFolders(folders); - } - })) { + Runnable r = new Runnable() { + public void run() { + bindFolders(folders); + } + }; + if (waitUntilResume(r)) { return; } sFolders.clear(); @@ -3683,11 +3710,12 @@ public class Launcher extends Activity * Implementation of the method from LauncherModel.Callbacks. */ public void bindAppWidget(final LauncherAppWidgetInfo item) { - if (waitUntilResume(new Runnable() { - public void run() { - bindAppWidget(item); - } - })) { + Runnable r = new Runnable() { + public void run() { + bindAppWidget(item); + } + }; + if (waitUntilResume(r)) { return; } @@ -3730,11 +3758,12 @@ public class Launcher extends Activity * Implementation of the method from LauncherModel.Callbacks. */ public void finishBindingItems(final boolean upgradePath) { - if (waitUntilResume(new Runnable() { - public void run() { - finishBindingItems(upgradePath); - } - })) { + Runnable r = new Runnable() { + public void run() { + finishBindingItems(upgradePath); + } + }; + if (waitUntilResume(r)) { return; } if (mSavedState != null) { @@ -3820,11 +3849,12 @@ public class Launcher extends Activity * Implementation of the method from LauncherModel.Callbacks. */ public void bindAppsUpdated(final ArrayList<ApplicationInfo> apps) { - if (waitUntilResume(new Runnable() { - public void run() { - bindAppsUpdated(apps); - } - })) { + Runnable r = new Runnable() { + public void run() { + bindAppsUpdated(apps); + } + }; + if (waitUntilResume(r)) { return; } @@ -3845,11 +3875,12 @@ public class Launcher extends Activity public void bindComponentsRemoved(final ArrayList<String> packageNames, final ArrayList<ApplicationInfo> appInfos, final boolean packageRemoved) { - if (waitUntilResume(new Runnable() { + Runnable r = new Runnable() { public void run() { bindComponentsRemoved(packageNames, appInfos, packageRemoved); } - })) { + }; + if (waitUntilResume(r)) { return; } diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index cd37a167c..50e84b70f 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -156,6 +156,9 @@ public class LauncherModel extends BroadcastReceiver { public void finishBindingItems(boolean upgradePath); public void bindAppWidget(LauncherAppWidgetInfo info); public void bindAllApplications(ArrayList<ApplicationInfo> apps); + public void bindAppsAdded(ArrayList<Long> newScreens, + ArrayList<ItemInfo> addNotAnimated, + ArrayList<ItemInfo> addAnimated); public void bindAppsUpdated(ArrayList<ApplicationInfo> apps); public void bindComponentsRemoved(ArrayList<String> packageNames, ArrayList<ApplicationInfo> appInfos, @@ -275,6 +278,7 @@ public class LauncherModel extends BroadcastReceiver { } public void addAndBindAddedApps(final Context context, final ArrayList<ItemInfo> added, final Callbacks callbacks) { + Log.w(TAG, "10249126 - addAndBindAddedApps()"); if (added.isEmpty()) { throw new RuntimeException("EMPTY ADDED ARRAY?"); } @@ -354,6 +358,8 @@ public class LauncherModel extends BroadcastReceiver { } } + Log.w(TAG, "10249126 - addAndBindAddedApps - updateWorkspaceScreenOrder(" + workspaceScreens.size() + ")"); + // Update the workspace screens updateWorkspaceScreenOrder(context, workspaceScreens); @@ -362,8 +368,6 @@ public class LauncherModel extends BroadcastReceiver { public void run() { Callbacks cb = mCallbacks != null ? mCallbacks.get() : null; if (callbacks == cb && cb != null) { - callbacks.bindAddScreens(addedWorkspaceScreensFinal); - ItemInfo info = addedShortcutsFinal.get(addedShortcutsFinal.size() - 1); long lastScreenId = info.screenId; final ArrayList<ItemInfo> addAnimated = new ArrayList<ItemInfo>(); @@ -375,16 +379,8 @@ public class LauncherModel extends BroadcastReceiver { addNotAnimated.add(i); } } - // 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()) { - callbacks.bindItems(addNotAnimated, 0, - addNotAnimated.size(), false); - } - if (!addAnimated.isEmpty()) { - callbacks.bindItems(addAnimated, 0, - addAnimated.size(), true); - } + callbacks.bindAppsAdded(addedWorkspaceScreensFinal, + addNotAnimated, addAnimated); } } }); @@ -1905,6 +1901,7 @@ public class LauncherModel extends BroadcastReceiver { } if (loadedOldDb) { + Log.w(TAG, "10249126 - loadWorkspace - loadedOldDb"); long maxScreenId = 0; // If we're importing we use the old screen order. for (ItemInfo item: sBgItemsIdMap.values()) { @@ -1931,6 +1928,7 @@ public class LauncherModel extends BroadcastReceiver { LauncherAppState app = LauncherAppState.getInstance(); app.getLauncherProvider().updateMaxItemId(maxItemId); } else { + Log.w(TAG, "10249126 - loadWorkspace - !loadedOldDb"); TreeMap<Integer, Long> orderedScreens = loadWorkspaceScreensDb(mContext); for (Integer i : orderedScreens.keySet()) { sBgWorkspaceScreens.add(orderedScreens.get(i)); diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 81d764171..696b702c8 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -1710,6 +1710,8 @@ public class Workspace extends SmoothPagedView CellLayout cl = ((CellLayout) getChildAt(i)); mScreenOrder.add(getIdForScreen(cl)); } + + Log.w(TAG, "10249126 - onEndReordering()"); mLauncher.getModel().updateWorkspaceScreenOrder(mLauncher, mScreenOrder); // Re-enable auto layout transitions for page deletion. |