AVRCP: Disallow MBS Connect to players during BT On
Simultaneous MBS connections to all players leading
to binder connect & player launch leading to player
start-up launch resulting cost memory hence system
performance. Now for creating the list of Browsable
players rely on browse white-list.
CRs-Fixed: 2597375
Change-Id: I5e5921f68b676d5e2233bf5474d248a6488c90ac
diff --git a/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java b/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java
index 4e4268e..7c556bb 100644
--- a/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java
+++ b/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java
@@ -2805,23 +2805,6 @@
return playStatus;
}
- private boolean isPlayerInBrowseList() {
- MediaPlayerInfo_ext info = getAddressedPlayerInfo();
- String pkgName = (info != null) ? info.getPackageName():"";
- if (pkgName == null || pkgName.isEmpty())
- return false;
-
- BrowsedMediaPlayer_ext player =
- mAvrcpBrowseManager.getBrowsedMediaPlayer(dummyaddr);
- String browseService = (pkgName != null)?getBrowseServiceName(pkgName):null;
- if (player == null || browseService == null || browseService.isEmpty())
- return false;
-
- boolean isBrowseSupported = player.isPackageInMBSList(pkgName);
- Log.d(TAG, "Browse supported for pkg " + pkgName + " is " + isBrowseSupported);
- return isBrowseSupported;
- }
-
private boolean isPlayingState(@Nullable PlaybackState state) {
if (state == null) return false;
return (state != null) && (state.getState() == PlaybackState.STATE_PLAYING);
@@ -3300,7 +3283,6 @@
private void SetBrowsePackage(String PackageName) {
String browseService = (PackageName != null)?getBrowseServiceName(PackageName):null;
- BrowsedMediaPlayer_ext player = mAvrcpBrowseManager.getBrowsedMediaPlayer(dummyaddr);
Log.w(TAG, "SetBrowsePackage for pkg " + PackageName + "svc" + browseService);
if (browseService != null && !browseService.isEmpty()) {
BluetoothDevice browse_active_device = mBrowsingActiveDevice;
@@ -3311,11 +3293,6 @@
Log.w(TAG, "Addr Player update to Browse " + PackageName);
mAvrcpBrowseManager.getBrowsedMediaPlayer(addr).
setCurrentPackage(PackageName, browseService);
- if (player != null && !mPkgRequestedMBSConnect.contains(PackageName)) {
- Log.w(TAG,"checkMBSConnection try connect");
- player.CheckMBSConnection(PackageName, browseService);
- mPkgRequestedMBSConnect.add(PackageName);
- }
}
} else {
Log.w(TAG, "SetBrowsePackage Active device not set yet cache " + PackageName +
@@ -3999,9 +3976,7 @@
synchronized (this) {
synchronized (mBrowsePlayerInfoList) {
mBrowsePlayerInfoList.clear();
- BrowsedMediaPlayer_ext player =
- mAvrcpBrowseManager.getBrowsedMediaPlayer(dummyaddr);
- Log.d(TAG, "buildBrowsablePlayerList " + player);
+ Log.d(TAG, "buildBrowsablePlayerList ");
Intent intent = new Intent(android.service.media.MediaBrowserService.SERVICE_INTERFACE);
List<ResolveInfo> playerList =
mPackageManager.queryIntentServices(intent, PackageManager.MATCH_ALL);
@@ -4015,9 +3990,6 @@
String serviceName = info.serviceInfo.name;
String packageName = info.serviceInfo.packageName;
Log.d(TAG, "svc " + serviceName + " and pkg = " + packageName);
- if ((player != null) && (serviceName != null)) {
- player.CheckMBSConnection(packageName, serviceName);
- }
BrowsePlayerInfo_ext currentPlayer =
new BrowsePlayerInfo_ext(packageName, displayableName, serviceName);
mBrowsePlayerInfoList.add(currentPlayer);