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

Commit 73aeea2d authored by Lenka Trochtova's avatar Lenka Trochtova
Browse files

Make master clear constants system APIs.

This is needed for unbundling of the OobConfig apk.

Test: gts-tradefed run gts -m GtsGmscoreHostTestCases --test com.google.android.gts.devicepolicy.DeviceOwnerUserRestrictionTest#testFactoryReset_disallowFactoryReset

Bug: 32974361

Change-Id: I71e7270bb4c3234ec0516382b18a2ca35aab4c81
parent 860239ed
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -9096,6 +9096,7 @@ package android.content {
    field public static final java.lang.String ACTION_EDIT = "android.intent.action.EDIT";
    field public static final java.lang.String ACTION_EDIT = "android.intent.action.EDIT";
    field public static final java.lang.String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE = "android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE";
    field public static final java.lang.String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE = "android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE";
    field public static final java.lang.String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE = "android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE";
    field public static final java.lang.String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE = "android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE";
    field public static final java.lang.String ACTION_FACTORY_RESET = "android.intent.action.FACTORY_RESET";
    field public static final java.lang.String ACTION_FACTORY_TEST = "android.intent.action.FACTORY_TEST";
    field public static final java.lang.String ACTION_FACTORY_TEST = "android.intent.action.FACTORY_TEST";
    field public static final java.lang.String ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT";
    field public static final java.lang.String ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT";
    field public static final java.lang.String ACTION_GET_RESTRICTION_ENTRIES = "android.intent.action.GET_RESTRICTION_ENTRIES";
    field public static final java.lang.String ACTION_GET_RESTRICTION_ENTRIES = "android.intent.action.GET_RESTRICTION_ENTRIES";
@@ -9259,6 +9260,7 @@ package android.content {
    field public static final java.lang.String EXTRA_DONT_KILL_APP = "android.intent.extra.DONT_KILL_APP";
    field public static final java.lang.String EXTRA_DONT_KILL_APP = "android.intent.extra.DONT_KILL_APP";
    field public static final java.lang.String EXTRA_EMAIL = "android.intent.extra.EMAIL";
    field public static final java.lang.String EXTRA_EMAIL = "android.intent.extra.EMAIL";
    field public static final java.lang.String EXTRA_EXCLUDE_COMPONENTS = "android.intent.extra.EXCLUDE_COMPONENTS";
    field public static final java.lang.String EXTRA_EXCLUDE_COMPONENTS = "android.intent.extra.EXCLUDE_COMPONENTS";
    field public static final java.lang.String EXTRA_FORCE_FACTORY_RESET = "android.intent.extra.FORCE_FACTORY_RESET";
    field public static final java.lang.String EXTRA_HTML_TEXT = "android.intent.extra.HTML_TEXT";
    field public static final java.lang.String EXTRA_HTML_TEXT = "android.intent.extra.HTML_TEXT";
    field public static final java.lang.String EXTRA_INDEX = "android.intent.extra.INDEX";
    field public static final java.lang.String EXTRA_INDEX = "android.intent.extra.INDEX";
    field public static final java.lang.String EXTRA_INITIAL_INTENTS = "android.intent.extra.INITIAL_INTENTS";
    field public static final java.lang.String EXTRA_INITIAL_INTENTS = "android.intent.extra.INITIAL_INTENTS";
+39 −3
Original line number Original line Diff line number Diff line
@@ -3226,17 +3226,53 @@ public class Intent implements Parcelable, Cloneable {
    public static final String
    public static final String
            ACTION_DYNAMIC_SENSOR_CHANGED = "android.intent.action.DYNAMIC_SENSOR_CHANGED";
            ACTION_DYNAMIC_SENSOR_CHANGED = "android.intent.action.DYNAMIC_SENSOR_CHANGED";


    /** {@hide} */
    /**
     * Deprecated - use {@link #ACTION_FACTORY_RESET} instead.
     *
     * {@hide}
     */
    @Deprecated
    public static final String ACTION_MASTER_CLEAR = "android.intent.action.MASTER_CLEAR";
    public static final String ACTION_MASTER_CLEAR = "android.intent.action.MASTER_CLEAR";


    /**
    /**
     * Boolean intent extra to be used with {@link ACTION_MASTER_CLEAR} in order to force a factory
     * Boolean intent extra to be used with {@link #ACTION_MASTER_CLEAR} in order to force a factory
     * reset even if {@link android.os.UserManager.DISALLOW_FACTORY_RESET} is set.
     * reset even if {@link android.os.UserManager#DISALLOW_FACTORY_RESET} is set.
     *
     * <p>Deprecated - use {@link #EXTRA_FORCE_FACTORY_RESET} instead.
     *
     * @hide
     * @hide
     */
     */
    @Deprecated
    public static final String EXTRA_FORCE_MASTER_CLEAR =
    public static final String EXTRA_FORCE_MASTER_CLEAR =
            "android.intent.extra.FORCE_MASTER_CLEAR";
            "android.intent.extra.FORCE_MASTER_CLEAR";


    /**
     * A broadcast action to trigger a factory reset.
     *
     * <p> The sender must hold the {@link android.Manifest.permission#MASTER_CLEAR} permission.
     *
     * <p>Not for use by third-party applications.
     *
     * @see #EXTRA_FORCE_MASTER_CLEAR
     *
     * {@hide}
     */
    @SystemApi
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_FACTORY_RESET = "android.intent.action.FACTORY_RESET";

    /**
     * Boolean intent extra to be used with {@link #ACTION_MASTER_CLEAR} in order to force a factory
     * reset even if {@link android.os.UserManager#DISALLOW_FACTORY_RESET} is set.
     *
     * <p>Not for use by third-party applications.
     *
     * @hide
     */
    @SystemApi
    public static final String EXTRA_FORCE_FACTORY_RESET =
            "android.intent.extra.FORCE_FACTORY_RESET";

    /**
    /**
     * Broadcast action: report that a settings element is being restored from backup.  The intent
     * Broadcast action: report that a settings element is being restored from backup.  The intent
     * contains three extras: EXTRA_SETTING_NAME is a string naming the restored setting,
     * contains three extras: EXTRA_SETTING_NAME is a string naming the restored setting,
+4 −1
Original line number Original line Diff line number Diff line
@@ -3393,7 +3393,10 @@
            android:permission="android.permission.MASTER_CLEAR">
            android:permission="android.permission.MASTER_CLEAR">
            <intent-filter
            <intent-filter
                    android:priority="100" >
                    android:priority="100" >
                <!-- For Checkin, Settings, etc.: action=MASTER_CLEAR -->
                <!-- For Checkin, Settings, etc.: action=FACTORY_RESET -->
                <action android:name="android.intent.action.FACTORY_RESET" />
                <!-- As above until all the references to the deprecated MASTER_CLEAR get updated to
                     FACTORY_RESET. -->
                <action android:name="android.intent.action.MASTER_CLEAR" />
                <action android:name="android.intent.action.MASTER_CLEAR" />


                <!-- MCS always uses REMOTE_INTENT: category=MASTER_CLEAR -->
                <!-- MCS always uses REMOTE_INTENT: category=MASTER_CLEAR -->
+10 −1
Original line number Original line Diff line number Diff line
@@ -42,12 +42,21 @@ public class MasterClearReceiver extends BroadcastReceiver {
                return;
                return;
            }
            }
        }
        }
        if (Intent.ACTION_MASTER_CLEAR.equals(intent.getAction())) {
            Slog.w(TAG, "The request uses the deprecated Intent#ACTION_MASTER_CLEAR, "
                    + "Intent#ACTION_FACTORY_RESET should be used instead.");
        }
        if (intent.hasExtra(Intent.EXTRA_FORCE_MASTER_CLEAR)) {
            Slog.w(TAG, "The request uses the deprecated Intent#EXTRA_FORCE_MASTER_CLEAR, "
                    + "Intent#EXTRA_FORCE_FACTORY_RESET should be used instead.");
        }


        final boolean shutdown = intent.getBooleanExtra("shutdown", false);
        final boolean shutdown = intent.getBooleanExtra("shutdown", false);
        final String reason = intent.getStringExtra(Intent.EXTRA_REASON);
        final String reason = intent.getStringExtra(Intent.EXTRA_REASON);
        final boolean wipeExternalStorage = intent.getBooleanExtra(
        final boolean wipeExternalStorage = intent.getBooleanExtra(
                Intent.EXTRA_WIPE_EXTERNAL_STORAGE, false);
                Intent.EXTRA_WIPE_EXTERNAL_STORAGE, false);
        final boolean forceWipe = intent.getBooleanExtra(Intent.EXTRA_FORCE_MASTER_CLEAR, false);
        final boolean forceWipe = intent.getBooleanExtra(Intent.EXTRA_FORCE_MASTER_CLEAR, false)
                || intent.getBooleanExtra(Intent.EXTRA_FORCE_FACTORY_RESET, false);


        Slog.w(TAG, "!!! FACTORY RESET !!!");
        Slog.w(TAG, "!!! FACTORY RESET !!!");
        // The reboot call is blocking, so we need to do it on another thread.
        // The reboot call is blocking, so we need to do it on another thread.
+1 −0
Original line number Original line Diff line number Diff line
@@ -17869,6 +17869,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                || Intent.ACTION_MEDIA_SCANNER_SCAN_FILE.equals(action)
                || Intent.ACTION_MEDIA_SCANNER_SCAN_FILE.equals(action)
                || Intent.ACTION_SHOW_KEYBOARD_SHORTCUTS.equals(action)
                || Intent.ACTION_SHOW_KEYBOARD_SHORTCUTS.equals(action)
                || Intent.ACTION_MASTER_CLEAR.equals(action)
                || Intent.ACTION_MASTER_CLEAR.equals(action)
                || Intent.ACTION_FACTORY_RESET.equals(action)
                || AppWidgetManager.ACTION_APPWIDGET_CONFIGURE.equals(action)
                || AppWidgetManager.ACTION_APPWIDGET_CONFIGURE.equals(action)
                || AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action)
                || AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action)
                || LocationManager.HIGH_POWER_REQUEST_CHANGE_ACTION.equals(action)
                || LocationManager.HIGH_POWER_REQUEST_CHANGE_ACTION.equals(action)