DropBoxManagerpublic class DropBoxManager extends Object 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
{@link android.content.Context#getSystemService}
with {@link android.content.Context#DROPBOX_SERVICE}.
DropBoxManager entries are not sent anywhere directly, but other system
services and debugging tools may scan and upload entries for processing. |
Fields Summary |
---|
private static final String | TAG | private final com.android.internal.os.IDropBoxManagerService | mService | public static final int | IS_EMPTYFlag value: Entry's content was deleted to save space. | public static final int | IS_TEXTFlag value: Content is human-readable UTF-8 text (can be combined with IS_GZIPPED). | public static final int | IS_GZIPPEDFlag value: Content can be decompressed with {@link java.util.zip.GZIPOutputStream}. | private static final int | HAS_BYTE_ARRAYFlag value for serialization only: Value is a byte array, not a file descriptor | public static final String | ACTION_DROPBOX_ENTRY_ADDEDBroadcast 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.
This is a protected intent that can only be sent
by the system. | public static final String | EXTRA_TAGExtra for {@link android.os.DropBoxManager#ACTION_DROPBOX_ENTRY_ADDED}:
string containing the dropbox tag. | public static final String | EXTRA_TIMEExtra 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. |
Constructors Summary |
---|
public DropBoxManager(com.android.internal.os.IDropBoxManagerService service){@hide} mService = service;
| protected DropBoxManager()Create a dummy instance for testing. All methods will fail unless
overridden with an appropriate mock implementation. To obtain a
functional instance, use {@link android.content.Context#getSystemService}. mService = null;
|
Methods Summary |
---|
public void | addData(java.lang.String tag, byte[] data, int flags)Stores binary data, which may be ignored or discarded as with {@link #addText}.
if (data == null) throw new NullPointerException("data == null");
try { mService.add(new Entry(tag, 0, data, flags)); } catch (RemoteException e) {}
| public void | addFile(java.lang.String tag, java.io.File file, int flags)Stores the contents of a file, which may be ignored or discarded as with
{@link #addText}.
if (file == null) throw new NullPointerException("file == null");
Entry entry = new Entry(tag, 0, file, flags);
try {
mService.add(entry);
} catch (RemoteException e) {
// ignore
} finally {
entry.close();
}
| public void | addText(java.lang.String tag, java.lang.String data)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 {@link #isTagEnabled}).
try { mService.add(new Entry(tag, 0, data)); } catch (RemoteException e) {}
| public android.os.DropBoxManager$Entry | getNextEntry(java.lang.String tag, long msec)Gets the next entry from the drop box after the specified time.
Requires android.permission.READ_LOGS . You must always call
{@link Entry#close()} on the return value!
try { return mService.getNextEntry(tag, msec); } catch (RemoteException e) { return null; }
| public boolean | isTagEnabled(java.lang.String tag)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.
try { return mService.isTagEnabled(tag); } catch (RemoteException e) { return false; }
|
|