Annotate @SystemApi with required permissions.
Most @SystemApi methods should be protected with system (or higher) permissions, so annotate common methods with @RequiresPermission to make automatic verification easier. Verification is really only relevant when calling into system services (where permissions checking can happen on the other side of a Binder call), so annotate managers with the new @SystemService annotation, which is now automatically documented. This is purely a docs change; no logic changes are being made. Test: make -j32 update-api && make -j32 offline-sdk-docs Bug: 62263906 Change-Id: I2554227202d84465676aa4ab0dd336b5c45fc651
This commit is contained in:
@@ -23,6 +23,7 @@ import android.annotation.RequiresPermission;
|
||||
import android.annotation.SdkConstant;
|
||||
import android.annotation.SdkConstant.SdkConstantType;
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.SystemService;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -64,9 +65,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* Class that answers queries about the state of network connectivity. It also
|
||||
* notifies applications when network connectivity changes. Get an instance
|
||||
* of this class by calling
|
||||
* {@link android.content.Context#getSystemService(String) Context.getSystemService(Context.CONNECTIVITY_SERVICE)}.
|
||||
* notifies applications when network connectivity changes.
|
||||
* <p>
|
||||
* The primary responsibilities of this class are to:
|
||||
* <ol>
|
||||
@@ -80,6 +79,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* traffic</li>
|
||||
* </ol>
|
||||
*/
|
||||
@SystemService(Context.CONNECTIVITY_SERVICE)
|
||||
public class ConnectivityManager {
|
||||
private static final String TAG = "ConnectivityManager";
|
||||
|
||||
@@ -2105,6 +2105,7 @@ public class ConnectivityManager {
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED)
|
||||
public void startTethering(int type, boolean showProvisioningUi,
|
||||
final OnStartTetheringCallback callback, Handler handler) {
|
||||
checkNotNull(callback, "OnStartTetheringCallback cannot be null.");
|
||||
@@ -2139,6 +2140,7 @@ public class ConnectivityManager {
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED)
|
||||
public void stopTethering(int type) {
|
||||
try {
|
||||
mService.stopTethering(type);
|
||||
|
||||
Reference in New Issue
Block a user