Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 034f3b9f authored by Antoan Angelov's avatar Antoan Angelov Committed by Android (Google) Code Review
Browse files

Merge "Add system API to PersistentDataBlockManager to return config_persistentDataPackageName"

parents f21152bb b7542a3b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -11070,6 +11070,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();
+6 −4
Original line number Diff line number Diff line
@@ -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>() {
+19 −1
Original line number Diff line number Diff line
@@ -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);
    }
}