Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7468041d authored by Sal Savage's avatar Sal Savage Committed by Automerger Merge Worker
Browse files

Make BluetoothAdapter#disable(boolean persist) a @SystemApi am: 8dafa60a am:...

Make BluetoothAdapter#disable(boolean persist) a @SystemApi am: 8dafa60a am: 7db30132 am: 8aa2d3ba

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15960228

Change-Id: Ib006284b14bd775104e903bcab1417d3f4e9ffa7
parents f6483e1d 8aa2d3ba
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1938,6 +1938,7 @@ package android.bluetooth {
  public final class BluetoothAdapter {
    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean addOnMetadataChangedListener(@NonNull android.bluetooth.BluetoothDevice, @NonNull java.util.concurrent.Executor, @NonNull android.bluetooth.BluetoothAdapter.OnMetadataChangedListener);
    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean disable(boolean);
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean disableBLE();
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean enableBLE();
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean enableNoAutoConnect();
+6 −2
Original line number Diff line number Diff line
@@ -1245,13 +1245,17 @@ public final class BluetoothAdapter {
    /**
     * Turn off the local Bluetooth adapter and don't persist the setting.
     *
     * @param persist Indicate whether the off state should be persisted following the next reboot
     * @return true to indicate adapter shutdown has begun, or false on immediate error
     * @hide
     */
    @UnsupportedAppUsage(trackingBug = 171933273)
    @SystemApi
    @RequiresLegacyBluetoothAdminPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    @RequiresPermission(allOf = {
            android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
    })
    public boolean disable(boolean persist) {

        try {
+6 −1
Original line number Diff line number Diff line
@@ -1154,6 +1154,11 @@ class BluetoothManagerService extends IBluetoothManager.Stub {

    public boolean disable(AttributionSource attributionSource, boolean persist)
            throws RemoteException {
        if (!persist) {
            mContext.enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED,
                    "Need BLUETOOTH_PRIVILEGED permission");
        }

        final String packageName = attributionSource.getPackageName();
        if (!checkBluetoothPermissions(attributionSource, "disable", true)) {
            if (DBG) {