@@ -102,7 +102,13 @@ private List<DisplayCapability> createDisplayCapabilityList(DisplayCapabilities
102102 WindowTypeCapabilities windowTypeCapabilities = new WindowTypeCapabilities (WindowType .MAIN , 1 );
103103
104104 DisplayCapability displayCapability = new DisplayCapability ();
105- displayCapability .setDisplayName (display != null ? display .getDisplayName () : display .getDisplayType ().toString ());
105+ if (display != null ){
106+ if (display .getDisplayName () != null ) {
107+ displayCapability .setDisplayName (display .getDisplayName ());
108+ } else if (display .getDisplayType () != null ) {
109+ displayCapability .setDisplayName (display .getDisplayType ().toString ());
110+ }
111+ }
106112 displayCapability .setWindowTypeSupported (Collections .singletonList (windowTypeCapabilities ));
107113
108114 // Create a window capability object for the default MAIN window
@@ -290,7 +296,9 @@ public void onReceived(RPCMessage message) {
290296 List <AppServiceCapability > appServicesCapabilitiesList = appServicesCapabilities .getAppServices ();
291297 AppServicesCapabilities cachedAppServicesCapabilities = (AppServicesCapabilities ) cachedSystemCapabilities .get (systemCapabilityType );
292298 //Update the cached app services
293- cachedAppServicesCapabilities .updateAppServices (appServicesCapabilitiesList );
299+ if (cachedAppServicesCapabilities != null ) {
300+ cachedAppServicesCapabilities .updateAppServices (appServicesCapabilitiesList );
301+ }
294302 //Set the new capability object to the updated cached capabilities
295303 capability = cachedAppServicesCapabilities ;
296304 }
@@ -353,56 +361,57 @@ private void notifyListeners(SystemCapabilityType systemCapabilityType, Object c
353361 * @return if that capability is supported with the current, connected module
354362 */
355363 public boolean isCapabilitySupported (SystemCapabilityType type ){
356- if (cachedSystemCapabilities .get (type ) != null ){
364+ if (cachedSystemCapabilities .get (type ) != null ) {
357365 //The capability exists in the map and is not null
358366 return true ;
359- }else if (cachedSystemCapabilities .containsKey (SystemCapabilityType .HMI )){
360- HMICapabilities hmiCapabilities = ((HMICapabilities )cachedSystemCapabilities .get (SystemCapabilityType .HMI ));
367+ } else if (cachedSystemCapabilities .containsKey (SystemCapabilityType .HMI )) {
368+ HMICapabilities hmiCapabilities = ((HMICapabilities ) cachedSystemCapabilities .get (SystemCapabilityType .HMI ));
361369 Version rpcVersion = null ;
362370 if (callback != null ) {
363371 SdlMsgVersion version = callback .getSdlMsgVersion ();
364- if (version != null ){
372+ if (version != null ) {
365373 rpcVersion = new Version (version .getMajorVersion (), version .getMinorVersion (), version .getPatchVersion ());
366374 }
367375 }
368- switch (type ) {
369- case NAVIGATION :
370- return hmiCapabilities .isNavigationAvailable ();
371- case PHONE_CALL :
372- return hmiCapabilities .isPhoneCallAvailable ();
373- case VIDEO_STREAMING :
374- if (rpcVersion != null ) {
375- if (rpcVersion .isBetween (new Version (3 ,0 ,0 ), new Version (4 ,4 ,0 )) >= 0 ){
376- //This was before the system capability feature was added so check if
377- // graphics are supported instead
378- DisplayCapabilities displayCapabilities = (DisplayCapabilities ) getCapability (SystemCapabilityType .DISPLAY );
379- if (displayCapabilities != null ){
380- return displayCapabilities .getGraphicSupported () != null && displayCapabilities .getGraphicSupported ();
376+ if (hmiCapabilities != null ) {
377+ switch (type ) {
378+ case NAVIGATION :
379+ return hmiCapabilities .isNavigationAvailable ();
380+ case PHONE_CALL :
381+ return hmiCapabilities .isPhoneCallAvailable ();
382+ case VIDEO_STREAMING :
383+ if (rpcVersion != null ) {
384+ if (rpcVersion .isBetween (new Version (3 , 0 , 0 ), new Version (4 , 4 , 0 )) >= 0 ) {
385+ //This was before the system capability feature was added so check if
386+ // graphics are supported instead
387+ DisplayCapabilities displayCapabilities = (DisplayCapabilities ) getCapability (SystemCapabilityType .DISPLAY );
388+ if (displayCapabilities != null ) {
389+ return displayCapabilities .getGraphicSupported () != null && displayCapabilities .getGraphicSupported ();
390+ }
381391 }
382392 }
383- }
384- return hmiCapabilities . isVideoStreamingAvailable ();
385- case REMOTE_CONTROL :
386- return hmiCapabilities . isRemoteControlAvailable ();
387- case APP_SERVICES :
388- if (rpcVersion != null ) {
389- if ( rpcVersion . getMajor () == 5 && rpcVersion . getMinor () == 1 ){
390- //This is a corner case that the param was not available in 5.1.0, but
391- //the app services feature was available.
392- return true ;
393+ return hmiCapabilities . isVideoStreamingAvailable ();
394+ case REMOTE_CONTROL :
395+ return hmiCapabilities . isRemoteControlAvailable ();
396+ case APP_SERVICES :
397+ if ( rpcVersion != null ) {
398+ if (rpcVersion . getMajor () == 5 && rpcVersion . getMinor () == 1 ) {
399+ //This is a corner case that the param was not available in 5.1.0, but
400+ //the app services feature was available.
401+ return true ;
402+ }
393403 }
394- }
395- return hmiCapabilities . isAppServicesAvailable ();
396- case DISPLAYS :
397- return hmiCapabilities . isDisplaysCapabilityAvailable ();
398- case SEAT_LOCATION :
399- return hmiCapabilities . isSeatLocationAvailable ();
400- default :
401- return false ;
404+ return hmiCapabilities . isAppServicesAvailable ();
405+ case DISPLAYS :
406+ return hmiCapabilities . isDisplaysCapabilityAvailable ();
407+ case SEAT_LOCATION :
408+ return hmiCapabilities . isSeatLocationAvailable ();
409+ default :
410+ return false ;
411+ }
402412 }
403- }else {
404- return false ;
405413 }
414+ return false ;
406415 }
407416 /**
408417 * @param systemCapabilityType Type of capability desired
0 commit comments