to top
Android APIs
public class

DropBoxManager

extends Object
java.lang.Object
   ↳ android.os.DropBoxManager

Class Overview

Enqueues chunks of data (from various sources -- application crashes, kernel log records, etc.). The queue is size bounded and will drop old data if the enqueued data exceeds the maximum size. You can think of this as a persistent, system-wide, blob-oriented "logcat".

You can obtain an instance of this class by calling getSystemService(String) with DROPBOX_SERVICE.

DropBoxManager entries are not sent anywhere directly, but other system services and debugging tools may scan and upload entries for processing.

Summary

Nested Classes
class DropBoxManager.Entry A single entry retrieved from the drop box. 
Constants
String ACTION_DROPBOX_ENTRY_ADDED Broadcast Action: This is broadcast when a new entry is added in the dropbox.
String EXTRA_TAG Extra for ACTION_DROPBOX_ENTRY_ADDED: string containing the dropbox tag.
String EXTRA_TIME Extra for ACTION_DROPBOX_ENTRY_ADDED: long integer value containing time (in milliseconds since January 1, 1970 00:00:00 UTC) when the entry was created.
int IS_EMPTY Flag value: Entry's content was deleted to save space.
int IS_GZIPPED Flag value: Content can be decompressed with GZIPOutputStream.
int IS_TEXT Flag value: Content is human-readable UTF-8 text (can be combined with IS_GZIPPED).
Protected Constructors
DropBoxManager()
Create a dummy instance for testing.
Public Methods
void addData(String tag, byte[] data, int flags)
Stores binary data, which may be ignored or discarded as with addText(String, String).
void addFile(String tag, File file, int flags)
Stores the contents of a file, which may be ignored or discarded as with addText(String, String).
void addText(String tag, String data)
Stores human-readable text.
DropBoxManager.Entry getNextEntry(String tag, long msec)
Gets the next entry from the drop box after the specified time.
boolean isTagEnabled(String tag)
Checks any blacklists (set in system settings) to see whether a certain tag is allowed.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String ACTION_DROPBOX_ENTRY_ADDED

Added in API level 11

Broadcast Action: This is broadcast when a new entry is added in the dropbox. You must hold the READ_LOGS permission in order to receive this broadcast.

This is a protected intent that can only be sent by the system.

Constant Value: "android.intent.action.DROPBOX_ENTRY_ADDED"

public static final String EXTRA_TAG

Added in API level 11

Extra for ACTION_DROPBOX_ENTRY_ADDED: string containing the dropbox tag.

Constant Value: "tag"

public static final String EXTRA_TIME

Added in API level 11

Extra for ACTION_DROPBOX_ENTRY_ADDED: long integer value containing time (in milliseconds since January 1, 1970 00:00:00 UTC) when the entry was created.

Constant Value: "time"

public static final int IS_EMPTY

Added in API level 8

Flag value: Entry's content was deleted to save space.

Constant Value: 1 (0x00000001)

public static final int IS_GZIPPED

Added in API level 8

Flag value: Content can be decompressed with GZIPOutputStream.

Constant Value: 4 (0x00000004)

public static final int IS_TEXT

Added in API level 8

Flag value: Content is human-readable UTF-8 text (can be combined with IS_GZIPPED).

Constant Value: 2 (0x00000002)

Protected Constructors

protected DropBoxManager ()

Added in API level 8

Create a dummy instance for testing. All methods will fail unless overridden with an appropriate mock implementation. To obtain a functional instance, use getSystemService(String).

Public Methods

public void addData (String tag, byte[] data, int flags)

Added in API level 8

Stores binary data, which may be ignored or discarded as with addText(String, String).

Parameters
tag describing the type of entry being stored
data value to store
flags describing the data

public void addFile (String tag, File file, int flags)

Added in API level 8

Stores the contents of a file, which may be ignored or discarded as with addText(String, String).

Parameters
tag describing the type of entry being stored
file to read from
flags describing the data
Throws
IOException if the file can't be opened

public void addText (String tag, String data)

Added in API level 8

Stores human-readable text. The data may be discarded eventually (or even immediately) if space is limited, or ignored entirely if the tag has been blocked (see isTagEnabled(String)).

Parameters
tag describing the type of entry being stored
data value to store

public DropBoxManager.Entry getNextEntry (String tag, long msec)

Added in API level 8

Gets the next entry from the drop box after the specified time. Requires android.permission.READ_LOGS. You must always call close() on the return value!

Parameters
tag of entry to look for, null for all tags
msec time of the last entry seen
Returns
  • the next entry, or null if there are no more entries

public boolean isTagEnabled (String tag)

Added in API level 8

Checks any blacklists (set in system settings) to see whether a certain tag is allowed. Entries with disabled tags will be dropped immediately, so you can save the work of actually constructing and sending the data.

Parameters
tag that would be used in addText(String, String) or addFile(String, File, int)
Returns
  • whether events with that tag would be accepted