Interface management method and device, new energy automobile and storage medium
By managing the lifecycle of active components of the vehicle-side display screen, the display anomaly problem when the vehicle computer is connected to the smart terminal is solved, ensuring the normal display of the interface and saving resources, thereby improving user experience and safety.
Patent Information
- Application Number
- CN202511173673.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-21
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2045-08-21
AI Technical Summary
When the car computer is connected to the smart terminal, abnormal display problems often occur, such as black or gray screen, which affects the user experience and threatens driving safety.
By managing the life cycle of active components in the vehicle-side display, comparing component identifiers and deciding whether to send data stream requests based on the comparison results, maintaining or stopping data streams with smart terminals, and avoiding interface life cycle confusion.
It effectively avoids interface display abnormalities, saves vehicle system resources, and improves user experience and driving safety.
Smart Images

Figure CN120653352A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of new energy vehicle technology, and in particular to an interface management method, device, new energy vehicle, storage medium, and computer program product. Background Art
[0002] With the continuous development of smart car technology, some cars are equipped with related applications that can achieve interconnection with smart terminals such as mobile phones, thereby displaying the screen of the mobile terminal on the car-side display, allowing users to use multiple functions of the mobile terminal through the car-side display while driving. For example, users can operate the car control devices such as voice, touch screen, knobs, buttons, etc., and use the navigation or music playback functions of the mobile phone.
[0003] However, in related technologies, the interconnection between the vehicle computer and the smart terminal often encounters abnormal display problems on the vehicle side, such as a black screen, which not only affects the user experience but also poses a potential threat to driving safety. Summary of the Invention
[0004] Based on this, it is necessary to provide an interface management method, device, new energy vehicle, computer-readable storage medium and computer program product that can solve the display abnormality when the car and the mobile terminal are interconnected to address the above technical problems.
[0005] In a first aspect, the present application provides an interface management method, applied to a vehicle computer, the method comprising:
[0006] When a connection is established between the target application and the smart terminal, the interface of the smart terminal is displayed on the vehicle-side display screen; the interface displayed on the vehicle-side corresponds one-to-one with the active components in the vehicle-mounted system;
[0007] When the first interface in the vehicle-side display screen is exited, the lifecycle exit function of the first active component corresponding to the first interface is called, and the component identifier of the first active component and the latest component identifier are compared; the latest component identifier is the identifier of the latest active component; the latest active component is the active component with the latest creation time;
[0008] If the component identifier of the first active component is different from the latest component identifier, the data flow between the first active component and the smart terminal is maintained; otherwise, a request to stop the data flow is sent to the smart terminal.
[0009] According to one embodiment of the present application, the present invention further includes:
[0010] When the vehicle-side display screen calls up the second interface, a second active component corresponding to the second interface is created, and the latest component identifier is updated to the identifier corresponding to the second active component.
[0011] According to one embodiment of the present application, the step of creating a second activity component corresponding to the second interface includes:
[0012] Calling the lifecycle creation function of the second activity component to determine whether there is a data flow between the vehicle computer and the smart terminal at the current time;
[0013] If the data stream does not exist, sending a data stream request to the smart terminal;
[0014] If a data flow already exists, checking the value of a preset target variable, and if the value of the target variable is not a default value and the value of the target variable is different from the latest component identifier, sending a data flow request to the smart terminal; if the value of the target variable is a default value or the value of the target variable is the same as the latest component identifier, not sending the data flow request to the smart terminal;
[0015] The target variable is used to store the identifier of the most recent active component that requested to stop the video stream.
[0016] According to one embodiment of the present application, the method further includes:
[0017] When the component identifier of the first active component is different from the latest component identifier, sending a key frame request to the intelligent terminal;
[0018] Merging the key frame data returned by the intelligent terminal into the data stream received by the latest active component;
[0019] The merged data stream is provided to the decoder corresponding to the latest active component, and based on the decoding output of the decoder, the corresponding interface content is displayed on the vehicle-side display screen.
[0020] According to one embodiment of the present application, the method further includes:
[0021] For the latest active component, if the decoder corresponding to the latest active component has not completed initialization when receiving the data stream transmitted by the smart terminal, the data stream is stored in a preset target queue;
[0022] After the decoder is initialized, the data stream stored in the target queue is merged into the data stream currently received by the latest active component, and the merged data stream is provided to the decoder. Based on the decoding output of the decoder, the corresponding interface content is displayed on the vehicle-side display screen.
[0023] According to one embodiment of the present application, the method further includes:
[0024] When the target application is restarted and the active component corresponding to the restart interface has been created, if a stop data stream callback sent by the smart terminal is received, at least one of the following checks is performed: whether the value of a preset target variable is a default value, whether the latest component identifier is a null value, and whether the value of the target variable is the same as the latest component identifier; wherein the target variable is used to store the identifier of the active component most recently requested to stop the video stream;
[0025] If any of the check results is yes, call a close function to close the restart interface, set the latest component identifier to a null value, and set the target variable to a default value;
[0026] If all the check results are negative, the shutdown function is skipped to keep the restart interface.
[0027] According to one embodiment of the present application, the present invention further includes:
[0028] When the target application is exited and all active components corresponding to the target application are destroyed, the latest component identifier is set to a null value, and the target variable is set to a default value.
[0029] In a second aspect, an interface management device is also provided, which is applied to a vehicle computer and includes:
[0030] A connection display module is used to display the interface of the smart terminal through the vehicle-side display screen when a connection is established between the target application and the smart terminal; the interface displayed on the vehicle side corresponds one-to-one with the active components in the vehicle-mounted system;
[0031] An exit management module is configured to, when exiting the first interface on the vehicle-side display screen, call a lifecycle exit function contained in a first active component corresponding to the first interface, and compare the component identifier of the first active component with a latest component identifier; the latest component identifier is the identifier of the latest active component; and the latest active component is the active component with the latest creation time;
[0032] The data flow management module is configured to maintain the data flow with the smart terminal if the component identifier of the first active component is different from the latest component identifier; otherwise, send a request to stop the data flow to the smart terminal.
[0033] In a third aspect, a car is also provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described in any one of the above embodiments when executing the computer program.
[0034] In a fourth aspect, a computer-readable storage medium is further provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in any one of the above embodiments are implemented.
[0035] In a fifth aspect, a computer program product is also provided, comprising a computer program, which, when executed by a processor, implements the steps of the method described in any one of the above embodiments.
[0036] The above-mentioned interface management method, device, automobile, storage medium and computer program product can display the interface of the smart terminal through the vehicle-side display screen when the vehicle-side computer establishes a connection with the smart terminal based on the target application; the interface displayed on the vehicle side corresponds one-to-one with the active component in the vehicle-side computer system, and the life cycle of each interface is managed by the active component in the vehicle-side computer system; to avoid confusion in the life cycle management of each interface, when the first interface on the vehicle-side display screen exits, when the life cycle exit function contained in the first active component is called, the component identifier of the first active component and the latest component identifier are compared; if the component identifier of the first active component is different from the latest component identifier, no stop data flow request is sent to the smart terminal, that is, the data flow between the vehicle-side computer and the smart terminal is maintained to avoid the new interface content from not being displayed normally; if the component identifier of the first active component is the same as the latest component identifier, indicating that the stopped interface is a new interface, a stop data flow request is sent to the smart terminal to stop the data flow with the smart terminal, thereby promptly recovering the corresponding data transmission and processing resources. Through the above-mentioned method, it can not only avoid confusion in the interface life cycle that causes abnormal vehicle-side display interface, but also avoid waste of vehicle system resources, thereby improving user experience and driving safety. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0038] Figure 1 A schematic diagram of a process for displaying a mobile terminal interface on a vehicle side based on a target application in related technologies;
[0039] Figure 2 A flowchart of the vehicle-side exiting the target application interface;
[0040] Figure 3 A schematic diagram of the lifecycle management process of a target application interface in related technologies;
[0041] Figure 4A flowchart of a vehicle-side interface management method provided by an embodiment;
[0042] Figure 5 A flowchart of a vehicle-side interface management method provided in another embodiment;
[0043] Figure 6 A flowchart of a vehicle-side interface management method provided in yet another embodiment;
[0044] Figure 7 is a structural block diagram of an interface management device according to an embodiment;
[0045] Figure 8 2 is a structural diagram of a new energy vehicle in one embodiment. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solutions and advantages of this application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0047] Some cars are equipped with an interconnection technology that can project the functions of mobile terminals such as mobile phones onto the car's display screen. After the car computer is connected to the smart terminal based on this interconnection technology, users can operate various mobile phone functions through voice control or through car control devices such as touch screens, knobs, and buttons. For example, they can operate the navigation, audio software, and telephone conference functions on the mobile phone, allowing users to use various mobile terminal functions intelligently and safely while driving, thereby expanding the functions of the car computer. At the same time, there is no need for users to directly operate the mobile phone, thereby improving safety.
[0048] like Figure 1 The figure shows a flow chart of displaying the smart terminal interface on the vehicle side based on the target application in the related art. The display process includes: when the target application on the vehicle side is triggered, it is determined whether it is currently connected to the mobile terminal. If it cannot be connected to the mobile terminal, the display ends. If it has been successfully connected to the mobile terminal, the vehicle computer can request a UI (User Interface) from the connected mobile terminal. After receiving the request, the mobile terminal transmits a data stream including its UI interface information to the vehicle computer. The vehicle computer receives the data stream transmitted by the mobile terminal, decodes the data stream and displays it, and finally displays the interface and application information of the mobile terminal on the vehicle side display screen.
[0049] like Figure 2The figure below is a flow chart illustrating the display of the corresponding interconnection interface for exiting a target application on the vehicle side in the related art. The exit process includes: the user exits the target application on the vehicle side, the vehicle computer sends a message to the mobile terminal to stop data flow, and upon receiving the message, the mobile terminal stops sending data to the vehicle side (and exits the interconnection interface). After receiving the callback from the mobile terminal to stop data flow, the vehicle side shuts down the decoder and exits the corresponding interconnection interface.
[0050] However, after the vehicle-mounted computer and mobile terminal are connected via the target application, the vehicle-mounted display may display a black or gray screen. A black screen refers to the vehicle-mounted display being completely black and unable to display any content. A gray screen refers to the vehicle-mounted display appearing gray or off-white after connection, even though the vehicle-mounted computer system is still functioning. Whether black or gray, the abnormal display on the vehicle-mounted display can seriously affect normal user operations.
[0051] Since Activity (a system component) has excellent lifecycle management characteristics, in some implementations, Activity is used as the interface display carrier of the vehicle-side target application, that is, the activity component corresponding to the vehicle-side display interface (which can be represented as cpDisplayActivity). Furthermore, the logic of requesting UI data from the mobile terminal can be set in the lifecycle function onCreate() of the activity component cpDisplayActivity, so as to quickly obtain the data stream of the mobile terminal after the interface is called up and display the corresponding interface content; at the same time, the logic of sending a request to stop the data stream to the mobile terminal can be set in the lifecycle function onStop(), so as to stop the transmission and decoding of the data stream after the interface exits from the front end, thereby avoiding waste of system resources. In this way, the entire process from "birth" to "extinction" of the interface under the vehicle-side target application is managed through the lifecycle function of Activity.
[0052] The following is an introduction to the Activity lifecycle management functions:
[0053] onCreate() is generally called when the Activity is first created (only once) and is used to initialize the layout, bind controls, initialize data, register listeners, etc.
[0054] onStart() is generally called when the Activity changes from "invisible" to "visible". It is used to perform some lightweight operations (such as starting animations and updating UI status), but the user cannot interact at this time;
[0055] onResume() is generally called when the Activity enters the "foreground interactive" state. It is used to restore resources (such as playing videos, turning on sensors), obtain focus, and the user can operate the interface at this time;
[0056] onPause() is usually called when the activity is about to lose focus (for example, when part of the area is covered by a new activity). It is used to pause time-consuming operations (such as pausing video playback) and save temporary data to avoid resource waste.
[0057] onStop() is usually called when the activity is completely invisible (such as when it is covered by a full-screen activity) to release non-essential resources (such as stopping network requests and unbinding non-critical listeners);
[0058] onDestroy(), usually called before the Activity is destroyed (only once), is used to release resources (such as canceling network requests, unregistering broadcasts, and releasing memory);
[0059] onRestart() is usually called before the Activity returns to the "visible state" from the "stop state" and can be used to restore the previous state (such as reloading data).
[0060] The following are some examples of the lifecycle function call process based on Activity:
[0061] (1) When the user opens the target application and displays the initial interface, the Activity lifecycle function call process corresponding to the initial interface is: onCreate() → onStart() → onResume(), so that the user can interact based on the initial interface.
[0062] (2) When the user operates an application in the initial interface and enters the corresponding application interface, the Activity lifecycle function call process corresponding to the initial interface is: onPause() → onStop(), and the initial interface enters the "stop state" and is invisible.
[0063] (3) When the user returns to the initial interface again, the Activity lifecycle function call process corresponding to the initial interface is: onRestart() → onStart() → onResume(), so that the initial interface is restored to the front end and can be interacted with.
[0064] (4) When the user closes or exits the target application, the Activity lifecycle function call process corresponding to the initial interface is: onPause() → onStop() → onDestroy(), thereby completely destroying the initial interface and its corresponding Activity.
[0065] After research, the inventors found that the reason why the display screen goes black after the vehicle is connected to the mobile terminal through the target application may include: when the activity component cpDisplayActivity corresponding to the interface has been created and is running in the foreground, if the data stream sent by the mobile terminal is not received at this time, the screen will be displayed as a black screen. The reason for this phenomenon may be that there is confusion in the Activity life cycle management. Figure 3 As shown, it shows a chaotic life cycle management situation. The blue life cycle belongs to the new cpDisplayActivity, while the black life cycle belongs to the old cpDisplayActivity. The new cpDisplayActivity is created before the old cpDisplayActivity executes onStop(). As mentioned before, the UI will be requested from the mobile terminal in the life cycle function onCreate() of the new cpDisplayActivity, and a request to stop the data flow will be sent to the mobile terminal in the life cycle function onStop() of the old cpDisplayActivity. This results in the mobile terminal stopping the data flow between the mobile terminal and the vehicle computer based on the request of the old cpDisplayActivity during the display of the new cpDisplayActivity. The mobile terminal does not actually transmit the data flow to the vehicle computer, causing the vehicle-side display screen to be black.
[0066] In view of this, in the embodiment of the present application, when the vehicle-side computer establishes a connection with the smart terminal based on the target application, the interface of the smart terminal is displayed through the vehicle-side display screen; and the interface displayed on the vehicle side corresponds one-to-one with the active component in the vehicle-side computer system, so that the life cycle of each interface can be managed in the vehicle-side computer system through the active component. In order to avoid confusion in the life cycle management of each interface, when the first interface in the vehicle-side display screen exits, a judgment logic is added when the life cycle exit function contained in the first active component is called, that is, comparing the component identifier of the first active component with the latest component identifier; if the component identifier of the first active component is different from the latest component identifier, the life cycle exit function does not send a stop data flow request to the smart terminal, that is, maintains the data flow between the vehicle-side computer and the smart terminal to avoid the new interface content from not being displayed normally; if the component identifier of the first active component is the same as the latest component identifier, it indicates that the stopped interface is a new interface. At this time, the life cycle exit function needs to send a stop data flow request to the smart terminal to stop the data flow between the smart terminal and the smart terminal, and then promptly recover the responsive data receiving and processing resources. Through the interface management method of the embodiment of the present application, it is possible to avoid confusion in the interface life cycle that may cause abnormal vehicle-side display interface, and to avoid waste of vehicle system resources, thereby improving user experience and driving safety.
[0067] In an exemplary embodiment, Figure 4 As shown, an interface management method is provided, which is described by taking the method applied to a vehicle computer as an example, and includes the following steps S401 to S403. Among them:
[0068] Step S401, when a connection is established between the target application and the smart terminal, the interface of the smart terminal is displayed through the vehicle-side display screen; the interface displayed on the vehicle side corresponds one-to-one to the active components in the system.
[0069] In the embodiments of this application, the target application refers to an application that enables the vehicle computer to connect to a smart terminal such as a mobile phone. When the connection is successful, the vehicle-side display screen can display the current mobile phone operation interface, and the user can operate the application on the vehicle-side display screen as if operating a mobile phone, thereby expanding the functionality of the vehicle computer. The connection between the vehicle computer and the smart terminal based on the target application can be triggered by the user's operation on the vehicle side or on the smart terminal, without limitation.
[0070] Displaying the smart terminal interface on the vehicle-side display screen can mean displaying the entire current interface of the smart terminal, including application functions and interface operation controls. In this case, the user's operating logic for operating the vehicle-side display screen is consistent with the logic of directly operating the mobile terminal, and the user does not need to relearn or adapt.
[0071] Among them, the activity component can be the aforementioned Activity component, which contains multiple life cycle functions. The embodiment of the present application adjusts some of these functions to achieve the management of the life cycle of the interface, making the development cycle and difficulty controllable. The activity component can conveniently manage the life cycle of each interface.
[0072] As a specific example, the activity component corresponding to the interface displayed on the vehicle side can be understood as an Activity instance. For the sake of convenience, the Activity instance is also referred to as the activity component in this application, and in some places it is also abbreviated as Activity. Therefore, in relevant scenarios, the activity component and Activity both represent an Activity instance corresponding to an interface.
[0073] Different interfaces correspond to different Activity instances, and different Activity instances can be distinguished by their respective identifiers. In one embodiment, after the Activity instance is initialized, a hash value can be determined based on the memory address of the object. The hash value of each object is usually unique, even if they belong to the same class. Therefore, the hash value of the Activity instance object can be used as an identifier to distinguish different Activity instances. In other words, the identifier of the activity component can be understood as the hash value of the memory address of the Activity instance object.
[0074] In the embodiments of the present application, the lifecycle of each interface includes at least activation, execution, exit, and destruction. The lifecycle functions included in the corresponding activity components can efficiently manage the lifecycle of the interface. Activity component creation corresponds to the activation of the interface, activity component visibility corresponds to the interface being visible to the user, activity component exit corresponds to the interface being invisible to the user, and activity component destruction corresponds to the complete exit of the interface.
[0075] Step S402, when the first interface in the vehicle-side display screen is exited, the lifecycle exit function contained in the first active component corresponding to the first interface is called, and the component identifier of the first active component and the latest component identifier are compared; the latest component identifier is the identifier of the latest active component; the latest active component is the active component with the latest creation time.
[0076] Among them, the first interface is any interface under the target application. When the user slides the screen to switch interfaces or triggers an application on the screen, the first interface may be switched from a visible state in the front end to an invisible state. At this time, the active component corresponding to the first interface (i.e., an Activity instance) can call the corresponding lifecycle return function, such as onStop(), and execute the pre-set judgment logic in the lifecycle return function: compare the component identifier of the first active component and the latest component identifier, and trigger different further logic based on the result of the judgment logic. In an embodiment of the present application, the next step logic corresponding to the result of the judgment logic may include:
[0077] (1) Send a request to the smart terminal to stop the data flow;
[0078] (2) Do not send a request to stop data flow or a key frame request to the smart terminal.
[0079] The latest component ID can be recorded in a pre-defined variable, such as the variable mCpDisplayActivity. When a new activity component is created, the value of the variable mCpDisplayActivity will be updated to the ID of the newly created activity component. For example, when the new activity component calls onCreate(), the value of the variable mCpDisplayActivity is updated to the hash value of the newly created activity component.
[0080] Step S403: If the component identifier of the first active component is different from the latest component identifier, the data flow between the smart terminal is maintained; otherwise, a request to stop the data flow is sent to the smart terminal.
[0081] In one embodiment, when the active component corresponding to the first interface calls the lifecycle return function, if it is determined that the component identifier of the first active component is different from the latest component identifier recorded in the variable mCpDisplayActivity, it indicates that there are other new interfaces in operation. At this time, a stop data flow request should not be sent to the smart terminal. At this time, the data flow between the smart terminal will not stop, that is, the data flow between the smart terminal will be maintained; otherwise, it indicates that there is no other interface to be called up after the first interface. At this time, a stop data flow request can be sent to the smart terminal to instruct the mobile terminal to stop transmitting the data flow to the vehicle computer, so as to avoid the background still needing to receive and process the data flow after exiting the target application interface, resulting in unnecessary resource overhead.
[0082] It should be noted that the data stream of the present application can be one or a combination of video stream and audio stream. Through the transmission of the data stream, the UI interface of the smart terminal can be synchronously displayed on the vehicle-side display screen.
[0083] Based on the interface management method of the above embodiment, by recording the identifier of a newly created active component, logic is added in onCreate() to update the value of the preset variable to record the identifier of the latest active component, and logic is added in onStop() to make a judgment using the identifier of the active component being stopped and the identifier of the latest recorded active component. If it is the same active component, onStop() will send a request to stop the data flow. Otherwise, it proves that the active component being stopped is the old interface, and a new active component has been created. In this case, onStop() should not instruct the mobile terminal to stop the data flow, that is, onStop() does not send a request to stop the data flow, and maintains the data flow with the smart terminal. Through this method, based on the logical setting of the life cycle function, it can avoid confusion in the interface life cycle that causes abnormal display interface on the vehicle side, and it can also avoid waste of resources of the vehicle system, thereby improving user experience and driving safety.
[0084] In one embodiment, the update of the latest component identification of the embodiment of the present application is described, including: when the vehicle-side display screen calls up the second interface, creating a second active component corresponding to the second interface, and updating the latest component identification to the identification corresponding to the second active component.
[0085] The second interface refers to a new interface that is displayed on the vehicle display. The content of the interface or the scenario in which it is displayed is not limited. Whenever a new interface is displayed, a corresponding Activity instance object, i.e., a corresponding activity component, is created in the vehicle system.
[0086] Optionally, in the process of creating the second active component corresponding to the second interface, the lifecycle creation function of the second active component can be called, and based on the lifecycle creation function, it can be determined whether there is a data flow between the vehicle computer and the smart terminal at the current time; if there is no data flow, a data flow request is sent to the smart terminal; if there is already a data flow, a data flow request may not be sent to the smart terminal.
[0087] As an exemplary embodiment, a judgment logic can be added to the onCreate() method to determine whether there is a data stream between the vehicle computer and the smart terminal at the current time; if there is no data stream, the onCreate() method sends a data stream request to the smart terminal; if there is a data stream, the onCreate() method can perform further judgment, or exit without sending a data stream request to the smart terminal.
[0088] Based on the above example, a check is added to the onCreate() method of the activity component to check whether a data stream from the mobile terminal already exists. If not, the onCreate() method requests the UI from the mobile terminal. If the data stream already exists, the request is not repeated. This reduces unnecessary operations and avoids the issue of the mobile terminal being unable to automatically exit the target application interface after the voice assistant ends due to the vehicle computer requesting the UI when the mobile terminal invokes the interface.
[0089] However, the inventors further discovered that when the lifecycle creation function determines that there is a data flow between the vehicle computer and the smart terminal at the current time, although there is a data flow at this time, the old Activity may have sent a request to stop the data flow to the mobile terminal. However, due to the time difference in interaction, the mobile terminal has not yet responded to the request. Therefore, it is possible that in the following time, the mobile terminal will stop the data flow between the vehicle computer because of responding to the old Activity's request to stop the data flow, which will cause the vehicle end to be unable to receive the data flow of the second interface, resulting in the abnormal display of the newly created second interface.
[0090] To address this issue, in other embodiments, in the process of creating the second active component corresponding to the second interface, the lifecycle creation function of the second active component is called, and based on the lifecycle creation function, it is determined whether there is a data flow between the vehicle computer and the smart terminal at the current time; if there is no data flow, a data flow request is sent to the smart terminal; if there is a data flow, the value of the preset target variable is further checked, and when the value of the target variable is not the default value and the value of the target variable is different from the latest component identifier, a data flow request needs to be sent to the smart terminal; when the value of the target variable is the default value or the value of the target variable is the same as the latest component identifier, a data flow request is not sent to the smart terminal; wherein the target variable is used to save the identifier of the active component that requested to stop the video stream most recently.
[0091] In this way, the identifier of the most recent active component that requested the mobile terminal to stop the video stream is saved through a preset target variable, that is, the identifier of the active component that last sent a request to the mobile terminal to stop the data stream is recorded. As an example, the target variable can be represented as mExitHashCode. When no active component requests to stop the data stream, the value of the variable is the default value. On this basis, if onCreate() determines that a data stream already exists, it is necessary to further check the value of the target variable mExitHashCode. When the value of the target variable mExitHashCode is not the default value and the value of the target variable mExitHashCode is different from the latest component identifier, it indicates that other active components have sent data stream requests to the smart terminal before. At this time, it is still necessary to send a data stream request to the smart terminal to avoid the data stream of the second interface being unable to be received due to the mobile terminal stopping transmission due to the interaction time difference, thereby avoiding the vehicle-side display abnormality caused by the interaction time difference.
[0092] The inventors also discovered that when the Activity lifecycle becomes disrupted, for example, in the onStop() method, a check is performed to determine whether the stopped Activity is the most recently created Activity. If not, the request to stop the data stream may not be made. This means that during the switching process between the old and new Activities, the mobile terminal's video stream is not actually stopped and resent, so the key frame still exists at the beginning of the video stream. In this case, the new Activity will display a gray screen due to the lack of key frame data.
[0093] To address this issue, in one embodiment, when the lifecycle rollback function determines that the component identifier of the first active component is different from the latest component identifier, instead of sending a stop data stream request to the smart terminal, a key frame request is sent to the smart terminal; further, the key frame data returned by the smart terminal is merged into the data stream received by the latest active component; and the merged data stream is provided to the decoder corresponding to the latest active component, and based on the decoding output of the decoder, the corresponding interface content is displayed on the vehicle-side display screen.
[0094] Based on this, in onStop(), the current activity is compared with the previously stored identifier of the most recently created activity (mCpDisplayActivity). If they are different activities, onStop() does not send a request to stop the data stream to the mobile terminal, but does request a keyframe. If they are the same activity, a request to stop the data stream is sent to the mobile terminal through onStop(). This ensures proper data stream stop management, preventing black screen issues, while also ensuring that the newly activated interface displays normally, preventing gray screen issues.
[0095] The inventors' research also revealed that another reason for missing key frames is that when the target application interface is passively triggered, the vehicle-mounted system first receives the data stream from the mobile terminal before launching the corresponding activity. During this process, because launching the activity and initializing the corresponding decoder take time, the first few frames of the data stream sent by the mobile terminal may be missed. Key frames are typically located at the beginning of the data stream. Therefore, even if the subsequent data stream can be decoded normally, the missing key frames may still cause the vehicle-mounted display to appear gray or white.
[0096] In view of this situation, in one embodiment, the interface management method of the present application further includes:
[0097] For the latest active component, if the decoder corresponding to the latest active component has not completed initialization when receiving the data stream transmitted by the smart terminal, the received data stream will be stored in the preset target queue; after the decoder initialization is completed, the data stream stored in the target queue will be merged into the currently received data stream, and the merged data stream will be provided to the decoder. Based on the decoding output of the decoder, the corresponding interface content will be displayed on the vehicle-end display screen.
[0098] As a supplementary explanation, in an embodiment of the present application, the target queue can pre-set a data stream cache queue for temporarily storing data. Under normal circumstances, the data stream received by the vehicle computer can be provided to the decoder through other queues or directly; the target queue of an embodiment of the present application needs to be distinguished from the queue of the data stream received in other situations.
[0099] Based on this, when the decoder is not yet fully created, the vehicle computer can first store the received data stream in a preset queue. When the decoder is ready, these data streams are inserted into the header of the newly received data stream. This allows the key frames of the data stream to be preserved. Then, through the decoder's output, a normal interface can be displayed on the vehicle display screen, preventing the gray screen problem caused by missing key frames.
[0100] The inventors also discovered that during the interaction between the car computer and the phone based on the target application, due to the time it takes for the interaction to occur, timing issues can easily cause display anomalies. For example, when a user swipes right to exit the target application interface, the car computer sends a request to the phone to stop the data flow. However, if the user then clicks the app icon again to restart the target application interface, the car computer may not receive a callback from the phone indicating that the data flow has stopped until then. This can cause the car computer to incorrectly end the latest activity, resulting in a flashback of the target application interface.
[0101] Based on this, in one embodiment, the interface management method of the present application further includes: when the target application is restarted and the activity component corresponding to the restart interface has been created, if a stop data flow callback sent by the smart terminal is received, performing at least one of the following checks:
[0102] (1) Whether the value of the preset target variable is the default value;
[0103] (2) Whether the latest component identifier is null;
[0104] (3) Whether the value of the target variable is the same as the latest component identifier;
[0105] The target variable is used to store the identifier of the most recent active component that requested to stop the video stream.
[0106] If the result of any of the checks (1) to (3) is yes, call the close function to close the restart interface, set the latest component identifier to a null value, and set the target variable to the default value;
[0107] If the results of all checks in (1) to (3) are negative, the shutdown function is skipped to maintain the restart interface and avoid the problem of flash back.
[0108] To address the issue of UI flashbacks, a variable (represented as mExitHashCode) can be introduced to record the hash value of the activity that most recently requested to stop the video stream. In Java, all objects inherit from the Object class, which provides a default hashCode() method. This method's implementation is based on the object's memory address, so each object's hash value is typically unique, even if they belong to the same class. Therefore, the hash value of an activity can be used to determine whether it is the same Activity instance. When the phone's callback to stop the data stream returns, the car computer compares the hash code in the callback with the hash code of the currently displayed activity. If the two are identical, the activity can be safely terminated. If they are different, the currently displayed activity is not the one the user intended to terminate. In this case, the callback can be skipped to maintain the currently displayed activity, thus avoiding UI flashbacks.
[0109] In conjunction with the above embodiments, the interface management method of this application is illustrated below using the example of connecting a car computer and a mobile phone via the target application CarPlay. After the car computer and the mobile phone are connected via CarPlay, the car computer requests the UI video stream from the mobile phone and decodes the received video stream using a decoder, thereby displaying the mobile phone interface on the car-side display screen.
[0110] In one embodiment, Figure 5 FIG. 1 is a flow chart showing a target application interface on a vehicle side according to an embodiment of the present application. Figure 5 As shown, the specific process of the interface management method includes:
[0111] When the user triggers carplay to enter the corresponding initial interface, the car computer first determines whether a connection has been successfully established with the phone. If not, the current interface is closed through the relevant shutdown method / function (such as the system method finish()). If the connection is successfully established, the activity for the initial interface is created through onCreate(), and the latest component identifier mCpDisplayActivity is updated to the identifier of this activity in onCreate(). At the same time, the judgment logic is executed in the onCreate() method: checking whether there is currently a video stream transmitted by the mobile phone; if no video stream exists, the UI is requested from the mobile phone; if the video stream already exists, further checking whether the preset target variable mExitHashCode is the default value and whether the value of this target variable is the same as the identifier of the latest activity.
[0112] If the target variable mExitHashCode is not the default value and the value of the target variable mExitHashCode is different from the identifier of the latest activity, a UI request is made to the phone. If the target variable mExitHashCode is the default value or the preset value of the target variable is the same as the identifier of the latest activity, it means that the user wants to close the current latest activity. In this case, no UI request is made to the phone.
[0113] After the mobile phone receives the UI request sent by the vehicle computer, it starts to transmit the corresponding video stream to the vehicle computer.
[0114] The vehicle computer receives the video stream and provides it to the corresponding decoder, which decodes and outputs the video to display the interface content.
[0115] In another embodiment, Figure 6 In the process of exiting a target application interface on the vehicle side provided in another embodiment of the present application, reference is made to Figure 6 As shown, the specific process of the interface management method includes:
[0116] The user swipes right or up on the car-side display to exit the current interface of CarPlay.
[0117] In the onStop() method of the current Activity, determine whether the Activity being stopped is the same as the latest Activity. If so, send a request to the phone to stop the video stream. If not, it indicates that the Activity being stopped is the old Activity and a new Activity has been created. In this case, a request to stop the video stream should be sent to the phone.
[0118] In this case, due to the switching between the old and new activities, the phone's video stream is not actually stopped and resent during the switching process. Therefore, the new activity may not receive the complete video stream sent by the phone due to the time difference. In particular, key frames often exist at the head of the video stream and are easily missed during the switching process. Based on this, in a further embodiment, if the onStop() method of the current interface activity determines that the current interface activity being stopped is different from the latest activity, onStop() will send a key frame request to the phone; otherwise, onStop() will send a request to stop the video stream to the phone.
[0119] Among them, a key frame request can be sent to the mobile phone by calling the key frame request interface provided by the mobile phone. After receiving the key frame request, the mobile phone transmits the key frame data of the current UI to the vehicle computer; the vehicle computer adds the key frame data to other video streams received by the current interface Activity, and then provides the merged video stream to the corresponding decoder, thereby realizing the normal rendering and display of the UI.
[0120] In a related embodiment, if the current Activity's onStop() method determines that the currently stopped Activity is the same as the most recent Activity, not only is a keyframe request sent to the phone, but the target variable mExitHashCode is also updated in onStop() to the identifier of the current Activity. Specifically, the target variable can be updated to the hash value of the current Activity, as long as it can uniquely identify an Activity.
[0121] It should be noted that the step of sending a key frame request to the mobile phone and the step of updating the value of the target variable can be executed in parallel, or the step of sending a key frame request to the mobile phone can be executed first and then the value of the target variable is updated, or the value of the target variable can be updated first and then the step of sending a key frame request to the mobile phone is executed.
[0122] After receiving the request to stop the video stream, the mobile phone stops sending the video stream to the vehicle computer and returns a callback for stopping the video stream.
[0123] After receiving the callback to stop the video stream, the vehicle computer shuts down the decoder. In addition, it further checks whether the target variable mExitHashCode is equal to the default value, whether the identifier of the latest active component mCpDisplayActivity is null, and whether the value of the target variable mExitHashCode is equal to the identifier of the latest active component mCpDisplayActivity.
[0124] Optionally, the judgment condition may be:
[0125] Target variable mExitHashCode == default value ||
[0126] Latest activity component mCpDisplayActivity==null ||
[0127] mExitHashCode== mCpDisplayActivity.hashCode().
[0128] If this judgment condition is met, since the phone has received a callback to stop the video stream, which usually means that the video stream can no longer continue or resources need to be cleaned up, the vehicle computer directly calls finish() to close the current target application interface, sets the target variable mExitHashCode to the default value, and updates the latest activity component mCpDisplayActivity to an empty value. The default value can be -1.
[0129] If this condition is not met, there is no need to process the current stop video stream callback to ensure that the interface that the user does not want to return to runs normally.
[0130] Based on the judgment conditions:
[0131] mExitHashCode == -1|| mCpDisplayActivity==null||
[0132] mExitHashCode==mCpDisplayActivity.hashCode() can safely and reliably handle the interface exit logic. For example, it can handle two different interface exit scenarios.
[0133] Scenario 1: The car user actively exits the target application interface.
[0134] 1. Trigger exit intent: When the user actively leaves the target application interface, the system will call lifecycle methods (or functions) such as onStop().
[0135] 2. Record the exit target: At this point, the lifecycle method code records the hash code of the current screen instance being exited and assigns it to the target variable mExitHashCode. This hash code acts like an "identity tag," marking the specific screen instance to be exited.
[0136] 3. Send a stop request and process the callback: The vehicle sends a request to the phone (or server) to stop the video stream. When the callback is received, the decoder and other resources are stopped first.
[0137] 4. Check the interface status:
[0138] Case A: After stopping the decoder, the target application interface may have been completely destroyed by the system. In this case, the latest active component, mCpDisplayActivity, can be set to null. mCpDisplayActivity can be thought of as the "identity tag" of the newly activated interface. The conditional mCpDisplayActivity == null holds true. In this case, the previous exit operation has completed, and the target variable mExitHashCode, the "tag," is no longer needed. Therefore, the target variable mExitHashCode is reset to its default value of -1, indicating that "no interface is currently being exited."
[0139] Case B: If the target application interface instance mCpDisplayActivity still exists when the decoder is stopped (perhaps the user simply switched to another activity, but the interface was not destroyed). The code will then compare the target variable mExitHashCode (the previously recorded "interface label to be exited") with the currently existing mCpDisplayActivity.hashCode(). If the two are equal, it means that the current interface is the one you want to exit. At this point, you can safely call finish() to completely close it and also reset the target variable mExitHashCode to -1. If the two are different, it means that although there was an exit intention before, a new interface instance is now in the foreground. In this case, the new interface should not be closed, and the finish() operation can be skipped to keep the new interface running normally.
[0140] Scenario 2: The vehicle computer passively receives a stop video streaming callback from the mobile phone.
[0141] 1. Trigger condition: This usually occurs when the vehicle itself does not actively send an exit signal, but receives a callback to stop the video stream due to reasons related to the mobile phone.
[0142] 2. Check for exit intent: At this point, the code checks whether the target variable mExitHashCode is the default value -1. If the car computer passively receives a stop video streaming callback from the mobile phone, the target variable mExitHashCode is generally the default value.
[0143] 3. Exit: If the target variable mExitHashCode == -1, there is no record of a user exiting the interface. In this case, receiving a stop video streaming callback from the phone usually means that the video stream can no longer continue or that resources need to be cleaned up. Therefore, the car computer directly calls finish() to close the current target application interface.
[0144] Based on the interface display and exit process control examples described above, a context-aware resource management strategy based on activity component identification is proposed to address interface anomalies caused by timing issues during vehicle-to-mobile phone interactions. This strategy assigns a unique identifier to each Activity instance and tracks its status in real time, enabling more refined resource control. This strategy is applicable not only to video streams but also to multiple resource types, such as audio streams and data connections. It effectively avoids resource conflicts caused by context switching, improves system stability, and enhances the reliability and robustness of integrating target applications like CarPlay into the vehicle-to-mobile system.
[0145] Furthermore, by building an Activity lifecycle optimization framework centered on user experience, taking user experience as the core optimization goal, and dynamically adjusting the Activity lifecycle and resource allocation strategy, we can minimize display anomalies visible to vehicle-side users, improve user-perceived performance and satisfaction, and eliminate the hidden dangers of distracting drivers due to display failures.
[0146] It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts of the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0147] Based on the same inventive concept, embodiments of the present application also provide an interface management device for implementing the aforementioned interface management method. The implementation solution provided by this device is similar to the implementation solution described in the aforementioned method. Therefore, the specific limitations of one or more interface management device embodiments provided below can be found in the above-mentioned limitations of the interface management method and will not be repeated here.
[0148] In one embodiment, Figure 7 As shown, an interface management device is provided, which is applied to a vehicle computer. The device may include:
[0149] The connection display module 701 is used to display the interface of the smart terminal through the vehicle-side display screen when the target application is connected to the smart terminal; the interface displayed on the vehicle side corresponds to the active components in the vehicle-mounted system one by one;
[0150] The exit management module 702 is configured to, when the first interface on the vehicle-side display screen is exited, call the lifecycle exit function of the first active component corresponding to the first interface, and compare the component identifier of the first active component with the latest component identifier; the latest component identifier is the identifier of the latest active component; the latest active component is the active component with the latest creation time;
[0151] The data flow management module 703 is configured to maintain the data flow with the smart terminal if the component identifier of the first active component is different from the latest component identifier; otherwise, send a request to stop the data flow to the smart terminal.
[0152] Based on the interface management device applicable to a vehicle computer according to this embodiment, under the action of the connection display module, if the vehicle computer establishes a connection with the smart terminal based on the target application, the interface of the smart terminal can be displayed on the vehicle-side display screen; at the same time, the interface displayed on the vehicle side corresponds one-to-one to the active component of the system, and the life cycle of each interface is managed by the active component in the vehicle computer system; to avoid confusion in the life cycle management of each interface, when the first interface on the vehicle-side display screen exits, when the life cycle exit function contained in the first active component is called based on the exit management module, the component identifier of the first active component and the latest component identifier are compared, and the comparison result is passed to the data flow management module. If the component identifier of the first active component is different from the latest component identifier, the data flow management module controls not to send a stop data flow request to the smart terminal, that is, to maintain the data flow between the vehicle computer and the smart terminal to avoid the new interface content from not being displayed normally; if the component identifier of the first active component is the same as the latest component identifier, it indicates that the stopped interface is a new interface. At this time, the data flow management module needs to send a stop data flow request to the smart terminal to stop the data flow with the smart terminal, thereby promptly recovering the corresponding data transmission and processing resources. Through the above solution, we can avoid confusion in the interface life cycle that may cause abnormal vehicle-side display interface, and avoid waste of vehicle system resources, thereby improving user experience and driving safety.
[0153] In one embodiment, the above-mentioned interface management device also includes: a creation management module, which is used to create a second active component corresponding to the second interface when the vehicle-end display screen calls up the second interface, and update the latest component identifier to the identifier corresponding to the second active component.
[0154] In a specific embodiment, a management module is created, which is specifically used to call the lifecycle creation function of the second active component to determine whether there is a data flow between the vehicle computer and the smart terminal at the current time; if there is no data flow, a data flow request is sent to the smart terminal; if there is already a data flow, no data flow request is sent to the smart terminal.
[0155] In another specific embodiment, a creation management module is specifically configured to call a lifecycle creation function of the second activity component to determine whether a data flow exists between the vehicle computer and the smart terminal at the current time;
[0156] If the data stream does not exist, sending a data stream request to the smart terminal;
[0157] If a data flow already exists, checking the value of a preset target variable, and if the value of the target variable is not a default value and the value of the target variable is different from the latest component identifier, sending a data flow request to the smart terminal; if the value of the target variable is a default value or the value of the target variable is the same as the latest component identifier, not sending the data flow request to the smart terminal;
[0158] The target variable is used to store the identifier of the most recent active component that requested to stop the data flow.
[0159] In one embodiment, the aforementioned exit management module is also used to send a key frame request to the smart terminal when the component identifier of the first active component is different from the latest component identifier; in addition, the interface management device also includes: a decoding management module, which is used to merge the key frame data returned by the smart terminal into the data stream received by the latest active component; provide the merged data stream to the decoder corresponding to the latest active component, and display the corresponding interface content on the vehicle-side display screen based on the decoding output of the decoder.
[0160] In one embodiment, the interface management device also includes: a decoding management module, which is used to store the data stream in a preset target queue for the latest active component if the decoder corresponding to the latest active component has not completed initialization when receiving the data stream transmitted by the smart terminal; after the decoder is initialized, the data stream stored in the target queue is merged into the data stream currently received by the latest active component, and the merged data stream is provided to the decoder, and based on the decoding output of the decoder, the corresponding interface content is displayed on the vehicle-end display screen.
[0161] In one embodiment, the interface management device further includes: a callback processing module for, when the target application is restarted and the active component corresponding to the restart interface has been created, performing at least one of the following checks upon receiving a stop data stream callback sent by the smart terminal: whether the value of a preset target variable is a default value, whether the latest component identifier is a null value, and whether the value of the target variable is the same as the latest component identifier; wherein the target variable is used to store the identifier of the most recent active component that requested to stop the video stream;
[0162] If any of the check results is yes, call a close function to close the restart interface, set the latest component identifier to a null value, and set the target variable to a default value;
[0163] If all the check results are negative, the shutdown function is skipped to keep the restart interface.
[0164] In one embodiment, the exit management module is further configured to set the latest component identifier to a null value and the target variable to a default value when the target application is exited and all active components corresponding to the target application are destroyed.
[0165] Each module in the interface management device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor in the new energy vehicle in hardware form, or can be stored in the memory of the new energy vehicle in software form, so that the processor can call and execute the corresponding operations of each module.
[0166] In an exemplary embodiment, a new energy vehicle is provided, the internal structure of which can be as follows: Figure 8As shown. The new energy vehicle includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, while the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the new energy vehicle provides computing and control capabilities. The memory of the new energy vehicle includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operating system and computer programs stored in the non-volatile storage medium. The input / output interface of the new energy vehicle is used to exchange information between the processor and external devices. The communication interface of the new energy vehicle is used to communicate with external terminals via wired or wireless means, and the wireless means can be implemented via Wi-Fi, mobile cellular networks, NFC (near-field communication), or other technologies. When executed by the processor, the computer program implements a vehicle braking control method. The display unit of the new energy vehicle is used to produce a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the new energy vehicle can be a touch layer covered on the display screen, or it can be a button, trackball or touchpad set in the new energy vehicle.
[0167] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0168] In an exemplary embodiment, a new energy vehicle is provided, the structure of which can be as follows: Figure 8 As shown, the new energy vehicle includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the method of any of the above embodiments when executing the computer program.
[0169] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0170] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0171] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), data processing logic devices based on quantum computing, and the like.
[0172] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0173] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. An interface management method, characterized in that: Applied to a vehicle computer, the method includes: When a connection is established between the target application and the smart terminal, the interface of the smart terminal is displayed on the vehicle-side display screen; the interface displayed on the vehicle-side corresponds one-to-one with the active components in the vehicle-mounted system; When the first interface in the vehicle-side display screen is exited, the lifecycle exit function of the first active component corresponding to the first interface is called, and the component identifier of the first active component and the latest component identifier are compared; the latest component identifier is the identifier of the latest active component; the latest active component is the active component with the latest creation time; If the component identifier of the first active component is different from the latest component identifier, the data flow between the first active component and the smart terminal is maintained; otherwise, a request to stop the data flow is sent to the smart terminal.
2. The method according to claim 1, characterized in that Also includes: When the vehicle-side display screen calls up the second interface, a second active component corresponding to the second interface is created, and the latest component identifier is updated to the identifier corresponding to the second active component.
3. The method according to claim 2, characterized in that The step of creating a second activity component corresponding to the second interface includes: Calling the lifecycle creation function of the second activity component to determine whether there is a data flow between the vehicle computer and the smart terminal at the current time; If the data stream does not exist, sending a data stream request to the smart terminal; If the data stream already exists, no data stream request is sent to the smart terminal.
4. The method according to claim 2, characterized in that The step of creating a second activity component corresponding to the second interface includes: Calling the lifecycle creation function of the second activity component to determine whether there is a data flow between the vehicle computer and the smart terminal at the current time; If the data stream does not exist, sending a data stream request to the smart terminal; If a data flow already exists, checking the value of a preset target variable, and if the value of the target variable is not a default value and the value of the target variable is different from the latest component identifier, sending a data flow request to the smart terminal; if the value of the target variable is a default value or the value of the target variable is the same as the latest component identifier, not sending the data flow request to the smart terminal; The target variable is used to store the identifier of the most recent active component that requested to stop the data flow.
5. The method according to claim 1, wherein The method further comprises: When the component identifier of the first active component is different from the latest component identifier, sending a key frame request to the intelligent terminal; Merging the key frame data returned by the intelligent terminal into the data stream received by the latest active component; The merged data stream is provided to the decoder corresponding to the latest active component, and based on the decoding output of the decoder, the corresponding interface content is displayed on the vehicle-side display screen.
6. The method according to claim 1, characterized in that The method further comprises: For the latest active component, if the decoder corresponding to the latest active component has not completed initialization when receiving the data stream transmitted by the smart terminal, the data stream is stored in a preset target queue; After the decoder is initialized, the data stream stored in the target queue is merged into the data stream currently received by the latest active component, and the merged data stream is provided to the decoder. Based on the decoding output of the decoder, the corresponding interface content is displayed on the vehicle-side display screen.
7. The method according to claim 1, characterized in that The method further comprises: When the target application is restarted and the active component corresponding to the restart interface has been created, if a stop data stream callback sent by the smart terminal is received, at least one of the following checks is performed: whether the value of a preset target variable is a default value, whether the latest component identifier is a null value, and whether the value of the target variable is the same as the latest component identifier; wherein the target variable is used to store the identifier of the active component most recently requested to stop the video stream; If any of the check results is yes, call a close function to close the restart interface, set the latest component identifier to a null value, and set the target variable to a default value; If all the check results are negative, the shutdown function is skipped to keep the restart interface.
8. The method according to claim 4 or 7, characterized in that Also includes: When the target application is exited and all active components corresponding to the target application are destroyed, the latest component identifier is set to a null value, and the target variable is set to a default value.
9. An interface management device, characterized in that: Applied to vehicle computers, including: A connection display module is used to display the interface of the smart terminal through the vehicle-side display screen when a connection is established between the target application and the smart terminal; the interface displayed on the vehicle side corresponds one-to-one with the active components in the vehicle-mounted system; An exit management module is configured to, when exiting the first interface on the vehicle-side display screen, call a lifecycle exit function contained in a first active component corresponding to the first interface, and compare the component identifier of the first active component with a latest component identifier; the latest component identifier is the identifier of the latest active component; and the latest active component is the active component with the latest creation time; The data flow management module is configured to maintain the data flow with the smart terminal if the component identifier of the first active component is different from the latest component identifier; otherwise, send a request to stop the data flow to the smart terminal.
10. A new energy vehicle, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Terminal screen projection display method, terminal and storage medium
CN113485667A
Display screen blank screen processing method and system, electronic equipment and storage medium
CN118386933A
Application program running method and system based on cloud vehicle machine, electronic equipment and medium
CN118741190A
Detection and recovery method and device for stuck display interface of vehicle machine and storage medium
CN118916201A
Data processing method and device, electronic equipment and storage medium
CN119232833A