AVRCP: Property based Player App Settings timeout
Have property based delay calculation for response
timeout of Player Application Settings commands.
CRs-Fixed: 2567090
Change-Id: I72097ae5e26c14b507adf317d309016ad23a6060
diff --git a/packages_apps_bluetooth_ext/src/avrcp/AvrcpPlayerAppSettings.java b/packages_apps_bluetooth_ext/src/avrcp/AvrcpPlayerAppSettings.java
index 0ca60a0..baa3332 100644
--- a/packages_apps_bluetooth_ext/src/avrcp/AvrcpPlayerAppSettings.java
+++ b/packages_apps_bluetooth_ext/src/avrcp/AvrcpPlayerAppSettings.java
@@ -39,12 +39,14 @@
import java.util.List;
import java.util.Set;
import java.util.Iterator;
+import android.os.SystemProperties;
public class AvrcpPlayerAppSettings {
private static final boolean DEBUG = true;
private static final String TAG = "AvrcpPlayerAppSettings";
private boolean mIsRegisterd;
+ private long mPlayerAppSettingsCmdDelay;
private ArrayList <Integer> mPendingCmds;
private ArrayList <Integer> mPendingSetAttributes;
private ArrayList <Byte> mPlayerSettingCmds;
@@ -107,6 +109,10 @@
private final String UPDATE_ATTRIB_TEXT = "UpdateAttributesText";
private final String UPDATE_VALUE_TEXT = "UpdateValuesText";
+ // Property for response delay for Player App Settings commands
+ private static final String AVRCP_PLAYERAPP_SETTINGS_PROPERTY =
+ "persist.vendor.btstack.avrcp.playerappsettings_time";
+
//Intents for PlayerApplication Settings
private static final String PLAYERSETTINGS_REQUEST =
"org.codeaurora.music.playersettingsrequest";
@@ -119,6 +125,8 @@
mPendingCmds = null;
mPendingSetAttributes = null;
mPlayerSettingCmds = null;
+ mPlayerAppSettingsCmdDelay =
+ SystemProperties.getLong(AVRCP_PLAYERAPP_SETTINGS_PROPERTY, 100L);
mContext = context;
mAvrcpPlayerAppSettingsRspInterface = playerAppSettings;
}
@@ -523,6 +531,10 @@
return ret;
}
+ public long getPlayerAppSettingsCmdDelay() {
+ return mPlayerAppSettingsCmdDelay;
+ }
+
private byte[] getByteAddress(BluetoothDevice device) {
return Utils.getBytesFromAddress(device.getAddress());
}
diff --git a/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java b/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java
index 7378261..8f07abb 100644
--- a/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java
+++ b/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java
@@ -3265,12 +3265,13 @@
}
private void SendPlayerSettingMsg(Integer cmd, byte[] address) {
+ long delay_interval = mAvrcpPlayerAppSettings.getPlayerAppSettingsCmdDelay();
Message msg = mHandler.obtainMessage();
msg.what = MESSAGE_PLAYERSETTINGS_TIMEOUT;
msg.arg1 = cmd;
msg.arg2 = 0;
msg.obj = Utils.getAddressStringFromByte(address);
- mHandler.sendMessageDelayed(msg, 500);
+ mHandler.sendMessageDelayed(msg, delay_interval);
}
private void CreateMusicSettingsAppCmdLookupOrUpdate(Integer cmd,