public class PersistentDataBlockManager extends Object
write(byte[])
is called, it will overwite the data that was previously written on the block.
Clients can query the size of the currently written block via
getDataBlockSize()
.
Clients can query the maximum size for a block via
getMaximumDataBlockSize()
Clients can read the currently written block by invoking
read()
.Modifier and Type | Class and Description |
---|---|
static interface |
PersistentDataBlockManager.FlashLockState |
Modifier and Type | Field and Description |
---|---|
static int |
FLASH_LOCK_LOCKED
Indicates that the device's bootloader is LOCKED.
|
static int |
FLASH_LOCK_UNKNOWN
Indicates that the device's bootloader lock state is UNKNOWN.
|
static int |
FLASH_LOCK_UNLOCKED
Indicates that the device's bootloader is UNLOCKED.
|
Constructor and Description |
---|
PersistentDataBlockManager(IPersistentDataBlockService service) |
Modifier and Type | Method and Description |
---|---|
int |
getDataBlockSize()
Retrieves the size of the block currently written to the persistent partition.
|
int |
getFlashLockState()
Retrieves available information about this device's flash lock state.
|
long |
getMaximumDataBlockSize()
Retrieves the maximum size allowed for a data block.
|
boolean |
getOemUnlockEnabled()
Returns whether or not "OEM unlock" is enabled or disabled on this device.
|
byte[] |
read()
Returns the data block stored on the persistent partition.
|
void |
setOemUnlockEnabled(boolean enabled)
Writes a byte enabling or disabling the ability to "OEM unlock" the device.
|
void |
wipe()
Zeroes the previously written block in its entirety.
|
int |
write(byte[] data)
Writes
data to the persistent partition. |
public static final int FLASH_LOCK_UNKNOWN
public static final int FLASH_LOCK_UNLOCKED
public static final int FLASH_LOCK_LOCKED
public PersistentDataBlockManager(IPersistentDataBlockService service)
public int write(byte[] data)
data
to the persistent partition. Previously written data
will be overwritten. This data will persist across factory resets.
Returns the number of bytes written or -1 on error. If the block is too big
to fit on the partition, returns -MAX_BLOCK_SIZE.data
- the data to writepublic byte[] read()
public int getDataBlockSize()
public long getMaximumDataBlockSize()
public void wipe()
public void setOemUnlockEnabled(boolean enabled)
public boolean getOemUnlockEnabled()
public int getFlashLockState()
FLASH_LOCK_LOCKED
if device bootloader is locked,
FLASH_LOCK_UNLOCKED
if device bootloader is unlocked, or FLASH_LOCK_UNKNOWN
if this information cannot be ascertained on this device.