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

Commit 852446ad authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents 6110f065 852b48b6
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
@@ -1025,23 +1025,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.
     */