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.
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 String |
Extra for |
static Int |
Flag value: Entry's content was deleted to save space. |
static Int |
Flag value: Content can be decompressed with java. |
static Int |
Flag value: Content is human-readable UTF-8 text (can be combined with IS_GZIPPED). |
Protected constructors | |
---|---|
Create an instance for testing. |
Public methods | |
---|---|
open Unit |
Stores binary data, which may be ignored or discarded as with |
open Unit |
Stores the contents of a file, which may be ignored or discarded as with |
open Unit |
Stores human-readable text. |
open DropBoxManager.Entry? |
getNextEntry(tag: String!, msec: Long) Gets the next entry from the drop box after the specified time. |
open Boolean |
isTagEnabled(tag: String!) Checks any denylists (set in system settings) to see whether a certain tag is allowed. |
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. For apps targeting 35 and later, For apps targeting Android versions lower than 35, you must hold android.Manifest.permission#READ_LOGS
. This broadcast can be rate limited for low priority entries
This is a protected intent that can only be sent by the system.
Value: "android.intent.action.DROPBOX_ENTRY_ADDED"
EXTRA_DROPPED_COUNT
static val EXTRA_DROPPED_COUNT: String
Extra for android.os.DropBoxManager#ACTION_DROPBOX_ENTRY_ADDED
: integer value containing number of broadcasts dropped due to rate limiting on this android.os.DropBoxManager#EXTRA_TAG
Value: "android.os.extra.DROPPED_COUNT"
EXTRA_TAG
static val EXTRA_TAG: String
Extra for android.os.DropBoxManager#ACTION_DROPBOX_ENTRY_ADDED
: string containing the dropbox tag.
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.
Value: "time"
IS_EMPTY
static val IS_EMPTY: Int
Flag value: Entry's content was deleted to save space.
Value: 1
IS_GZIPPED
static val IS_GZIPPED: Int
Flag value: Content can be decompressed with java.util.zip.GZIPOutputStream.
Value: 4
IS_TEXT
static val IS_TEXT: Int
Flag value: Content is human-readable UTF-8 text (can be combined with IS_GZIPPED).
Value: 2
Protected constructors
DropBoxManager
protected DropBoxManager()
Create an 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
addData
open fun addData(
tag: String,
data: ByteArray?,
flags: Int
): Unit
Stores binary data, which may be ignored or discarded as with addText
.
Parameters | |
---|---|
tag |
String: describing the type of entry being stored This value cannot be null . |
data |
ByteArray?: value to store This value may be null . |
flags |
Int: describing the data Value is either 0 or a combination of android.os.DropBoxManager#IS_EMPTY , android.os.DropBoxManager#IS_TEXT , and android.os.DropBoxManager#IS_GZIPPED |
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
.
Parameters | |
---|---|
tag |
String: describing the type of entry being stored This value cannot be null . |
file |
File: to read from This value cannot be null . |
flags |
Int: describing the data Value is either 0 or a combination of android.os.DropBoxManager#IS_EMPTY , android.os.DropBoxManager#IS_TEXT , and android.os.DropBoxManager#IS_GZIPPED |
Exceptions | |
---|---|
java.io.IOException |
if the file can't be opened |
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
).
Parameters | |
---|---|
tag |
String: describing the type of entry being stored This value cannot be null . |
data |
String: value to store This value cannot be null . |
getNextEntry
open fun getNextEntry(
tag: String!,
msec: Long
): DropBoxManager.Entry?
Gets the next entry from the drop box after the specified time. You must always call android.os.DropBoxManager.Entry#close() on the return value! android.Manifest.permission#READ_LOGS
permission is required for apps targeting Android versions lower than 35.
Requires android.Manifest.permission#READ_DROPBOX_DATA
and android.Manifest.permission#PACKAGE_USAGE_STATS
Parameters | |
---|---|
tag |
String!: of entry to look for, null for all tags |
msec |
Long: time of the last entry seen |
Return | |
---|---|
DropBoxManager.Entry? |
the next entry, or null if there are no more entries |
isTagEnabled
open fun isTagEnabled(tag: String!): Boolean
Checks any denylists (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 |
String!: that would be used in addText or addFile |
Return | |
---|---|
Boolean |
whether events with that tag would be accepted |