Skip to content

Commit e78a000

Browse files
author
Jean-Baptiste Queru
committed
resolved conflicts for merge of 4b94c45 to stage-korg-master
Change-Id: I07b974f96ca598677e58623050e4668822e68f23
2 parents d0ffef4 + 4b94c45 commit e78a000

File tree

3 files changed

+66
-2
lines changed

3 files changed

+66
-2
lines changed

api/current.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124732,6 +124732,39 @@
124732124732
<parameter name="tag" type="java.lang.String">
124733124733
</parameter>
124734124734
</method>
124735+
<field name="ACTION_DROPBOX_ENTRY_ADDED"
124736+
type="java.lang.String"
124737+
transient="false"
124738+
volatile="false"
124739+
value="&quot;android.intent.action.DROPBOX_ENTRY_ADDED&quot;"
124740+
static="true"
124741+
final="true"
124742+
deprecated="not deprecated"
124743+
visibility="public"
124744+
>
124745+
</field>
124746+
<field name="EXTRA_TAG"
124747+
type="java.lang.String"
124748+
transient="false"
124749+
volatile="false"
124750+
value="&quot;tag&quot;"
124751+
static="true"
124752+
final="true"
124753+
deprecated="not deprecated"
124754+
visibility="public"
124755+
>
124756+
</field>
124757+
<field name="EXTRA_TIME"
124758+
type="java.lang.String"
124759+
transient="false"
124760+
volatile="false"
124761+
value="&quot;time&quot;"
124762+
static="true"
124763+
final="true"
124764+
deprecated="not deprecated"
124765+
visibility="public"
124766+
>
124767+
</field>
124735124768
<field name="IS_EMPTY"
124736124769
type="int"
124737124770
transient="false"

core/java/android/os/DropBoxManager.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,30 @@ public class DropBoxManager {
5757
/** Flag value for serialization only: Value is a byte array, not a file descriptor */
5858
private static final int HAS_BYTE_ARRAY = 8;
5959

60+
/**
61+
* Broadcast Action: This is broadcast when a new entry is added in the dropbox.
62+
* You must hold the {@link android.Manifest.permission#READ_LOGS} permission
63+
* in order to receive this broadcast.
64+
*
65+
* <p class="note">This is a protected intent that can only be sent
66+
* by the system.
67+
*/
68+
public static final String ACTION_DROPBOX_ENTRY_ADDED =
69+
"android.intent.action.DROPBOX_ENTRY_ADDED";
70+
71+
/**
72+
* Extra for {@link android.os.DropBoxManager#ACTION_DROPBOX_ENTRY_ADDED}:
73+
* string containing the dropbox tag.
74+
*/
75+
public static final String EXTRA_TAG = "tag";
76+
77+
/**
78+
* Extra for {@link android.os.DropBoxManager#ACTION_DROPBOX_ENTRY_ADDED}:
79+
* long integer value containing time (in milliseconds since January 1, 1970 00:00:00 UTC)
80+
* when the entry was created.
81+
*/
82+
public static final String EXTRA_TIME = "time";
83+
6084
/**
6185
* A single entry retrieved from the drop box.
6286
* This may include a reference to a stream, so you must call

services/java/com/android/server/DropBoxManagerService.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,14 @@ public void add(DropBoxManager.Entry entry) {
218218
}
219219
} while (read > 0);
220220

221-
createEntry(temp, tag, flags);
221+
long time = createEntry(temp, tag, flags);
222222
temp = null;
223+
224+
Intent dropboxIntent = new Intent(DropBoxManager.ACTION_DROPBOX_ENTRY_ADDED);
225+
dropboxIntent.putExtra(DropBoxManager.EXTRA_TAG, tag);
226+
dropboxIntent.putExtra(DropBoxManager.EXTRA_TIME, time);
227+
mContext.sendBroadcast(dropboxIntent, android.Manifest.permission.READ_LOGS);
228+
223229
} catch (IOException e) {
224230
Slog.e(TAG, "Can't write: " + tag, e);
225231
} finally {
@@ -597,7 +603,7 @@ private synchronized void enrollEntry(EntryFile entry) {
597603
}
598604

599605
/** Moves a temporary file to a final log filename and enrolls it. */
600-
private synchronized void createEntry(File temp, String tag, int flags) throws IOException {
606+
private synchronized long createEntry(File temp, String tag, int flags) throws IOException {
601607
long t = System.currentTimeMillis();
602608

603609
// Require each entry to have a unique timestamp; if there are entries
@@ -636,6 +642,7 @@ private synchronized void createEntry(File temp, String tag, int flags) throws I
636642
} else {
637643
enrollEntry(new EntryFile(temp, mDropBoxDir, tag, t, flags, mBlockSize));
638644
}
645+
return t;
639646
}
640647

641648
/**

0 commit comments

Comments
 (0)