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

Commit 1b3e4c86 authored by Sal Savage's avatar Sal Savage
Browse files

Migrate SAP server enable/disable to sysprops

Tag: #refactor
Bug: 217448211
Test: atest BluetoothInstrumentationTests
Merged-In: Id4e3b781584bb63eada2254c0f51f5469d262ae7
Change-Id: Id4e3b781584bb63eada2254c0f51f5469d262ae7
parent deb783eb
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -363,6 +363,16 @@
                 android:resource="@xml/authenticator"/>
        </service>

        <!--  SIM Access Profile (SAP) server Profile Service -->
        <service android:process="@string/process"
             android:name="com.android.bluetooth.sap.SapService"
             android:enabled="true"
             android:exported="true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothSap"/>
            </intent-filter>
        </service>

        <!--  Telephony Bearer Service (TBS) server Profile Service  -->
        <service
            android:process="@string/process"
@@ -521,14 +531,6 @@
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <service android:process="@string/process"
             android:name=".sap.SapService"
             android:enabled="@bool/profile_supported_sap"
             android:exported="true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothSap"/>
            </intent-filter>
        </service>
        <service android:process="@string/process"
             android:name=".hfp.HeadsetService"
             android:enabled="@bool/profile_supported_hs_hfp"
+0 −1
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@
    <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>
    <bool name="profile_supported_sap">false</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
+4 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.os.Handler;
import android.os.Message;
import android.os.ParcelUuid;
import android.os.PowerManager;
import android.sysprop.BluetoothProperties;
import android.text.TextUtils;
import android.util.Log;

@@ -102,6 +103,9 @@ public class SapService extends ProfileService {
            BluetoothUuid.SAP,
    };

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

    public SapService() {
        mState = BluetoothSap.STATE_DISCONNECTED;
+2 −2
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ public class SapServiceTest {
    public void setUp() throws Exception {
        mTargetContext = InstrumentationRegistry.getTargetContext();
        Assume.assumeTrue("Ignore test when SapService is not enabled",
                mTargetContext.getResources().getBoolean(R.bool.profile_supported_sap));
                SapService.isEnabled());
        MockitoAnnotations.initMocks(this);
        TestUtils.setAdapterService(mAdapterService);
        doReturn(true, false).when(mAdapterService).isStartedProfile(anyString());
@@ -69,7 +69,7 @@ public class SapServiceTest {

    @After
    public void tearDown() throws Exception {
        if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_sap)) {
        if (!SapService.isEnabled()) {
            return;
        }
        TestUtils.stopService(mServiceRule, SapService.class);