Loading android/app/AndroidManifest.xml +34 −33 Original line number Diff line number Diff line Loading @@ -122,6 +122,39 @@ </intent-filter> </service> <!-- Audio/Video Remote Control Profile (AVRCP) controller Profile Service and owned Services, Providers and Activiies --> <service android:process="@string/process" android:name="com.android.bluetooth.avrcpcontroller.AvrcpControllerService" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.bluetooth.IBluetoothAvrcpController"/> </intent-filter> </service> <service android:process="@string/process" android:name="com.android.bluetooth.avrcpcontroller.BluetoothMediaBrowserService" android:enabled="true" android:exported="true" android:label="@string/a2dp_sink_mbs_label"> <intent-filter> <action android:name="android.media.browse.MediaBrowserService"/> </intent-filter> </service> <provider android:process="@string/process" android:name="com.android.bluetooth.avrcpcontroller.AvrcpCoverArtProvider" android:authorities="com.android.bluetooth.avrcpcontroller.AvrcpCoverArtProvider" android:enabled="false" android:grantUriPermissions="true" android:exported="true"> </provider> <activity android:name="com.android.bluetooth.BluetoothPrefs" android:exported="true" android:enabled="false"> <intent-filter> <action android:name="android.intent.action.APPLICATION_PREFERENCES"/> </intent-filter> </activity> <provider android:name=".opp.BluetoothOppProvider" android:authorities="com.android.bluetooth.opp" android:exported="true" Loading Loading @@ -331,39 +364,7 @@ </intent-filter> </service> <service android:process="@string/process" android:name=".avrcpcontroller.BluetoothMediaBrowserService" android:exported="true" android:enabled="@bool/profile_supported_a2dp_sink" android:label="@string/a2dp_sink_mbs_label"> <intent-filter> <action android:name="android.media.browse.MediaBrowserService"/> </intent-filter> </service> <activity android:name="com.android.bluetooth.BluetoothPrefs" android:exported="@bool/profile_supported_a2dp_sink" android:enabled="@bool/profile_supported_a2dp_sink"> <intent-filter> <action android:name="android.intent.action.APPLICATION_PREFERENCES"/> </intent-filter> </activity> <service android:process="@string/process" android:name="com.android.bluetooth.avrcpcontroller.AvrcpControllerService" android:enabled="@bool/profile_supported_avrcp_controller" android:exported="true"> <intent-filter> <action android:name="android.bluetooth.IBluetoothAvrcpController"/> </intent-filter> </service> <provider android:process="@string/process" android:name="com.android.bluetooth.avrcpcontroller.AvrcpCoverArtProvider" android:authorities="com.android.bluetooth.avrcpcontroller.AvrcpCoverArtProvider" android:enabled="@bool/avrcp_controller_enable_cover_art" android:grantUriPermissions="true" android:exported="true"> </provider> <service android:process="@string/process" android:name="com.android.bluetooth.hid.HidHostService" android:name=".hid.HidHostService" android:enabled="@bool/profile_supported_hid_host" android:exported="true"> <intent-filter> Loading android/app/res/values/config.xml +0 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ <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> <bool name="profile_supported_avrcp_controller">false</bool> <bool name="profile_supported_sap">false</bool> <bool name="profile_supported_pbapclient">false</bool> <bool name="profile_supported_mapmce">false</bool> Loading android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerService.java +18 −0 Original line number Diff line number Diff line Loading @@ -23,11 +23,14 @@ import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.bluetooth.IBluetoothAvrcpController; import android.content.AttributionSource; import android.content.ComponentName; import android.content.Intent; import android.support.v4.media.MediaBrowserCompat.MediaItem; import android.support.v4.media.session.PlaybackStateCompat; import android.sysprop.BluetoothProperties; import android.util.Log; import com.android.bluetooth.BluetoothPrefs; import com.android.bluetooth.R; import com.android.bluetooth.Utils; import com.android.bluetooth.a2dpsink.A2dpSinkService; Loading @@ -51,6 +54,13 @@ public class AvrcpControllerService extends ProfileService { static final boolean DBG = Log.isLoggable(TAG, Log.DEBUG); static final boolean VDBG = Log.isLoggable(TAG, Log.VERBOSE); /** * Owned Components */ private static final String ON_ERROR_SETTINGS_ACTIVITY = BluetoothPrefs.class.getCanonicalName(); private static final String COVER_ART_PROVIDER = AvrcpCoverArtProvider.class.getCanonicalName(); /* * Play State Values from JNI */ Loading Loading @@ -132,12 +142,18 @@ public class AvrcpControllerService extends ProfileService { classInitNative(); } public static boolean isEnabled() { return BluetoothProperties.isProfileAvrcpControllerEnabled().orElse(false); } @Override protected synchronized boolean start() { initNative(); setComponentAvailable(ON_ERROR_SETTINGS_ACTIVITY, true); mAdapterService = AdapterService.getAdapterService(); mCoverArtEnabled = getResources().getBoolean(R.bool.avrcp_controller_enable_cover_art); if (mCoverArtEnabled) { setComponentAvailable(COVER_ART_PROVIDER, true); mCoverArtManager = new AvrcpCoverArtManager(this, new ImageDownloadCallback()); } sBrowseTree = new BrowseTree(null); Loading @@ -164,7 +180,9 @@ public class AvrcpControllerService extends ProfileService { if (mCoverArtManager != null) { mCoverArtManager.cleanup(); mCoverArtManager = null; setComponentAvailable(COVER_ART_PROVIDER, false); } setComponentAvailable(ON_ERROR_SETTINGS_ACTIVITY, false); return true; } Loading android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceTest.java +2 −3 Original line number Diff line number Diff line Loading @@ -55,8 +55,7 @@ public class AvrcpControllerServiceTest { public void setUp() throws Exception { mTargetContext = InstrumentationRegistry.getTargetContext(); Assume.assumeTrue("Ignore test when AvrcpControllerService is not enabled", mTargetContext.getResources() .getBoolean(R.bool.profile_supported_avrcp_controller)); AvrcpControllerService.isEnabled()); MockitoAnnotations.initMocks(this); TestUtils.setAdapterService(mAdapterService); doReturn(true, false).when(mAdapterService).isStartedProfile(anyString()); Loading @@ -70,7 +69,7 @@ public class AvrcpControllerServiceTest { @After public void tearDown() throws Exception { if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_avrcp_controller)) { if (!AvrcpControllerService.isEnabled()) { return; } TestUtils.stopService(mServiceRule, AvrcpControllerService.class); Loading android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java +2 −6 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ import android.support.v4.media.session.MediaSessionCompat; import android.support.v4.media.session.PlaybackStateCompat; import android.util.SparseArray; import androidx.test.InstrumentationRegistry; import androidx.test.filters.FlakyTest; import androidx.test.filters.MediumTest; import androidx.test.rule.ServiceTestRule; Loading Loading @@ -72,7 +71,6 @@ public class AvrcpControllerStateMachineTest { private static final int KEY_UP = 1; private BluetoothAdapter mAdapter; private Context mTargetContext; @Rule public final ServiceTestRule mAvrcpServiceRule = new ServiceTestRule(); @Rule public final ServiceTestRule mA2dpServiceRule = new ServiceTestRule(); Loading @@ -92,10 +90,8 @@ public class AvrcpControllerStateMachineTest { @Before public void setUp() throws Exception { mTargetContext = InstrumentationRegistry.getTargetContext(); Assume.assumeTrue("Ignore test when AVRCP Controller is not enabled", mTargetContext.getResources().getBoolean( R.bool.profile_supported_avrcp_controller)); AvrcpControllerService.isEnabled()); if (Looper.myLooper() == null) { Looper.prepare(); } Loading Loading @@ -145,7 +141,7 @@ public class AvrcpControllerStateMachineTest { @After public void tearDown() throws Exception { if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_avrcp_controller)) { if (!AvrcpControllerService.isEnabled()) { return; } destroyStateMachine(mAvrcpStateMachine); Loading Loading
android/app/AndroidManifest.xml +34 −33 Original line number Diff line number Diff line Loading @@ -122,6 +122,39 @@ </intent-filter> </service> <!-- Audio/Video Remote Control Profile (AVRCP) controller Profile Service and owned Services, Providers and Activiies --> <service android:process="@string/process" android:name="com.android.bluetooth.avrcpcontroller.AvrcpControllerService" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.bluetooth.IBluetoothAvrcpController"/> </intent-filter> </service> <service android:process="@string/process" android:name="com.android.bluetooth.avrcpcontroller.BluetoothMediaBrowserService" android:enabled="true" android:exported="true" android:label="@string/a2dp_sink_mbs_label"> <intent-filter> <action android:name="android.media.browse.MediaBrowserService"/> </intent-filter> </service> <provider android:process="@string/process" android:name="com.android.bluetooth.avrcpcontroller.AvrcpCoverArtProvider" android:authorities="com.android.bluetooth.avrcpcontroller.AvrcpCoverArtProvider" android:enabled="false" android:grantUriPermissions="true" android:exported="true"> </provider> <activity android:name="com.android.bluetooth.BluetoothPrefs" android:exported="true" android:enabled="false"> <intent-filter> <action android:name="android.intent.action.APPLICATION_PREFERENCES"/> </intent-filter> </activity> <provider android:name=".opp.BluetoothOppProvider" android:authorities="com.android.bluetooth.opp" android:exported="true" Loading Loading @@ -331,39 +364,7 @@ </intent-filter> </service> <service android:process="@string/process" android:name=".avrcpcontroller.BluetoothMediaBrowserService" android:exported="true" android:enabled="@bool/profile_supported_a2dp_sink" android:label="@string/a2dp_sink_mbs_label"> <intent-filter> <action android:name="android.media.browse.MediaBrowserService"/> </intent-filter> </service> <activity android:name="com.android.bluetooth.BluetoothPrefs" android:exported="@bool/profile_supported_a2dp_sink" android:enabled="@bool/profile_supported_a2dp_sink"> <intent-filter> <action android:name="android.intent.action.APPLICATION_PREFERENCES"/> </intent-filter> </activity> <service android:process="@string/process" android:name="com.android.bluetooth.avrcpcontroller.AvrcpControllerService" android:enabled="@bool/profile_supported_avrcp_controller" android:exported="true"> <intent-filter> <action android:name="android.bluetooth.IBluetoothAvrcpController"/> </intent-filter> </service> <provider android:process="@string/process" android:name="com.android.bluetooth.avrcpcontroller.AvrcpCoverArtProvider" android:authorities="com.android.bluetooth.avrcpcontroller.AvrcpCoverArtProvider" android:enabled="@bool/avrcp_controller_enable_cover_art" android:grantUriPermissions="true" android:exported="true"> </provider> <service android:process="@string/process" android:name="com.android.bluetooth.hid.HidHostService" android:name=".hid.HidHostService" android:enabled="@bool/profile_supported_hid_host" android:exported="true"> <intent-filter> Loading
android/app/res/values/config.xml +0 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ <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> <bool name="profile_supported_avrcp_controller">false</bool> <bool name="profile_supported_sap">false</bool> <bool name="profile_supported_pbapclient">false</bool> <bool name="profile_supported_mapmce">false</bool> Loading
android/app/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerService.java +18 −0 Original line number Diff line number Diff line Loading @@ -23,11 +23,14 @@ import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.bluetooth.IBluetoothAvrcpController; import android.content.AttributionSource; import android.content.ComponentName; import android.content.Intent; import android.support.v4.media.MediaBrowserCompat.MediaItem; import android.support.v4.media.session.PlaybackStateCompat; import android.sysprop.BluetoothProperties; import android.util.Log; import com.android.bluetooth.BluetoothPrefs; import com.android.bluetooth.R; import com.android.bluetooth.Utils; import com.android.bluetooth.a2dpsink.A2dpSinkService; Loading @@ -51,6 +54,13 @@ public class AvrcpControllerService extends ProfileService { static final boolean DBG = Log.isLoggable(TAG, Log.DEBUG); static final boolean VDBG = Log.isLoggable(TAG, Log.VERBOSE); /** * Owned Components */ private static final String ON_ERROR_SETTINGS_ACTIVITY = BluetoothPrefs.class.getCanonicalName(); private static final String COVER_ART_PROVIDER = AvrcpCoverArtProvider.class.getCanonicalName(); /* * Play State Values from JNI */ Loading Loading @@ -132,12 +142,18 @@ public class AvrcpControllerService extends ProfileService { classInitNative(); } public static boolean isEnabled() { return BluetoothProperties.isProfileAvrcpControllerEnabled().orElse(false); } @Override protected synchronized boolean start() { initNative(); setComponentAvailable(ON_ERROR_SETTINGS_ACTIVITY, true); mAdapterService = AdapterService.getAdapterService(); mCoverArtEnabled = getResources().getBoolean(R.bool.avrcp_controller_enable_cover_art); if (mCoverArtEnabled) { setComponentAvailable(COVER_ART_PROVIDER, true); mCoverArtManager = new AvrcpCoverArtManager(this, new ImageDownloadCallback()); } sBrowseTree = new BrowseTree(null); Loading @@ -164,7 +180,9 @@ public class AvrcpControllerService extends ProfileService { if (mCoverArtManager != null) { mCoverArtManager.cleanup(); mCoverArtManager = null; setComponentAvailable(COVER_ART_PROVIDER, false); } setComponentAvailable(ON_ERROR_SETTINGS_ACTIVITY, false); return true; } Loading
android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceTest.java +2 −3 Original line number Diff line number Diff line Loading @@ -55,8 +55,7 @@ public class AvrcpControllerServiceTest { public void setUp() throws Exception { mTargetContext = InstrumentationRegistry.getTargetContext(); Assume.assumeTrue("Ignore test when AvrcpControllerService is not enabled", mTargetContext.getResources() .getBoolean(R.bool.profile_supported_avrcp_controller)); AvrcpControllerService.isEnabled()); MockitoAnnotations.initMocks(this); TestUtils.setAdapterService(mAdapterService); doReturn(true, false).when(mAdapterService).isStartedProfile(anyString()); Loading @@ -70,7 +69,7 @@ public class AvrcpControllerServiceTest { @After public void tearDown() throws Exception { if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_avrcp_controller)) { if (!AvrcpControllerService.isEnabled()) { return; } TestUtils.stopService(mServiceRule, AvrcpControllerService.class); Loading
android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java +2 −6 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ import android.support.v4.media.session.MediaSessionCompat; import android.support.v4.media.session.PlaybackStateCompat; import android.util.SparseArray; import androidx.test.InstrumentationRegistry; import androidx.test.filters.FlakyTest; import androidx.test.filters.MediumTest; import androidx.test.rule.ServiceTestRule; Loading Loading @@ -72,7 +71,6 @@ public class AvrcpControllerStateMachineTest { private static final int KEY_UP = 1; private BluetoothAdapter mAdapter; private Context mTargetContext; @Rule public final ServiceTestRule mAvrcpServiceRule = new ServiceTestRule(); @Rule public final ServiceTestRule mA2dpServiceRule = new ServiceTestRule(); Loading @@ -92,10 +90,8 @@ public class AvrcpControllerStateMachineTest { @Before public void setUp() throws Exception { mTargetContext = InstrumentationRegistry.getTargetContext(); Assume.assumeTrue("Ignore test when AVRCP Controller is not enabled", mTargetContext.getResources().getBoolean( R.bool.profile_supported_avrcp_controller)); AvrcpControllerService.isEnabled()); if (Looper.myLooper() == null) { Looper.prepare(); } Loading Loading @@ -145,7 +141,7 @@ public class AvrcpControllerStateMachineTest { @After public void tearDown() throws Exception { if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_avrcp_controller)) { if (!AvrcpControllerService.isEnabled()) { return; } destroyStateMachine(mAvrcpStateMachine); Loading