Loading android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java +13 −8 Original line number Diff line number Diff line Loading @@ -156,6 +156,7 @@ public class BluetoothInCallService extends InCallService { @Override @RequiresPermission(allOf = {BLUETOOTH_CONNECT, MODIFY_PHONE_STATE}) public void onServiceConnected(int profile, BluetoothProfile proxy) { Log.d(TAG, "onServiceConnected for profile: " + profile); synchronized (LOCK) { if (profile == BluetoothProfile.HEADSET) { mBluetoothHeadset = new BluetoothHeadsetProxy((BluetoothHeadset) proxy); Loading @@ -164,6 +165,7 @@ public class BluetoothInCallService extends InCallService { mBluetoothLeCallControl = new BluetoothLeCallControlProxy((BluetoothLeCallControl) proxy); boolean isBearerRegistered = mBluetoothLeCallControl.registerBearer( TAG, List.of("tel"), Loading @@ -172,9 +174,11 @@ public class BluetoothInCallService extends InCallService { getBearerTechnology(), mExecutor, mBluetoothLeCallControlCallback); Log.d(TAG, "isBearerRegistered: " + isBearerRegistered); sendTbsCurrentCallsList(); } } Log.d(TAG, "Calls updated for profile: " + profile); } @Override Loading Loading @@ -784,6 +788,7 @@ public class BluetoothInCallService extends InCallService { if (mBluetoothLeCallControl != null) { mBluetoothLeCallControl.unregisterBearer(); mBluetoothLeCallControl.closeBluetoothLeCallControlProxy(mAdapter); mBluetoothLeCallControl = null; } sInstance = null; mCallbacks.clear(); Loading framework/java/android/bluetooth/BluetoothLeCallControl.java +10 −26 Original line number Diff line number Diff line Loading @@ -55,8 +55,6 @@ import java.util.concurrent.Executor; */ public final class BluetoothLeCallControl implements BluetoothProfile { private static final String TAG = "BluetoothLeCallControl"; private static final boolean DBG = true; private static final boolean VDBG = false; /** @hide */ @IntDef( Loading Loading @@ -296,6 +294,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile { @Override public void onBearerRegistered(int ccid) { if (mCallback != null) { Log.d(TAG, "onBearerRegistered: ccid is " + ccid); mCcid = ccid; } else { // registration timeout Loading Loading @@ -390,9 +389,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile { /** @hide */ public void close() { if (VDBG) { Log.d(TAG, "close()"); } Log.v(TAG, "close()"); mAdapter.closeProfileProxy(this); } Loading Loading @@ -489,13 +486,12 @@ public final class BluetoothLeCallControl implements BluetoothProfile { int technology, @NonNull Executor executor, @NonNull Callback callback) { if (DBG) { Log.d(TAG, "registerBearer"); } if (callback == null) { throw new IllegalArgumentException("null parameter: " + callback); } if (mCcid != 0) { Log.e(TAG, "Ccid is already set to " + mCcid); return false; } Loading Loading @@ -546,9 +542,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile { */ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED}) public void unregisterBearer() { if (DBG) { Log.d(TAG, "unregisterBearer"); } if (mCcid == 0) { return; } Loading Loading @@ -581,9 +575,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile { */ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED}) public void onCallAdded(@NonNull BluetoothLeCall call) { if (DBG) { Log.d(TAG, "onCallAdded: call=" + call); } if (mCcid == 0) { return; } Loading Loading @@ -614,9 +606,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile { */ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED}) public void onCallRemoved(@NonNull UUID callId, @TerminationReason int reason) { if (DBG) { Log.d(TAG, "callRemoved: callId=" + callId); } if (mCcid == 0) { return; } Loading Loading @@ -646,9 +636,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile { */ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED}) public void onCallStateChanged(@NonNull UUID callId, @BluetoothLeCall.State int state) { if (DBG) { Log.d(TAG, "callStateChanged: callId=" + callId + " state=" + state); } if (mCcid == 0) { return; } Loading Loading @@ -705,9 +693,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile { */ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED}) public void networkStateChanged(@NonNull String provider, int technology) { if (DBG) { Log.d(TAG, "networkStateChanged: provider=" + provider + ", technology=" + technology); } if (mCcid == 0) { return; } Loading Loading @@ -745,9 +731,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile { */ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED}) public void requestResult(int requestId, @Result int result) { if (DBG) { Log.d(TAG, "requestResult: requestId=" + requestId + " result=" + result); } if (mCcid == 0) { return; } Loading Loading
android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java +13 −8 Original line number Diff line number Diff line Loading @@ -156,6 +156,7 @@ public class BluetoothInCallService extends InCallService { @Override @RequiresPermission(allOf = {BLUETOOTH_CONNECT, MODIFY_PHONE_STATE}) public void onServiceConnected(int profile, BluetoothProfile proxy) { Log.d(TAG, "onServiceConnected for profile: " + profile); synchronized (LOCK) { if (profile == BluetoothProfile.HEADSET) { mBluetoothHeadset = new BluetoothHeadsetProxy((BluetoothHeadset) proxy); Loading @@ -164,6 +165,7 @@ public class BluetoothInCallService extends InCallService { mBluetoothLeCallControl = new BluetoothLeCallControlProxy((BluetoothLeCallControl) proxy); boolean isBearerRegistered = mBluetoothLeCallControl.registerBearer( TAG, List.of("tel"), Loading @@ -172,9 +174,11 @@ public class BluetoothInCallService extends InCallService { getBearerTechnology(), mExecutor, mBluetoothLeCallControlCallback); Log.d(TAG, "isBearerRegistered: " + isBearerRegistered); sendTbsCurrentCallsList(); } } Log.d(TAG, "Calls updated for profile: " + profile); } @Override Loading Loading @@ -784,6 +788,7 @@ public class BluetoothInCallService extends InCallService { if (mBluetoothLeCallControl != null) { mBluetoothLeCallControl.unregisterBearer(); mBluetoothLeCallControl.closeBluetoothLeCallControlProxy(mAdapter); mBluetoothLeCallControl = null; } sInstance = null; mCallbacks.clear(); Loading
framework/java/android/bluetooth/BluetoothLeCallControl.java +10 −26 Original line number Diff line number Diff line Loading @@ -55,8 +55,6 @@ import java.util.concurrent.Executor; */ public final class BluetoothLeCallControl implements BluetoothProfile { private static final String TAG = "BluetoothLeCallControl"; private static final boolean DBG = true; private static final boolean VDBG = false; /** @hide */ @IntDef( Loading Loading @@ -296,6 +294,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile { @Override public void onBearerRegistered(int ccid) { if (mCallback != null) { Log.d(TAG, "onBearerRegistered: ccid is " + ccid); mCcid = ccid; } else { // registration timeout Loading Loading @@ -390,9 +389,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile { /** @hide */ public void close() { if (VDBG) { Log.d(TAG, "close()"); } Log.v(TAG, "close()"); mAdapter.closeProfileProxy(this); } Loading Loading @@ -489,13 +486,12 @@ public final class BluetoothLeCallControl implements BluetoothProfile { int technology, @NonNull Executor executor, @NonNull Callback callback) { if (DBG) { Log.d(TAG, "registerBearer"); } if (callback == null) { throw new IllegalArgumentException("null parameter: " + callback); } if (mCcid != 0) { Log.e(TAG, "Ccid is already set to " + mCcid); return false; } Loading Loading @@ -546,9 +542,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile { */ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED}) public void unregisterBearer() { if (DBG) { Log.d(TAG, "unregisterBearer"); } if (mCcid == 0) { return; } Loading Loading @@ -581,9 +575,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile { */ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED}) public void onCallAdded(@NonNull BluetoothLeCall call) { if (DBG) { Log.d(TAG, "onCallAdded: call=" + call); } if (mCcid == 0) { return; } Loading Loading @@ -614,9 +606,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile { */ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED}) public void onCallRemoved(@NonNull UUID callId, @TerminationReason int reason) { if (DBG) { Log.d(TAG, "callRemoved: callId=" + callId); } if (mCcid == 0) { return; } Loading Loading @@ -646,9 +636,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile { */ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED}) public void onCallStateChanged(@NonNull UUID callId, @BluetoothLeCall.State int state) { if (DBG) { Log.d(TAG, "callStateChanged: callId=" + callId + " state=" + state); } if (mCcid == 0) { return; } Loading Loading @@ -705,9 +693,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile { */ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED}) public void networkStateChanged(@NonNull String provider, int technology) { if (DBG) { Log.d(TAG, "networkStateChanged: provider=" + provider + ", technology=" + technology); } if (mCcid == 0) { return; } Loading Loading @@ -745,9 +731,7 @@ public final class BluetoothLeCallControl implements BluetoothProfile { */ @RequiresPermission(allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED}) public void requestResult(int requestId, @Result int result) { if (DBG) { Log.d(TAG, "requestResult: requestId=" + requestId + " result=" + result); } if (mCcid == 0) { return; } Loading