Merge "Added or fixed doctrings for required permissions." into jb-dev

This commit is contained in:
Nicolas Falliere
2012-06-18 17:39:48 -07:00
committed by Android (Google) Code Review
8 changed files with 79 additions and 1 deletions

View File

@@ -1916,7 +1916,8 @@ public class AccountManager {
* *
* <p>It is safe to call this method from the main thread. * <p>It is safe to call this method from the main thread.
* *
* <p>No permission is required to call this method. * <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#GET_ACCOUNTS}.
* *
* @param listener The listener to send notifications to * @param listener The listener to send notifications to
* @param handler {@link Handler} identifying the thread to use * @param handler {@link Handler} identifying the thread to use

View File

@@ -51,6 +51,9 @@ import java.util.List;
* Apps that request downloads through this API should register a broadcast receiver for * Apps that request downloads through this API should register a broadcast receiver for
* {@link #ACTION_NOTIFICATION_CLICKED} to appropriately handle when the user clicks on a running * {@link #ACTION_NOTIFICATION_CLICKED} to appropriately handle when the user clicks on a running
* download in a notification or from the downloads UI. * download in a notification or from the downloads UI.
*
* Note that the application must have the {@link android.Manifest.permission#INTERNET}
* permission to use this class.
*/ */
public class DownloadManager { public class DownloadManager {

View File

@@ -62,6 +62,9 @@ public class KeyguardManager {
* Note: This call has no effect while any {@link android.app.admin.DevicePolicyManager} * Note: This call has no effect while any {@link android.app.admin.DevicePolicyManager}
* is enabled that requires a password. * is enabled that requires a password.
* *
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#DISABLE_KEYGUARD}.
*
* @see #reenableKeyguard() * @see #reenableKeyguard()
*/ */
public void disableKeyguard() { public void disableKeyguard() {
@@ -80,6 +83,9 @@ public class KeyguardManager {
* Note: This call has no effect while any {@link android.app.admin.DevicePolicyManager} * Note: This call has no effect while any {@link android.app.admin.DevicePolicyManager}
* is enabled that requires a password. * is enabled that requires a password.
* *
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#DISABLE_KEYGUARD}.
*
* @see #disableKeyguard() * @see #disableKeyguard()
*/ */
public void reenableKeyguard() { public void reenableKeyguard() {
@@ -188,6 +194,9 @@ public class KeyguardManager {
* This will, if the keyguard is secure, bring up the unlock screen of * This will, if the keyguard is secure, bring up the unlock screen of
* the keyguard. * the keyguard.
* *
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#DISABLE_KEYGUARD}.
*
* @param callback Let's you know whether the operation was succesful and * @param callback Let's you know whether the operation was succesful and
* it is safe to launch anything that would normally be considered safe * it is safe to launch anything that would normally be considered safe
* once the user has gotten past the keyguard. * once the user has gotten past the keyguard.

View File

@@ -468,6 +468,9 @@ public class WallpaperManager {
* wallpaper; it must be a valid PNG or JPEG image. On success, the intent * wallpaper; it must be a valid PNG or JPEG image. On success, the intent
* {@link Intent#ACTION_WALLPAPER_CHANGED} is broadcast. * {@link Intent#ACTION_WALLPAPER_CHANGED} is broadcast.
* *
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#SET_WALLPAPER}.
*
* @param resid The bitmap to save. * @param resid The bitmap to save.
* *
* @throws IOException If an error occurs reverting to the default * @throws IOException If an error occurs reverting to the default
@@ -504,6 +507,9 @@ public class WallpaperManager {
* converted to a PNG and stored as the wallpaper. On success, the intent * converted to a PNG and stored as the wallpaper. On success, the intent
* {@link Intent#ACTION_WALLPAPER_CHANGED} is broadcast. * {@link Intent#ACTION_WALLPAPER_CHANGED} is broadcast.
* *
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#SET_WALLPAPER}.
*
* @param bitmap The bitmap to save. * @param bitmap The bitmap to save.
* *
* @throws IOException If an error occurs reverting to the default * @throws IOException If an error occurs reverting to the default
@@ -540,6 +546,9 @@ public class WallpaperManager {
* image. On success, the intent {@link Intent#ACTION_WALLPAPER_CHANGED} * image. On success, the intent {@link Intent#ACTION_WALLPAPER_CHANGED}
* is broadcast. * is broadcast.
* *
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#SET_WALLPAPER}.
*
* @param data A stream containing the raw data to install as a wallpaper. * @param data A stream containing the raw data to install as a wallpaper.
* *
* @throws IOException If an error occurs reverting to the default * @throws IOException If an error occurs reverting to the default
@@ -645,6 +654,9 @@ public class WallpaperManager {
* <b>retrieve</b> the suggested size so they can construct a wallpaper * <b>retrieve</b> the suggested size so they can construct a wallpaper
* that matches it. * that matches it.
* *
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#SET_WALLPAPER_HINTS}.
*
* @param minimumWidth Desired minimum width * @param minimumWidth Desired minimum width
* @param minimumHeight Desired minimum height * @param minimumHeight Desired minimum height
*/ */
@@ -746,6 +758,9 @@ public class WallpaperManager {
* wallpaper. On success, the intent {@link Intent#ACTION_WALLPAPER_CHANGED} * wallpaper. On success, the intent {@link Intent#ACTION_WALLPAPER_CHANGED}
* is broadcast. * is broadcast.
* *
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#SET_WALLPAPER}.
*
* @throws IOException If an error occurs reverting to the default * @throws IOException If an error occurs reverting to the default
* wallpaper. * wallpaper.
*/ */

View File

@@ -1415,6 +1415,8 @@ public abstract class ContentResolver {
/** /**
* Check if the provider should be synced when a network tickle is received * Check if the provider should be synced when a network tickle is received
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#READ_SYNC_SETTINGS}.
* *
* @param account the account whose setting we are querying * @param account the account whose setting we are querying
* @param authority the provider whose setting we are querying * @param authority the provider whose setting we are querying
@@ -1430,6 +1432,8 @@ public abstract class ContentResolver {
/** /**
* Set whether or not the provider is synced when it receives a network tickle. * Set whether or not the provider is synced when it receives a network tickle.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
* *
* @param account the account whose setting we are querying * @param account the account whose setting we are querying
* @param authority the provider whose behavior is being controlled * @param authority the provider whose behavior is being controlled
@@ -1461,6 +1465,9 @@ public abstract class ContentResolver {
* {@link #SYNC_EXTRAS_EXPEDITED}, {@link #SYNC_EXTRAS_MANUAL} set to true. * {@link #SYNC_EXTRAS_EXPEDITED}, {@link #SYNC_EXTRAS_MANUAL} set to true.
* If any are supplied then an {@link IllegalArgumentException} will be thrown. * If any are supplied then an {@link IllegalArgumentException} will be thrown.
* *
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
*
* @param account the account to specify in the sync * @param account the account to specify in the sync
* @param authority the provider to specify in the sync request * @param authority the provider to specify in the sync request
* @param extras extra parameters to go along with the sync request * @param extras extra parameters to go along with the sync request
@@ -1497,6 +1504,8 @@ public abstract class ContentResolver {
/** /**
* Remove a periodic sync. Has no affect if account, authority and extras don't match * Remove a periodic sync. Has no affect if account, authority and extras don't match
* an existing periodic sync. * an existing periodic sync.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
* *
* @param account the account of the periodic sync to remove * @param account the account of the periodic sync to remove
* @param authority the provider of the periodic sync to remove * @param authority the provider of the periodic sync to remove
@@ -1519,6 +1528,8 @@ public abstract class ContentResolver {
/** /**
* Get the list of information about the periodic syncs for the given account and authority. * Get the list of information about the periodic syncs for the given account and authority.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#READ_SYNC_SETTINGS}.
* *
* @param account the account whose periodic syncs we are querying * @param account the account whose periodic syncs we are querying
* @param authority the provider whose periodic syncs we are querying * @param authority the provider whose periodic syncs we are querying
@@ -1540,6 +1551,8 @@ public abstract class ContentResolver {
/** /**
* Check if this account/provider is syncable. * Check if this account/provider is syncable.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#READ_SYNC_SETTINGS}.
* @return >0 if it is syncable, 0 if not, and <0 if the state isn't known yet. * @return >0 if it is syncable, 0 if not, and <0 if the state isn't known yet.
*/ */
public static int getIsSyncable(Account account, String authority) { public static int getIsSyncable(Account account, String authority) {
@@ -1552,6 +1565,8 @@ public abstract class ContentResolver {
/** /**
* Set whether this account/provider is syncable. * Set whether this account/provider is syncable.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
* @param syncable >0 denotes syncable, 0 means not syncable, <0 means unknown * @param syncable >0 denotes syncable, 0 means not syncable, <0 means unknown
*/ */
public static void setIsSyncable(Account account, String authority, int syncable) { public static void setIsSyncable(Account account, String authority, int syncable) {
@@ -1566,6 +1581,8 @@ public abstract class ContentResolver {
/** /**
* Gets the master auto-sync setting that applies to all the providers and accounts. * Gets the master auto-sync setting that applies to all the providers and accounts.
* If this is false then the per-provider auto-sync setting is ignored. * If this is false then the per-provider auto-sync setting is ignored.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#READ_SYNC_SETTINGS}.
* *
* @return the master auto-sync setting that applies to all the providers and accounts * @return the master auto-sync setting that applies to all the providers and accounts
*/ */
@@ -1580,6 +1597,8 @@ public abstract class ContentResolver {
/** /**
* Sets the master auto-sync setting that applies to all the providers and accounts. * Sets the master auto-sync setting that applies to all the providers and accounts.
* If this is false then the per-provider auto-sync setting is ignored. * If this is false then the per-provider auto-sync setting is ignored.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
* *
* @param sync the master auto-sync setting that applies to all the providers and accounts * @param sync the master auto-sync setting that applies to all the providers and accounts
*/ */
@@ -1595,6 +1614,8 @@ public abstract class ContentResolver {
/** /**
* Returns true if there is currently a sync operation for the given * Returns true if there is currently a sync operation for the given
* account or authority in the pending list, or actively being processed. * account or authority in the pending list, or actively being processed.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#READ_SYNC_STATS}.
* @param account the account whose setting we are querying * @param account the account whose setting we are querying
* @param authority the provider whose behavior is being queried * @param authority the provider whose behavior is being queried
* @return true if a sync is active for the given account or authority. * @return true if a sync is active for the given account or authority.
@@ -1610,6 +1631,9 @@ public abstract class ContentResolver {
/** /**
* If a sync is active returns the information about it, otherwise returns null. * If a sync is active returns the information about it, otherwise returns null.
* <p> * <p>
* This method requires the caller to hold the permission
* {@link android.Manifest.permission#READ_SYNC_STATS}.
* <p>
* @return the SyncInfo for the currently active sync or null if one is not active. * @return the SyncInfo for the currently active sync or null if one is not active.
* @deprecated * @deprecated
* Since multiple concurrent syncs are now supported you should use * Since multiple concurrent syncs are now supported you should use
@@ -1633,6 +1657,10 @@ public abstract class ContentResolver {
/** /**
* Returns a list with information about all the active syncs. This list will be empty * Returns a list with information about all the active syncs. This list will be empty
* if there are no active syncs. * if there are no active syncs.
* <p>
* This method requires the caller to hold the permission
* {@link android.Manifest.permission#READ_SYNC_STATS}.
* <p>
* @return a List of SyncInfo objects for the currently active syncs. * @return a List of SyncInfo objects for the currently active syncs.
*/ */
public static List<SyncInfo> getCurrentSyncs() { public static List<SyncInfo> getCurrentSyncs() {
@@ -1660,6 +1688,8 @@ public abstract class ContentResolver {
/** /**
* Return true if the pending status is true of any matching authorities. * Return true if the pending status is true of any matching authorities.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#READ_SYNC_STATS}.
* @param account the account whose setting we are querying * @param account the account whose setting we are querying
* @param authority the provider whose behavior is being queried * @param authority the provider whose behavior is being queried
* @return true if there is a pending sync with the matching account and authority * @return true if there is a pending sync with the matching account and authority

View File

@@ -813,6 +813,8 @@ public abstract class Context {
/** /**
* @deprecated Use {@link android.app.WallpaperManager#setBitmap(Bitmap) * @deprecated Use {@link android.app.WallpaperManager#setBitmap(Bitmap)
* WallpaperManager.set()} instead. * WallpaperManager.set()} instead.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#SET_WALLPAPER}.
*/ */
@Deprecated @Deprecated
public abstract void setWallpaper(Bitmap bitmap) throws IOException; public abstract void setWallpaper(Bitmap bitmap) throws IOException;
@@ -820,6 +822,8 @@ public abstract class Context {
/** /**
* @deprecated Use {@link android.app.WallpaperManager#setStream(InputStream) * @deprecated Use {@link android.app.WallpaperManager#setStream(InputStream)
* WallpaperManager.set()} instead. * WallpaperManager.set()} instead.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#SET_WALLPAPER}.
*/ */
@Deprecated @Deprecated
public abstract void setWallpaper(InputStream data) throws IOException; public abstract void setWallpaper(InputStream data) throws IOException;
@@ -827,6 +831,8 @@ public abstract class Context {
/** /**
* @deprecated Use {@link android.app.WallpaperManager#clear * @deprecated Use {@link android.app.WallpaperManager#clear
* WallpaperManager.clear()} instead. * WallpaperManager.clear()} instead.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#SET_WALLPAPER}.
*/ */
@Deprecated @Deprecated
public abstract void clearWallpaper() throws IOException; public abstract void clearWallpaper() throws IOException;

View File

@@ -377,6 +377,8 @@ public class ConnectivityManager {
* this network is the default route for outgoing connections. You should * this network is the default route for outgoing connections. You should
* always check {@link NetworkInfo#isConnected()} before initiating network * always check {@link NetworkInfo#isConnected()} before initiating network
* traffic. This may return {@code null} when no networks are available. * traffic. This may return {@code null} when no networks are available.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
*/ */
public NetworkInfo getActiveNetworkInfo() { public NetworkInfo getActiveNetworkInfo() {
try { try {
@@ -451,6 +453,8 @@ public class ConnectivityManager {
* Tells the underlying networking system that the caller wants to * Tells the underlying networking system that the caller wants to
* begin using the named feature. The interpretation of {@code feature} * begin using the named feature. The interpretation of {@code feature}
* is completely up to each networking implementation. * is completely up to each networking implementation.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#CHANGE_NETWORK_STATE}.
* @param networkType specifies which network the request pertains to * @param networkType specifies which network the request pertains to
* @param feature the name of the feature to be used * @param feature the name of the feature to be used
* @return an integer value representing the outcome of the request. * @return an integer value representing the outcome of the request.
@@ -471,6 +475,8 @@ public class ConnectivityManager {
* Tells the underlying networking system that the caller is finished * Tells the underlying networking system that the caller is finished
* using the named feature. The interpretation of {@code feature} * using the named feature. The interpretation of {@code feature}
* is completely up to each networking implementation. * is completely up to each networking implementation.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#CHANGE_NETWORK_STATE}.
* @param networkType specifies which network the request pertains to * @param networkType specifies which network the request pertains to
* @param feature the name of the feature that is no longer needed * @param feature the name of the feature that is no longer needed
* @return an integer value representing the outcome of the request. * @return an integer value representing the outcome of the request.
@@ -490,6 +496,8 @@ public class ConnectivityManager {
* Ensure that a network route exists to deliver traffic to the specified * Ensure that a network route exists to deliver traffic to the specified
* host via the specified network interface. An attempt to add a route that * host via the specified network interface. An attempt to add a route that
* already exists is ignored, but treated as successful. * already exists is ignored, but treated as successful.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#CHANGE_NETWORK_STATE}.
* @param networkType the type of the network over which traffic to the specified * @param networkType the type of the network over which traffic to the specified
* host is to be routed * host is to be routed
* @param hostAddress the IP address of the host to which the route is desired * @param hostAddress the IP address of the host to which the route is desired

View File

@@ -43,6 +43,8 @@ public abstract class Vibrator {
/** /**
* Vibrate constantly for the specified period of time. * Vibrate constantly for the specified period of time.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#VIBRATE}.
* *
* @param milliseconds The number of milliseconds to vibrate. * @param milliseconds The number of milliseconds to vibrate.
*/ */
@@ -61,6 +63,8 @@ public abstract class Vibrator {
* To cause the pattern to repeat, pass the index into the pattern array at which * To cause the pattern to repeat, pass the index into the pattern array at which
* to start the repeat, or -1 to disable repeating. * to start the repeat, or -1 to disable repeating.
* </p> * </p>
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#VIBRATE}.
* *
* @param pattern an array of longs of times for which to turn the vibrator on or off. * @param pattern an array of longs of times for which to turn the vibrator on or off.
* @param repeat the index into pattern at which to repeat, or -1 if * @param repeat the index into pattern at which to repeat, or -1 if
@@ -70,6 +74,8 @@ public abstract class Vibrator {
/** /**
* Turn the vibrator off. * Turn the vibrator off.
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#VIBRATE}.
*/ */
public abstract void cancel(); public abstract void cancel();
} }