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

Commit bb510b97 authored by William Escande's avatar William Escande
Browse files

Remove always from isBleScanAlwaysAvailable

This method is wrongly named as the returned value can changed depending
on external factor and settings

Test: None
Flag: Exempt refactor
Bug: 341783936
Change-Id: I8349b2a0d1eae148da09c85b1cb25922713a22d9
parent a5f33b0a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2434,9 +2434,9 @@ public final class BluetoothAdapter {
    @RequiresNoPermission
    public boolean isBleScanAlwaysAvailable() {
        try {
            return mManagerService.isBleScanAlwaysAvailable();
            return mManagerService.isBleScanAvailable();
        } catch (RemoteException e) {
            Log.e(TAG, "remote exception when calling isBleScanAlwaysAvailable", e);
            Log.e(TAG, "remote exception when calling isBleScanAvailable", e);
            return false;
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ interface IBluetoothManager
    boolean onFactoryReset(in AttributionSource attributionSource);

    @JavaPassthrough(annotation="@android.annotation.RequiresNoPermission")
    boolean isBleScanAlwaysAvailable();
    boolean isBleScanAvailable();
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
    boolean enableBle(in AttributionSource attributionSource, IBinder b);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
+2 −2
Original line number Diff line number Diff line
@@ -875,7 +875,7 @@ class BluetoothManagerService {
        }
    }

    boolean isBleScanAlwaysAvailable() {
    boolean isBleScanAvailable() {
        if (Flags.airplaneModeXBleOn()) {
            if (AirplaneModeListener.isOn() && !mEnable) {
                return false;
@@ -915,7 +915,7 @@ class BluetoothManagerService {
                new ContentObserver(new Handler(mLooper)) {
                    @Override
                    public void onChange(boolean selfChange) {
                        if (isBleScanAlwaysAvailable()) {
                        if (isBleScanAvailable()) {
                            // Nothing to do
                            return;
                        }
+2 −2
Original line number Diff line number Diff line
@@ -237,8 +237,8 @@ class BluetoothServiceBinder extends IBluetoothManager.Stub {
    }

    @Override
    public boolean isBleScanAlwaysAvailable() {
        return mBluetoothManagerService.isBleScanAlwaysAvailable();
    public boolean isBleScanAvailable() {
        return mBluetoothManagerService.isBleScanAvailable();
    }

    @Override
+3 −3
Original line number Diff line number Diff line
@@ -293,10 +293,10 @@ public class BluetoothServiceBinderTest {
    }

    @Test
    public void isBleScanAlwaysAvailable() {
    public void isBleScanAvailable() {
        // No permission needed for this call
        mBinder.isBleScanAlwaysAvailable();
        verify(mManagerService).isBleScanAlwaysAvailable();
        mBinder.isBleScanAvailable();
        verify(mManagerService).isBleScanAvailable();
        verifyMock();
    }