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

Commit c5e9a48d authored by Alex Johnston's avatar Alex Johnston Committed by Android (Google) Code Review
Browse files

Merge "Add factory reset protection policy Test API to DPM" into rvc-dev

parents d31dc67d e62d8d11
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -580,6 +580,7 @@ package android.app.admin {
    method public java.util.List<java.lang.String> getOwnerInstalledCaCerts(@NonNull android.os.UserHandle);
    method public boolean isCurrentInputMethodSetByOwner();
    method public boolean isDeviceManaged();
    method public boolean isFactoryResetProtectionPolicySupported();
    field public static final String ACCOUNT_FEATURE_DEVICE_OR_PROFILE_OWNER_ALLOWED = "android.account.DEVICE_OR_PROFILE_OWNER_ALLOWED";
    field public static final String ACCOUNT_FEATURE_DEVICE_OR_PROFILE_OWNER_DISALLOWED = "android.account.DEVICE_OR_PROFILE_OWNER_DISALLOWED";
    field public static final String ACTION_DATA_SHARING_RESTRICTION_APPLIED = "android.app.action.DATA_SHARING_RESTRICTION_APPLIED";
+16 −0
Original line number Diff line number Diff line
@@ -10952,6 +10952,22 @@ public class DevicePolicyManager {
        }
    }
    /**
     * Returns whether factory reset protection policy is supported on the device.
     *
     * @return {@code true} if the device support factory reset protection policy.
     *
     * @hide
     */
    @TestApi
    public boolean isFactoryResetProtectionPolicySupported() {
        try {
            return mService.isFactoryResetProtectionPolicySupported();
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
        }
    }
    /**
     * Called by the device owner or profile owner to clear application user data of a given
     * package. The behaviour of this is equivalent to the target application calling
+1 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ interface IDevicePolicyManager {

    void setFactoryResetProtectionPolicy(in ComponentName who, in FactoryResetProtectionPolicy policy);
    FactoryResetProtectionPolicy getFactoryResetProtectionPolicy(in ComponentName who);
    boolean isFactoryResetProtectionPolicySupported();

    ComponentName setGlobalProxy(in ComponentName admin, String proxySpec, String exclusionList);
    ComponentName getGlobalProxyAdmin(int userHandle);
+13 −3
Original line number Diff line number Diff line
@@ -7326,13 +7326,23 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        return admin != null ? admin.mFactoryResetProtectionPolicy : null;
    }
    private int getFrpManagementAgentUidOrThrow() {
    private int getFrpManagementAgentUid() {
        PersistentDataBlockManagerInternal pdb = mInjector.getPersistentDataBlockManagerInternal();
        if ((pdb == null) || (pdb.getAllowedUid() == -1)) {
        return pdb != null ? pdb.getAllowedUid() : -1;
    }
    private int getFrpManagementAgentUidOrThrow() {
        int uid = getFrpManagementAgentUid();
        if (uid == -1) {
            throw new UnsupportedOperationException(
                    "The persistent data block service is not supported on this device");
        }
        return pdb.getAllowedUid();
        return uid;
    }
    @Override
    public boolean isFactoryResetProtectionPolicySupported() {
        return getFrpManagementAgentUid() != -1;
    }
    @Override