Fixed wipeData() so it doesn't depend on device_admin.

That method can be called by apps that have the MASTER_CLEAR
permission, even if the device doesn't support device_admin

Test: manual verification using automotive's KitchenSink app
Fixes: 190861794

Change-Id: I97ddb18580593e7b23f8fb55b3346049a2261144
This commit is contained in:
Felipe Leme
2021-06-11 16:12:34 -07:00
parent 96d2926fc7
commit 73471b7634

View File

@@ -6832,7 +6832,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
@Override
public void wipeDataWithReason(int flags, String wipeReasonForUser,
boolean calledOnParentInstance) {
if (!mHasFeature) {
if (!mHasFeature && !hasCallingOrSelfPermission(permission.MASTER_CLEAR)) {
return;
}
final CallerIdentity caller = getCallerIdentity();