Add system API to PersistentDataBlockManager to return config_persistentDataPackageName
Fixes: 215369101 Test: none Change-Id: Ic10dc8ce41c872d77c8a454f63a783984aab71d8
This commit is contained in:
@@ -11031,6 +11031,7 @@ package android.service.persistentdata {
|
||||
method @android.service.persistentdata.PersistentDataBlockManager.FlashLockState @RequiresPermission(anyOf={android.Manifest.permission.READ_OEM_UNLOCK_STATE, "android.permission.OEM_UNLOCK_STATE"}) public int getFlashLockState();
|
||||
method public long getMaximumDataBlockSize();
|
||||
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_OEM_UNLOCK_STATE, "android.permission.OEM_UNLOCK_STATE"}) public boolean getOemUnlockEnabled();
|
||||
method @NonNull public String getPersistentDataPackageName();
|
||||
method public byte[] read();
|
||||
method @Deprecated @RequiresPermission("android.permission.OEM_UNLOCK_STATE") public void setOemUnlockEnabled(boolean);
|
||||
method @RequiresPermission("android.permission.OEM_UNLOCK_STATE") public void wipe();
|
||||
|
||||
@@ -1021,19 +1021,21 @@ public final class SystemServiceRegistry {
|
||||
}});
|
||||
|
||||
registerService(Context.PERSISTENT_DATA_BLOCK_SERVICE, PersistentDataBlockManager.class,
|
||||
new StaticServiceFetcher<PersistentDataBlockManager>() {
|
||||
new CachedServiceFetcher<PersistentDataBlockManager>() {
|
||||
@Override
|
||||
public PersistentDataBlockManager createService() throws ServiceNotFoundException {
|
||||
public PersistentDataBlockManager createService(ContextImpl ctx)
|
||||
throws ServiceNotFoundException {
|
||||
IBinder b = ServiceManager.getServiceOrThrow(Context.PERSISTENT_DATA_BLOCK_SERVICE);
|
||||
IPersistentDataBlockService persistentDataBlockService =
|
||||
IPersistentDataBlockService.Stub.asInterface(b);
|
||||
if (persistentDataBlockService != null) {
|
||||
return new PersistentDataBlockManager(persistentDataBlockService);
|
||||
return new PersistentDataBlockManager(ctx, persistentDataBlockService);
|
||||
} else {
|
||||
// not supported
|
||||
return null;
|
||||
}
|
||||
}});
|
||||
}
|
||||
});
|
||||
|
||||
registerService(Context.OEM_LOCK_SERVICE, OemLockManager.class,
|
||||
new StaticServiceFetcher<OemLockManager>() {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package android.service.persistentdata;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.SystemApi;
|
||||
@@ -25,6 +26,8 @@ import android.content.Context;
|
||||
import android.os.RemoteException;
|
||||
import android.service.oemlock.OemLockManager;
|
||||
|
||||
import com.android.internal.R;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@@ -50,6 +53,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
@SystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE)
|
||||
public class PersistentDataBlockManager {
|
||||
private static final String TAG = PersistentDataBlockManager.class.getSimpleName();
|
||||
private final Context mContext;
|
||||
private IPersistentDataBlockService sService;
|
||||
|
||||
/**
|
||||
@@ -74,7 +78,10 @@ public class PersistentDataBlockManager {
|
||||
public @interface FlashLockState {}
|
||||
|
||||
/** @hide */
|
||||
public PersistentDataBlockManager(IPersistentDataBlockService service) {
|
||||
public PersistentDataBlockManager(
|
||||
Context context,
|
||||
IPersistentDataBlockService service) {
|
||||
mContext = context;
|
||||
sService = service;
|
||||
}
|
||||
|
||||
@@ -204,4 +211,15 @@ public class PersistentDataBlockManager {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the package name which can access the persistent data partition.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@NonNull
|
||||
public String getPersistentDataPackageName() {
|
||||
return mContext.getString(R.string.config_persistentDataPackageName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user