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

Commit e71c1db3 authored by Sal Savage's avatar Sal Savage
Browse files

Migrate LE Audio related profile enable/disable to sysprops

Tag: #refactor
Bug: 217448211
Test: atest BluetoothInstrumentationTests
Change-Id: I05677f0abb069ffa98c2ea67b515ebf6adab50bc
parent 7b20810e
Loading
Loading
Loading
Loading
+86 −70
Original line number Diff line number Diff line
@@ -155,6 +155,92 @@
            </intent-filter>
        </activity>

        <!--  Basic Audio Profile (BAP) Profile Service  -->
        <service
            android:process="@string/process"
            android:name="com.android.bluetooth.le_audio.LeAudioService"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothLeAudio" />
            </intent-filter>
        </service>

        <!-- Basic Audio Profile (BAP) Broadcast Assistant Profle Service -->
        <service
            android:process="@string/process"
            android:name = "com.android.bluetooth.bass_client.BassClientService"
            android:enabled="true"
            android:exported = "true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothLeBroadcastAssistant" />
            </intent-filter>
        </service>

        <!-- Battery Service (BAS) Client Profle Service -->
        <service
            android:process="@string/process"
            android:name="com.android.bluetooth.bas.BatteryService"
            android:enabled="true"
            android:exported = "true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothBattery" />
            </intent-filter>
        </service>

        <!--  Coordinated Set Identification Profile (CSIP) set coordinator Profile Service  -->
        <service
            android:process="@string/process"
            android:name="com.android.bluetooth.csip.CsipSetCoordinatorService"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothCsipSetCoordinator" />
            </intent-filter>
        </service>

        <!--  Hearing Aid Profile (HAP) client Profile Service  -->
        <service android:process="@string/process"
             android:name="com.android.bluetooth.hap.HapClientService"
             android:enabled="true"
             android:exported="true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothHapClient"/>
            </intent-filter>
        </service>

        <!--  Media Control Profile (MCP) server Profile Service  -->
        <service android:process="@string/process"
             android:name="com.android.bluetooth.mcp.McpService"
             android:enabled="true"
             android:exported="true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothMcpServiceManager" />
            </intent-filter>
        </service>

        <!--  Telephony Bearer Service (TBS) server Profile Service  -->
        <service
            android:process="@string/process"
            android:name="com.android.bluetooth.tbs.TbsService"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothLeCallControl" />
            </intent-filter>
        </service>

        <!--  Volume Control Profile (VCP) server Profile Service  -->
        <service
            android:process="@string/process"
            android:name="com.android.bluetooth.vc.VolumeControlService"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothVolumeControl" />
            </intent-filter>
        </service>

        <provider android:name=".opp.BluetoothOppProvider"
             android:authorities="com.android.bluetooth.opp"
             android:exported="true"
@@ -379,14 +465,6 @@
                <action android:name="android.bluetooth.IBluetoothHidDevice"/>
            </intent-filter>
        </service>
        <service android:process="@string/process"
             android:name="com.android.bluetooth.mcp.McpService"
             android:exported="true"
             android:enabled="@bool/profile_supported_mcp_server">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothMcpServiceManager" />
            </intent-filter>
        </service>
        <service
             android:process="@string/process"
             android:name="com.android.bluetooth.pan.PanService"
