Loading android/app/src/com/android/bluetooth/tbs/TbsGeneric.java +3 −0 Original line number Diff line number Diff line Loading @@ -181,6 +181,9 @@ public class TbsGeneric { mTbsGatt.clearSilentModeFlag(); } // Android supports inband ringtone mTbsGatt.setInbandRingtoneFlag(); mReceiver = new Receiver(); mTbsGatt.getContext().registerReceiver(mReceiver, new IntentFilter(AudioManager.RINGER_MODE_CHANGED_ACTION)); Loading android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java +0 −53 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.media.AudioManager; import android.net.Uri; import android.os.Binder; import android.os.Bundle; Loading Loading @@ -61,8 +60,6 @@ import java.util.Map; import java.util.UUID; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; /** * Used to receive updates about calls from the Telecom component. This service is bound to Telecom Loading Loading @@ -97,8 +94,6 @@ public class BluetoothInCallService extends InCallService { // Indicates that no BluetoothCall is ringing private static final int DEFAULT_RINGING_ADDRESS_TYPE = 128; private static final int DISCONNECT_TONE_TIMEOUT_SECONDS = 1; private int mNumActiveCalls = 0; private int mNumHeldCalls = 0; private int mNumChildrenOfActiveCall = 0; Loading @@ -114,13 +109,6 @@ public class BluetoothInCallService extends InCallService { private BluetoothLeCallControlProxy mBluetoothLeCallControl; private ExecutorService mExecutor; private Semaphore mDisconnectionToneSemaphore = new Semaphore(0); private int mAudioMode = AudioManager.MODE_INVALID; private final Object mAudioModeLock = new Object(); @VisibleForTesting public AudioManager mAudioManager; @VisibleForTesting public TelephonyManager mTelephonyManager; Loading Loading @@ -328,19 +316,6 @@ public class BluetoothInCallService extends InCallService { } } class BluetoothOnModeChangedListener implements AudioManager.OnModeChangedListener { @Override public void onModeChanged(int mode) { synchronized (mAudioModeLock) { mAudioMode = mode; } if (mode == AudioManager.MODE_NORMAL) { mDisconnectionToneSemaphore.release(); } } } private BluetoothOnModeChangedListener mBluetoothOnModeChangedListener; @Override public IBinder onBind(Intent intent) { Log.i(TAG, "onBind. Intent: " + intent); Loading Loading @@ -567,26 +542,6 @@ public class BluetoothInCallService extends InCallService { return; } Log.d(TAG, "onCallRemoved"); BluetoothCall heldCall = mCallInfo.getHeldCall(); if (mCallInfo.isNullCall(heldCall)) { // current call is the only call mDisconnectionToneSemaphore.drainPermits(); boolean isAudioModeNormal = false; synchronized (mAudioModeLock) { isAudioModeNormal = (mAudioMode == AudioManager.MODE_NORMAL); } if (!isAudioModeNormal) { Log.d(TAG, "Acquiring mDisconnectionToneSemaphore"); try { boolean result = mDisconnectionToneSemaphore.tryAcquire( DISCONNECT_TONE_TIMEOUT_SECONDS, TimeUnit.SECONDS); Log.d(TAG, "Acquiring mDisconnectionToneSemaphore result " + result); } catch (InterruptedException e) { Log.w(TAG, "Failed to acquire mDisconnectionToneSemaphore"); } } } CallStateCallback callback = getCallback(call); if (callback != null) { call.unregisterCallback(callback); Loading Loading @@ -633,10 +588,6 @@ public class BluetoothInCallService extends InCallService { mBluetoothAdapterReceiver = new BluetoothAdapterReceiver(); IntentFilter intentFilter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED); registerReceiver(mBluetoothAdapterReceiver, intentFilter); mBluetoothOnModeChangedListener = new BluetoothOnModeChangedListener(); mAudioManager = getSystemService(AudioManager.class); mAudioManager.addOnModeChangedListener( Executors.newSingleThreadExecutor(), mBluetoothOnModeChangedListener); mOnCreateCalled = true; } Loading @@ -650,10 +601,6 @@ public class BluetoothInCallService extends InCallService { private void clear() { Log.d(TAG, "clear"); if (mBluetoothOnModeChangedListener != null) { mAudioManager.removeOnModeChangedListener(mBluetoothOnModeChangedListener); mBluetoothOnModeChangedListener = null; } if (mBluetoothAdapterReceiver != null) { unregisterReceiver(mBluetoothAdapterReceiver); mBluetoothAdapterReceiver = null; Loading android/app/tests/unit/Android.bp +4 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,10 @@ android_test { }, platform_apis: true, test_suites: ["device-tests"], test_suites: [ "device-tests", "mts-bluetooth", ], instrumentation_for: "Bluetooth", } android/app/tests/unit/AndroidTest.xml +6 −0 Original line number Diff line number Diff line Loading @@ -34,4 +34,10 @@ <option name="package" value="com.android.bluetooth.tests" /> <option name="hidden-api-checks" value="false"/> </test> <!-- Only run Cts Tests in MTS if the Bluetooth Mainline module is installed. --> <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController"> <option name="mainline-module-package-name" value="com.google.android.bluetooth" /> </object> </configuration> apex/apex_manifest.json +1 −1 Original line number Diff line number Diff line { "name": "com.android.bluetooth", "version": 330000000 "version": 330090000 } Loading
android/app/src/com/android/bluetooth/tbs/TbsGeneric.java +3 −0 Original line number Diff line number Diff line Loading @@ -181,6 +181,9 @@ public class TbsGeneric { mTbsGatt.clearSilentModeFlag(); } // Android supports inband ringtone mTbsGatt.setInbandRingtoneFlag(); mReceiver = new Receiver(); mTbsGatt.getContext().registerReceiver(mReceiver, new IntentFilter(AudioManager.RINGER_MODE_CHANGED_ACTION)); Loading
android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java +0 −53 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.media.AudioManager; import android.net.Uri; import android.os.Binder; import android.os.Bundle; Loading Loading @@ -61,8 +60,6 @@ import java.util.Map; import java.util.UUID; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; /** * Used to receive updates about calls from the Telecom component. This service is bound to Telecom Loading Loading @@ -97,8 +94,6 @@ public class BluetoothInCallService extends InCallService { // Indicates that no BluetoothCall is ringing private static final int DEFAULT_RINGING_ADDRESS_TYPE = 128; private static final int DISCONNECT_TONE_TIMEOUT_SECONDS = 1; private int mNumActiveCalls = 0; private int mNumHeldCalls = 0; private int mNumChildrenOfActiveCall = 0; Loading @@ -114,13 +109,6 @@ public class BluetoothInCallService extends InCallService { private BluetoothLeCallControlProxy mBluetoothLeCallControl; private ExecutorService mExecutor; private Semaphore mDisconnectionToneSemaphore = new Semaphore(0); private int mAudioMode = AudioManager.MODE_INVALID; private final Object mAudioModeLock = new Object(); @VisibleForTesting public AudioManager mAudioManager; @VisibleForTesting public TelephonyManager mTelephonyManager; Loading Loading @@ -328,19 +316,6 @@ public class BluetoothInCallService extends InCallService { } } class BluetoothOnModeChangedListener implements AudioManager.OnModeChangedListener { @Override public void onModeChanged(int mode) { synchronized (mAudioModeLock) { mAudioMode = mode; } if (mode == AudioManager.MODE_NORMAL) { mDisconnectionToneSemaphore.release(); } } } private BluetoothOnModeChangedListener mBluetoothOnModeChangedListener; @Override public IBinder onBind(Intent intent) { Log.i(TAG, "onBind. Intent: " + intent); Loading Loading @@ -567,26 +542,6 @@ public class BluetoothInCallService extends InCallService { return; } Log.d(TAG, "onCallRemoved"); BluetoothCall heldCall = mCallInfo.getHeldCall(); if (mCallInfo.isNullCall(heldCall)) { // current call is the only call mDisconnectionToneSemaphore.drainPermits(); boolean isAudioModeNormal = false; synchronized (mAudioModeLock) { isAudioModeNormal = (mAudioMode == AudioManager.MODE_NORMAL); } if (!isAudioModeNormal) { Log.d(TAG, "Acquiring mDisconnectionToneSemaphore"); try { boolean result = mDisconnectionToneSemaphore.tryAcquire( DISCONNECT_TONE_TIMEOUT_SECONDS, TimeUnit.SECONDS); Log.d(TAG, "Acquiring mDisconnectionToneSemaphore result " + result); } catch (InterruptedException e) { Log.w(TAG, "Failed to acquire mDisconnectionToneSemaphore"); } } } CallStateCallback callback = getCallback(call); if (callback != null) { call.unregisterCallback(callback); Loading Loading @@ -633,10 +588,6 @@ public class BluetoothInCallService extends InCallService { mBluetoothAdapterReceiver = new BluetoothAdapterReceiver(); IntentFilter intentFilter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED); registerReceiver(mBluetoothAdapterReceiver, intentFilter); mBluetoothOnModeChangedListener = new BluetoothOnModeChangedListener(); mAudioManager = getSystemService(AudioManager.class); mAudioManager.addOnModeChangedListener( Executors.newSingleThreadExecutor(), mBluetoothOnModeChangedListener); mOnCreateCalled = true; } Loading @@ -650,10 +601,6 @@ public class BluetoothInCallService extends InCallService { private void clear() { Log.d(TAG, "clear"); if (mBluetoothOnModeChangedListener != null) { mAudioManager.removeOnModeChangedListener(mBluetoothOnModeChangedListener); mBluetoothOnModeChangedListener = null; } if (mBluetoothAdapterReceiver != null) { unregisterReceiver(mBluetoothAdapterReceiver); mBluetoothAdapterReceiver = null; Loading
android/app/tests/unit/Android.bp +4 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,10 @@ android_test { }, platform_apis: true, test_suites: ["device-tests"], test_suites: [ "device-tests", "mts-bluetooth", ], instrumentation_for: "Bluetooth", }
android/app/tests/unit/AndroidTest.xml +6 −0 Original line number Diff line number Diff line Loading @@ -34,4 +34,10 @@ <option name="package" value="com.android.bluetooth.tests" /> <option name="hidden-api-checks" value="false"/> </test> <!-- Only run Cts Tests in MTS if the Bluetooth Mainline module is installed. --> <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController"> <option name="mainline-module-package-name" value="com.google.android.bluetooth" /> </object> </configuration>
apex/apex_manifest.json +1 −1 Original line number Diff line number Diff line { "name": "com.android.bluetooth", "version": 330000000 "version": 330090000 }