Bug: 21589105 Rescope WRITE_SETTINGS and SYSTEM_ALERT_WINDOW permission

Raised the protection level of WRITE_SETTINGS permission to appop and also
allowed backwards compatibility with pre23 flag. Also made sure that this
permission is not added as RuntimePermission in DefaultPermissionGrantPolicy as
that breaks a lot of gmscore stuff.

Introduced new action to manage write system settings as a new API and
renamed the string that describes the managing of overlay permission.

Change-Id: Ifd25a6ddc06de68ee37015cb9fb23452e4ef10f4
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 4e13758..fff355b 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -574,7 +574,22 @@
      */
     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
     public static final String ACTION_MANAGE_OVERLAY_PERMISSION =
-            "android.settings.MANAGE_OVERLAY_PERMISSION";
+            "android.settings.action.MANAGE_OVERLAY_PERMISSION";
+
+    /**
+     * Activity Action: Show settings to toggle apps' capablity to
+     * to read/write system settings.
+     * <p>
+     * In some cases, a matching Activity may not exist, so ensure you
+     * safeguard against this.
+     * <p>
+     * Input: Nothing.
+     * <p>
+     * Output: Nothing.
+     */
+    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+    public static final String ACTION_MANAGE_WRITE_SETTINGS =
+            "android.settings.action.MANAGE_WRITE_SETTINGS";
 
     /**
      * Activity Action: Show screen of details about a particular application.