lineagehw: Remove persistent storage feature
Change-Id: I286735192cf3f688980645efa7c1ba057fa825ca
This commit is contained in:
@@ -52,9 +52,6 @@ interface ILineageHardwareService {
|
||||
DisplayMode getDefaultDisplayMode();
|
||||
boolean setDisplayMode(in DisplayMode mode, boolean makeDefault);
|
||||
|
||||
boolean writePersistentBytes(String key, in byte[] bytes);
|
||||
byte[] readPersistentBytes(String key);
|
||||
|
||||
int getThermalState();
|
||||
boolean registerThermalListener(IThermalListenerCallback callback);
|
||||
boolean unRegisterThermalListener(IThermalListenerCallback callback);
|
||||
|
||||
@@ -134,12 +134,6 @@ public final class LineageHardwareManager {
|
||||
@VisibleForTesting
|
||||
public static final int FEATURE_DISPLAY_MODES = 0x2000;
|
||||
|
||||
/**
|
||||
* Persistent storage
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public static final int FEATURE_PERSISTENT_STORAGE = 0x4000;
|
||||
|
||||
/**
|
||||
* Thermal change monitor
|
||||
*/
|
||||
@@ -491,132 +485,6 @@ public final class LineageHardwareManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a string to persistent storage, which persists thru factory reset
|
||||
*
|
||||
* @param key String identifier for this item. Must not exceed 64 characters.
|
||||
* @param value The UTF-8 encoded string to store of at least 1 character. null deletes the key/value pair.
|
||||
* @return true on success
|
||||
*/
|
||||
public boolean writePersistentString(String key, String value) {
|
||||
try {
|
||||
if (checkService()) {
|
||||
return sService.writePersistentBytes(key,
|
||||
value == null ? null : value.getBytes("UTF-8"));
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Log.e(TAG, e.getMessage(), e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an integer to persistent storage, which persists thru factory reset
|
||||
*
|
||||
* @param key String identifier for this item. Must not exceed 64 characters.
|
||||
* @param value The integer to store
|
||||
* @return true on success
|
||||
*/
|
||||
public boolean writePersistentInt(String key, int value) {
|
||||
try {
|
||||
if (checkService()) {
|
||||
return sService.writePersistentBytes(key,
|
||||
ByteBuffer.allocate(4).putInt(value).array());
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a byte array to persistent storage, which persists thru factory reset
|
||||
*
|
||||
* @param key String identifier for this item. Must not exceed 64 characters.
|
||||
* @param value The byte array to store, must be 1-4096 bytes. null deletes the key/value pair.
|
||||
* @return true on success
|
||||
*/
|
||||
public boolean writePersistentBytes(String key, byte[] value) {
|
||||
try {
|
||||
if (checkService()) {
|
||||
return sService.writePersistentBytes(key, value);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a string from persistent storage
|
||||
*
|
||||
* @param key String identifier for this item. Must not exceed 64 characters.
|
||||
* @return the stored UTF-8 encoded string, null if not found
|
||||
*/
|
||||
public String readPersistentString(String key) {
|
||||
try {
|
||||
if (checkService()) {
|
||||
byte[] bytes = sService.readPersistentBytes(key);
|
||||
if (bytes != null) {
|
||||
return new String(bytes, "UTF-8");
|
||||
}
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Log.e(TAG, e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read an integer from persistent storage
|
||||
*
|
||||
* @param key String identifier for this item. Must not exceed 64 characters.
|
||||
* @return the stored integer, zero if not found
|
||||
*/
|
||||
public int readPersistentInt(String key) {
|
||||
try {
|
||||
if (checkService()) {
|
||||
byte[] bytes = sService.readPersistentBytes(key);
|
||||
if (bytes != null) {
|
||||
return ByteBuffer.wrap(bytes).getInt();
|
||||
}
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a byte array from persistent storage
|
||||
*
|
||||
* @param key String identifier for this item. Must not exceed 64 characters.
|
||||
* @return the stored byte array, null if not found
|
||||
*/
|
||||
public byte[] readPersistentBytes(String key) {
|
||||
try {
|
||||
if (checkService()) {
|
||||
return sService.readPersistentBytes(key);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Delete an object from persistent storage
|
||||
*
|
||||
* @param key String identifier for this item
|
||||
* @return true if an item was deleted
|
||||
*/
|
||||
public boolean deletePersistentObject(String key) {
|
||||
try {
|
||||
if (checkService()) {
|
||||
return sService.writePersistentBytes(key, null);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@hide}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user