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

Commit d43997f2 authored by Sal Savage's avatar Sal Savage Committed by Automerger Merge Worker
Browse files

Migrate GATT enable/disable to sysprops am: 417b0396 am: 7e63968d

parents 23e1bd2a 7e63968d
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -201,6 +201,17 @@
            </intent-filter>
        </service>

        <!--  Generic Attribute (GATT) Profile Service  -->
        <service android:process="@string/process"
             android:name="com.android.bluetooth.gatt.GattService"
             android:enabled="true"
             android:exported="true"
             android:permission="android.permission.ACCESS_BLUETOOTH_SHARE">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothGatt"/>
            </intent-filter>
        </service>

        <!--  Hearing Aid Profile (HAP) client Profile Service  -->
        <service android:process="@string/process"
             android:name="com.android.bluetooth.hap.HapClientService"
@@ -433,14 +444,6 @@
                <action android:name="android.bluetooth.IBluetoothSap"/>
            </intent-filter>
        </service>
        <service android:process="@string/process"
             android:name=".gatt.GattService"
             android:enabled="@bool/profile_supported_gatt"
             android:exported="true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothGatt"/>
            </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
@@ -20,7 +20,6 @@
    <bool name="profile_supported_opp">true</bool>
    <bool name="profile_supported_pan">true</bool>
    <bool name="profile_supported_pbap">true</bool>
    <bool name="profile_supported_gatt">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_map">true</bool>
+5 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ import android.os.UserHandle;
import android.os.WorkSource;
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.sysprop.BluetoothProperties;
import android.text.format.DateUtils;
import android.util.Log;

@@ -269,6 +270,10 @@ public class GattService extends ProfileService {
    private Handler mTestModeHandler;
    private final Object mTestModeLock = new Object();

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

    /**
     */
    private final Predicate<ScanResult> mLocationDenylistPredicate = (scanResult) -> {
+2 −3
Original line number Diff line number Diff line
@@ -40,8 +40,7 @@ public class GattServiceTest {
    @Before
    public void setUp() throws Exception {
        mTargetContext = InstrumentationRegistry.getTargetContext();
        Assume.assumeTrue("Ignore test when GattService is not enabled",
                mTargetContext.getResources().getBoolean(R.bool.profile_supported_gatt));
        Assume.assumeTrue("Ignore test when GattService is not enabled", GattService.isEnabled());
        MockitoAnnotations.initMocks(this);
        TestUtils.setAdapterService(mAdapterService);
        doReturn(true).when(mAdapterService).isStartedProfile(anyString());
@@ -52,7 +51,7 @@ public class GattServiceTest {

    @After
    public void tearDown() throws Exception {
        if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_gatt)) {
        if (!GattService.isEnabled()) {
            return;
        }
        doReturn(false).when(mAdapterService).isStartedProfile(anyString());