Loading core/java/android/os/RecoverySystem.java +7 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.os; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.UserManager; import android.util.Log; import java.io.ByteArrayInputStream; Loading Loading @@ -348,6 +349,7 @@ public class RecoverySystem { * * @throws IOException if writing the recovery command file * fails, or if the reboot itself fails. * @throws SecurityException if the current user is not allowed to wipe data. */ public static void rebootWipeUserData(Context context) throws IOException { rebootWipeUserData(context, false); Loading @@ -367,11 +369,16 @@ public class RecoverySystem { * * @throws IOException if writing the recovery command file * fails, or if the reboot itself fails. * @throws SecurityException if the current user is not allowed to wipe data. * * @hide */ public static void rebootWipeUserData(Context context, boolean shutdown) throws IOException { UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE); if (um.hasUserRestriction(UserManager.DISALLOW_FACTORY_RESET)) { throw new SecurityException("Wiping data is not allowed for this user."); } final ConditionVariable condition = new ConditionVariable(); Intent intent = new Intent("android.intent.action.MASTER_CLEAR_NOTIFICATION"); Loading services/core/java/com/android/server/MasterClearReceiver.java +2 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ public class MasterClearReceiver extends BroadcastReceiver { Log.wtf(TAG, "Still running after master clear?!"); } catch (IOException e) { Slog.e(TAG, "Can't perform master clear/factory reset", e); } catch (SecurityException e) { Slog.e(TAG, "Can't perform master clear/factory reset", e); } } }; Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +2 −0 Original line number Diff line number Diff line Loading @@ -2480,6 +2480,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { RecoverySystem.rebootWipeUserData(mContext); } catch (IOException e) { Slog.w(LOG_TAG, "Failed requesting data wipe", e); } catch (SecurityException e) { Slog.w(LOG_TAG, "Failed requesting data wipe", e); } } } Loading Loading
core/java/android/os/RecoverySystem.java +7 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.os; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.UserManager; import android.util.Log; import java.io.ByteArrayInputStream; Loading Loading @@ -348,6 +349,7 @@ public class RecoverySystem { * * @throws IOException if writing the recovery command file * fails, or if the reboot itself fails. * @throws SecurityException if the current user is not allowed to wipe data. */ public static void rebootWipeUserData(Context context) throws IOException { rebootWipeUserData(context, false); Loading @@ -367,11 +369,16 @@ public class RecoverySystem { * * @throws IOException if writing the recovery command file * fails, or if the reboot itself fails. * @throws SecurityException if the current user is not allowed to wipe data. * * @hide */ public static void rebootWipeUserData(Context context, boolean shutdown) throws IOException { UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE); if (um.hasUserRestriction(UserManager.DISALLOW_FACTORY_RESET)) { throw new SecurityException("Wiping data is not allowed for this user."); } final ConditionVariable condition = new ConditionVariable(); Intent intent = new Intent("android.intent.action.MASTER_CLEAR_NOTIFICATION"); Loading
services/core/java/com/android/server/MasterClearReceiver.java +2 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ public class MasterClearReceiver extends BroadcastReceiver { Log.wtf(TAG, "Still running after master clear?!"); } catch (IOException e) { Slog.e(TAG, "Can't perform master clear/factory reset", e); } catch (SecurityException e) { Slog.e(TAG, "Can't perform master clear/factory reset", e); } } }; Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +2 −0 Original line number Diff line number Diff line Loading @@ -2480,6 +2480,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { RecoverySystem.rebootWipeUserData(mContext); } catch (IOException e) { Slog.w(LOG_TAG, "Failed requesting data wipe", e); } catch (SecurityException e) { Slog.w(LOG_TAG, "Failed requesting data wipe", e); } } } Loading