From 56bb0b7219059d15eb1ed0fb16154f3ab5499d21 Mon Sep 17 00:00:00 2001 From: Jinguang Dong Date: Tue, 17 Jul 2018 11:53:18 +0800 Subject: [PATCH] Ensure dropbox could copy tombstone files to special folder. Process of tombstoned have changed the generation flow for tombstone, and dropbox could not be notified when generating new tombstone file any more, so dropbox could not copy and compress tombstone file to /data/system/dropbox. We need to modify observer events from CLOSE_WRITE to CREATE, and it could work normally. Bug: http://b/111608961 Test: 1 After tombstone is triggered, we could see the tombstone file in the data/system/dropbox directory. Signed-off-by: Haoran Li Change-Id: I9d6a31773e4a58658ffab214b1e337f27e9f3ae6 (cherry picked from commit fe8d2c9a8c86bc842871129600ad9fbbb9b60ab3) --- core/java/com/android/server/BootReceiver.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/com/android/server/BootReceiver.java b/core/java/com/android/server/BootReceiver.java index 95534e264b802..621d5a6e5c55d 100644 --- a/core/java/com/android/server/BootReceiver.java +++ b/core/java/com/android/server/BootReceiver.java @@ -258,13 +258,13 @@ public class BootReceiver extends BroadcastReceiver { // Start watching for new tombstone files; will record them as they occur. // This gets registered with the singleton file observer thread. - sTombstoneObserver = new FileObserver(TOMBSTONE_DIR.getPath(), FileObserver.CLOSE_WRITE) { + sTombstoneObserver = new FileObserver(TOMBSTONE_DIR.getPath(), FileObserver.CREATE) { @Override public void onEvent(int event, String path) { HashMap timestamps = readTimestamps(); try { File file = new File(TOMBSTONE_DIR, path); - if (file.isFile()) { + if (file.isFile() && file.getName().startsWith("tombstone_")) { addFileToDropBox(db, timestamps, headers, file.getPath(), LOG_SIZE, TAG_TOMBSTONE); }