Interface refreshing method and device, electronic equipment and computer readable storage medium
By combining delay tasks and periodic sampling mechanisms, the interface flickering problem caused by vehicle media applications receiving multiple different data in a short time is solved, and the stable interface refresh and user experience are improved.
Patent Information
- Application Number
- CN202411862821.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-12-17
Smart Images

Figure CN119883313A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of vehicle-mounted display technology, and more specifically, to an interface refresh method, device, electronic device and computer-readable storage medium in the field of vehicle-mounted display technology. Background Art
[0002] The CarMediaApp is a UI container for the Google native MediaSession framework, which can access different servers (including MediaSession apps) to display different content. The content displayed by the CarMediaApp is the callback data of the MediaSession app. If the MediaSession app calls back different data multiple times in a short period of time, the CarMediaApp will display different interfaces multiple times. In this way, the interface display changes in a short period of time will give users a sense of flickering, affecting the user experience of the CarMediaApp. Summary of the invention
[0003] The present application provides an interface refresh method, device, electronic device and computer-readable storage medium, which can solve the problem of visual flickering in the display interface.
[0004] In a first aspect, an interface refresh method is provided, the interface refresh method comprising: each time first display data is received, using the first display data to update second display data in a delayed display task; judging whether a sampling cycle duration of a data sampling task has arrived; wherein a start time of the data sampling task is the same as a start time of the delayed display task, and the sampling cycle duration is greater than a delay duration of the delayed display task; when the sampling cycle duration arrives, obtaining display data with the latest storage time from the updated display data of the delayed display task to obtain target display data; and refreshing the display interface according to the target display data.
[0005] The embodiment of the present application adopts the method of updating the second display data in the delayed display task with the first display data each time the first display data is received, judging whether the sampling period of the data sampling task has been reached, the start time of the data sampling task is the same as the start time of the delayed display task, and the sampling period is greater than the delay period of the delayed display task. When the sampling period is reached, the display data with the latest storage time is obtained from the display data of the updated delayed display task to obtain the target display data. The technical solution of refreshing the display interface according to the target display data is realized, thereby realizing the combination of the delayed task mechanism and the periodic sampling mechanism for interface display. On the one hand, by setting the delayed display task, it is possible to avoid receiving different display data multiple times in a short period of time, which causes the display interface to refresh frequently and change, and causes visual flickering problems. On the other hand, by setting the data sampling task and setting the sampling period of the data sampling task to be greater than the delay period of the delayed display task, it is possible to avoid the loss of display data caused by the delayed task, which causes the display interface to not refresh for a long time, thereby improving the user experience.
[0006] In one possible implementation, each time the first display data is received, using the first display data to update the second display data in the delayed display task includes: each time the vehicle media application receives the first display data sent by the media session application, using the first display data to replace the second display data to update the delayed display task.
[0007] In a possible implementation, replacing the second display data with the first display data includes: determining similarity between the first display data and the second display data; and if the similarity is less than a similarity threshold, replacing the second display data with the first display data.
[0008] In one possible implementation, refreshing the display interface according to the target display data includes: refreshing the display interface of the vehicle media application according to the target display data, which can solve the problem of visual flickering in the display interface of CarMediaApp caused by frequent updates of display data by the MediaSession application in the field of in-vehicle display technology.
[0009] In a possible implementation, after determining whether the sampling cycle duration of the data sampling task has been reached, the interface refresh method further includes: if the sampling cycle duration has not been reached, determining whether the delay duration has been reached; if the delay duration has been reached, obtaining the display data with the latest storage time from the updated display data of the delayed display task to obtain the target display data, and refreshing the display interface using the target display data obtained when the delay duration has been reached, thereby avoiding the problem of the display interface not being refreshed for a long time. .
[0010] In one possible implementation, refreshing the display interface according to the target display data includes: determining whether the similarity between the first data to be used and the second data to be used is less than a similarity threshold; wherein the first data to be used is the target display data obtained when the delay duration is reached, and the second data to be used is the target display data obtained when the sampling period duration is reached; if so, refreshing the display interface according to the second data to be used, effectively avoiding unnecessary interface refresh display.
[0011] In a possible implementation, each time the first display data is received, after the second display data in the delayed display task is updated with the first display data, the interface refresh method further includes: setting the delay time to zero and re-timing the delay time. After each update of the delayed display task, the delay time is set to zero and the delay time is re-timing, thereby avoiding the problem of flickering of the display interface when the display interface is refreshed with the first data to be used.
[0012] In a second aspect, an interface refreshing device is provided, the interface refreshing device comprising:
[0013] a task updating module, configured to update the second display data in the delayed display task by using the first display data each time the first display data is received;
[0014] A time judgment module, used to judge whether the sampling period of the data sampling task has arrived; wherein the start time of the data sampling task is the same as the start time of the delayed display task, and the sampling period is longer than the delay period of the delayed display task;
[0015] A data sampling module, configured to obtain, when the sampling period is reached, display data with the latest storage time from the updated display data of the delayed display task to obtain target display data;
[0016] The interface refresh module is used to refresh the display interface according to the target display data.
[0017] In a possible implementation, the task update module is specifically configured to replace the second display data with the first display data to update the delayed display task each time the vehicle media application receives the first display data sent by the media session application.
[0018] In a possible implementation, the task update module, in replacing the second display data with the first display data, is further used to: determine the similarity between the first display data and the second display data; if the similarity is less than a similarity threshold, replace the second display data with the first display data.
[0019] In a possible implementation, the interface refresh module is specifically configured to refresh a display interface of the vehicle media application according to the target display data.
[0020] In a possible implementation, the data sampling module is also used to determine whether the delay duration has been reached when the sampling period duration has not been reached; when the delay duration has been reached, the display data with the latest storage time is obtained from the updated display data of the delayed display task to obtain the target display data.
[0021] In one possible implementation, the interface refresh module is specifically used to determine whether the similarity between the first data to be used and the second data to be used is less than a similarity threshold; wherein the first data to be used is the target display data obtained when the delay time is reached, and the second data to be used is the target display data obtained when the sampling period time is reached; if so, refresh the display interface according to the second data to be used.
[0022] In a possible implementation, the task updating module is further configured to reset the delay duration to zero and re-time the delay duration after using the first display data to update the second display data in the delayed display task each time the first display data is received.
[0023] In a third aspect, an electronic device is provided, comprising a memory and a processor. The memory is used to store executable program code, and the processor is used to call and run the executable program code from the memory, so that the electronic device executes the interface refresh method in the first aspect or any possible implementation of the first aspect.
[0024] In a fourth aspect, a computer program product is provided, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the interface refresh method in the first aspect or any possible implementation of the first aspect.
[0025] In a fifth aspect, a computer-readable storage medium is provided, which stores a computer program code. When the computer program code runs on a computer, the computer executes the interface refresh method in the above-mentioned first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 An exemplary schematic diagram showing an undelayed interface refresh method;
[0027] Figure 2 An exemplary schematic diagram showing a delayed interface refresh method;
[0028] Figure 3 Another exemplary schematic diagram showing a delayed interface refresh method;
[0029] Figure 4 Another exemplary schematic diagram showing a delayed interface refresh method;
[0030] Figure 5 An exemplary schematic diagram showing an interface refresh method combining delay and periodic sampling;
[0031] Figure 6 A schematic flow chart of an interface refresh method provided in an embodiment of the present application is shown;
[0032] Figure 7 A schematic diagram of the structure of an interface refreshing device provided in an embodiment of the present application is shown;
[0033] Figure 8 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0034] The technical solution in the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B: "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0035] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.
[0036] The car media application (CarMediaApp) is the UI container of Google's native MediaSession framework, which can access different servers (Content Provider, CP) to display different content. Among them. The server includes service applications that follow the MediaSession framework, such as Spotify, TuneIn, Tidal, Deezer, Audible and other MediaSession applications. MediaSession applications are third-party applications. Spotify is a popular music streaming service platform that allows users to access millions of songs, podcasts, audiobooks and other audio content; TuneIn provides streaming services, which can listen to online music, radio and interview programs; Tidal is used to provide lossless sound quality music, HiRes FLAC and Dolby Atmos and other advanced audio; Deezer is a well-known music website and streaming service platform; Audible is an audio reading application. The MediaSession framework is a multimedia application framework introduced by Google after Android 5.0, which is mainly used to solve the communication problem between the interface and the service during music playback.
[0037] CarMediaApp connects to the MediaSession application through the MediaSession framework. CarMediaApp controls the MediaSession application through the control commands of the MediaSession framework. CarMediaApp listens to the MediaSession application callback through the listening commands of the MediaSession framework and parses the content for interface display.
[0038] The control commands include:
[0039] Play command: play media;
[0040] skipToPrevious command: plays the previous media;
[0041] skipToNext command: play the next media;
[0042] doCustomAction command: Requests the application's custom functions, such as favorites, double speed, fast forward, etc.
[0043] The monitoring commands include:
[0044] onMetadataChanged command: media information callback, such as cover, song, singer, etc.
[0045] onQueueChanged command: playlist callback;
[0046] onPlaybackStateChanged command: playback status callback, such as playback status, current progress, custom function list, error code, etc.;
[0047] onRepeatModeChanged command: loop mode callback.
[0048] The content displayed by CarMediaApp is the callback data of MediaSession application. If MediaSession application calls back different data multiple times in a short period of time, the vehicle media application will display different interfaces multiple times. In this way, the interface display changes in a short period of time will cause the user to feel that the interface flickers, affecting the user's experience of using the vehicle media application.
[0049] The problem of interface flickering includes but is not limited to: 1. For example, during the playback process of a MediaSession application, the play button keeps flickering between loading and playing. The reason is that the display data of the play button changes rapidly between the buffering state and the playing state within 1S, causing the play button to flicker. 2. For another example, when a MediaSession application switches songs, the cover flickers with an unknown picture, and the displayed cover flickers. The reason is that when the MediaSession application switches songs, it calls back an unknown picture, and then immediately calls back the correct cover picture.
[0050] To solve the above problems, the present application provides an interface refresh method, device, electronic device and computer-readable storage medium. The embodiments of the present application introduce a delayed task mechanism and a periodic sampling mechanism for refreshing the display interface. By combining the delayed task mechanism and the periodic sampling mechanism, it is possible to solve the problem of MediaSession applications frequently updating display data in the field of vehicle-mounted display technology, causing visual flickering in the display interface.
[0051] For the delayed task mechanism, specifically, the old display data in the delayed display task is updated with each new display data received, and then when the delay time of the delayed display task is reached (that is, the delayed display task times out), the display interface is refreshed according to the latest display data in the delayed display task, thereby solving the problem of visual flickering in the display interface.
[0052] A situation such as Figure 1 As shown, Figure 1 An exemplary schematic diagram showing an undelayed interface refresh method is shown. Figure 1In the case where the delayed task mechanism is not adopted, if erroneous display data is received and correct display data is received after an interval of 100ms, if no processing is done, a black area will be displayed for 100ms, causing the display interface to flicker.
[0053] If the delay is increased by 200m, the correct display data will squeeze out (remove) the incorrect display data, thereby filtering out the flickering black area and solving the flickering problem. The display effect is shown in the figure below. Figure 2 As shown, Figure 2 An exemplary schematic diagram showing a delayed interface refresh method.
[0054] In another case, if display data is received every 100ms, and no processing is done, each display data will be displayed for 100ms, causing the display interface to flicker. The display effect is shown in the figure below. Figure 3 As shown, Figure 3 Another exemplary schematic diagram showing a delayed interface refresh method.
[0055] If the delay is increased by 200m, the display effect is as follows Figure 4 As shown, Figure 4 Another exemplary schematic diagram of a delayed interface refresh method is shown. Although the display interface does not flicker, a lot of intermediate display data will be lost, which is not expected during the display process.
[0056] If the delay is increased by 200m and the periodic acquisition is increased by 300ms, the display effect is as follows: Figure 5 As shown, Figure 5 An exemplary schematic diagram of an interface refresh method combining delay and periodic sampling is shown. By combining delay and periodic sampling to refresh the display interface, not only the problem of flickering on the display interface can be solved, but also the problem of loss of intermediate display data, which causes the display interface to not refresh for a long time, can be avoided.
[0057] The following is an embodiment of an interface refresh method provided in this application specification.
[0058] Figure 6 A schematic flow chart of an interface refresh method provided in an embodiment of the present application is shown, Figure 6 As shown, the execution subject of the interface refresh method provided in the embodiment of the present application is an electronic device, for example, the electronic device includes a mobile display device, a display device installed on a vehicle, and other devices with display functions.
[0059] The above interface refresh method includes the following solutions:
[0060] S110: when the first display data is received each time, using the first display data to update the second display data in the delayed display task;
[0061] S120: Determine whether the sampling period of the data sampling task has arrived;
[0062] S130: when the sampling period has expired, obtaining the display data with the latest storage time from the display data of the updated delayed display task to obtain the target display data;
[0063] S140: Refresh the display interface according to the target display data.
[0064] In an exemplary embodiment, each time new display data is received that has not been used is referred to as first display data, and a delayed display task is created in advance. When the display interface of an electronic device displays data for the first time, if no display data has been received, it can be understood that the second display data stored in the delayed display task is empty data, that is, no display data is stored in the delayed display task. When the display interface of an electronic device does not display data for the first time, the second display data stored in the delayed display task can be understood as display data that has been received in the past and has not been used, and can also be referred to as old display data. The delayed display task is a temporary storage mechanism for saving the latest received and unused display data, and for deciding whether to use the latest received and unused display data as the final display data after a certain delay.
[0065] The delayed display task corresponds to a delay time. After the display data is stored in the delayed display task, the display data in the delayed display task will not be used to refresh the display interface immediately, but will be suspended for delayed use. After each first display data is received, the first display data is stored in the delayed display task to update the second display data stored in the delayed display task, thereby realizing the update of the delayed display task, which means that the delayed display task always stores the latest received and unused display data.
[0066] The data sampling task can be understood as a periodic sampling task for display data, which is also created in advance. The data sampling task corresponds to a sampling cycle duration, which is greater than the delay duration of the delayed display task. The sampling cycle duration refers to the time interval for the regular execution of the data sampling task, and the delay duration refers to the waiting time for the delayed display task, ensuring that the display data frequently received in a short period of time will not be displayed immediately, thereby avoiding flickering problems. Setting the sampling cycle duration to be greater than the delay duration can avoid the problem that some display data is received but lost due to delayed use, resulting in the display interface not refreshing for a long time.
[0067] The start time of the data sampling task is the same as the start time of the delayed display task, that is, the two tasks are executed together, that is, the delayed display task and the data sampling task are started at the same time. For example, at the first moment, the delayed display task is started, and the data sampling task is also started at the first moment. The delay duration timer corresponding to the delayed display task and the sampling period duration timer corresponding to the data sampling task start timing at the same time.
[0068] After the delayed display task is updated, it is determined whether the sampling cycle of the data sampling task has been reached. If it is determined that the sampling cycle has been reached, the display data with the latest storage time is obtained from the display data of the updated delayed display task. It can also be understood as obtaining the latest received and unused display data from the display data of the updated delayed display task to obtain the target display data, that is, the display data finally used to refresh the display interface. For example, the display data with the latest storage time in the updated delayed display task is the first display data 5 received at the 5th moment, the current moment is the 7th moment, and the 7th moment is also the moment when the sampling cycle has been reached, and no display data has been received from the 5th moment to the 7th moment, then the first display data 5 is the target display data.
[0069] After obtaining the target display data, the display interface is refreshed using the target display data to visualize the content of the target display data in the display interface, ensuring that the user sees the latest and most stable data content display in the display interface. By introducing the delayed task mechanism and the periodic sampling mechanism into the interface display, the display interface will not change frequently even if different display data is received multiple times in a short period of time, which not only avoids the problem of visual flicker, but also avoids the problem of display data loss caused by delay, which causes the display interface to not refresh for a long time.
[0070] The embodiment of the present application adopts the method of updating the second display data in the delayed display task with the first display data each time the first display data is received, judging whether the sampling period of the data sampling task has been reached, the start time of the data sampling task is the same as the start time of the delayed display task, and the sampling period is greater than the delay period of the delayed display task. When the sampling period is reached, the display data with the latest storage time is obtained from the display data of the updated delayed display task to obtain the target display data. The technical solution of refreshing the display interface according to the target display data is realized, thereby realizing the combination of the delayed task mechanism and the periodic sampling mechanism for interface display. On the one hand, by setting the delayed display task, it is possible to avoid receiving different display data multiple times in a short period of time, which causes the display interface to refresh frequently and change, and causes visual flickering problems. On the other hand, by setting the data sampling task and setting the sampling period of the data sampling task to be greater than the delay period of the delayed display task, it is possible to avoid the loss of display data caused by the delayed task, which causes the display interface to not refresh for a long time, thereby improving the user experience.
[0071] The following Figure 1 The specific implementation methods of each step in the illustrated embodiment are described as follows:
[0072] In a possible implementation, after determining in S120 whether the sampling period of the data sampling task has been reached, the interface refresh method further includes the following steps:
[0073] If the sampling period has not been reached, determine whether the delay period has been reached;
[0074] When the delay time is reached, the display data with the latest storage time is obtained from the display data of the updated delayed display task to obtain the target display data.
[0075] Since the sampling cycle duration is longer than the delay duration, if the sampling cycle duration has not been reached, the display data stored in the delayed display task will not be used. This will cause the display data to be lost because the sampling cycle duration has not been reached and the delayed task, resulting in the problem that the display interface will not be refreshed for a long time. Therefore, when the sampling cycle duration has not been reached, it is further determined whether the delay duration has been reached. If the delay duration has been reached, the display data with the latest storage time is obtained from the display data of the updated delayed display task to obtain the target display data. The target display data obtained when the delay duration is reached is then used to refresh the display interface, thereby avoiding the problem that the display interface will not be refreshed for a long time. Among them, the target display data obtained when the delay duration is reached may be the same as or different from the target display data obtained when the sampling cycle duration is reached.
[0076] In a possible implementation, the above S140, refreshing the display interface according to the target display data, includes the following steps:
[0077] Determine whether the similarity between the first data to be used and the second data to be used is less than a similarity threshold;
[0078] If not, refresh the display interface according to the second data to be used.
[0079] The first data to be used is the target display data obtained when the delay time is reached, and the second data to be used is the target display data obtained when the sampling period time is reached.
[0080] Since the sampling period is longer than the delay period, the delay period may arrive earlier than the sampling period. If the display interface has been refreshed using the first data to be used, after the second data to be used is acquired, it is determined whether the similarity between the first data to be used and the second data to be used is less than the similarity threshold. If not, it indicates that the first data to be used and the second data to be used are the same data. Since the display interface has been refreshed using the first data to be used, and the second data to be used is the same as the first data to be used, if the display interface is refreshed again using the second data to be used, the content in the display interface will not change. In this case, the second data to be used will not be used to refresh the display interface, which is beneficial to avoid wasting the system's computing resources. If yes, it indicates that the first data to be used and the second data to be used are not the same data. In this case, the second data to be used will be used to refresh the display interface, thereby effectively avoiding unnecessary interface refresh display.
[0081] In a possible implementation, in the above S110, after using the first display data to update the second display data in the delayed display task each time the first display data is received, the interface refresh method further includes the following steps:
[0082] Set the delay time to zero and restart the delay time.
[0083] As time goes by, the remaining time of the delay time is gradually reduced. If the delayed display task does not re-time the delay time after each update, when the delay time is reached, any subsequent time is the arrival time of the delay time, and the first display data received each time is the first data to be used. In this way, the display interface will be frequently refreshed with the first data to be used each time, resulting in the problem of flickering display interface. Therefore, after each update of the delayed display task, the delay time is reset to zero and the delay time is re-timed, so as to avoid the problem of flickering display interface when the first data to be used is used to refresh the display interface.
[0084] In a possible implementation, the above S110, when the first display data is received each time, using the first display data to update the second display data in the delayed display task includes the following steps:
[0085] Each time CarMediaApp receives the first display data sent by the MediaSession application, the first display data is used to replace the second display data to update the delayed display task.
[0086] When the above interface refresh method is specifically applied to a display device provided on a vehicle, for example, the display device is a vehicle-mounted display device, and the vehicle-mounted display device is installed with CarMediaApp, CarMediaApp refreshes the display interface of CarMediaApp through the display data sent by the MediaSession application.
[0087] When CarMediaApp receives the start request of CarMediaApp, it creates a delayed display task and a data sampling task, sets the sampling period of the data sampling task to be longer than the delay period of the delayed display task, and then starts the delayed display task and the data sampling task at the same time.
[0088] After starting the delayed display task and data sampling task, CarMediaApp replaces the second display data with the first display data every time it receives the first display data sent by the MediaSession application to update the delayed display task. Among them, the delayed display task always stores one display data. After the first display data replaces the second display data, the original second display data will be deleted, and the first display data will be the new second display data, so that the display data stored in the delayed display task can always be the latest display data received.
[0089] In a possible implementation, the above-mentioned replacing the second display data with the first display data includes the following steps:
[0090] determining a similarity between the first display data and the second display data;
[0091] If the similarity is less than the similarity threshold, the first display data is used to replace the second display data.
[0092] Regarding the case where the above interface refresh method is specifically applied to an in-vehicle display device, considering that the first display data sent by the MediaSession application to CarMediaApp may be the same as the second display data in the delayed display task, CarMediaApp uses the first display data to replace the second display data each time it receives the first display data sent by the MediaSession application, which may easily cause a waste of computing resources. Therefore, each time CarMediaApp receives the first display data sent by the MediaSession application, it determines whether the first display data sent by the MediaSession application is the same as the second display data in the delayed display task. If they are the same, there is no need to replace the second display data in the delayed display task, and the second display data in the delayed display task continues to be retained; if they are not the same, the first display data is used to replace the second display data in the delayed display task, thereby saving the system's computing resources and avoiding unnecessary update operations. Among them, it is determined whether the first display data sent by the MediaSession application is the same as the second display data in the delayed display task, and through similarity judgment, if the similarity between the first display data and the second display data is less than the similarity threshold, it is determined that the first display data and the second display data are not the same; if the similarity between the first display data and the second display data is greater than or equal to the similarity threshold, it is determined that the first display data and the second display data are the same.
[0093] In a possible implementation, the above S140, refreshing the display interface according to the target display data, includes the following steps:
[0094] Refresh the display interface of CarMediaApp according to the target display data.
[0095] When the above-mentioned interface refresh method is specifically applied to a vehicle-mounted display device, when the sampling cycle duration is reached, the display data with the latest storage time is obtained from the display data of the updated delayed display task to obtain the target display data. By using the target display data to refresh the display interface of CarMediaApp, the problem of visual flickering in the display interface of CarMediaApp caused by frequent updates of display data by the MediaSession application in the field of vehicle-mounted display technology can be solved.
[0096] The following is another embodiment of an interface refresh method provided in this application specification.
[0097] The interface refresh method provided in the embodiment of the present application is applied to a vehicle-mounted display device, and the interface refresh method includes the following schemes:
[0098] S210: Each time the CarMediaApp receives the first display data sent by the MediaSession application, the first display data is used to replace the second display data in the delayed display task to update the delayed display task.
[0099] The delayed display task is a temporary storage mechanism for storing the latest received and unused display data, and deciding whether to use the latest received and unused display data as the final display data after a certain delay.
[0100] One display data is always stored in the delayed display task. Using the first display data to replace the second display data in the delayed display task includes: determining the similarity between the first display data and the second display data, if the similarity is less than the similarity threshold, using the first display data to replace the second display data, if the similarity is greater than or equal to the similarity threshold, discarding the first display data and keeping the second display data unchanged. Since one display data is always stored in the delayed display task, after the first display data is used to replace the second display data, the original second display data will be deleted, and the first display data will be the new second display data, so that the display data stored in the delayed display task can always be the latest display data received.
[0101] S221: The delay duration of the delayed display task is set to zero, and the delay duration is re-timed.
[0102] As time goes by, the remaining time of the delay time is gradually reduced. If the delayed display task does not re-time the delay time after each update, when the delay time is reached, any subsequent time is the arrival time of the delay time, and the first display data received each time is the first data to be used. In this way, the display interface will be frequently refreshed with the first data to be used each time, resulting in the problem of flickering display interface. Therefore, after each update of the delayed display task, the delay time is reset to zero and the delay time is re-timed, so as to avoid the problem of flickering display interface when the first data to be used is used to refresh the display interface.
[0103] S222: Determine whether the sampling cycle duration of the data sampling task has been reached. Among them, the sampling cycle duration is greater than the delay duration. The start time of the data sampling task is the same as the start time of the delayed display task, that is, the two tasks are executed together, that is, the delayed display task and the data sampling task are started at the same time. For example, at the first moment, the delayed display task is turned on, and the data sampling task is also turned on at the first moment. The delay duration timer corresponding to the delayed display task and the sampling cycle duration timer corresponding to the data sampling task start timing at the same time.
[0104] S223: When the sampling period duration has not been reached, determine whether the delay duration has been reached.
[0105] S224: when the delay time is reached, the display data with the latest storage time is obtained from the display data of the updated delayed display task to obtain the first data to be used, and the first data to be used is used as the target display data, and S226 is executed.
[0106] Since the sampling cycle duration is longer than the delay duration, if the sampling cycle duration has not been reached, the display data stored in the delayed display task will not be used. This will cause the display data to be lost due to the sampling cycle duration not being reached and the delayed task, thus causing the display interface to not refresh for a long time. Therefore, if the sampling cycle duration has not been reached, it is further determined whether the delay duration has been reached. If the delay duration has been reached, the display data with the latest storage time is obtained from the display data of the updated delayed display task to obtain the target display data, and then the target display data obtained when the delay duration is reached is used to refresh the display interface, thereby avoiding the problem of the display interface not refreshing for a long time.
[0107] S225: When the sampling period is reached, the display data with the latest storage time is obtained from the display data of the updated delayed display task to obtain the second data to be used, and the second data to be used is used as the target display data to execute S226.
[0108] The first data to be used and the second data to be used may be the same or different. Since the sampling period is longer than the delay period, it may happen that the delay period reaches a time earlier than the sampling period. If the display interface has been refreshed using the first data to be used, after obtaining the second data to be used, it is determined whether the similarity between the first data to be used and the second data to be used is less than the similarity threshold. If not, it means that the first data to be used and the second data to be used are the same data. Since the display interface has been refreshed using the first data to be used, and the second data to be used is the same as the first data to be used, if the display interface is refreshed again using the second data to be used, the content in the display interface will not change. Then the second data to be used will not be used to refresh the display interface, that is, the second data to be used will not be used as the target display data, which is conducive to avoiding the waste of computing resources of the system. If yes, it means that the first data to be used and the second data to be used are not the same data, then the second data to be used will be used to refresh the display interface, and the second data to be used will be used as the target display data, thereby effectively avoiding unnecessary interface refresh display.
[0109] S226: Refresh the display interface of CarMediaApp according to the target display data.
[0110] The embodiment of the present application combines the delayed task mechanism and the periodic sampling mechanism for the interface display of CarMediaApp in the field of vehicle-mounted display technology. On the one hand, by setting the delayed display task, it is possible to avoid receiving different display data multiple times in a short period of time, which causes the display interface of CarMediaApp to frequently refresh and change, and cause visual flickering problems. That is, it solves the problem of visual flickering in the display interface of CarMediaApp caused by the MediaSession application in the field of vehicle-mounted display technology frequently updating display data. On the other hand, by setting a data sampling task and setting the sampling period of the data sampling task to be longer than the delay duration of the delayed display task, it is possible to avoid the loss of display data caused by the delayed task, which causes the display interface of CarMediaApp to not refresh for a long time, which is conducive to improving the user experience of CarMediaApp.
[0111] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0112] Figure 7 A schematic diagram of the structure of an interface refresh device provided in an embodiment of the present application is shown. Figure 7 As shown, the interface refreshing device 700 includes:
[0113] A task updating module 710, configured to update the second display data in the delayed display task by using the first display data each time the first display data is received;
[0114] The time judgment module 720 is used to judge whether the sampling period of the data sampling task has been reached; wherein the start time of the data sampling task is the same as the start time of the delayed display task, and the sampling period is longer than the delay period of the delayed display task;
[0115] The data sampling module 730 is used to obtain the display data with the latest storage time from the updated display data of the delayed display task to obtain the target display data when the sampling period is reached;
[0116] The interface refreshing module 740 is used to refresh the display interface according to the target display data.
[0117] In a possible implementation, the task update module 710 is specifically configured to replace the second display data with the first display data to update the delayed display task each time the vehicle media application receives the first display data sent by the media session application.
[0118] In a possible implementation, the task update module 710, in replacing the second display data with the first display data, is further used to: determine the similarity between the first display data and the second display data; if the similarity is less than a similarity threshold, replace the second display data with the first display data.
[0119] In a possible implementation, the interface refresh module 740 is specifically configured to refresh the display interface of the vehicle media application according to the target display data.
[0120] In a possible implementation, the data sampling module 730 is also used to determine whether the delay duration has been reached when the sampling period duration has not been reached; when the delay duration has been reached, the display data with the latest storage time is obtained from the updated display data of the delayed display task to obtain the target display data.
[0121] In one possible implementation, the interface refresh module 740 is specifically used to determine whether the similarity between the first data to be used and the second data to be used is less than a similarity threshold; wherein the first data to be used is the target display data obtained when the delay time is reached, and the second data to be used is the target display data obtained when the sampling period time is reached; if so, refresh the display interface according to the second data to be used.
[0122] In a possible implementation, the task updating module 710 is further configured to reset the delay duration to zero and re-time the delay duration after using the first display data to update the second display data in the delayed display task each time the first display data is received.
[0123] It should be noted that the interface refresh device provided in the above embodiment only uses the division of the above functional modules as an example when executing the interface refresh method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the interface refresh device provided in the above embodiment belongs to the same concept as the interface refresh method embodiment. Therefore, for details not disclosed in the device embodiment of the present application, please refer to the above-mentioned interface refresh method embodiment of the present application, which will not be repeated here.
[0124] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0125] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown. Figure 8As shown, the electronic device 800 includes: a memory 801 and a processor 802, wherein the memory 801 stores an executable program code 8011, and the processor 802 is used to call and execute the executable program code 8011 to perform an interface refresh method.
[0126] In this embodiment, the electronic device can be divided into functional modules according to the above method example. For example, each functional module can be corresponded to, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0127] In the case of dividing each functional module according to each function, the electronic device may include: a task update module, a time judgment module, a data sampling module, an interface refresh module, etc. It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, which will not be repeated here.
[0128] The electronic device provided in this embodiment is used to execute the above-mentioned interface refreshing method, and thus can achieve the same effect as the above-mentioned implementation method.
[0129] In the case of an integrated unit, the electronic device may include a processing module and a storage module. The processing module may be used to control and manage the actions of the electronic device. The storage module may be used to support the electronic device in executing related program codes and data.
[0130] The processing module may be a processor or a controller, which may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module may be a memory.
[0131] This embodiment also provides a computer-readable storage medium, in which a computer program code is stored. When the computer program code is executed on a computer, the computer executes the above-mentioned related method steps to implement an interface refresh method in the above-mentioned embodiment.
[0132] This embodiment also provides a computer program product. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement an interface refresh method in the above-mentioned embodiment.
[0133] In addition, the electronic device provided in the embodiments of the present application may specifically be a chip, component or module, and the electronic device may include a connected processor and memory; wherein the memory is used to store instructions, and when the electronic device is running, the processor may call and execute instructions so that the chip executes an interface refresh method in the above-mentioned embodiments.
[0134] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding interface refresh method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding interface refresh method provided above, and will not be repeated here.
[0135] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0136] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0137] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. An interface refresh method, characterized in that: The interface refreshing method comprises: each time the first display data is received, using the first display data to update the second display data in the delayed display task; Determine whether the sampling cycle duration of the data sampling task has arrived; wherein the start time of the data sampling task is the same as the start time of the delayed display task, and the sampling cycle duration is greater than the delay duration of the delayed display task; When the sampling period is reached, the display data with the latest storage time is obtained from the updated display data of the delayed display task to obtain the target display data; Refresh the display interface according to the target display data.
2. The interface refresh method according to claim 1, characterized in that: In the case where the first display data is received each time, using the first display data to update the second display data in the delayed display task comprises: Each time the vehicle media application receives the first display data sent by the media session application, the second display data is replaced by the first display data to update the delayed display task.
3. The interface refresh method according to claim 2, characterized in that: The using the first display data to replace the second display data comprises: determining a similarity between the first display data and the second display data; If the similarity is less than a similarity threshold, the first display data is used to replace the second display data.
4. The interface refresh method according to claim 2, characterized in that: The refreshing of the display interface according to the target display data comprises: Refresh the display interface of the vehicle media application according to the target display data.
5. The interface refresh method according to claim 1, characterized in that: After determining whether the sampling period of the data sampling task has been reached, the interface refreshing method further includes: If the sampling period has not been reached, determining whether the delay period has been reached; When the delay time is reached, the display data with the latest storage time is acquired from the updated display data of the delayed display task to obtain the target display data.
6. The interface refreshing method according to claim 5, characterized in that: The refreshing of the display interface according to the target display data comprises: Determine whether the similarity between the first data to be used and the second data to be used is less than a similarity threshold; wherein the first data to be used is the target display data obtained when the delay time is reached, and the second data to be used is the target display data obtained when the sampling period time is reached; If so, refresh the display interface according to the second data to be used.
7. The interface refreshing method according to claim 1, characterized in that: In each case where the first display data is received, after the first display data is used to update the second display data in the delayed display task, the interface refreshing method further includes: The delay time is reset to zero, and the delay time is re-timed.
8. An interface refreshing device, characterized in that: The interface refreshing device comprises: a task updating module, configured to update the second display data in the delayed display task by using the first display data each time the first display data is received; A time judgment module, used to judge whether the sampling period of the data sampling task has arrived; wherein the start time of the data sampling task is the same as the start time of the delayed display task, and the sampling period is longer than the delay period of the delayed display task; A data sampling module, configured to obtain, when the sampling period is reached, display data with the latest storage time from the updated display data of the delayed display task to obtain target display data; The interface refresh module is used to refresh the display interface according to the target display data.
9. An electronic device, characterized in that: The electronic device comprises: A memory for storing executable program codes; A processor, used to call and run the executable program code from the memory, so that the electronic device executes the interface refresh method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed, the interface refresh method according to any one of claims 1 to 7 is implemented.