am e78a0009: resolved conflicts for merge of 4b94c451 to stage-korg-master

* commit 'e78a000955c283509ee8a21b8b7e448060ac8dd8':
  Added dropbox broadcast notification
This commit is contained in:
Jean-Baptiste Queru
2010-12-13 13:10:23 -08:00
committed by Android Git Automerger
3 changed files with 66 additions and 2 deletions

View File

@ -124776,6 +124776,39 @@
<parameter name="tag" type="java.lang.String"> <parameter name="tag" type="java.lang.String">
</parameter> </parameter>
</method> </method>
<field name="ACTION_DROPBOX_ENTRY_ADDED"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;android.intent.action.DROPBOX_ENTRY_ADDED&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="EXTRA_TAG"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;tag&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="EXTRA_TIME"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;time&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="IS_EMPTY" <field name="IS_EMPTY"
type="int" type="int"
transient="false" transient="false"

View File

@ -57,6 +57,30 @@ public class DropBoxManager {
/** Flag value for serialization only: Value is a byte array, not a file descriptor */ /** Flag value for serialization only: Value is a byte array, not a file descriptor */
private static final int HAS_BYTE_ARRAY = 8; private static final int HAS_BYTE_ARRAY = 8;
/**
* Broadcast Action: This is broadcast when a new entry is added in the dropbox.
* You must hold the {@link android.Manifest.permission#READ_LOGS} permission
* in order to receive this broadcast.
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
*/
public static final String ACTION_DROPBOX_ENTRY_ADDED =
"android.intent.action.DROPBOX_ENTRY_ADDED";
/**
* Extra for {@link android.os.DropBoxManager#ACTION_DROPBOX_ENTRY_ADDED}:
* string containing the dropbox tag.
*/
public static final String EXTRA_TAG = "tag";
/**
* Extra for {@link android.os.DropBoxManager#ACTION_DROPBOX_ENTRY_ADDED}:
* long integer value containing time (in milliseconds since January 1, 1970 00:00:00 UTC)
* when the entry was created.
*/
public static final String EXTRA_TIME = "time";
/** /**
* A single entry retrieved from the drop box. * A single entry retrieved from the drop box.
* This may include a reference to a stream, so you must call * This may include a reference to a stream, so you must call

View File

@ -218,8 +218,14 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
} }
} while (read > 0); } while (read > 0);
createEntry(temp, tag, flags); long time = createEntry(temp, tag, flags);
temp = null; 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) { } catch (IOException e) {
Slog.e(TAG, "Can't write: " + tag, e); Slog.e(TAG, "Can't write: " + tag, e);
} finally { } finally {
@ -597,7 +603,7 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
} }
/** Moves a temporary file to a final log filename and enrolls it. */ /** 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(); long t = System.currentTimeMillis();
// Require each entry to have a unique timestamp; if there are entries // Require each entry to have a unique timestamp; if there are entries
@ -636,6 +642,7 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
} else { } else {
enrollEntry(new EntryFile(temp, mDropBoxDir, tag, t, flags, mBlockSize)); enrollEntry(new EntryFile(temp, mDropBoxDir, tag, t, flags, mBlockSize));
} }
return t;
} }
/** /**