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

Commit 5f2365f9 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

gtbs: Remove usage of mContext.getMainThreadHandler

This is hidden API and shall not be used.

Bug: 150670922
Sponsor: @jpawlowski
Test: phone call over BT
Change-Id: Idb81d93d8df45b40a68fdd2529ec77d3cfa2d866
parent d796637e
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import android.bluetooth.BluetoothGattDescriptor;
import android.bluetooth.BluetoothGattServerCallback;
import android.bluetooth.BluetoothGattService;
import android.bluetooth.BluetoothLeCall;
import android.os.Handler;
import android.os.Looper;
import android.content.Context;
import android.util.Log;

@@ -133,6 +135,7 @@ public class TbsGatt {
    private final GattCharacteristic mIncomingCallCharacteristic;
    private final GattCharacteristic mCallFriendlyNameCharacteristic;
    private BluetoothGattServerProxy mBluetoothGattServer;
    private Handler mHandler;
    private Callback mCallback;

    public static abstract class Callback {
@@ -210,6 +213,7 @@ public class TbsGatt {
        setCallControlPointOptionalOpcodes(isLocalHoldOpcodeSupported, isJoinOpcodeSupported);
        mStatusFlagsCharacteristic.setValue(0, BluetoothGattCharacteristic.FORMAT_UINT16, 0);
        mCallback = callback;
        mHandler = new Handler(Looper.getMainLooper());

        if (mBluetoothGattServer == null) {
            mBluetoothGattServer = new BluetoothGattServerProxy(mContext);
@@ -412,7 +416,7 @@ public class TbsGatt {
            super.setValue(value);

            // to avoid sending control point notification before write response
            mContext.getMainThreadHandler().post(() -> mNotifier.notify(device, this));
            mHandler.post(() -> mNotifier.notify(device, this));
        }
    }