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

Commit 21111f72 authored by Sal Savage's avatar Sal Savage
Browse files

Migrate PAN profile enable/disable to sysprops

Tag: #refactor
Bug: 217448211
Test: atest BluetoothInstrumentationTests
Merged-In: I6c25026a5d41640d24736a867eec61793346dbcf
Change-Id: I6c25026a5d41640d24736a867eec61793346dbcf
parent cbb3c5da
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -315,6 +315,17 @@
            </intent-filter>
        </service>

        <!--  Personal Area Network (PAN) Profile Service  -->
        <service
             android:process="@string/process"
             android:name="com.android.bluetooth.pan.PanService"
             android:enabled="true"
             android:exported="true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothPan"/>
            </intent-filter>
        </service>

        <!--  Telephony Bearer Service (TBS) server Profile Service  -->
        <service
            android:process="@string/process"
@@ -504,15 +515,6 @@
                <action android:name="android.bluetooth.IBluetoothHeadset"/>
            </intent-filter>
        </service>
        <service
             android:process="@string/process"
             android:name=".pan.PanService"
             android:enabled="@bool/profile_supported_pan"
             android:exported="true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothPan"/>
            </intent-filter>
        </service>
        <service android:process="@string/process"
             android:name=".pbapclient.PbapClientService"
             android:enabled="@bool/profile_supported_pbapclient"
+0 −1
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
    <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="profile_supported_pan">true</bool>
    <bool name="profile_supported_pbap">true</bool>
    <bool name="pbap_include_photos_in_vcard">true</bool>
    <bool name="pbap_use_profile_for_owner_vcard">true</bool>
+6 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.os.UserManager;
import android.sysprop.BluetoothProperties;
import android.util.Log;

import com.android.bluetooth.BluetoothMetricsProto;
@@ -113,6 +114,11 @@ public class PanService extends ProfileService {
        classInitNative();
    }

    public static boolean isEnabled() {
        return BluetoothProperties.isProfilePanNapEnabled().orElse(false)
                || BluetoothProperties.isProfilePanPanuEnabled().orElse(false);
    }

    @Override
    public IProfileServiceBinder initBinder() {
        return new BluetoothPanBinder(this);
+2 −2
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ public class PanServiceTest {
    public void setUp() throws Exception {
        mTargetContext = InstrumentationRegistry.getTargetContext();
        Assume.assumeTrue("Ignore test when PanService is not enabled",
                mTargetContext.getResources().getBoolean(R.bool.profile_supported_pan));
                PanService.isEnabled());
        MockitoAnnotations.initMocks(this);
        TestUtils.setAdapterService(mAdapterService);
        doReturn(mDatabaseManager).when(mAdapterService).getDatabase();
@@ -77,7 +77,7 @@ public class PanServiceTest {

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