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

Commit 2788d288 authored by William Escande's avatar William Escande
Browse files

TbsService: Move variable to final

Also fix some typo
Since some variable are final, we can remove the impossible null check

Bug: 311772251
Test: None
Flag: EXEMPT refactor
Change-Id: Ic34171d04ad4bbcf24bb5545d40347fdbaf33bff
parent 4cc14ad4
Loading
Loading
Loading
Loading
+5 −18
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ public class TbsService extends ProfileService {
    private static final String TAG = "TbsService";

    private static TbsService sTbsService;
    private Map<BluetoothDevice, Integer> mDeviceAuthorizations = new HashMap<>();
    private final Map<BluetoothDevice, Integer> mDeviceAuthorizations = new HashMap<>();

    private final TbsGeneric mTbsGeneric = new TbsGeneric();

@@ -65,7 +65,6 @@ public class TbsService extends ProfileService {

    @Override
    public void start() {

        Log.d(TAG, "start()");
        if (sTbsService != null) {
            throw new IllegalStateException("start() called twice");
@@ -88,10 +87,8 @@ public class TbsService extends ProfileService {
        // Mark service as stopped
        setTbsService(null);

        if (mTbsGeneric != null) {
        mTbsGeneric.cleanup();
    }
    }

    @Override
    public void cleanup() {
@@ -156,10 +153,8 @@ public class TbsService extends ProfileService {
                isAuthorized ? BluetoothDevice.ACCESS_ALLOWED : BluetoothDevice.ACCESS_REJECTED;
        mDeviceAuthorizations.put(device, authorization);

        if (mTbsGeneric != null) {
        mTbsGeneric.onDeviceAuthorizationSet(device);
    }
    }

    /**
     * Returns authorization value for given device.
@@ -187,7 +182,7 @@ public class TbsService extends ProfileService {

        LeAudioService leAudioService = LeAudioService.getLeAudioService();
        if (leAudioService == null) {
            Log.e(TAG, "TBS access not permited. LeAudioService not available");
            Log.e(TAG, "TBS access not permitted. LeAudioService not available");
            return BluetoothDevice.ACCESS_UNKNOWN;
        }

@@ -198,7 +193,7 @@ public class TbsService extends ProfileService {
            return BluetoothDevice.ACCESS_ALLOWED;
        }

        Log.e(TAG, "TBS access not permited");
        Log.e(TAG, "TBS access not permitted");
        return BluetoothDevice.ACCESS_UNKNOWN;
    }

@@ -208,10 +203,6 @@ public class TbsService extends ProfileService {
     * @param device device for which inband ringtone has been set
     */
    public void setInbandRingtoneSupport(BluetoothDevice device) {
        if (mTbsGeneric == null) {
            Log.i(TAG, "setInbandRingtoneSupport, mTbsGeneric not available");
            return;
        }
        mTbsGeneric.setInbandRingtoneSupport(device);
    }

@@ -221,10 +212,6 @@ public class TbsService extends ProfileService {
     * @param device device for which inband ringtone has been clear
     */
    public void clearInbandRingtoneSupport(BluetoothDevice device) {
        if (mTbsGeneric == null) {
            Log.i(TAG, "clearInbandRingtoneSupport, mTbsGeneric not available");
            return;
        }
        mTbsGeneric.clearInbandRingtoneSupport(device);
    }