diff options
| author | 2020-03-09 16:58:34 -0700 | |
|---|---|---|
| committer | 2020-03-20 01:44:50 -0700 | |
| commit | 6a5d8e4b552a689a931ec4a72e1f3ec2af7f33fc (patch) | |
| tree | 550db170f2c1cba950961b851f7bf24df0a1dcf8 | |
| parent | 3e6f5a87f9e078858877e51bf28eaaca8dc8347f (diff) | |
Update permissions of BluetoothPan System APIs and re-hide some APIs
that do not need to be System APIs.
Bug: 146045934
Test: Manual
Merged-In: Ic6325fde05294eb0266fee25f4b3e7098749a287
Change-Id: Ic6325fde05294eb0266fee25f4b3e7098749a287
| -rwxr-xr-x | api/system-current.txt | 12 | ||||
| -rw-r--r-- | core/java/android/bluetooth/BluetoothPan.java | 22 |
2 files changed, 21 insertions, 13 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index ee5c35f606a5..bb66b7345134 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -1641,13 +1641,11 @@ package android.bluetooth { } public final class BluetoothPan implements java.lang.AutoCloseable android.bluetooth.BluetoothProfile { - method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public void close(); - method @RequiresPermission(android.Manifest.permission.BLUETOOTH) protected void finalize(); - method @NonNull public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices(); - method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public int getConnectionState(@Nullable android.bluetooth.BluetoothDevice); - method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public boolean isTetheringOn(); - method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public void setBluetoothTethering(boolean); - method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean setConnectionPolicy(@NonNull android.bluetooth.BluetoothDevice, int); + method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices(); + method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public int getConnectionState(@Nullable android.bluetooth.BluetoothDevice); + method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean isTetheringOn(); + method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public void setBluetoothTethering(boolean); + method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setConnectionPolicy(@NonNull android.bluetooth.BluetoothDevice, int); field public static final String ACTION_CONNECTION_STATE_CHANGED = "android.bluetooth.pan.profile.action.CONNECTION_STATE_CHANGED"; field public static final String EXTRA_LOCAL_ROLE = "android.bluetooth.pan.extra.LOCAL_ROLE"; field public static final int LOCAL_NAP_ROLE = 1; // 0x1 diff --git a/core/java/android/bluetooth/BluetoothPan.java b/core/java/android/bluetooth/BluetoothPan.java index ec63fd058b16..7af770e69efe 100644 --- a/core/java/android/bluetooth/BluetoothPan.java +++ b/core/java/android/bluetooth/BluetoothPan.java @@ -174,8 +174,9 @@ public final class BluetoothPan implements BluetoothProfile, AutoCloseable { /** * Closes the connection to the service and unregisters callbacks + * + * @hide */ - @RequiresPermission(Manifest.permission.BLUETOOTH) public void close() { if (VDBG) log("close()"); mProfileConnector.disconnect(); @@ -185,7 +186,7 @@ public final class BluetoothPan implements BluetoothProfile, AutoCloseable { return mProfileConnector.getService(); } - @RequiresPermission(Manifest.permission.BLUETOOTH) + /** @hide */ protected void finalize() { if (mCloseGuard != null) { mCloseGuard.warnIfOpen(); @@ -280,7 +281,7 @@ public final class BluetoothPan implements BluetoothProfile, AutoCloseable { * @hide */ @SystemApi - @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN) + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setConnectionPolicy(@NonNull BluetoothDevice device, @ConnectionPolicy int connectionPolicy) { if (DBG) log("setConnectionPolicy(" + device + ", " + connectionPolicy + ")"); @@ -304,8 +305,11 @@ public final class BluetoothPan implements BluetoothProfile, AutoCloseable { /** * {@inheritDoc} + * @hide */ + @SystemApi @Override + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public @NonNull List<BluetoothDevice> getConnectedDevices() { if (VDBG) log("getConnectedDevices()"); final IBluetoothPan service = getService(); @@ -344,9 +348,11 @@ public final class BluetoothPan implements BluetoothProfile, AutoCloseable { /** * {@inheritDoc} + * @hide */ + @SystemApi @Override - @RequiresPermission(Manifest.permission.BLUETOOTH) + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public int getConnectionState(@Nullable BluetoothDevice device) { if (VDBG) log("getState(" + device + ")"); final IBluetoothPan service = getService(); @@ -366,8 +372,10 @@ public final class BluetoothPan implements BluetoothProfile, AutoCloseable { * Turns on/off bluetooth tethering * * @param value is whether to enable or disable bluetooth tethering + * @hide */ - @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN) + @SystemApi + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public void setBluetoothTethering(boolean value) { String pkgName = mContext.getOpPackageName(); if (DBG) log("setBluetoothTethering(" + value + "), calling package:" + pkgName); @@ -385,8 +393,10 @@ public final class BluetoothPan implements BluetoothProfile, AutoCloseable { * Determines whether tethering is enabled * * @return true if tethering is on, false if not or some error occurred + * @hide */ - @RequiresPermission(Manifest.permission.BLUETOOTH) + @SystemApi + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean isTetheringOn() { if (VDBG) log("isTetheringOn()"); final IBluetoothPan service = getService(); |