Removing old debugging logs. (Bug 107442854)

Change-Id: I56d6838af3cca710eab300d3e71ca1be90866cdd
This commit is contained in:
Winson Chung
2013-09-19 16:27:36 -07:00
parent bb701aaa83
commit ede4129e77
4 changed files with 62 additions and 257 deletions

View File

@@ -687,10 +687,6 @@ public class DragController {
}
}
mDragObject.dragSource.onDropCompleted((View) dropTarget, mDragObject, false, accepted);
// Write all the logs to disk
Launcher.addDumpLog(TAG, "10249126 - DragController.drop() - dumping logs to disk", true);
mLauncher.dumpLogsToLocalData(false);
}
private DropTarget findDropTarget(int x, int y, int[] dropCoordinates) {

View File

@@ -130,6 +130,7 @@ public class Launcher extends Activity
static final boolean DEBUG_WIDGETS = false;
static final boolean DEBUG_STRICT_MODE = false;
static final boolean DEBUG_RESUME_TIME = false;
static final boolean DEBUG_DUMP_LOG = false;
private static final int REQUEST_CREATE_SHORTCUT = 1;
private static final int REQUEST_CREATE_APPWIDGET = 5;
@@ -889,10 +890,6 @@ public class Launcher extends Activity
if (DEBUG_RESUME_TIME) {
Log.d(TAG, "Time spent in onResume: " + (System.currentTimeMillis() - startTime));
}
// Write all the logs to disk
Launcher.addDumpLog(TAG, "10249126 - onResume() - dumping logs to disk", true);
dumpLogsToLocalData(false);
}
@Override
@@ -909,10 +906,6 @@ public class Launcher extends Activity
mPaused = true;
mDragController.cancelDrag();
mDragController.resetLastGestureUpTime();
// Write all the logs to disk
Launcher.addDumpLog(TAG, "10249126 - onPause() - dumping logs to disk", true);
dumpLogsToLocalData(false);
}
protected void onFinishBindingItems() {
@@ -3587,7 +3580,6 @@ public class Launcher extends Activity
public void bindAddScreens(ArrayList<Long> orderedScreenIds) {
int count = orderedScreenIds.size();
for (int i = 0; i < count; i++) {
Launcher.addDumpLog(TAG, "10249126 - bindAddScreens(" + orderedScreenIds.get(i) + ")", true);
mWorkspace.insertNewWorkspaceScreenBeforeEmptyScreen(orderedScreenIds.get(i));
}
}
@@ -3645,8 +3637,6 @@ public class Launcher extends Activity
return;
}
Launcher.addDumpLog(TAG, "10249126 - bindAppsAdded(" + newScreens.size() + ")", true);
// Add the new screens
bindAddScreens(newScreens);
@@ -3869,10 +3859,6 @@ public class Launcher extends Activity
onFinishBindingItems();
}
});
// Write all the logs to disk
Launcher.addDumpLog(TAG, "10249126 - finishBindingItems() - dumping logs to disk", true);
dumpLogsToLocalData(false);
}
private boolean canRunNewAppsAnimation() {
@@ -4273,15 +4259,17 @@ public class Launcher extends Activity
}
public static void dumpDebugLogsToConsole() {
synchronized (sDumpLogs) {
Log.d(TAG, "");
Log.d(TAG, "*********************");
Log.d(TAG, "Launcher debug logs: ");
for (int i = 0; i < sDumpLogs.size(); i++) {
Log.d(TAG, " " + sDumpLogs.get(i));
if (DEBUG_DUMP_LOG) {
synchronized (sDumpLogs) {
Log.d(TAG, "");
Log.d(TAG, "*********************");
Log.d(TAG, "Launcher debug logs: ");
for (int i = 0; i < sDumpLogs.size(); i++) {
Log.d(TAG, " " + sDumpLogs.get(i));
}
Log.d(TAG, "*********************");
Log.d(TAG, "");
}
Log.d(TAG, "*********************");
Log.d(TAG, "");
}
}
@@ -4289,105 +4277,59 @@ public class Launcher extends Activity
if (debugLog) {
Log.d(tag, log);
}
sDateStamp.setTime(System.currentTimeMillis());
synchronized (sDumpLogs) {
sDumpLogs.add(sDateFormat.format(sDateStamp) + ": " + tag + ", " + log);
}
}
public void dumpLogsToLocalData(final boolean email) {
new Thread("DumpLogsToLocalData") {
@Override
public void run() {
boolean success = false;
sDateStamp.setTime(sRunStart);
String FILENAME = sDateStamp.getMonth() + "-"
+ sDateStamp.getDay() + "_"
+ sDateStamp.getHours() + "-"
+ sDateStamp.getMinutes() + "_"
+ sDateStamp.getSeconds() + ".txt";
FileOutputStream fos = null;
File outFile = null;
try {
outFile = new File(getFilesDir(), FILENAME);
outFile.createNewFile();
fos = new FileOutputStream(outFile);
} catch (Exception e) {
e.printStackTrace();
}
if (fos != null) {
PrintWriter writer = new PrintWriter(fos);
writer.println(" ");
writer.println("Debug logs: ");
synchronized (sDumpLogs) {
for (int i = 0; i < sDumpLogs.size(); i++) {
writer.println(" " + sDumpLogs.get(i));
}
}
writer.close();
}
try {
if (fos != null) {
fos.close();
success = true;
}
} catch (IOException e) {
e.printStackTrace();
}
if (success && email) {
if (!emailSent()) {
emailFile(outFile);
}
}
if (DEBUG_DUMP_LOG) {
sDateStamp.setTime(System.currentTimeMillis());
synchronized (sDumpLogs) {
sDumpLogs.add(sDateFormat.format(sDateStamp) + ": " + tag + ", " + log);
}
}.start();
}
}
private void emailFile(File file) {
File publicCopy = new File(Environment.getExternalStorageDirectory(), file.getName());
try {
copyFile(file, publicCopy);
} catch (IOException e) {
e.printStackTrace();
return;
public void dumpLogsToLocalData() {
if (DEBUG_DUMP_LOG) {
new Thread("DumpLogsToLocalData") {
@Override
public void run() {
boolean success = false;
sDateStamp.setTime(sRunStart);
String FILENAME = sDateStamp.getMonth() + "-"
+ sDateStamp.getDay() + "_"
+ sDateStamp.getHours() + "-"
+ sDateStamp.getMinutes() + "_"
+ sDateStamp.getSeconds() + ".txt";
FileOutputStream fos = null;
File outFile = null;
try {
outFile = new File(getFilesDir(), FILENAME);
outFile.createNewFile();
fos = new FileOutputStream(outFile);
} catch (Exception e) {
e.printStackTrace();
}
if (fos != null) {
PrintWriter writer = new PrintWriter(fos);
writer.println(" ");
writer.println("Debug logs: ");
synchronized (sDumpLogs) {
for (int i = 0; i < sDumpLogs.size(); i++) {
writer.println(" " + sDumpLogs.get(i));
}
}
writer.close();
}
try {
if (fos != null) {
fos.close();
success = true;
}
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
}
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_EMAIL, new String[] {"adamcohen@google.com, winsonc@google.com," +
"mikejurka@google"});
intent.putExtra(Intent.EXTRA_SUBJECT, "Data corruption " + file.getName());
intent.putExtra(Intent.EXTRA_TEXT, "Data corruption has occurred, logs attached");
if (!file.exists() || !file.canRead()) {
Toast.makeText(this, "Attachment Error", Toast.LENGTH_SHORT).show();
finish();
return;
}
Toast.makeText(this, "Data corruption has occurred, please send e-mail", Toast.LENGTH_LONG);
Uri uri = Uri.fromFile(publicCopy);
intent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(intent, "Please send logs, consider clearing data"));
setEmailSent(true);
}
public void copyFile(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
// Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
}
}

View File

@@ -170,7 +170,7 @@ public class LauncherModel extends BroadcastReceiver {
public void bindPackagesUpdated(ArrayList<Object> widgetsAndShortcuts);
public void bindSearchablesChanged();
public void onPageBoundSynchronously(int page);
public void dumpLogsToLocalData(boolean email);
public void dumpLogsToLocalData();
}
public interface ItemInfoFilter {
@@ -286,7 +286,6 @@ public class LauncherModel extends BroadcastReceiver {
}
public void addAndBindAddedApps(final Context context, final ArrayList<ItemInfo> added,
final Callbacks callbacks, final ArrayList<AppInfo> addedApps) {
Launcher.addDumpLog(TAG, "10249126 - addAndBindAddedApps()", true);
if (added.isEmpty()) {
return;
}
@@ -333,7 +332,6 @@ public class LauncherModel extends BroadcastReceiver {
workspaceScreens.size());
while (numPagesToAdd > 0) {
long screenId = lp.generateNewScreenId();
Launcher.addDumpLog(TAG, "10249126 - addAndBindAddedApps(" + screenId + ")", true);
// Save the screen id for binding in the workspace
workspaceScreens.add(screenId);
addedWorkspaceScreensFinal.add(screenId);
@@ -365,8 +363,6 @@ public class LauncherModel extends BroadcastReceiver {
}
}
Launcher.addDumpLog(TAG, "10249126 - addAndBindAddedApps - updateWorkspaceScreenOrder(" + workspaceScreens.size() + ")", true);
// Update the workspace screens
updateWorkspaceScreenOrder(context, workspaceScreens);
@@ -571,7 +567,6 @@ public class LauncherModel extends BroadcastReceiver {
String msg = "item: " + item + " container being set to: " +
item.container + ", not in the list of folders";
Log.e(TAG, msg);
Launcher.dumpDebugLogsToConsole();
}
}
@@ -632,11 +627,6 @@ public class LauncherModel extends BroadcastReceiver {
*/
static void moveItemInDatabase(Context context, final ItemInfo item, final long container,
final long screenId, final int cellX, final int cellY) {
String transaction = "DbDebug Modify item (" + item.title + ") in db, id: " + item.id +
" (" + item.container + ", " + item.screenId + ", " + item.cellX + ", " + item.cellY +
") --> " + "(" + container + ", " + screenId + ", " + cellX + ", " + cellY + ")";
Launcher.addDumpLog(TAG, transaction, true);
item.container = container;
item.cellX = cellX;
item.cellY = cellY;
@@ -671,11 +661,6 @@ public class LauncherModel extends BroadcastReceiver {
for (int i = 0; i < count; i++) {
ItemInfo item = items.get(i);
String transaction = "DbDebug Modify item (" + item.title + ") in db, id: "
+ item.id + " (" + item.container + ", " + item.screenId + ", " + item.cellX
+ ", " + item.cellY + ") --> " + "(" + container + ", " + screen + ", "
+ item.cellX + ", " + item.cellY + ")";
Launcher.addDumpLog(TAG, transaction, true);
item.container = container;
// We store hotseat items in canonical form which is this orientation invariant position
@@ -704,11 +689,6 @@ public class LauncherModel extends BroadcastReceiver {
*/
static void modifyItemInDatabase(Context context, final ItemInfo item, final long container,
final long screenId, final int cellX, final int cellY, final int spanX, final int spanY) {
String transaction = "DbDebug Modify item (" + item.title + ") in db, id: " + item.id +
" (" + item.container + ", " + item.screenId + ", " + item.cellX + ", " + item.cellY +
") --> " + "(" + container + ", " + screenId + ", " + cellX + ", " + cellY + ")";
Launcher.addDumpLog(TAG, transaction, true);
item.cellX = cellX;
item.cellY = cellY;
item.spanX = spanX;
@@ -874,11 +854,6 @@ public class LauncherModel extends BroadcastReceiver {
Runnable r = new Runnable() {
public void run() {
String transaction = "DbDebug Add item (" + item.title + ") to db, id: "
+ item.id + " (" + container + ", " + screenId + ", " + cellX + ", "
+ cellY + ")";
Launcher.addDumpLog(TAG, transaction, true);
cr.insert(notify ? LauncherSettings.Favorites.CONTENT_URI :
LauncherSettings.Favorites.CONTENT_URI_NO_NOTIFICATION, values);
@@ -901,7 +876,6 @@ public class LauncherModel extends BroadcastReceiver {
String msg = "adding item: " + item + " to a folder that " +
" doesn't exist";
Log.e(TAG, msg);
Launcher.dumpDebugLogsToConsole();
}
}
break;
@@ -935,11 +909,6 @@ public class LauncherModel extends BroadcastReceiver {
Runnable r = new Runnable() {
public void run() {
String transaction = "DbDebug Delete item (" + item.title + ") from db, id: "
+ item.id + " (" + item.container + ", " + item.screenId + ", " + item.cellX +
", " + item.cellY + ")";
Launcher.addDumpLog(TAG, transaction, true);
cr.delete(uriToDelete, null, null);
// Lock on mBgLock *after* the db operation
@@ -954,7 +923,6 @@ public class LauncherModel extends BroadcastReceiver {
String msg = "deleting a folder (" + item + ") which still " +
"contains items (" + info + ")";
Log.e(TAG, msg);
Launcher.dumpDebugLogsToConsole();
}
}
sBgWorkspaceItems.remove(item);
@@ -980,7 +948,6 @@ public class LauncherModel extends BroadcastReceiver {
* a list of screen ids in the order that they should appear.
*/
void updateWorkspaceScreenOrder(Context context, final ArrayList<Long> screens) {
Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder()", true);
final ArrayList<Long> screensCopy = new ArrayList<Long>(screens);
final ContentResolver cr = context.getContentResolver();
final Uri uri = LauncherSettings.WorkspaceScreens.CONTENT_URI;
@@ -990,17 +957,10 @@ public class LauncherModel extends BroadcastReceiver {
while (iter.hasNext()) {
long id = iter.next();
if (id < 0) {
Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder - remove: " + id + ")", true);
iter.remove();
}
}
// Dump the screens copy
Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder - screensCopy", true);
for (Long l : screensCopy) {
Launcher.addDumpLog(TAG, "10249126\t- " + l, true);
}
Runnable r = new Runnable() {
@Override
public void run() {
@@ -1013,26 +973,13 @@ public class LauncherModel extends BroadcastReceiver {
long screenId = screensCopy.get(i);
v.put(LauncherSettings.WorkspaceScreens._ID, screenId);
v.put(LauncherSettings.WorkspaceScreens.SCREEN_RANK, i);
Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder(" + screenId + ", " + i + ")", true);
values[i] = v;
}
cr.bulkInsert(uri, values);
synchronized (sBgLock) {
// Dump the sBgWorkspaceScreens
Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder - sBgWorkspaceScreens - pre clear", true);
for (Long l : sBgWorkspaceScreens) {
Launcher.addDumpLog(TAG, "10249126\t- " + l, true);
}
sBgWorkspaceScreens.clear();
sBgWorkspaceScreens.addAll(screensCopy);
// Dump the sBgWorkspaceScreens
Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder - sBgWorkspaceScreens - post clear", true);
for (Long l : sBgWorkspaceScreens) {
Launcher.addDumpLog(TAG, "10249126\t- " + l, true);
}
}
}
};
@@ -1273,9 +1220,6 @@ public class LauncherModel extends BroadcastReceiver {
try {
long screenId = sc.getLong(idIndex);
int rank = sc.getInt(rankIndex);
Launcher.addDumpLog(TAG, "10249126 - loadWorkspaceScreensDb(" + screenId + ", " + rank + ")", true);
orderedScreens.put(rank, screenId);
} catch (Exception e) {
Launcher.addDumpLog(TAG, "Desktop items loading interrupted - invalid screens: " + e, true);
@@ -1343,7 +1287,6 @@ public class LauncherModel extends BroadcastReceiver {
isUpgradePath = loadWorkspace();
synchronized (LoaderTask.this) {
if (mStopped) {
Launcher.addDumpLog(TAG, "10249126 - loadAndBindWorkspace() stopped", true);
return isUpgradePath;
}
mWorkspaceLoaded = true;
@@ -1484,10 +1427,7 @@ public class LauncherModel extends BroadcastReceiver {
if (AppsCustomizePagedView.DISABLE_ALL_APPS) {
// Ensure that all the applications that are in the system are
// represented on the home screen.
Launcher.addDumpLog(TAG, "10249126 - verifyApplications - useMoreApps="
+ UPGRADE_USE_MORE_APPS_FOLDER + " isUpgrade=" + isUpgrade, true);
if (!UPGRADE_USE_MORE_APPS_FOLDER || !isUpgrade) {
Launcher.addDumpLog(TAG, "10249126 - verifyApplications(" + isUpgrade + ")", true);
verifyApplications();
}
}
@@ -1507,7 +1447,6 @@ public class LauncherModel extends BroadcastReceiver {
public void stopLocked() {
synchronized (LoaderTask.this) {
Launcher.addDumpLog(TAG, "10249126 - STOPPED", true);
mStopped = true;
this.notify();
}
@@ -1552,7 +1491,6 @@ public class LauncherModel extends BroadcastReceiver {
synchronized (sBgLock) {
for (AppInfo app : mBgAllAppsList.data) {
tmpInfos = getItemInfoForComponentName(app.componentName);
Launcher.addDumpLog(TAG, "10249126 - \t" + app.componentName.getPackageName() + ", " + tmpInfos.isEmpty(), true);
if (tmpInfos.isEmpty()) {
// We are missing an application icon, so add this to the workspace
added.add(app);
@@ -1667,7 +1605,6 @@ public class LauncherModel extends BroadcastReceiver {
synchronized (sBgLock) {
clearSBgDataStructures();
Launcher.addDumpLog(TAG, "10249126 - loadWorkspace()", true);
final ArrayList<Long> itemsToRemove = new ArrayList<Long>();
final Uri contentUri = LauncherSettings.Favorites.CONTENT_URI;
@@ -1720,7 +1657,6 @@ public class LauncherModel extends BroadcastReceiver {
long id;
Intent intent;
Launcher.addDumpLog(TAG, "10249126 - Num rows: " + c.getCount(), true);
while (!mStopped && c.moveToNext()) {
try {
int itemType = c.getInt(itemTypeIndex);
@@ -1739,7 +1675,6 @@ public class LauncherModel extends BroadcastReceiver {
Uri uri = LauncherSettings.Favorites.getContentUri(id,
false);
contentResolver.delete(uri, null, null);
Launcher.addDumpLog(TAG, "Invalid package removed: " + cn, true);
} else {
// If apps can be on external storage, then we just
// leave them for the user to remove (maybe add
@@ -1932,7 +1867,6 @@ public class LauncherModel extends BroadcastReceiver {
// Break early if we've stopped loading
if (mStopped) {
Launcher.addDumpLog(TAG, "10249126 - loadWorkspace() - Stopped", true);
clearSBgDataStructures();
return false;
}
@@ -1956,14 +1890,12 @@ public class LauncherModel extends BroadcastReceiver {
}
if (loadedOldDb) {
Launcher.addDumpLog(TAG, "10249126 - loadWorkspace - loadedOldDb", true);
long maxScreenId = 0;
// If we're importing we use the old screen order.
for (ItemInfo item: sBgItemsIdMap.values()) {
long screenId = item.screenId;
if (item.container == LauncherSettings.Favorites.CONTAINER_DESKTOP &&
!sBgWorkspaceScreens.contains(screenId)) {
Launcher.addDumpLog(TAG, "10249126 - loadWorkspace-loadedOldDb(" + screenId + ")", true);
sBgWorkspaceScreens.add(screenId);
if (screenId > maxScreenId) {
maxScreenId = screenId;
@@ -1972,12 +1904,6 @@ public class LauncherModel extends BroadcastReceiver {
}
Collections.sort(sBgWorkspaceScreens);
// Dump the sBgWorkspaceScreens
Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder - sBgWorkspaceScreens", true);
for (Long l : sBgWorkspaceScreens) {
Launcher.addDumpLog(TAG, "10249126\t- " + l, true);
}
LauncherAppState.getLauncherProvider().updateMaxScreenId(maxScreenId);
updateWorkspaceScreenOrder(context, sBgWorkspaceScreens);
@@ -1989,50 +1915,24 @@ public class LauncherModel extends BroadcastReceiver {
}
LauncherAppState.getLauncherProvider().updateMaxItemId(maxItemId);
} else {
Launcher.addDumpLog(TAG, "10249126 - loadWorkspace - !loadedOldDb [" + sWorkerThread.getThreadId() + ", " + Process.myTid() + "]", true);
TreeMap<Integer, Long> orderedScreens = loadWorkspaceScreensDb(mContext);
for (Integer i : orderedScreens.keySet()) {
Launcher.addDumpLog(TAG, "10249126 - adding to sBgWorkspaceScreens: " + orderedScreens.get(i), true);
sBgWorkspaceScreens.add(orderedScreens.get(i));
}
// Remove any empty screens
ArrayList<Long> unusedScreens = new ArrayList<Long>(sBgWorkspaceScreens);
for (Long l : unusedScreens) {
Launcher.addDumpLog(TAG, "10249126 - unused screens: " + l, true);
}
Launcher.addDumpLog(TAG, "10249126 - sBgItemsIdMap [" + sWorkerThread.getThreadId() + ", " + Process.myTid() + "]", true);
for (ItemInfo item: sBgItemsIdMap.values()) {
long screenId = item.screenId;
Launcher.addDumpLog(TAG, "10249126 - \t" + item.container + ", " + screenId + " - " + unusedScreens.contains(screenId) + " | " + item, true);
if (item.container == LauncherSettings.Favorites.CONTAINER_DESKTOP &&
unusedScreens.contains(screenId)) {
unusedScreens.remove(screenId);
Launcher.addDumpLog(TAG, "10249126 - \t\tRemoving " + screenId, true);
for (Long l : unusedScreens) {
Launcher.addDumpLog(TAG, "10249126 - \t\t\t unused screens: " + l, true);
}
}
}
// If there are any empty screens remove them, and update.
if (unusedScreens.size() != 0) {
// Dump the sBgWorkspaceScreens
Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder - sBgWorkspaceScreens - pre removeAll", true);
for (Long l : sBgWorkspaceScreens) {
Launcher.addDumpLog(TAG, "10249126\t- " + l, true);
}
sBgWorkspaceScreens.removeAll(unusedScreens);
// Dump the sBgWorkspaceScreens
Launcher.addDumpLog(TAG, "10249126 - updateWorkspaceScreenOrder - sBgWorkspaceScreens - post removeAll", true);
for (Long l : sBgWorkspaceScreens) {
Launcher.addDumpLog(TAG, "10249126\t- " + l, true);
}
updateWorkspaceScreenOrder(context, sBgWorkspaceScreens);
}
}
@@ -2185,16 +2085,6 @@ public class LauncherModel extends BroadcastReceiver {
private void bindWorkspaceScreens(final Callbacks oldCallbacks,
final ArrayList<Long> orderedScreens) {
Launcher.addDumpLog(TAG, "10249126 - bindWorkspaceScreens()", true);
// Dump the orderedScreens
synchronized (sBgLock) {
Launcher.addDumpLog(TAG, "10249126 - orderedScreens", true);
for (Long l : sBgWorkspaceScreens) {
Launcher.addDumpLog(TAG, "10249126\t- " + l, true);
}
}
final Runnable r = new Runnable() {
@Override
public void run() {
@@ -2278,7 +2168,6 @@ public class LauncherModel extends BroadcastReceiver {
* Binds all loaded data to actual views on the main thread.
*/
private void bindWorkspace(int synchronizeBindPage, final boolean isUpgradePath) {
Launcher.addDumpLog(TAG, "10249126 - bindWorkspace(" + synchronizeBindPage + ", " + isUpgradePath + ")", true);
final long t = SystemClock.uptimeMillis();
Runnable r;
@@ -2679,12 +2568,11 @@ public class LauncherModel extends BroadcastReceiver {
});
// Write all the logs to disk
Launcher.addDumpLog(TAG, "10249126 - PackageUpdatedTask - dumping logs to disk", true);
mHandler.post(new Runnable() {
public void run() {
Callbacks cb = mCallbacks != null ? mCallbacks.get() : null;
if (callbacks == cb && cb != null) {
callbacks.dumpLogsToLocalData(false);
callbacks.dumpLogsToLocalData();
}
}
});

View File

@@ -479,7 +479,6 @@ public class Workspace extends SmoothPagedView
}
public void removeAllWorkspaceScreens() {
Launcher.addDumpLog(TAG, "10249126 - removeAllWorkspaceScreens()", true);
// Remove the pages and clear the screen models
removeAllViews();
mScreenOrder.clear();
@@ -490,7 +489,6 @@ public class Workspace extends SmoothPagedView
// Find the index to insert this view into. If the empty screen exists, then
// insert it before that.
int insertIndex = mScreenOrder.indexOf(EXTRA_EMPTY_SCREEN_ID);
Launcher.addDumpLog(TAG, "10249126 - insertNewWorkspaceScreenBeforeEmptyScreen(" + insertIndex + ")", true);
if (insertIndex < 0) {
insertIndex = mScreenOrder.size();
}
@@ -502,9 +500,6 @@ public class Workspace extends SmoothPagedView
}
public long insertNewWorkspaceScreen(long screenId, int insertIndex) {
String log = "10249126 - insertNewWorkspaceScreen(" + screenId + ", " + insertIndex + ")";
Launcher.addDumpLog(TAG, log, true);
if (mWorkspaceScreens.containsKey(screenId)) {
throw new RuntimeException("Screen id " + screenId + " already exists!");
}
@@ -522,7 +517,6 @@ public class Workspace extends SmoothPagedView
}
public void createCustomContentPage() {
Launcher.addDumpLog(TAG, "10249126 - createCustomContentPage()", true);
CellLayout customScreen = (CellLayout)
mLauncher.getLayoutInflater().inflate(R.layout.workspace_screen, null);
@@ -540,8 +534,6 @@ public class Workspace extends SmoothPagedView
}
public void removeCustomContentPage() {
Launcher.addDumpLog(TAG, "10249126 - removeCustomContentPage()", true);
CellLayout customScreen = getScreenWithId(CUSTOM_CONTENT_SCREEN_ID);
if (customScreen == null) {
throw new RuntimeException("Expected custom content screen to exist");
@@ -621,12 +613,6 @@ public class Workspace extends SmoothPagedView
}
public long commitExtraEmptyScreen() {
Launcher.addDumpLog(TAG, "10249126 - commitExtraEmptyScreen()", true);
// Write all the logs to disk
Launcher.addDumpLog(TAG, "10249126 - commitExtraEmptyScreen() - dumping logs to disk", true);
mLauncher.dumpLogsToLocalData(false);
CellLayout cl = mWorkspaceScreens.get(EXTRA_EMPTY_SCREEN_ID);
mWorkspaceScreens.remove(EXTRA_EMPTY_SCREEN_ID);
mScreenOrder.remove(EXTRA_EMPTY_SCREEN_ID);
@@ -643,13 +629,11 @@ public class Workspace extends SmoothPagedView
public CellLayout getScreenWithId(long screenId) {
Launcher.addDumpLog(TAG, "10249126 - getScreenWithId(" + screenId + ")", true);
CellLayout layout = mWorkspaceScreens.get(screenId);
return layout;
}
public long getIdForScreen(CellLayout layout) {
Launcher.addDumpLog(TAG, "10249126 - getIdForScreen()", true);
Iterator<Long> iter = mWorkspaceScreens.keySet().iterator();
while (iter.hasNext()) {
long id = iter.next();
@@ -661,7 +645,6 @@ public class Workspace extends SmoothPagedView
}
public int getPageIndexForScreenId(long screenId) {
Launcher.addDumpLog(TAG, "10249126 - getPageIndexForScreenId(" + screenId + ")", true);
return indexOfChild(mWorkspaceScreens.get(screenId));
}
@@ -682,8 +665,6 @@ public class Workspace extends SmoothPagedView
return;
}
Launcher.addDumpLog(TAG, "10249126 - stripEmptyScreens()", true);
int currentPage = getNextPage();
ArrayList<Long> removeScreens = new ArrayList<Long>();
for (Long id: mWorkspaceScreens.keySet()) {
@@ -699,7 +680,6 @@ public class Workspace extends SmoothPagedView
int pageShift = 0;
for (Long id: removeScreens) {
Launcher.addDumpLog(TAG, "10249126 - \tremove(" + id + ")", true);
CellLayout cl = mWorkspaceScreens.get(id);
mWorkspaceScreens.remove(id);
mScreenOrder.remove(id);
@@ -1746,7 +1726,6 @@ public class Workspace extends SmoothPagedView
mScreenOrder.add(getIdForScreen(cl));
}
Launcher.addDumpLog(TAG, "10249126 - onEndReordering()", true);
mLauncher.getModel().updateWorkspaceScreenOrder(mLauncher, mScreenOrder);
// Re-enable auto layout transitions for page deletion.