Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Old devices with SDL 2.0 can't display text fields and SoftButtons #1729

Closed
peterkomar opened this issue Sep 13, 2021 · 4 comments
Closed

Old devices with SDL 2.0 can't display text fields and SoftButtons #1729

peterkomar opened this issue Sep 13, 2021 · 4 comments
Labels
bug A defect in the library

Comments

@peterkomar
Copy link

peterkomar commented Sep 13, 2021

Bug Report

On head units with SDL Core 2.0, displaying text fields and SoftButtons doesn't work if use sdl_android 5.2.0.

For older sdl_android 5.1.0 everything works fine.

OS & Version Information
  • Android Version: 9
  • SDL Android Version: 5.2.0
Test Case, Sample Code, and / or Example App
SoftButtonState textState = new SoftButtonState("statusTire", "Status", null);
        SoftButtonObject softButtonObject = new SoftButtonObject("softButtonObject", Collections.singletonList(textState), textState.getName(), new SoftButtonObject.OnEventListener() {
            @Override
            public void onPress(SoftButtonObject softButtonObject, OnButtonPress onButtonPress) {
                Messages.info("Click on Status button");
                sdlService.updateMessagesLog();
            }

            @Override
            public void onEvent(SoftButtonObject softButtonObject, OnButtonEvent onButtonEvent) {
                Messages.info("OnButton event triggered");
                sdlService.updateMessagesLog();

            }
        });

        SoftButtonState pressureState = new SoftButtonState("pressureTire", "Pressure", null);
        SoftButtonObject pressureButtonObject = new SoftButtonObject(
                "pressButtonObject",
                Collections.singletonList(pressureState),
                pressureState.getName(),
                new SoftButtonObject.OnEventListener() {
                    @Override
                    public void onPress(SoftButtonObject softButtonObject, OnButtonPress onButtonPress) {
                        Messages.info("Click on Pressure button");

                        sdlService.updateMessagesLog();
                    }

                    @Override
                    public void onEvent(SoftButtonObject softButtonObject, OnButtonEvent onButtonEvent) {
                        Messages.info("OnButton pressure event triggered");
                        sdlService.updateMessagesLog();

                    }
                });


        sdlManager.getScreenManager().beginTransaction();
        sdlManager.getScreenManager().setTextField1("Text Field 1");
        sdlManager.getScreenManager().setTextField2("Text Field 2");
        sdlManager.getScreenManager().setTextField3("Text Field 3");
        sdlManager.getScreenManager().setTextField4("Text Field 4");
        sdlManager.getScreenManager().setMediaTrackTextField("Media Track Field");
        sdlManager.getScreenManager().setSoftButtonObjects(Arrays.asList(softButtonObject, pressureButtonObject));
        sdlManager.getScreenManager().commit(success -> {
            if (success) {
                Messages.info("DEFAULT OK");
            } else {
                Messages.info("DEFAULT Fail");
            }
            sdlService.updateMessagesLog();
        });
@joeljfischer
Copy link
Contributor

Can you clarify your problem? Are you are connecting to a head unit running an SDL Core 2.0? Or are you using sdl_android 2.0 and seeing this problem?

@peterkomar
Copy link
Author

I am connecting to the head unit running an SDL Core 2.0 and using sdl_android 5.2.0

@JulianKast
Copy link
Contributor

I discovered the issue to be an NPE from #1706 that was added in 5.2.0. Logs :

2021-09-17 10:45:52.267 18430-18430/com.sdl.hellosdlandroid E/SdlProtocol: 5.2.0: Failure propagating onProtocolMessageReceived: java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference
    java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference
        at com.smartdevicelink.managers.lifecycle.BaseSystemCapabilityManager.createDisplayCapabilityList(BaseSystemCapabilityManager.java:138)
        at com.smartdevicelink.managers.lifecycle.BaseSystemCapabilityManager.createDisplayCapabilityList(BaseSystemCapabilityManager.java:100)
        at com.smartdevicelink.managers.lifecycle.BaseSystemCapabilityManager.parseRAIResponse(BaseSystemCapabilityManager.java:260)
        at com.smartdevicelink.managers.lifecycle.BaseLifecycleManager$3.onReceived(BaseLifecycleManager.java:420)
        at com.smartdevicelink.managers.lifecycle.BaseLifecycleManager.onRPCReceived(BaseLifecycleManager.java:533)
        at com.smartdevicelink.managers.lifecycle.BaseLifecycleManager.access$700(BaseLifecycleManager.java:104)
        at com.smartdevicelink.managers.lifecycle.BaseLifecycleManager$4.onRPCMessageReceived(BaseLifecycleManager.java:908)
        at com.smartdevicelink.session.BaseSdlSession.onProtocolMessageReceived(BaseSdlSession.java:312)
        at com.smartdevicelink.protocol.SdlProtocolBase$MessageFrameAssembler.notifyIfFinished(SdlProtocolBase.java:1385)
        at com.smartdevicelink.protocol.SdlProtocolBase$MessageFrameAssembler.handleRemainingFrame(SdlProtocolBase.java:1354)
        at com.smartdevicelink.protocol.SdlProtocolBase$MessageFrameAssembler.handleMultiFrameMessageFrame(SdlProtocolBase.java:1399)
        at com.smartdevicelink.protocol.SdlProtocolBase$MessageFrameAssembler.handleFrame(SdlProtocolBase.java:1430)
        at com.smartdevicelink.protocol.SdlProtocolBase.handlePacketReceived(SdlProtocolBase.java:719)
        at com.smartdevicelink.protocol.SdlProtocolBase$2.onPacketReceived(SdlProtocolBase.java:1191)
        at com.smartdevicelink.transport.TransportManager$TransportBrokerImpl.onPacketReceived(TransportManager.java:379)
        at com.smartdevicelink.transport.TransportBroker$ClientHandler.handleMessage(TransportBroker.java:281)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7664)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Working on fixing it now, the issue should be fixed for the upcoming release 5.3.0

@jordynmackool jordynmackool added the bug A defect in the library label Sep 24, 2021
@bilal-alsharifi
Copy link
Contributor

The issue got fixed in this PR #1734

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A defect in the library
Projects
None yet
Development

No branches or pull requests

5 participants