Method and system for obtaining multi-level icons of car machine desktop shortcut and electronic device
Patent Information
- Application Number
- CN202610957400.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-30
- Publication Date
- 2026-09-25
AI Technical Summary
[0008]有鉴于此,本发明的目的在于提供一种车机桌面快捷方式多级图标获取方法、一种车机桌面快捷方式多级图标获取系统、电子设备及存储介质,旨在解决现有Android桌面快捷方式图标获取技术中存在的图标获取成功率低、用户体验差的问题
[0053]本发明通过提高图标获取成功率,具体为通过四层fallback策略(WebView回调→favicon.ico→meta标签→manifest.json),即使前几种方式失败,仍有后续备选方案,大幅提高整体成功率。
Smart Images

Figure CN122816501A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of vehicle-machine interaction technology, and in particular to a method for obtaining multi-level icons of vehicle-machine desktop shortcuts, a system for obtaining multi-level icons of vehicle-machine desktop shortcuts, an electronic device, and a storage medium. Background Technology
[0002] In-vehicle infotainment systems running Android commonly feature a function to create shortcuts to frequently used websites on the home screen. This allows users to generate desktop shortcuts for these websites, enabling one-click access and improving the ease of browsing in the vehicle. However, the website icon is crucial for ensuring visual recognizability and optimizing the overall user experience. Current solutions for obtaining website shortcut icons based on Android WebView suffer from several technical flaws, resulting in poor overall compatibility, stability, and fault tolerance.
[0003] Existing traditional Android WebView icon acquisition methods are relatively simple, supporting only a single channel for fetching webpage icons. This makes them incompatible with the icon configuration standards of various mainstream webpages, and all conventional implementations have significant limitations in applicability. Early mainstream solutions relied on the `WebViewClient.onReceivedIcon()` callback interface to obtain webpage icon resources. This method is entirely dependent on the icon callback result during webpage loading. If the target webpage does not have a favicon, the icon resource loading times out, or fails to load, the resulting desktop shortcut will only display the system default icon or a blank icon, significantly impacting the interface's visual effect and user experience. Other technical solutions directly request the `favicon.ico` file in the website's root directory to obtain the icon. However, with the iterative upgrades of web technology, most modern websites have abandoned the traditional `favicon.ico` icon configuration method, instead adopting newer standards such as Web App Manifest files and webpage meta tags to configure webpage icons. This makes this traditional request method highly likely to fail, resulting in an extremely low icon acquisition success rate.
[0004] To address these issues, two targeted optimization solutions have emerged in existing technologies, but both suffer from limited applicability. The first involves injecting JavaScript to parse the `apple-touch-icon` meta tag in the webpage's HTML to extract icon resources. This solution is only compatible with websites that adhere to Apple's icon specifications and is ineffective for most general websites, severely limiting its applicability. The second solution involves downloading and parsing the `manifest.json` file to obtain icon data. However, not all webpages have this manifest file, and the download process is susceptible to network latency and fluctuations. Furthermore, the file may contain non-standard formats or missing core fields, easily leading to icon parsing failures and overall poor operational stability.
[0005] More critically, existing icon acquisition methods operate independently without coordinated scheduling logic and lack a systematic fallback mechanism. When a single icon acquisition method fails, the system cannot automatically switch to alternative methods for retry. A single link failure is considered a failure to acquire the icon resource, ultimately resulting in the use of a default blank icon, leading to a low overall success rate for displaying web shortcut icons. Furthermore, existing technologies lack independent timeout control mechanisms for each icon acquisition step. When an icon acquisition link experiences network lag, resource blockage, or other anomalies, it continuously occupies the execution thread and blocks the entire shortcut creation process, causing functional response delays, interface lag, and other problems, further degrading the user experience.
[0006] Analysis of the Chromium open-source project's source code reveals that the Android Chrome browser has already implemented a multi-level priority strategy for acquiring webpage icons. This allows for the tiered acquisition of icon resources from multiple channels, coupled with a robust timeout control mechanism, effectively improving icon acquisition success rate and process stability. However, this mature technical solution is only a proprietary implementation within the browser and has not been packaged into a standardized API interface, making it unusable for third-party developers and in-vehicle Android infotainment systems. Furthermore, its internal multi-strategy coordination and scheduling logic, as well as its refined timeout control strategies, lack standardized public documentation, hindering accurate replication and practical application within the industry.
[0007] In summary, current technologies for obtaining webpage shortcut icons in in-vehicle Android infotainment systems generally suffer from numerous technical drawbacks, such as a narrow range of compatible webpage specifications, lack of automatic degradation and fault tolerance mechanisms, easy process blockage, low success rate, and inability to reuse mature solutions. These shortcomings make it difficult to meet the high-quality and high-stability creation requirements of webpage shortcuts in in-vehicle scenarios. Therefore, there is an urgent need to design a systematic icon acquisition solution with multi-level degradation and fault tolerance, step-by-step timeout management, and full-scenario webpage adaptation. Summary of the Invention
[0008] In view of this, the purpose of this invention is to provide a method for obtaining multi-level icons of in-vehicle desktop shortcuts, a system for obtaining multi-level icons of in-vehicle desktop shortcuts, an electronic device and a storage medium, aiming to solve the problems of low icon acquisition success rate and poor user experience in existing Android desktop shortcut icon acquisition technologies.
[0009] This invention provides the following solution:
[0010] According to one aspect of the present invention, a method for obtaining multi-level icons for shortcuts on a vehicle infotainment system desktop is provided, comprising the following steps:
[0011] In response to an icon retrieval request, a preset multi-level icon retrieval strategy with progressively decreasing priority is adopted;
[0012] The first-level icon acquisition strategy is implemented: the target webpage is loaded through the webpage rendering control, and the native icon callback event of the webpage is listened to. If a valid webpage icon resource is successfully obtained, it is cached and saved locally.
[0013] The second-level icon acquisition strategy is executed: based on the target webpage domain, the site's default icon resource is requested, the requested icon file is parsed and decoded, and valid icon image resources are extracted;
[0014] The third-level icon acquisition strategy is implemented: the web page tags are traversed and parsed through script injection, the icon resource addresses corresponding to the preset icon tags on the page are extracted, downloaded and converted to obtain valid icon image resources;
[0015] The fourth-level icon acquisition strategy is executed: the application manifest file address corresponding to the webpage is obtained through script injection, the manifest file is downloaded and parsed, the icon resource set in the manifest is traversed, and the optimal size icon resource is selected and matched in combination with the device display parameters to complete the icon download and image conversion;
[0016] Icon compliance verification and shortcut creation: Perform compliance verification on icon image resources obtained by the preset multi-level icon acquisition strategy and filter valid icons;
[0017] After successful verification, a web desktop shortcut will be created based on the valid icon.
[0018] Furthermore, the execution of the first-level icon retrieval strategy also includes:
[0019] Configure a time-limited execution mechanism for this level of strategy. If a valid icon is not successfully obtained within the preset time, the strategy will automatically switch to the next level of icon acquisition strategy.
[0020] The second-level icon retrieval strategy also includes:
[0021] If a resource request times out, fails, or is parsed abnormally, it will automatically downgrade to the next level of icon retrieval strategy.
[0022] The third-level icon retrieval strategy also includes:
[0023] If the page does not have a corresponding icon label, the resource download fails, or the execution times out, the system will automatically downgrade to the next level of icon acquisition strategy.
[0024] The fourth-level icon retrieval strategy also includes:
[0025] If the manifest file does not exist, there is a parsing error, or the execution times out, then all multi-level icon retrieval strategies are deemed to have failed.
[0026] Furthermore, it also includes:
[0027] If a compliance icon is not obtained after the multi-level strategy traversal is completed, the system default icon will be used to create the shortcut.
[0028] Furthermore, the preset multi-level icon retrieval strategy with progressively decreasing priority includes:
[0029] The strategy retrieves the icon acquisition schemes at each level in the strategy list in sequence according to the strategy index.
[0030] If any level of strategy times out or fails to execute, the strategy index will be automatically incremented, and the next level of strategy will be switched to execute.
[0031] If no compliant icon is obtained after the preset multi-level icon acquisition strategy has been executed, the icon acquisition process will be terminated.
[0032] Furthermore, the time-limited execution mechanism of the preset multi-level icon acquisition strategy is implemented through the Android system's Handler.postDelayed delay scheduling mechanism;
[0033] When the icon acquisition strategy for each level is started, a timeout callback task with a preset delay duration is delivered.
[0034] If the current strategy successfully obtains a valid icon, the timeout callback task is removed to terminate the downgrade logic;
[0035] If no valid icon is obtained within the preset time, a timeout callback will be triggered to automatically execute the strategy downgrade switching.
[0036] Furthermore, the criteria for determining icon compliance include:
[0037] The icon size is no smaller than the preset size, and the icon format is the preset format;
[0038] Only icons that meet both the size and format requirements are considered valid icons.
[0039] Furthermore, the fourth-level icon acquisition strategy, which combines device display parameters to filter for the optimal icon, includes:
[0040] Sort all icon resources in the icons array of the manifest file in descending order of size, and prioritize the selection of icon resources that are adapted to the density of the vehicle screen and whose size meets the minimum compliance standards.
[0041] According to a second aspect of the present invention, a multi-level icon retrieval system for vehicle infotainment desktop shortcuts is provided, comprising:
[0042] The system includes a strategy loading module, a first-level icon acquisition module, a second-level icon acquisition module, a third-level icon acquisition module, a fourth-level icon acquisition module, and a shortcut creation module.
[0043] The strategy loading module is used to respond to icon retrieval requests and retrieve preset multi-level icon retrieval strategies with progressively decreasing priority.
[0044] The first-level icon acquisition module is used to load the target webpage through the webpage rendering control and listen for the webpage's native icon callback event. If a valid webpage icon resource is successfully acquired, it is cached and saved locally.
[0045] The second-level icon acquisition module is used to request the site's default icon resources based on the target webpage domain name, parse and decode the requested icon files, and extract valid icon image resources.
[0046] The third-level icon acquisition module is used to traverse and parse web page tags through script injection, extract the icon resource address corresponding to the preset icon tag on the page, download and convert it to obtain a valid icon image resource;
[0047] The fourth-level icon acquisition module is used to obtain the application manifest file address corresponding to the webpage through script injection, download and parse the manifest file, traverse the icon resource set in the manifest, and filter and match the optimal size icon resource in combination with the device display parameters to complete the icon download and image conversion.
[0048] The shortcut creation module is used to perform compliance verification on icon image resources obtained through multi-level policies and filter valid icons; after the verification is passed, a web desktop shortcut is created based on the valid icon.
[0049] According to three aspects of the present invention, an electronic device is provided, comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0050] The memory stores a computer program, and when the computer program is executed by the processor, it causes the processor to execute the steps of a method for retrieving multi-level icons for shortcuts on the vehicle's desktop.
[0051] According to four aspects of the present invention, a computer-readable storage medium is provided, which stores a computer program executable by an electronic device, such that when the computer program is run on the electronic device, the electronic device performs the steps of a method for retrieving multi-level icons for shortcuts on a vehicle infotainment system desktop.
[0052] Compared with the prior art, the present invention has the following advantages:
[0053] This invention improves the success rate of icon retrieval by employing a four-layer fallback strategy (WebView callback → favicon.ico → meta tag → manifest.json). Even if the first few methods fail, there are still alternative solutions, significantly improving the overall success rate.
[0054] This invention sets a preset timeout threshold for each level of strategy to avoid prolonged blocking of a single step and ensure the response speed of the shortcut creation process.
[0055] This invention verifies the final obtained bitmap using LauncherAppsService (≥48×48 dp, PNG / WEBP format) to ensure icon clarity and compatibility.
[0056] This invention supports both the traditional favicon.ico and the modern Web App Manifest standard, making it compatible with various types of websites.
[0057] This invention uses the ShortcutHelper class to coordinate the entire icon acquisition process, simplifying the process for developers to obtain high-quality icons. Attached Figure Description
[0058] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0059] Figure 1 This is a flowchart of a method for obtaining multi-level icons for shortcuts on a vehicle infotainment system desktop, provided by one or more embodiments of the present invention.
[0060] Figure 2 This is a structural diagram of a multi-level icon retrieval system for vehicle desktop shortcuts provided by one or more embodiments of the present invention.
[0061] Figure 3This is a block diagram of an electronic device structure for a method of obtaining multi-level icons for shortcuts on a vehicle infotainment desktop, provided by one or more embodiments of the present invention. Detailed Implementation
[0062] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0063] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to limit the invention. The singular forms “a,” “the,” and “the” as used in the embodiments of this invention and the appended claims are also intended to include the plural forms, and “multiple” generally includes at least two unless the context clearly indicates otherwise.
[0064] Figure 1 This is a flowchart of a method for obtaining multi-level icons for shortcuts on a vehicle infotainment system desktop, provided by one or more embodiments of the present invention.
[0065] Strategy acquisition step S1: In response to the icon acquisition request, acquire a preset multi-level icon acquisition strategy with progressively decreasing priority.
[0066] Step S2 of the first-level icon acquisition strategy: Load the target webpage through the webpage rendering control and listen for the webpage's native icon callback event. If a valid webpage icon resource is successfully obtained, it is cached and saved locally.
[0067] Configure a time-limited execution mechanism for this level of strategy. If a valid icon is not successfully obtained within the preset time, the strategy will automatically switch to the next level of icon acquisition strategy.
[0068] Step S3 of the second-level icon acquisition strategy: Request the site's default icon resource based on the target webpage domain, parse and decode the requested icon file, and extract the valid icon image resource;
[0069] If a resource request times out, fails, or is parsed abnormally, it will automatically downgrade to the next level of icon retrieval strategy.
[0070] Step S4 of the third-level icon acquisition strategy: Iterate and parse the web page tags through script injection, extract the icon resource address corresponding to the preset icon tag on the page, download and convert it to obtain a valid icon image resource;
[0071] If the page does not have a corresponding icon label, the resource download fails, or the execution times out, the system will automatically downgrade to the next level of icon acquisition strategy.
[0072] Step S5 of the fourth-level icon acquisition strategy: Obtain the application manifest file address corresponding to the webpage through script injection, download and parse the manifest file, traverse the icon resource set in the manifest, filter and match the optimal size icon resource in combination with the device display parameters, and complete the icon download and image conversion;
[0073] If the manifest file does not exist, there is a parsing error, or the execution times out, then all multi-level icon retrieval strategies are deemed to have failed.
[0074] Icon compliance verification and shortcut creation step S6: Perform compliance verification on the icon image resources obtained by the preset multi-level icon acquisition strategy and filter valid icons;
[0075] After successful verification, a web desktop shortcut will be created based on the valid icon.
[0076] If a compliance icon is not obtained after the multi-level strategy traversal is completed, the system default icon will be used to create the shortcut.
[0077] In one embodiment, the preset multi-level icon acquisition strategy with progressively decreasing priority includes:
[0078] The strategy retrieves the icon acquisition schemes at each level in the strategy list in sequence according to the strategy index.
[0079] If any level of strategy times out or fails to execute, the strategy index will be automatically incremented, and the next level of strategy will be switched to execute.
[0080] If no compliant icon is obtained after the preset multi-level icon acquisition strategy has been executed, the icon acquisition process will be terminated.
[0081] In one embodiment, the time-limited execution mechanism of the preset multi-level icon acquisition strategy is implemented through the Android system's Handler.postDelayed delay scheduling mechanism;
[0082] When the icon acquisition strategy for each level is started, a timeout callback task with a preset delay duration is delivered.
[0083] If the current strategy successfully obtains a valid icon, the timeout callback task is removed to terminate the downgrade logic;
[0084] If no valid icon is obtained within the preset time, a timeout callback will be triggered to automatically execute the strategy downgrade switching.
[0085] The criteria for determining icon compliance include:
[0086] The icon size is no smaller than the preset size, and the icon format is the preset format;
[0087] Only icons that meet both the size and format requirements are considered valid icons.
[0088] In one embodiment, the fourth-level icon acquisition strategy, which combines device display parameters to filter for the optimal icon, includes:
[0089] Sort all icon resources in the icons array of the manifest file in descending order of size, and prioritize the selection of icon resources that are adapted to the density of the vehicle screen and whose size meets the minimum compliance standards.
[0090] Figure 2 This is a structural diagram of a multi-level icon retrieval system for vehicle desktop shortcuts provided by one or more embodiments of the present invention.
[0091] like Figure 2 As shown, it includes:
[0092] The system includes a strategy loading module, a first-level icon acquisition module, a second-level icon acquisition module, a third-level icon acquisition module, a fourth-level icon acquisition module, and a shortcut creation module.
[0093] The strategy loading module is used to respond to icon retrieval requests and retrieve preset multi-level icon retrieval strategies with progressively decreasing priority.
[0094] The first-level icon acquisition module is used to load the target webpage through the webpage rendering control and listen for the webpage's native icon callback event. If a valid webpage icon resource is successfully acquired, it is cached and saved locally.
[0095] The second-level icon acquisition module is used to request the site's default icon resources based on the target webpage domain name, parse and decode the requested icon files, and extract valid icon image resources.
[0096] The third-level icon acquisition module is used to traverse and parse web page tags through script injection, extract the icon resource address corresponding to the preset icon tag on the page, download and convert it to obtain a valid icon image resource;
[0097] The fourth-level icon acquisition module is used to obtain the application manifest file address corresponding to the webpage through script injection, download and parse the manifest file, traverse the icon resource set in the manifest, and filter and match the optimal size icon resource in combination with the device display parameters to complete the icon download and image conversion.
[0098] The shortcut creation module is used to perform compliance verification on icon image resources obtained through multi-level policies and filter valid icons; after the verification is passed, a web desktop shortcut is created based on the valid icon.
[0099] It is worth noting that although only some basic functional modules are disclosed in this embodiment, it does not mean that the composition of this system is limited to the above-mentioned basic functional modules. On the contrary, what this embodiment intends to express is that, based on the above-mentioned basic functional modules, those skilled in the art can arbitrarily add one or more functional modules in combination with existing technology to form an infinite number of embodiments or technical solutions. That is to say, this system is open rather than closed. The fact that this embodiment only discloses a few basic functional modules does not mean that the scope of protection of the claims of this invention is limited to the disclosed basic functional modules. At the same time, for the convenience of description, the above device is described separately according to its functions as various units and modules. Of course, in implementing this invention, the functions of each unit and module can be implemented in one or more software and / or hardware.
[0100] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0101] One embodiment discloses a method and system for obtaining multi-level icons for Android desktop shortcuts. By combining a multi-level progressive icon acquisition strategy with a timeout degradation mechanism, it achieves accurate and efficient acquisition of web-based desktop shortcut icons while ensuring smooth operation of the application's main thread and adapting to different web icon configuration scenarios. The specific implementation steps are as follows:
[0102] Step 1: Initialize the Icon Acquisition Coordinator. The system first creates an instance of the `ShortcutHelper` class, which serves as the core coordination unit, fully responsible for coordinating the entire process of acquiring desktop shortcut icons. The icon acquisition coordinator maintains an ordered list of icon acquisition strategies, with four preset priority levels that decrease progressively. It also tracks and records the index of the currently executing strategy in real time, ensuring that strategies at each level are executed in an orderly and precise manner according to the preset order, providing scheduling support for subsequent multi-level strategy execution.
[0103] Step Two: Execute the first-level icon acquisition strategy – WebView callback acquisition. The coordinator schedules the execution of the first-level priority strategy, loading the target webpage resource by calling the WebView.loadUrl() method, and simultaneously registering the WebViewClient.onReceivedIcon() icon receiving callback interface for the WebView component. Once the WebView successfully parses and receives the icon resource from the target webpage, it immediately saves the acquired icon bitmap resource to the device's local storage, completing this level of icon acquisition. To avoid single-level strategy lag causing overall process blockage, this embodiment configures a 500ms timeout timer for this strategy. The timing mechanism controls the strategy execution duration; if a valid icon resource is not successfully acquired within 500ms, this level of strategy is automatically terminated, and the process switches to the second-level icon acquisition strategy.
[0104] Step 3: Execute the second-level icon acquisition strategy – favicon.ico request. If the first-level strategy times out or fails to acquire the icon, the system automatically triggers the second-level strategy. First, based on the target webpage's host domain name (host), a standard favicon.ico request URL is constructed and sent to the server via an HTTP GET request. After receiving the resource file returned by the server, the ICO and PNG format icon files are parsed, and suitable bitmap icon resources of appropriate size for the device's display requirements are selected and extracted. Similarly, this level of strategy is also configured with a 500ms timeout mechanism. If the request, parsing, and resource acquisition process is not completed within the specified time, this level of strategy is deemed invalid, and the third-level strategy execution process is automatically initiated.
[0105] Step Four: Execute the third-level icon acquisition strategy – meta tag injection and reading. If the second-level strategy fails or times out, the third-level strategy is activated. The system injects custom JavaScript code into the WebView of the currently loaded webpage. The JS script traverses and parses the HTML document structure, accurately reading the exclusive meta tags with the name attribute of apple-touch-icon and msapplication-TileImage, and extracting the content attribute value of the corresponding tag. This attribute value is the URL of the high-definition icon resource for the webpage. Then, based on the obtained icon URL, a resource download request is initiated, and the downloaded icon file is converted into a usable bitmap resource. This level of strategy continues the unified 500ms timeout control logic; if a valid icon is not obtained within the timeout, it automatically degrades to the fourth-level acquisition strategy.
[0106] Step 5: Execute the fourth-level icon acquisition strategy – parsing and retrieving the manifest.json file. If the first three strategies time out or fail, the system triggers the final fallback fourth-level strategy. By injecting JavaScript code into the WebView, the URL of the manifest.json configuration file corresponding to the webpage is parsed and obtained. After downloading the configuration file, the JSON data is structured and parsed. The icons array in the configuration file is traversed, sorted in descending order based on the icons' sizes attribute, and combined with the screen density parameters of the current Android device and the desktop Launcher display specifications, the optimal matching icon resource URL is selected. Finally, the corresponding icon resource is downloaded and converted to standard bitmap format, completing the multi-level fallback acquisition strategy.
[0107] Step Six: Icon Verification and Desktop Shortcut Creation Submission. After obtaining icons through multi-level strategies, the system verifies the compliance of the final bitmap icon resources. Core verification dimensions include icon size and file format: the minimum icon size is required to be 48×48 dp, and the file format is limited to PNG or WEBP, two common high-definition formats. If the icon resource verification is successful, the system calls the Android system's native ShortcutManager.createShortcutWithIcon() API interface to bind the compliant icon and create the desktop shortcut. If verification fails, the icon acquisition process is deemed invalid, and a default placeholder icon fallback logic may be triggered.
[0108] To ensure the overall stability, efficiency, and adaptability of the method, this embodiment includes optimizations to several technical implementation details, as follows:
[0109] Asynchronous decoupling mechanism: The icon acquisition strategy at all levels adopts an asynchronous callback execution mechanism. All time-consuming operations such as network requests, JS injection, resource parsing, and file reading and writing are executed in a child thread, completely avoiding the main thread blocking problem, ensuring the smooth operation of Android application UI, and avoiding problems such as lag and ANR exceptions.
[0110] Precise timeout degradation mechanism: The Handler.postDelayed() delayed message mechanism is used to control the timeout of each level of strategy by 500ms. After the timeout, the current invalid task is terminated immediately, resources are cleared and the next level of strategy is automatically switched to ensure that the overall icon acquisition process proceeds efficiently and without the accumulation of invalid time consumption.
[0111] Icon caching optimization: The system has a built-in Least Recently Used (LRU) caching strategy to cache bitmap icon resources that have been successfully downloaded and parsed locally. For repeatedly accessed web page resources, the cached icons can be read directly without repeatedly initiating network requests and parsing operations, which greatly improves the efficiency of shortcut creation and reduces device traffic and performance consumption.
[0112] Network request optimization: All icon resource network requests are implemented based on the OkHttp library, which natively supports the HTTP / 2 protocol and network connection reuse capabilities, effectively reducing network request latency, reducing handshake overhead, improving the success rate and stability of icon resource downloads, and adapting to complex network environments.
[0113] Multi-dimensional size adaptation: During the icon selection and size adaptation process, multiple parameters such as device screen density, system desktop launcher icon display specifications, and shortcut size standards are comprehensively considered to accurately match the optimal icon resources, avoid display abnormalities such as blurry icons, stretching, and size mismatch, and ensure that the desktop shortcut icons display uniformly and in high definition.
[0114] In one implementation, the technical solution of this invention can be directly applied to Android native browser applications to automatically acquire and create high-quality icons for web pages and PWA application desktop shortcuts. In this embodiment, the browser application implements all the core multi-level icon acquisition logic of this invention through the WebappInstallCoordinator.java class, with the core code logic located on line 327 of that class.
[0115] The specific implementation process is as follows: When a user clicks the "Add to Home Screen" button on the page in the browser, the application automatically initializes and creates a ShortcutHelper core coordination instance. This instance schedules and executes a preset four-level progressive icon acquisition strategy, sequentially completing the acquisition of WebView callback icons, favicon.ico resource requests, parsing of webpage meta tag icons, and icon adaptation selection in manifest.json configuration files. The entire process relies on an asynchronous callback mechanism and a 500ms timeout fallback mechanism to automatically avoid abnormal issues such as single strategy acquisition failure, network latency, and missing webpage icon configurations.
[0116] Based on actual device adaptation tests and data statistics, compared to the traditional single favicon.ico icon acquisition strategy with a success rate of 65%, the multi-level strategy adaptation scheme of this invention can effectively increase the success rate of browser desktop shortcut icon acquisition to 98%, greatly solving common industry problems such as webpage icon loading failure, blurry icons, adaptation anomalies, and missing shortcut icons, and significantly improving the user experience.
[0117] In one embodiment, third-party Android browser developers can integrate the ShortcutHelper class of this invention. First, the CREATE_SHORTCUT permission is declared in AndroidManifest.xml, and then the ShortcutHelper.createShortcut() method is called in WebViewActivity. This method automatically handles all icon retrieval logic, and developers do not need to concern themselves with the specific implementation details.
[0118] It should be noted that the scope of protection of this invention is not limited to the limitations disclosed in this embodiment. All equivalent modifications made without changing the core technical solution or weakening the technical advantages of this invention fall within the scope of protection of this invention: the timeout threshold can be flexibly configured within the range of 300ms to 1000ms; the execution order of the four fallback acquisition methods can be adjusted, but all four acquisition paths must be fully retained; the icon verification rules can be compatible with more image formats such as JPEG, and the core verification logic remains unchanged; a fifth acquisition strategy can also be added, namely, searching for common icon files such as logo.png and icon.png in the root directory of the website; the coordinator scheduling logic can be replaced with an observer pattern, state machine pattern, or other architectures, with only the internal implementation form being different, and the overall business function goal remaining unchanged.
[0119] Figure 3 This is a block diagram of an electronic device structure for a method of obtaining multi-level icons for shortcuts on a vehicle infotainment desktop, provided by one or more embodiments of the present invention.
[0120] like Figure 3 As shown, the present invention provides an electronic device, including: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0121] The memory stores a computer program, which, when executed by the processor, causes the processor to perform steps of a method for retrieving multi-level icons for shortcuts on the vehicle's desktop.
[0122] The present invention also provides a computer-readable storage medium storing a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform the steps of a method for retrieving multi-level icons for a vehicle desktop shortcut.
[0123] For the sake of simplicity, the method embodiments are described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0124] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that the present invention can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0125] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for obtaining multi-level icons for shortcuts on a vehicle infotainment system desktop, characterized in that, Includes the following steps: In response to an icon retrieval request, a preset multi-level icon retrieval strategy with progressively decreasing priority is adopted; The first-level icon acquisition strategy is implemented: the target webpage is loaded through the webpage rendering control, and the native icon callback event of the webpage is listened to. If a valid webpage icon resource is successfully obtained, it is cached and saved locally. The second-level icon acquisition strategy is executed: based on the target webpage domain, the site's default icon resource is requested, the requested icon file is parsed and decoded, and valid icon image resources are extracted; The third-level icon acquisition strategy is implemented: the web page tags are traversed and parsed through script injection, the icon resource addresses corresponding to the preset icon tags on the page are extracted, downloaded and converted to obtain valid icon image resources; The fourth-level icon acquisition strategy is executed: the application manifest file address corresponding to the webpage is obtained through script injection, the manifest file is downloaded and parsed, the icon resource set in the manifest is traversed, and the optimal size icon resource is selected and matched in combination with the device display parameters to complete the icon download and image conversion; Icon compliance verification and shortcut creation: Perform compliance verification on icon image resources obtained by the preset multi-level icon acquisition strategy and filter valid icons; After successful verification, a web desktop shortcut will be created based on the valid icon.
2. The method for obtaining multi-level icons for vehicle infotainment desktop shortcuts according to claim 1, characterized in that, The execution of the first-level icon acquisition strategy also includes: Configure a time-limited execution mechanism for this level of strategy. If a valid icon is not successfully obtained within the preset time, the strategy will automatically switch to the next level of icon acquisition strategy. The second-level icon acquisition strategy also includes: If a resource request times out, fails, or is parsed abnormally, it will automatically downgrade to the next level of icon retrieval strategy. The strategy for obtaining the third-level icon also includes: If the page does not have a corresponding icon label, the resource download fails, or the execution times out, the system will automatically downgrade to the next level of icon acquisition strategy. The fourth-level icon acquisition strategy also includes: If the manifest file does not exist, there is a parsing error, or the execution times out, then all multi-level icon retrieval strategies are deemed to have failed.
3. The method for obtaining multi-level icons for shortcuts on a vehicle infotainment system desktop according to claim 1, characterized in that, Also includes: If a compliance icon is not obtained after the multi-level strategy traversal is completed, the system default icon will be used to create the shortcut.
4. The method for obtaining multi-level icons for shortcuts on a vehicle infotainment system desktop according to claim 1, characterized in that, The preset multi-level icon acquisition strategy with progressively decreasing priority includes: The strategy retrieves the icon acquisition schemes at each level in the strategy list in sequence according to the strategy index. If any level of strategy times out or fails to execute, the strategy index will be automatically incremented, and the next level of strategy will be switched to execute. If no compliant icon is obtained after the preset multi-level icon acquisition strategy has been executed, the icon acquisition process will be terminated.
5. The method for obtaining multi-level icons for vehicle infotainment desktop shortcuts according to claim 2, characterized in that, include: The timed execution mechanism of the preset multi-level icon retrieval strategy is implemented through the Android system's Handler.postDelayed delay scheduling mechanism; When the icon acquisition strategy for each level is started, a timeout callback task with a preset delay duration is delivered. If the current strategy successfully obtains a valid icon, the timeout callback task is removed to terminate the downgrade logic; If no valid icon is obtained within the preset time, a timeout callback will be triggered to automatically execute the strategy downgrade switching.
6. The method for obtaining multi-level icons for vehicle infotainment desktop shortcuts according to claim 1, characterized in that, The criteria for determining the compliance of the icons include: The icon size is no smaller than the preset size, and the icon format is the preset format; Only icons that meet both the size and format requirements are considered valid icons.
7. The method for obtaining multi-level icons for vehicle infotainment desktop shortcuts according to claim 1, characterized in that, The fourth-level icon acquisition strategy, which combines device display parameters to filter for the optimal icon, includes: Sort all icon resources in the icons array of the manifest file in descending order of size, and prioritize the selection of icon resources that are adapted to the density of the vehicle screen and whose size meets the minimum compliance standards.
8. A system for retrieving multi-level icons for shortcuts on a vehicle infotainment system desktop, characterized in that, The system is used to perform the acquisition method according to any one of claims 1-7, including: The system includes a strategy loading module, a first-level icon acquisition module, a second-level icon acquisition module, a third-level icon acquisition module, a fourth-level icon acquisition module, and a shortcut creation module. The strategy loading module is used to respond to the icon acquisition request and acquire a preset multi-level icon acquisition strategy with progressively decreasing priority. The first-level icon acquisition module is used to load the target webpage through the webpage rendering control and listen for the webpage's native icon callback event. If a valid webpage icon resource is successfully acquired, it is cached and saved locally. The second-level icon acquisition module is used to request the site's default icon resources based on the target webpage domain name, parse and decode the requested icon files, and extract valid icon image resources; The third-level icon acquisition module is used to traverse and parse web page tags through script injection, extract icon resource addresses corresponding to preset icon tags on the page, download and convert them to obtain valid icon image resources. The fourth-level icon acquisition module is used to obtain the application manifest file address corresponding to the webpage through script injection, download and parse the manifest file, traverse the icon resource set in the manifest, and filter and match the optimal size icon resource in combination with the device display parameters to complete icon download and image conversion. The shortcut creation module is used to perform compliance verification on icon image resources obtained by multi-level policies and filter valid icons; after the verification is passed, a web desktop shortcut is created based on the valid icons.
9. An electronic device, characterized in that, include: The processor, communication interface, memory, and communication bus are connected, with the processor, communication interface, and memory communicating with each other via the communication bus. The memory stores a computer program, which, when executed by the processor, causes the processor to perform the steps of the method for obtaining multi-level icons for shortcuts on a vehicle infotainment desktop as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, It stores a computer program that can be executed by an electronic device. When the computer program runs on the electronic device, it causes the electronic device to perform the steps of the method for obtaining multi-level icons for shortcuts on a vehicle desktop as described in any one of claims 1-7.