Merge "Add factory reset protection policy Test API to DPM" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c5e9a48db8
@@ -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";
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user