Loading android/app/AndroidManifest.xml +22 −20 Original line number Diff line number Diff line Loading @@ -230,6 +230,28 @@ </intent-filter> </service> <!-- Hands-Free Profile (HFP) AG/server Profile Service and owned Service --> <service android:process="@string/process" android:name="com.android.bluetooth.hfp.HeadsetService" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.bluetooth.IBluetoothHeadset"/> </intent-filter> </service> <service android:name="com.android.bluetooth.telephony.BluetoothInCallService" android:permission="android.permission.BIND_INCALL_SERVICE" android:process="@string/process" android:enabled="false" android:exported="true"> <meta-data android:name="android.telecom.INCLUDE_SELF_MANAGED_CALLS" android:value="true" /> <intent-filter> <action android:name="android.telecom.InCallService"/> </intent-filter> </service> <!-- Hands-Free HF/Client Profile Service and owned Service --> <service android:process="@string/process" android:name="com.android.bluetooth.hfpclient.HeadsetClientService" Loading Loading @@ -531,25 +553,5 @@ <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> <service android:process="@string/process" android:name=".hfp.HeadsetService" android:enabled="@bool/profile_supported_hs_hfp" android:exported="true"> <intent-filter> <action android:name="android.bluetooth.IBluetoothHeadset"/> </intent-filter> </service> <service android:name="com.android.bluetooth.telephony.BluetoothInCallService" android:permission="android.permission.BIND_INCALL_SERVICE" android:process="@string/process" android:enabled="@bool/profile_supported_hfp_incallservice" android:exported="true"> <meta-data android:name="android.telecom.INCLUDE_SELF_MANAGED_CALLS" android:value="true" /> <intent-filter> <action android:name="android.telecom.InCallService"/> </intent-filter> </service> </application> </manifest> android/app/res/values/config.xml +0 −2 Original line number Diff line number Diff line Loading @@ -13,8 +13,6 @@ limitations under the License. --> <resources> <bool name="profile_supported_hs_hfp">true</bool> <bool name="profile_supported_hfp_incallservice">true</bool> <bool name="profile_supported_opp">true</bool> <bool name="pbap_include_photos_in_vcard">true</bool> <bool name="pbap_use_profile_for_owner_vcard">true</bool> Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +6 −14 Original line number Diff line number Diff line Loading @@ -872,20 +872,6 @@ public class AdapterService extends Service { mA2dpService.switchCodecByBufferSize(activeDevices.get(0), isLowLatencyBufferSize); } /** * Enable/disable BluetoothInCallService * * @param enable to enable/disable BluetoothInCallService. */ public void enableBluetoothInCallService(boolean enable) { debugLog("enableBluetoothInCallService() - Enable = " + enable); getPackageManager().setComponentEnabledSetting( BLUETOOTH_INCALLSERVICE_COMPONENT, enable ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } void cleanup() { debugLog("cleanup()"); if (mCleaningUp) { Loading Loading @@ -4936,6 +4922,12 @@ public class AdapterService extends Service { writer.println("mDefaultSnoopLogSettingAtEnable = " + mDefaultSnoopLogSettingAtEnable); writer.println(); writer.println("Enabled Profile Services:"); for (Class profile : Config.getSupportedProfiles()) { writer.println(" " + profile.getSimpleName()); } writer.println(); mAdapterStateMachine.dump(fd, writer, args); StringBuilder sb = new StringBuilder(); Loading android/app/src/com/android/bluetooth/btservice/AdapterState.java +0 −17 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.os.Message; import android.os.SystemProperties; import android.util.Log; import com.android.bluetooth.telephony.BluetoothInCallService; import com.android.internal.util.State; import com.android.internal.util.StateMachine; Loading Loading @@ -229,21 +228,6 @@ final class AdapterState extends StateMachine { return BluetoothAdapter.STATE_ON; } @Override public void enter() { super.enter(); mAdapterService.enableBluetoothInCallService(true); } @Override public void exit() { BluetoothInCallService bluetoothInCallService = BluetoothInCallService.getInstance(); if (bluetoothInCallService == null) { mAdapterService.enableBluetoothInCallService(false); } super.exit(); } @Override public boolean processMessage(Message msg) { switch (msg.what) { Loading Loading @@ -392,7 +376,6 @@ final class AdapterState extends StateMachine { @Override public void enter() { super.enter(); mAdapterService.enableBluetoothInCallService(false); final int timeoutDelay = SystemProperties.getInt( BLE_STOP_TIMEOUT_DELAY_PROPERTY, BLE_STOP_TIMEOUT_DELAY); Log.d(TAG, "Stop Timeout Delay: " + timeoutDelay); Loading android/app/src/com/android/bluetooth/hfp/HeadsetService.java +18 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.bluetooth.BluetoothUuid; import android.bluetooth.IBluetoothHeadset; import android.content.AttributionSource; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; Loading @@ -43,6 +44,7 @@ import android.os.Looper; import android.os.ParcelUuid; import android.os.SystemProperties; import android.os.UserHandle; import android.sysprop.BluetoothProperties; import android.telecom.PhoneAccount; import android.util.Log; Loading @@ -53,6 +55,7 @@ import com.android.bluetooth.btservice.AdapterService; import com.android.bluetooth.btservice.MetricsLogger; import com.android.bluetooth.btservice.ProfileService; import com.android.bluetooth.btservice.storage.DatabaseManager; import com.android.bluetooth.telephony.BluetoothInCallService; import com.android.internal.annotations.VisibleForTesting; import com.android.modules.utils.SynchronousResultReceiver; Loading Loading @@ -93,6 +96,13 @@ import java.util.Objects; public class HeadsetService extends ProfileService { private static final String TAG = "HeadsetService"; private static final boolean DBG = false; /** * HFP AG owned/managed components */ private static final String HFP_AG_IN_CALL_SERVICE = BluetoothInCallService.class.getCanonicalName(); private static final String DISABLE_INBAND_RINGING_PROPERTY = "persist.bluetooth.disableinbandringing"; private static final ParcelUuid[] HEADSET_UUIDS = {BluetoothUuid.HSP, BluetoothUuid.HFP}; Loading Loading @@ -129,6 +139,10 @@ public class HeadsetService extends ProfileService { private boolean mCreated; private static HeadsetService sHeadsetService; public static boolean isEnabled() { return BluetoothProperties.isProfileHfpAgEnabled().orElse(false); } @Override public IProfileServiceBinder initBinder() { return new BluetoothHeadsetBinder(this); Loading @@ -149,6 +163,9 @@ public class HeadsetService extends ProfileService { if (mStarted) { throw new IllegalStateException("start() called twice"); } setComponentAvailable(HFP_AG_IN_CALL_SERVICE, true); // Step 1: Get AdapterService and DatabaseManager, should never be null mAdapterService = Objects.requireNonNull(AdapterService.getAdapterService(), "AdapterService cannot be null when HeadsetService starts"); Loading Loading @@ -253,6 +270,7 @@ public class HeadsetService extends ProfileService { synchronized (mStateMachines) { mAdapterService = null; } setComponentAvailable(HFP_AG_IN_CALL_SERVICE, false); return true; } Loading Loading
android/app/AndroidManifest.xml +22 −20 Original line number Diff line number Diff line Loading @@ -230,6 +230,28 @@ </intent-filter> </service> <!-- Hands-Free Profile (HFP) AG/server Profile Service and owned Service --> <service android:process="@string/process" android:name="com.android.bluetooth.hfp.HeadsetService" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.bluetooth.IBluetoothHeadset"/> </intent-filter> </service> <service android:name="com.android.bluetooth.telephony.BluetoothInCallService" android:permission="android.permission.BIND_INCALL_SERVICE" android:process="@string/process" android:enabled="false" android:exported="true"> <meta-data android:name="android.telecom.INCLUDE_SELF_MANAGED_CALLS" android:value="true" /> <intent-filter> <action android:name="android.telecom.InCallService"/> </intent-filter> </service> <!-- Hands-Free HF/Client Profile Service and owned Service --> <service android:process="@string/process" android:name="com.android.bluetooth.hfpclient.HeadsetClientService" Loading Loading @@ -531,25 +553,5 @@ <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> <service android:process="@string/process" android:name=".hfp.HeadsetService" android:enabled="@bool/profile_supported_hs_hfp" android:exported="true"> <intent-filter> <action android:name="android.bluetooth.IBluetoothHeadset"/> </intent-filter> </service> <service android:name="com.android.bluetooth.telephony.BluetoothInCallService" android:permission="android.permission.BIND_INCALL_SERVICE" android:process="@string/process" android:enabled="@bool/profile_supported_hfp_incallservice" android:exported="true"> <meta-data android:name="android.telecom.INCLUDE_SELF_MANAGED_CALLS" android:value="true" /> <intent-filter> <action android:name="android.telecom.InCallService"/> </intent-filter> </service> </application> </manifest>
android/app/res/values/config.xml +0 −2 Original line number Diff line number Diff line Loading @@ -13,8 +13,6 @@ limitations under the License. --> <resources> <bool name="profile_supported_hs_hfp">true</bool> <bool name="profile_supported_hfp_incallservice">true</bool> <bool name="profile_supported_opp">true</bool> <bool name="pbap_include_photos_in_vcard">true</bool> <bool name="pbap_use_profile_for_owner_vcard">true</bool> Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +6 −14 Original line number Diff line number Diff line Loading @@ -872,20 +872,6 @@ public class AdapterService extends Service { mA2dpService.switchCodecByBufferSize(activeDevices.get(0), isLowLatencyBufferSize); } /** * Enable/disable BluetoothInCallService * * @param enable to enable/disable BluetoothInCallService. */ public void enableBluetoothInCallService(boolean enable) { debugLog("enableBluetoothInCallService() - Enable = " + enable); getPackageManager().setComponentEnabledSetting( BLUETOOTH_INCALLSERVICE_COMPONENT, enable ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } void cleanup() { debugLog("cleanup()"); if (mCleaningUp) { Loading Loading @@ -4936,6 +4922,12 @@ public class AdapterService extends Service { writer.println("mDefaultSnoopLogSettingAtEnable = " + mDefaultSnoopLogSettingAtEnable); writer.println(); writer.println("Enabled Profile Services:"); for (Class profile : Config.getSupportedProfiles()) { writer.println(" " + profile.getSimpleName()); } writer.println(); mAdapterStateMachine.dump(fd, writer, args); StringBuilder sb = new StringBuilder(); Loading
android/app/src/com/android/bluetooth/btservice/AdapterState.java +0 −17 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.os.Message; import android.os.SystemProperties; import android.util.Log; import com.android.bluetooth.telephony.BluetoothInCallService; import com.android.internal.util.State; import com.android.internal.util.StateMachine; Loading Loading @@ -229,21 +228,6 @@ final class AdapterState extends StateMachine { return BluetoothAdapter.STATE_ON; } @Override public void enter() { super.enter(); mAdapterService.enableBluetoothInCallService(true); } @Override public void exit() { BluetoothInCallService bluetoothInCallService = BluetoothInCallService.getInstance(); if (bluetoothInCallService == null) { mAdapterService.enableBluetoothInCallService(false); } super.exit(); } @Override public boolean processMessage(Message msg) { switch (msg.what) { Loading Loading @@ -392,7 +376,6 @@ final class AdapterState extends StateMachine { @Override public void enter() { super.enter(); mAdapterService.enableBluetoothInCallService(false); final int timeoutDelay = SystemProperties.getInt( BLE_STOP_TIMEOUT_DELAY_PROPERTY, BLE_STOP_TIMEOUT_DELAY); Log.d(TAG, "Stop Timeout Delay: " + timeoutDelay); Loading
android/app/src/com/android/bluetooth/hfp/HeadsetService.java +18 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.bluetooth.BluetoothUuid; import android.bluetooth.IBluetoothHeadset; import android.content.AttributionSource; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; Loading @@ -43,6 +44,7 @@ import android.os.Looper; import android.os.ParcelUuid; import android.os.SystemProperties; import android.os.UserHandle; import android.sysprop.BluetoothProperties; import android.telecom.PhoneAccount; import android.util.Log; Loading @@ -53,6 +55,7 @@ import com.android.bluetooth.btservice.AdapterService; import com.android.bluetooth.btservice.MetricsLogger; import com.android.bluetooth.btservice.ProfileService; import com.android.bluetooth.btservice.storage.DatabaseManager; import com.android.bluetooth.telephony.BluetoothInCallService; import com.android.internal.annotations.VisibleForTesting; import com.android.modules.utils.SynchronousResultReceiver; Loading Loading @@ -93,6 +96,13 @@ import java.util.Objects; public class HeadsetService extends ProfileService { private static final String TAG = "HeadsetService"; private static final boolean DBG = false; /** * HFP AG owned/managed components */ private static final String HFP_AG_IN_CALL_SERVICE = BluetoothInCallService.class.getCanonicalName(); private static final String DISABLE_INBAND_RINGING_PROPERTY = "persist.bluetooth.disableinbandringing"; private static final ParcelUuid[] HEADSET_UUIDS = {BluetoothUuid.HSP, BluetoothUuid.HFP}; Loading Loading @@ -129,6 +139,10 @@ public class HeadsetService extends ProfileService { private boolean mCreated; private static HeadsetService sHeadsetService; public static boolean isEnabled() { return BluetoothProperties.isProfileHfpAgEnabled().orElse(false); } @Override public IProfileServiceBinder initBinder() { return new BluetoothHeadsetBinder(this); Loading @@ -149,6 +163,9 @@ public class HeadsetService extends ProfileService { if (mStarted) { throw new IllegalStateException("start() called twice"); } setComponentAvailable(HFP_AG_IN_CALL_SERVICE, true); // Step 1: Get AdapterService and DatabaseManager, should never be null mAdapterService = Objects.requireNonNull(AdapterService.getAdapterService(), "AdapterService cannot be null when HeadsetService starts"); Loading Loading @@ -253,6 +270,7 @@ public class HeadsetService extends ProfileService { synchronized (mStateMachines) { mAdapterService = null; } setComponentAvailable(HFP_AG_IN_CALL_SERVICE, false); return true; } Loading