DropBoxManager
open class DropBoxManager
kotlin.Any | |
↳ | android.os.DropBoxManager |
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".
DropBoxManager entries are not sent anywhere directly, but other system services and debugging tools may scan and upload entries for processing.
Requires API level 8 (Android 2.2, Froyo)
Summary
Nested classes | |
---|---|
open |
A single entry retrieved from the drop box. |
Constants | |
---|---|
static String |
Broadcast Action: This is broadcast when a new entry is added in the dropbox. |
static String |
Extra for |
static String |
Extra for |
static Int |
Flag value: Entry's content was deleted to save space. |
static Int |
Flag value: Content can be decompressed with |
static Int |
Flag value: Content is human-readable UTF-8 text (can be combined with IS_GZIPPED). |
Protected constructors | |
---|---|
<init>() Create a dummy instance for testing. |
Public methods | |
---|---|
open Boolean |
isTagEnabled(tag: String!) Checks any blacklists (set in system settings) to see whether a certain tag is allowed. |
open Unit |
Stores the contents of a file, which may be ignored or discarded as with |
open Unit |
Stores binary data, which may be ignored or discarded as with |
open DropBoxManager.Entry? |
getNextEntry(tag: String, msec: Long) Gets the next entry from the drop box after the specified time. |
open Unit |
Stores human-readable text. |
Constants
ACTION_DROPBOX_ENTRY_ADDED
static val ACTION_DROPBOX_ENTRY_ADDED: String
Broadcast Action: This is broadcast when a new entry is added in the dropbox. You must hold the 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.
Requires API level 11 (Android 3.0, Honeycomb)
Value: "android.intent.action.DROPBOX_ENTRY_ADDED"
EXTRA_TAG
static val EXTRA_TAG: String
Extra for android.os.DropBoxManager#ACTION_DROPBOX_ENTRY_ADDED
: string containing the dropbox tag.
Requires API level 11 (Android 3.0, Honeycomb)
Value: "tag"
EXTRA_TIME
static val EXTRA_TIME: String
Extra for 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.
Requires API level 11 (Android 3.0, Honeycomb)
Value: "time"
IS_EMPTY
static val IS_EMPTY: Int
Flag value: Entry's content was deleted to save space.
Requires API level 8 (Android 2.2, Froyo)
Value: 1
IS_GZIPPED
static val IS_GZIPPED: Int
Flag value: Content can be decompressed with java.util.zip.GZIPOutputStream
.
Requires API level 8 (Android 2.2, Froyo)
Value: 4
IS_TEXT
static val IS_TEXT: Int
Flag value: Content is human-readable UTF-8 text (can be combined with IS_GZIPPED).
Requires API level 8 (Android 2.2, Froyo)
Value: 2
Protected constructors
<init>
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 android.content.Context#getSystemService
.
Public methods
isTagEnabled
open fun isTagEnabled(tag: String!): Boolean
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.
Requires API level 8 (Android 2.2, Froyo)
Parameters | |
---|---|
tag |
String!: that would be used in #addText or #addFile |
Return | |
---|---|
Boolean: whether events with that tag would be accepted |
addFile
open fun addFile(tag: String!, file: File!, flags: Int): Unit
Stores the contents of a file, which may be ignored or discarded as with #addText
.
Requires API level 8 (Android 2.2, Froyo)
Parameters | |
---|---|
tag |
String!: describing the type of entry being stored |
file |
String!: to read from |
flags |
String!: describing the data |
Exceptions | |
---|---|
IOException |
if the file can't be opened |
addData
open fun addData(tag: String!, data: ByteArray!, flags: Int): Unit
Stores binary data, which may be ignored or discarded as with #addText
.
Requires API level 8 (Android 2.2, Froyo)
Parameters | |
---|---|
tag |
String!: describing the type of entry being stored |
data |
String!: value to store |
flags |
String!: describing the data |
getNextEntry
open fun getNextEntry(tag: String, msec: Long): DropBoxManager.Entry?
Gets the next entry from the drop box after the specified time. Requires android.permission.READ_LOGS
. You must always call Entry#close()
on the return value!
Requires android.Manifest.permission#READ_LOGS
and android.Manifest.permission#PACKAGE_USAGE_STATS
Requires API level 8 (Android 2.2, Froyo)
Parameters | |
---|---|
tag |
String: of entry to look for, null for all tags |
msec |
String: time of the last entry seen |
Return | |
---|---|
DropBoxManager.Entry?: the next entry, or null if there are no more entries |
addText
open fun addText(tag: String!, data: String!): Unit
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
).
Requires API level 8 (Android 2.2, Froyo)
Parameters | |
---|---|
tag |
String!: describing the type of entry being stored |
data |
String!: value to store |