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

Commit 852b48b6 authored by Felipe Leme's avatar Felipe Leme
Browse files

Removed DPM.factoryReset() method used by ManagedProvisioning app.

It's redundant, as DPM.wipeData() do the same (and is now vibible
to apps holding the MASTER_CLEAR permission).

Test: manual verification trying to install a DPC that doesn't exist

Bug: 175392542
Bug: 171603586
Bug: 172697975

Change-Id: I0ed88a6eb239239c38cf569bf21c0745518925e4
parent ade199be
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
@@ -12677,21 +12677,4 @@ public class DevicePolicyManager {
            }
        }
    }
    // TODO(b/175392542): remove if not needed by ManagedProvisioning app anymore
    /**
     * Used by ManagedProvisioning app to factory reset the device when DO cannto be provisioned.
     *
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.MASTER_CLEAR)
    public void factoryReset(String reason) {
        if (mService != null) {
            try {
                mService.factoryReset(reason);
            } catch (RemoteException re) {
                throw re.rethrowFromSystemServer();
            }
        }
    }
}
+0 −2
Original line number Diff line number Diff line
@@ -488,6 +488,4 @@ interface IDevicePolicyManager {
    boolean canProfileOwnerResetPasswordWhenLocked(int userId);

    void setNextOperationSafety(int operation, boolean safe);
    // TODO(b/175392542): remove if not needed by ManagedProvisioning app anymore
    void factoryReset(String reason);
}
+0 −17
Original line number Diff line number Diff line
@@ -1024,23 +1024,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        mSafetyChecker = new OneTimeSafetyChecker(this, operation, safe);
    }
    // TODO(b/175392542): remove if not needed by ManagedProvisioning app anymore
    @Override
    public void factoryReset(String reason) {
        Preconditions.checkCallAuthorization(
                hasCallingOrSelfPermission(permission.MASTER_CLEAR));
        Slog.w(LOG_TAG, "factoryReset(): " + reason);
        final long identity = Binder.clearCallingIdentity();
        try {
            FactoryResetter.newBuilder(mContext).setReason(reason).build().factoryReset();
        } catch (IOException e) {
            // Shouldn't happen.
            Slog.wtf(LOG_TAG, "Could not factory reset", e);
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
    }
    /**
     * Unit test will subclass it to inject mocks.
     */