@@ -429,59 +507,6 @@
                <action android:name="android.bluetooth.IBluetoothHearingAid"/>
            </intent-filter>
        </service>
        <service android:process="@string/process"
             android:name="com.android.bluetooth.hap.HapClientService"
             android:enabled="@bool/profile_supported_hap_client"
             android:exported="true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothHapClient"/>
            </intent-filter>
        </service>
        <service
            android:process="@string/process"
            android:name="com.android.bluetooth.vc.VolumeControlService"
            android:exported="true"
            android:enabled="@bool/profile_supported_vc">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothVolumeControl" />
            </intent-filter>
        </service>
        <service
            android:process="@string/process"
            android:name = "com.android.bluetooth.le_audio.LeAudioService"
            android:enabled="@bool/profile_supported_le_audio"
            android:exported = "true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothLeAudio" />
            </intent-filter>
        </service>
        <service
            android:process="@string/process"
            android:name = "com.android.bluetooth.csip.CsipSetCoordinatorService"
            android:enabled="@bool/profile_supported_csip_set_coordinator"
            android:exported = "true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothCsipSetCoordinator" />
            </intent-filter>
        </service>
        <service
            android:process="@string/process"
            android:name = "com.android.bluetooth.tbs.TbsService"
            android:enabled="@bool/profile_supported_le_call_control"
            android:exported = "true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothLeCallControl" />
            </intent-filter>
        </service>
        <service
            android:process="@string/process"
            android:name = "com.android.bluetooth.bass_client.BassClientService"
            android:enabled="@bool/profile_supported_bass_client"
            android:exported = "true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothLeBroadcastAssistant" />
            </intent-filter>
        </service>
        <!-- Authenticator for PBAP account. -->
        <service android:process="@string/process"
             android:name="com.android.bluetooth.pbapclient.AuthenticationService"
@@ -505,14 +530,5 @@
              <action android:name="android.telecom.InCallService"/>
            </intent-filter>
         </service>
        <service
            android:process="@string/process"
            android:name="com.android.bluetooth.bas.BatteryService"
            android:enabled="@bool/profile_supported_battery"
            android:exported = "true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothBattery" />
            </intent-filter>
        </service>
    </application>
</manifest>
+0 −9
Original line number Diff line number Diff line
@@ -28,15 +28,6 @@
    <bool name="profile_supported_pbapclient">false</bool>
    <bool name="profile_supported_mapmce">false</bool>
    <bool name="profile_supported_hid_device">true</bool>
    <bool name="profile_supported_le_audio">true</bool>
    <bool name="profile_supported_le_audio_broadcast">false</bool>
    <bool name="profile_supported_vc">true</bool>
    <bool name="profile_supported_mcp_server">true</bool>
    <bool name="profile_supported_csip_set_coordinator">true</bool>
    <bool name="profile_supported_le_call_control">true</bool>
    <bool name="profile_supported_hap_client">true</bool>
    <bool name="profile_supported_bass_client">true</bool>
    <bool name="profile_supported_battery">true</bool>

    <!-- If true, we will require location to be enabled on the device to
         fire Bluetooth LE scan result callbacks in addition to having one
+5 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.os.HandlerThread;
import android.os.ParcelUuid;
import android.sysprop.BluetoothProperties;
import android.util.Log;

import com.android.bluetooth.Utils;
@@ -66,6 +67,10 @@ public class BatteryService extends ProfileService {

    private BroadcastReceiver mBondStateChangedReceiver;

    public static boolean isEnabled() {
        return BluetoothProperties.isProfileBasClientEnabled().orElse(false);
    }

    @Override
    protected IProfileServiceBinder initBinder() {
        return new BluetoothBatteryBinder(this);
+5 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.os.Message;
import android.os.ParcelUuid;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.sysprop.BluetoothProperties;
import android.util.Log;

import com.android.bluetooth.Utils;
@@ -85,6 +86,10 @@ public class BassClientService extends ProfileService {
    private ScanCallback mSearchScanCallback;
    private Callbacks mCallbacks;

    public static boolean isEnabled() {
        return BluetoothProperties.isProfileBapBroadcastAssistEnabled().orElse(false);
    }

    void updatePeriodicAdvertisementResultMap(
            BluetoothDevice device,
            int addressType,
+1 −1
Original line number Diff line number Diff line
@@ -4609,7 +4609,7 @@ public class AdapterService extends Service {
     * @return true, if the LE audio broadcast source is supported
     */
    public boolean isLeAudioBroadcastSourceSupported() {
        return  getResources().getBoolean(R.bool.profile_supported_le_audio_broadcast)
        return  BluetoothProperties.isProfileBapBroadcastSourceEnabled().orElse(false)
                && mAdapterProperties.isLePeriodicAdvertisingSupported()
                && mAdapterProperties.isLeExtendedAdvertisingSupported()
                && mAdapterProperties.isLeIsochronousBroadcasterSupported();
Loading