summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorHakan Still <hakan.still@sonyericsson.com>2010-12-07 14:05:55 +0100
committerJohan Redestig <johan.redestig@sonyericsson.com>2010-12-08 13:19:33 +0100
commitb247536aa3d458750edbc6b45b2348a994d83426 (patch)
treee8e0a14fd8ae0b5a8dab3c4f7b1e33af71238209 /services
parent2b858caecb3c293c47b48eed12a55a49e3039874 (diff)
downloadframeworks_base-b247536aa3d458750edbc6b45b2348a994d83426.zip
frameworks_base-b247536aa3d458750edbc6b45b2348a994d83426.tar.gz
frameworks_base-b247536aa3d458750edbc6b45b2348a994d83426.tar.bz2
Added dropbox broadcast notification
To monitor the dropbox an application have to either poll the dropbox and keep track of all entries or observ the /data/system/dropbox directory. The later requires that the application runs as system-user. This commit adds that a broadcast intent is sent when something is written to the dropbox and an application can just listen on this intent and then reads the entry with help of the DropboxManager class. The application have to hold the permission android.permission.READ_LOGS to get the intent. Change-Id: I1f77f206a243df69f4ed5306078c47f7bf6181ec
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/DropBoxManagerService.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/services/java/com/android/server/DropBoxManagerService.java b/services/java/com/android/server/DropBoxManagerService.java
index 0de11c6..2cabce1 100644
--- a/services/java/com/android/server/DropBoxManagerService.java
+++ b/services/java/com/android/server/DropBoxManagerService.java
@@ -211,8 +211,14 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
}
} while (read > 0);
- createEntry(temp, tag, flags);
+ long time = createEntry(temp, tag, flags);
temp = null;
+
+ Intent dropboxIntent = new Intent(DropBoxManager.ACTION_DROPBOX_ENTRY_ADDED);
+ dropboxIntent.putExtra(DropBoxManager.EXTRA_TAG, tag);
+ dropboxIntent.putExtra(DropBoxManager.EXTRA_TIME, time);
+ mContext.sendBroadcast(dropboxIntent, android.Manifest.permission.READ_LOGS);
+
} catch (IOException e) {
Slog.e(TAG, "Can't write: " + tag, e);
} finally {
@@ -590,7 +596,7 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
}
/** Moves a temporary file to a final log filename and enrolls it. */
- private synchronized void createEntry(File temp, String tag, int flags) throws IOException {
+ private synchronized long createEntry(File temp, String tag, int flags) throws IOException {
long t = System.currentTimeMillis();
// Require each entry to have a unique timestamp; if there are entries
@@ -629,6 +635,7 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
} else {
enrollEntry(new EntryFile(temp, mDropBoxDir, tag, t, flags, mBlockSize));
}
+ return t;
}
/**