Skip to content

Commit 56bb344

Browse files
Nicolas FalliereAndroid (Google) Code Review
authored andcommitted
Merge "Added or fixed doctrings for required permissions." into jb-dev
2 parents ddbc85c + 9530e3a commit 56bb344

File tree

8 files changed

+79
-1
lines changed

8 files changed

+79
-1
lines changed

core/java/android/accounts/AccountManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1916,7 +1916,8 @@ public void onReceive(final Context context, final Intent intent) {
19161916
*
19171917
* <p>It is safe to call this method from the main thread.
19181918
*
1919-
* <p>No permission is required to call this method.
1919+
* <p>This method requires the caller to hold the permission
1920+
* {@link android.Manifest.permission#GET_ACCOUNTS}.
19201921
*
19211922
* @param listener The listener to send notifications to
19221923
* @param handler {@link Handler} identifying the thread to use

core/java/android/app/DownloadManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
* Apps that request downloads through this API should register a broadcast receiver for
5252
* {@link #ACTION_NOTIFICATION_CLICKED} to appropriately handle when the user clicks on a running
5353
* download in a notification or from the downloads UI.
54+
*
55+
* Note that the application must have the {@link android.Manifest.permission#INTERNET}
56+
* permission to use this class.
5457
*/
5558
public class DownloadManager {
5659

core/java/android/app/KeyguardManager.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ public class KeyguardLock {
6262
* Note: This call has no effect while any {@link android.app.admin.DevicePolicyManager}
6363
* is enabled that requires a password.
6464
*
65+
* <p>This method requires the caller to hold the permission
66+
* {@link android.Manifest.permission#DISABLE_KEYGUARD}.
67+
*
6568
* @see #reenableKeyguard()
6669
*/
6770
public void disableKeyguard() {
@@ -80,6 +83,9 @@ public void disableKeyguard() {
8083
* Note: This call has no effect while any {@link android.app.admin.DevicePolicyManager}
8184
* is enabled that requires a password.
8285
*
86+
* <p>This method requires the caller to hold the permission
87+
* {@link android.Manifest.permission#DISABLE_KEYGUARD}.
88+
*
8389
* @see #disableKeyguard()
8490
*/
8591
public void reenableKeyguard() {
@@ -188,6 +194,9 @@ public boolean inKeyguardRestrictedInputMode() {
188194
* This will, if the keyguard is secure, bring up the unlock screen of
189195
* the keyguard.
190196
*
197+
* <p>This method requires the caller to hold the permission
198+
* {@link android.Manifest.permission#DISABLE_KEYGUARD}.
199+
*
191200
* @param callback Let's you know whether the operation was succesful and
192201
* it is safe to launch anything that would normally be considered safe
193202
* once the user has gotten past the keyguard.

core/java/android/app/WallpaperManager.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,9 @@ public WallpaperInfo getWallpaperInfo() {
468468
* wallpaper; it must be a valid PNG or JPEG image. On success, the intent
469469
* {@link Intent#ACTION_WALLPAPER_CHANGED} is broadcast.
470470
*
471+
* <p>This method requires the caller to hold the permission
472+
* {@link android.Manifest.permission#SET_WALLPAPER}.
473+
*
471474
* @param resid The bitmap to save.
472475
*
473476
* @throws IOException If an error occurs reverting to the default
@@ -504,6 +507,9 @@ public void setResource(int resid) throws IOException {
504507
* converted to a PNG and stored as the wallpaper. On success, the intent
505508
* {@link Intent#ACTION_WALLPAPER_CHANGED} is broadcast.
506509
*
510+
* <p>This method requires the caller to hold the permission
511+
* {@link android.Manifest.permission#SET_WALLPAPER}.
512+
*
507513
* @param bitmap The bitmap to save.
508514
*
509515
* @throws IOException If an error occurs reverting to the default
@@ -540,6 +546,9 @@ public void setBitmap(Bitmap bitmap) throws IOException {
540546
* image. On success, the intent {@link Intent#ACTION_WALLPAPER_CHANGED}
541547
* is broadcast.
542548
*
549+
* <p>This method requires the caller to hold the permission
550+
* {@link android.Manifest.permission#SET_WALLPAPER}.
551+
*
543552
* @param data A stream containing the raw data to install as a wallpaper.
544553
*
545554
* @throws IOException If an error occurs reverting to the default
@@ -645,6 +654,9 @@ public int getDesiredMinimumHeight() {
645654
* <b>retrieve</b> the suggested size so they can construct a wallpaper
646655
* that matches it.
647656
*
657+
* <p>This method requires the caller to hold the permission
658+
* {@link android.Manifest.permission#SET_WALLPAPER_HINTS}.
659+
*
648660
* @param minimumWidth Desired minimum width
649661
* @param minimumHeight Desired minimum height
650662
*/
@@ -746,6 +758,9 @@ public void clearWallpaperOffsets(IBinder windowToken) {
746758
* wallpaper. On success, the intent {@link Intent#ACTION_WALLPAPER_CHANGED}
747759
* is broadcast.
748760
*
761+
* <p>This method requires the caller to hold the permission
762+
* {@link android.Manifest.permission#SET_WALLPAPER}.
763+
*
749764
* @throws IOException If an error occurs reverting to the default
750765
* wallpaper.
751766
*/

core/java/android/content/ContentResolver.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,6 +1415,8 @@ public static SyncAdapterType[] getSyncAdapterTypes() {
14151415

14161416
/**
14171417
* Check if the provider should be synced when a network tickle is received
1418+
* <p>This method requires the caller to hold the permission
1419+
* {@link android.Manifest.permission#READ_SYNC_SETTINGS}.
14181420
*
14191421
* @param account the account whose setting we are querying
14201422
* @param authority the provider whose setting we are querying
@@ -1430,6 +1432,8 @@ public static boolean getSyncAutomatically(Account account, String authority) {
14301432

14311433
/**
14321434
* Set whether or not the provider is synced when it receives a network tickle.
1435+
* <p>This method requires the caller to hold the permission
1436+
* {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
14331437
*
14341438
* @param account the account whose setting we are querying
14351439
* @param authority the provider whose behavior is being controlled
@@ -1461,6 +1465,9 @@ public static void setSyncAutomatically(Account account, String authority, boole
14611465
* {@link #SYNC_EXTRAS_EXPEDITED}, {@link #SYNC_EXTRAS_MANUAL} set to true.
14621466
* If any are supplied then an {@link IllegalArgumentException} will be thrown.
14631467
*
1468+
* <p>This method requires the caller to hold the permission
1469+
* {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
1470+
*
14641471
* @param account the account to specify in the sync
14651472
* @param authority the provider to specify in the sync request
14661473
* @param extras extra parameters to go along with the sync request
@@ -1497,6 +1504,8 @@ public static void addPeriodicSync(Account account, String authority, Bundle ext
14971504
/**
14981505
* Remove a periodic sync. Has no affect if account, authority and extras don't match
14991506
* an existing periodic sync.
1507+
* <p>This method requires the caller to hold the permission
1508+
* {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
15001509
*
15011510
* @param account the account of the periodic sync to remove
15021511
* @param authority the provider of the periodic sync to remove
@@ -1519,6 +1528,8 @@ public static void removePeriodicSync(Account account, String authority, Bundle
15191528

15201529
/**
15211530
* Get the list of information about the periodic syncs for the given account and authority.
1531+
* <p>This method requires the caller to hold the permission
1532+
* {@link android.Manifest.permission#READ_SYNC_SETTINGS}.
15221533
*
15231534
* @param account the account whose periodic syncs we are querying
15241535
* @param authority the provider whose periodic syncs we are querying
@@ -1540,6 +1551,8 @@ public static List<PeriodicSync> getPeriodicSyncs(Account account, String author
15401551

15411552
/**
15421553
* Check if this account/provider is syncable.
1554+
* <p>This method requires the caller to hold the permission
1555+
* {@link android.Manifest.permission#READ_SYNC_SETTINGS}.
15431556
* @return >0 if it is syncable, 0 if not, and <0 if the state isn't known yet.
15441557
*/
15451558
public static int getIsSyncable(Account account, String authority) {
@@ -1552,6 +1565,8 @@ public static int getIsSyncable(Account account, String authority) {
15521565

15531566
/**
15541567
* Set whether this account/provider is syncable.
1568+
* <p>This method requires the caller to hold the permission
1569+
* {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
15551570
* @param syncable >0 denotes syncable, 0 means not syncable, <0 means unknown
15561571
*/
15571572
public static void setIsSyncable(Account account, String authority, int syncable) {
@@ -1566,6 +1581,8 @@ public static void setIsSyncable(Account account, String authority, int syncable
15661581
/**
15671582
* Gets the master auto-sync setting that applies to all the providers and accounts.
15681583
* If this is false then the per-provider auto-sync setting is ignored.
1584+
* <p>This method requires the caller to hold the permission
1585+
* {@link android.Manifest.permission#READ_SYNC_SETTINGS}.
15691586
*
15701587
* @return the master auto-sync setting that applies to all the providers and accounts
15711588
*/
@@ -1580,6 +1597,8 @@ public static boolean getMasterSyncAutomatically() {
15801597
/**
15811598
* Sets the master auto-sync setting that applies to all the providers and accounts.
15821599
* If this is false then the per-provider auto-sync setting is ignored.
1600+
* <p>This method requires the caller to hold the permission
1601+
* {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
15831602
*
15841603
* @param sync the master auto-sync setting that applies to all the providers and accounts
15851604
*/
@@ -1595,6 +1614,8 @@ public static void setMasterSyncAutomatically(boolean sync) {
15951614
/**
15961615
* Returns true if there is currently a sync operation for the given
15971616
* account or authority in the pending list, or actively being processed.
1617+
* <p>This method requires the caller to hold the permission
1618+
* {@link android.Manifest.permission#READ_SYNC_STATS}.
15981619
* @param account the account whose setting we are querying
15991620
* @param authority the provider whose behavior is being queried
16001621
* @return true if a sync is active for the given account or authority.
@@ -1610,6 +1631,9 @@ public static boolean isSyncActive(Account account, String authority) {
16101631
/**
16111632
* If a sync is active returns the information about it, otherwise returns null.
16121633
* <p>
1634+
* This method requires the caller to hold the permission
1635+
* {@link android.Manifest.permission#READ_SYNC_STATS}.
1636+
* <p>
16131637
* @return the SyncInfo for the currently active sync or null if one is not active.
16141638
* @deprecated
16151639
* Since multiple concurrent syncs are now supported you should use
@@ -1633,6 +1657,10 @@ public static SyncInfo getCurrentSync() {
16331657
/**
16341658
* Returns a list with information about all the active syncs. This list will be empty
16351659
* if there are no active syncs.
1660+
* <p>
1661+
* This method requires the caller to hold the permission
1662+
* {@link android.Manifest.permission#READ_SYNC_STATS}.
1663+
* <p>
16361664
* @return a List of SyncInfo objects for the currently active syncs.
16371665
*/
16381666
public static List<SyncInfo> getCurrentSyncs() {
@@ -1660,6 +1688,8 @@ public static SyncStatusInfo getSyncStatus(Account account, String authority) {
16601688

16611689
/**
16621690
* Return true if the pending status is true of any matching authorities.
1691+
* <p>This method requires the caller to hold the permission
1692+
* {@link android.Manifest.permission#READ_SYNC_STATS}.
16631693
* @param account the account whose setting we are querying
16641694
* @param authority the provider whose behavior is being queried
16651695
* @return true if there is a pending sync with the matching account and authority

core/java/android/content/Context.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,20 +813,26 @@ public abstract SQLiteDatabase openOrCreateDatabase(String name,
813813
/**
814814
* @deprecated Use {@link android.app.WallpaperManager#setBitmap(Bitmap)
815815
* WallpaperManager.set()} instead.
816+
* <p>This method requires the caller to hold the permission
817+
* {@link android.Manifest.permission#SET_WALLPAPER}.
816818
*/
817819
@Deprecated
818820
public abstract void setWallpaper(Bitmap bitmap) throws IOException;
819821

820822
/**
821823
* @deprecated Use {@link android.app.WallpaperManager#setStream(InputStream)
822824
* WallpaperManager.set()} instead.
825+
* <p>This method requires the caller to hold the permission
826+
* {@link android.Manifest.permission#SET_WALLPAPER}.
823827
*/
824828
@Deprecated
825829
public abstract void setWallpaper(InputStream data) throws IOException;
826830

827831
/**
828832
* @deprecated Use {@link android.app.WallpaperManager#clear
829833
* WallpaperManager.clear()} instead.
834+
* <p>This method requires the caller to hold the permission
835+
* {@link android.Manifest.permission#SET_WALLPAPER}.
830836
*/
831837
@Deprecated
832838
public abstract void clearWallpaper() throws IOException;

core/java/android/net/ConnectivityManager.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ public int getNetworkPreference() {
377377
* this network is the default route for outgoing connections. You should
378378
* always check {@link NetworkInfo#isConnected()} before initiating network
379379
* traffic. This may return {@code null} when no networks are available.
380+
* <p>This method requires the caller to hold the permission
381+
* {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
380382
*/
381383
public NetworkInfo getActiveNetworkInfo() {
382384
try {
@@ -451,6 +453,8 @@ public boolean setRadio(int networkType, boolean turnOn) {
451453
* Tells the underlying networking system that the caller wants to
452454
* begin using the named feature. The interpretation of {@code feature}
453455
* is completely up to each networking implementation.
456+
* <p>This method requires the caller to hold the permission
457+
* {@link android.Manifest.permission#CHANGE_NETWORK_STATE}.
454458
* @param networkType specifies which network the request pertains to
455459
* @param feature the name of the feature to be used
456460
* @return an integer value representing the outcome of the request.
@@ -471,6 +475,8 @@ public int startUsingNetworkFeature(int networkType, String feature) {
471475
* Tells the underlying networking system that the caller is finished
472476
* using the named feature. The interpretation of {@code feature}
473477
* is completely up to each networking implementation.
478+
* <p>This method requires the caller to hold the permission
479+
* {@link android.Manifest.permission#CHANGE_NETWORK_STATE}.
474480
* @param networkType specifies which network the request pertains to
475481
* @param feature the name of the feature that is no longer needed
476482
* @return an integer value representing the outcome of the request.
@@ -490,6 +496,8 @@ public int stopUsingNetworkFeature(int networkType, String feature) {
490496
* Ensure that a network route exists to deliver traffic to the specified
491497
* host via the specified network interface. An attempt to add a route that
492498
* already exists is ignored, but treated as successful.
499+
* <p>This method requires the caller to hold the permission
500+
* {@link android.Manifest.permission#CHANGE_NETWORK_STATE}.
493501
* @param networkType the type of the network over which traffic to the specified
494502
* host is to be routed
495503
* @param hostAddress the IP address of the host to which the route is desired

core/java/android/os/Vibrator.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public Vibrator() {
4343

4444
/**
4545
* Vibrate constantly for the specified period of time.
46+
* <p>This method requires the caller to hold the permission
47+
* {@link android.Manifest.permission#VIBRATE}.
4648
*
4749
* @param milliseconds The number of milliseconds to vibrate.
4850
*/
@@ -61,6 +63,8 @@ public Vibrator() {
6163
* To cause the pattern to repeat, pass the index into the pattern array at which
6264
* to start the repeat, or -1 to disable repeating.
6365
* </p>
66+
* <p>This method requires the caller to hold the permission
67+
* {@link android.Manifest.permission#VIBRATE}.
6468
*
6569
* @param pattern an array of longs of times for which to turn the vibrator on or off.
6670
* @param repeat the index into pattern at which to repeat, or -1 if
@@ -70,6 +74,8 @@ public Vibrator() {
7074

7175
/**
7276
* Turn the vibrator off.
77+
* <p>This method requires the caller to hold the permission
78+
* {@link android.Manifest.permission#VIBRATE}.
7379
*/
7480
public abstract void cancel();
7581
}

0 commit comments

Comments
 (0)