Skip to content

Commit 49d2009

Browse files
Prevent sending GetSystemCapability for DISPLAYS
1 parent adfd593 commit 49d2009

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

base/src/main/java/com/smartdevicelink/proxy/SystemCapabilityManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ public void onReceived(RPCMessage message) {
312312
// this notification can return only affected windows (hence not all windows)
313313
List<DisplayCapability> newCapabilities = (List<DisplayCapability>) capability;
314314
updateCachedDisplayCapabilityList(newCapabilities);
315+
systemCapabilitiesSubscriptionStatus.put(SystemCapabilityType.DISPLAYS, true);
315316
}
316317
}
317318
if (capability != null) {
@@ -527,7 +528,7 @@ public boolean removeOnSystemCapabilityListener(final SystemCapabilityType syste
527528
&& onSystemCapabilityListeners.get(systemCapabilityType) != null) {
528529
success = onSystemCapabilityListeners.get(systemCapabilityType).remove(listener);
529530
// If the last listener for the supplied capability type is removed, unsubscribe from the capability type
530-
if (success && onSystemCapabilityListeners.get(systemCapabilityType).isEmpty() && isSubscribedToSystemCapability(systemCapabilityType)) {
531+
if (success && onSystemCapabilityListeners.get(systemCapabilityType).isEmpty() && isSubscribedToSystemCapability(systemCapabilityType) && systemCapabilityType != SystemCapabilityType.DISPLAYS) {
531532
retrieveCapability(systemCapabilityType, null, false);
532533
}
533534
}
@@ -540,7 +541,7 @@ public boolean removeOnSystemCapabilityListener(final SystemCapabilityType syste
540541
* @param subscribe flag to subscribe to updates of the supplied capability type. True means subscribe; false means cancel subscription; null means don't change current subscription status.
541542
*/
542543
private void retrieveCapability(final SystemCapabilityType systemCapabilityType, final OnSystemCapabilityListener scListener, final Boolean subscribe) {
543-
if (!systemCapabilityType.isQueryable()) {
544+
if (!systemCapabilityType.isQueryable() || systemCapabilityType == SystemCapabilityType.DISPLAYS) {
544545
String message = "This systemCapabilityType cannot be queried for";
545546
DebugTool.logError(message);
546547
if (scListener != null) {

0 commit comments

Comments
 (0)