docs: Updated reference docs for changed permission level

Updated reference to note that SYSTEM_ALERT_WINDOW is now "signature"
instead of "dangerous". (The Manifest.permission class and javadoc
is automatically generated from Manifest.xml.)

Also clarified how an app can request SYSTEM_ALERT_WINDOW and
WRITE_SETTINGS privileges (it's different than for ordinary
'dangerous' permissions).

See first comment for doc stage location.

bug: 24673125
Change-Id: Id5908b6cc8c8ea3d6901f245cd35c771bdd2eb87
This commit is contained in:
Andrew Solovay
2015-10-05 11:35:53 -07:00
parent 6ad1cf4b54
commit 0e57cfc16b
2 changed files with 43 additions and 20 deletions

View File

@@ -1417,15 +1417,17 @@ public final class Settings {
}
/**
* An app can use this method to check if it is currently allowed to draw on top of other
* apps. In order to be allowed to do so, an app must first declare the
* {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission in its manifest. If it
* is currently disallowed, it can prompt the user to grant it this capability through a
* management UI by sending an Intent with action
* {@link android.provider.Settings#ACTION_MANAGE_OVERLAY_PERMISSION}.
* Checks if the specified context can draw on top of other apps. As of API
* level 23, an app cannot draw on top of other apps unless it declares the
* {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission in its
* manifest, <em>and</em> the user specifically grants the app this
* capability. To prompt the user to grant this approval, the app must send an
* intent with the action
* {@link android.provider.Settings#ACTION_MANAGE_OVERLAY_PERMISSION}, which
* causes the system to display a permission management screen.
*
* @param context A context
* @return true if the calling app can draw on top of other apps, false otherwise.
* @param context App context.
* @return true if the specified context can draw on top of other apps, false otherwise
*/
public static boolean canDrawOverlays(Context context) {
int uid = Binder.getCallingUid();
@@ -1439,7 +1441,7 @@ public final class Settings {
* {@link android.Manifest.permission#CHANGE_NETWORK_STATE} or
* {@link android.Manifest.permission#WRITE_SETTINGS} permission in its manifest. If it
* is currently disallowed, it can prompt the user to grant it this capability through a
* management UI by sending an Intent with action
* management UI by sending an intent with action
* {@link android.provider.Settings#ACTION_MANAGE_WRITE_SETTINGS}.
*
* @param context A context
@@ -3727,14 +3729,16 @@ public final class Settings {
Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
/**
* An app can use this method to check if it is currently allowed to write or modify system
* settings. In order to gain write access to the system settings, an app must declare the
* {@link android.Manifest.permission#WRITE_SETTINGS} permission in its manifest. If it is
* currently disallowed, it can prompt the user to grant it this capability through a
* management UI by sending an Intent with action
* {@link android.provider.Settings#ACTION_MANAGE_WRITE_SETTINGS}.
* Checks if the specified app can modify system settings. As of API
* level 23, an app cannot modify system settings unless it declares the
* {@link android.Manifest.permission#WRITE_SETTINGS}
* permission in its manifest, <em>and</em> the user specifically grants
* the app this capability. To prompt the user to grant this approval,
* the app must send an intent with the action {@link
* android.provider.Settings#ACTION_MANAGE_WRITE_SETTINGS}, which causes
* the system to display a permission management screen.
*
* @param context A context
* @param context App context.
* @return true if the calling app can write to system settings, false otherwise
*/
public static boolean canWrite(Context context) {

View File

@@ -1408,11 +1408,21 @@
<!-- ================================== -->
<eat-comment />
<!-- Allows an application to open windows using the type
<!-- Allows an app to create windows using the type
{@link android.view.WindowManager.LayoutParams#TYPE_SYSTEM_ALERT},
shown on top of all other applications. Very few applications
shown on top of all other apps. Very few apps
should use this permission; these windows are intended for
system-level interaction with the user. -->
system-level interaction with the user.
<p class="note"><strong>Note:</strong> If the app
targets API level 23 or higher, the app user must explicitly grant
this permission to the app through a permission management screen. The app requests
the user's approval by sending an intent with action
{@link android.provider.Settings#ACTION_MANAGE_OVERLAY_PERMISSION}.
The app can check whether it has this authorization by calling
{@link android.provider.Settings#canDrawOverlays
Settings.canDrawOverlays()}.
<p>Protection level: signature -->
<permission android:name="android.permission.SYSTEM_ALERT_WINDOW"
android:label="@string/permlab_systemAlertWindow"
android:description="@string/permdesc_systemAlertWindow"
@@ -1535,7 +1545,16 @@
android:protectionLevel="signature|privileged|development" />
<!-- Allows an application to read or write the system settings.
<p>Protection level: signature
<p class="note"><strong>Note:</strong> If the app targets API level 23
or higher, the app user
must explicitly grant this permission to the app through a permission management screen.
The app requests the user's approval by sending an intent with action
{@link android.provider.Settings#ACTION_MANAGE_WRITE_SETTINGS}. The app
can check whether it has this authorization by calling {@link
android.provider.Settings.System#canWrite Settings.System.canWrite()}.
<p>Protection level: signature
-->
<permission android:name="android.permission.WRITE_SETTINGS"
android:label="@string/permlab_writeSettings"