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

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

Migrate A2DP Sink enable/disable to sysprops am: 7b185e47

parents 4f662030 7b185e47
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -104,6 +104,16 @@
            </intent-filter>
        </service>

        <!--  Advanced Audio Distribution Profile (A2DP) sink Profile Service  -->
        <service android:process="@string/process"
             android:name="com.android.bluetooth.a2dpsink.A2dpSinkService"
             android:enabled="true"
             android:exported="true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothA2dpSink"/>
            </intent-filter>
        </service>

        <provider android:name=".opp.BluetoothOppProvider"
             android:authorities="com.android.bluetooth.opp"
             android:exported="true"
@@ -310,14 +320,6 @@
                <action android:name="android.bluetooth.IBluetoothHeadset"/>
            </intent-filter>
        </service>
        <service android:process="@string/process"
             android:name=".a2dpsink.A2dpSinkService"
             android:enabled="@bool/profile_supported_a2dp_sink"
             android:exported="true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothA2dpSink"/>
            </intent-filter>
        </service>
        <service android:process="@string/process"
             android:name=".avrcpcontroller.BluetoothMediaBrowserService"
             android:exported="true"
+0 −1
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@
   limitations under the License.
-->
<resources>
    <bool name="profile_supported_a2dp_sink">false</bool>
    <bool name="profile_supported_hs_hfp">true</bool>
    <bool name="profile_supported_hfpclient">false</bool>
    <bool name="profile_supported_hfp_incallservice">true</bool>
+5 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.bluetooth.BluetoothProfile;
import android.bluetooth.IBluetoothA2dpSink;
import android.content.AttributionSource;
import android.media.AudioManager;
import android.sysprop.BluetoothProperties;
import android.util.Log;

import com.android.bluetooth.Utils;
@@ -63,6 +64,10 @@ public class A2dpSinkService extends ProfileService {

    A2dpSinkNativeInterface mNativeInterface;

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

    @Override
    protected boolean start() {
        mAdapterService = Objects.requireNonNull(AdapterService.getAdapterService(),
+2 −2
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public class A2dpSinkServiceTest {
    public void setUp() throws Exception {
        mTargetContext = InstrumentationRegistry.getTargetContext();
        Assume.assumeTrue("Ignore test when A2dpSinkService is not enabled",
                mTargetContext.getResources().getBoolean(R.bool.profile_supported_a2dp_sink));
                A2dpSinkService.isEnabled());
        MockitoAnnotations.initMocks(this);

        mAdapter = BluetoothAdapter.getDefaultAdapter();
@@ -110,7 +110,7 @@ public class A2dpSinkServiceTest {

    @After
    public void tearDown() throws Exception {
        if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_a2dp_sink)) {
        if (!A2dpSinkService.isEnabled()) {
            return;
        }
        TestUtils.stopService(mServiceRule, A2dpSinkService.class);
+2 −2
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ public class A2dpSinkStateMachineTest {
    public void setUp() throws Exception {
        mTargetContext = InstrumentationRegistry.getTargetContext();
        Assume.assumeTrue("Ignore test when A2dpSinkService is not enabled",
                mTargetContext.getResources().getBoolean(R.bool.profile_supported_a2dp_sink));
                A2dpSinkService.isEnabled());
        MockitoAnnotations.initMocks(this);

        mAdapter = BluetoothAdapter.getDefaultAdapter();
@@ -82,7 +82,7 @@ public class A2dpSinkStateMachineTest {

    @After
    public void tearDown() throws Exception {
        if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_a2dp_sink)) {
        if (!A2dpSinkService.isEnabled()) {
            return;
        }
        mStateMachine = null;
Loading