summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2017-01-05 14:36:02 -0800
committerSunny Goyal <sunnygoyal@google.com>2017-01-09 14:27:56 -0800
commit49f19f0af96ccf9da78b62a4ac9f51e40b40adc5 (patch)
tree59e016e7dec851661d833fc7ec02c80daa171b0b /src/com/android
parente09bacc1ef50aa7c4fe551a7360d7f5613927ee9 (diff)
downloadandroid_packages_apps_Trebuchet-49f19f0af96ccf9da78b62a4ac9f51e40b40adc5.tar.gz
android_packages_apps_Trebuchet-49f19f0af96ccf9da78b62a4ac9f51e40b40adc5.tar.bz2
android_packages_apps_Trebuchet-49f19f0af96ccf9da78b62a4ac9f51e40b40adc5.zip
Adding some logging around launcher restore
> Also enabling fileLog when the device is debug build (even when launcher is not dogfood build) Bug: 30735662 Change-Id: Ieab2c962d57f6f7f972f8111070d4ecbef06b3e7
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/launcher3/LauncherBackupAgent.java8
-rw-r--r--src/com/android/launcher3/Utilities.java6
-rw-r--r--src/com/android/launcher3/logging/FileLog.java2
-rw-r--r--src/com/android/launcher3/provider/ImportDataTask.java3
-rw-r--r--src/com/android/launcher3/provider/RestoreDbTask.java1
5 files changed, 19 insertions, 1 deletions
diff --git a/src/com/android/launcher3/LauncherBackupAgent.java b/src/com/android/launcher3/LauncherBackupAgent.java
index b3e73f768..140794b07 100644
--- a/src/com/android/launcher3/LauncherBackupAgent.java
+++ b/src/com/android/launcher3/LauncherBackupAgent.java
@@ -5,11 +5,19 @@ import android.app.backup.BackupDataInput;
import android.app.backup.BackupDataOutput;
import android.os.ParcelFileDescriptor;
+import com.android.launcher3.logging.FileLog;
import com.android.launcher3.provider.RestoreDbTask;
public class LauncherBackupAgent extends BackupAgent {
@Override
+ public void onCreate() {
+ super.onCreate();
+ // Set the log dir as LauncherAppState is not initialized during restore.
+ FileLog.setDir(getFilesDir());
+ }
+
+ @Override
public void onRestore(
BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) {
// Doesn't do incremental backup/restore
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 2cb913858..89ffd315d 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -104,6 +104,12 @@ public final class Utilities {
public static final boolean ATLEAST_LOLLIPOP_MR1 =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1;
+ /**
+ * Indicates if the device has a debug build. Should only be used to store additional info or
+ * add extra logging and not for changing the app behavior.
+ */
+ public static final boolean IS_DEBUG_DEVICE = Build.TYPE.toLowerCase().contains("debug");
+
// An intent extra to indicate the horizontal scroll of the wallpaper.
public static final String EXTRA_WALLPAPER_OFFSET = "com.android.launcher3.WALLPAPER_OFFSET";
diff --git a/src/com/android/launcher3/logging/FileLog.java b/src/com/android/launcher3/logging/FileLog.java
index 8629e9266..ffb41b76b 100644
--- a/src/com/android/launcher3/logging/FileLog.java
+++ b/src/com/android/launcher3/logging/FileLog.java
@@ -40,7 +40,7 @@ public final class FileLog {
private static File sLogsDirectory = null;
public static void setDir(File logsDir) {
- if (ProviderConfig.IS_DOGFOOD_BUILD) {
+ if (ProviderConfig.IS_DOGFOOD_BUILD || Utilities.IS_DEBUG_DEVICE) {
synchronized (DATE_FORMAT) {
// If the target directory changes, stop any active thread.
if (sHandler != null && !logsDir.equals(sLogsDirectory)) {
diff --git a/src/com/android/launcher3/provider/ImportDataTask.java b/src/com/android/launcher3/provider/ImportDataTask.java
index 9d8e62ae5..808e6e3ac 100644
--- a/src/com/android/launcher3/provider/ImportDataTask.java
+++ b/src/com/android/launcher3/provider/ImportDataTask.java
@@ -89,10 +89,12 @@ public class ImportDataTask {
ArrayList<Long> allScreens = LauncherDbUtils.getScreenIdsFromCursor(
mContext.getContentResolver().query(mOtherScreensUri, null, null, null,
LauncherSettings.WorkspaceScreens.SCREEN_RANK));
+ FileLog.d(TAG, "Importing DB from " + mOtherFavoritesUri);
// During import we reset the screen IDs to 0-indexed values.
if (allScreens.isEmpty()) {
// No thing to migrate
+ FileLog.e(TAG, "No data found to import");
return false;
}
@@ -293,6 +295,7 @@ public class ImportDataTask {
}
}
}
+ FileLog.d(TAG, totalItemsOnWorkspace + " items imported from external source");
if (totalItemsOnWorkspace < MIN_ITEM_COUNT_FOR_SUCCESSFUL_MIGRATION) {
throw new Exception("Insufficient data");
}
diff --git a/src/com/android/launcher3/provider/RestoreDbTask.java b/src/com/android/launcher3/provider/RestoreDbTask.java
index 47bee0669..a200a8526 100644
--- a/src/com/android/launcher3/provider/RestoreDbTask.java
+++ b/src/com/android/launcher3/provider/RestoreDbTask.java
@@ -142,6 +142,7 @@ public class RestoreDbTask {
}
public static void setPending(Context context, boolean isPending) {
+ FileLog.d(TAG, "Restore data received through full backup");
Utilities.getPrefs(context).edit().putBoolean(RESTORE_TASK_PENDING, isPending).commit();
}
}