summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-06-07 13:53:20 -0700
committerSunny Goyal <sunnygoyal@google.com>2016-06-07 13:54:50 -0700
commite0e0e1d0004ab443c97aa96e390581fbce85fcd1 (patch)
tree975b9ddcf8c37e0e7e45aaec20242747d766b84e
parent2a5b356375e15602acab429642064c566a1a1f4d (diff)
downloadandroid_packages_apps_Trebuchet-e0e0e1d0004ab443c97aa96e390581fbce85fcd1.tar.gz
android_packages_apps_Trebuchet-e0e0e1d0004ab443c97aa96e390581fbce85fcd1.tar.bz2
android_packages_apps_Trebuchet-e0e0e1d0004ab443c97aa96e390581fbce85fcd1.zip
Fixing FileLogs tests
During tests, the logs directory is changed. But the active thread was not getting stopped which was causing some logs to be written to the old location corresponding to some previous test Change-Id: I7b8587eae0eb68fa180e3992694cab3745922483
-rw-r--r--AndroidManifest.xml11
-rw-r--r--src/com/android/launcher3/logging/FileLog.java9
2 files changed, 19 insertions, 1 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index eb7ea0c61..3a3a28dd6 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -49,7 +49,16 @@
<uses-permission android:name="com.android.launcher3.permission.READ_SETTINGS" />
<uses-permission android:name="com.android.launcher3.permission.WRITE_SETTINGS" />
- <application>
+ <application
+ android:backupAgent="com.android.launcher3.LauncherBackupAgent"
+ android:fullBackupOnly="true"
+ android:fullBackupContent="@xml/backupscheme"
+ android:hardwareAccelerated="true"
+ android:icon="@mipmap/ic_launcher_home"
+ android:label="@string/app_name"
+ android:largeHeap="@bool/config_largeHeap"
+ android:restoreAnyVersion="true"
+ android:supportsRtl="true" >
<!--
Main launcher activity. When extending only change the name, and keep all the
diff --git a/src/com/android/launcher3/logging/FileLog.java b/src/com/android/launcher3/logging/FileLog.java
index 68d9b8c92..8629e9266 100644
--- a/src/com/android/launcher3/logging/FileLog.java
+++ b/src/com/android/launcher3/logging/FileLog.java
@@ -40,6 +40,15 @@ public final class FileLog {
private static File sLogsDirectory = null;
public static void setDir(File logsDir) {
+ if (ProviderConfig.IS_DOGFOOD_BUILD) {
+ synchronized (DATE_FORMAT) {
+ // If the target directory changes, stop any active thread.
+ if (sHandler != null && !logsDir.equals(sLogsDirectory)) {
+ ((HandlerThread) sHandler.getLooper().getThread()).quit();
+ sHandler = null;
+ }
+ }
+ }
sLogsDirectory = logsDir;
}