CN114996226B - Icon detection method, electronic device, readable storage medium, and program product - Google Patents

Icon detection method, electronic device, readable storage medium, and program product Download PDF

Info

Publication number
CN114996226B
CN114996226B CN202111307392.2A CN202111307392A CN114996226B CN 114996226 B CN114996226 B CN 114996226B CN 202111307392 A CN202111307392 A CN 202111307392A CN 114996226 B CN114996226 B CN 114996226B
Authority
CN
China
Prior art keywords
file
icon
icon file
original
mirror image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111307392.2A
Other languages
Chinese (zh)
Other versions
CN114996226A (en
Inventor
石英男
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202111307392.2A priority Critical patent/CN114996226B/en
Publication of CN114996226A publication Critical patent/CN114996226A/en
Application granted granted Critical
Publication of CN114996226B publication Critical patent/CN114996226B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/1734Details of monitoring file system events, e.g. by the use of hooks, filter drivers, logs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/148File search processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/164File meta data generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/173Customisation support for file systems, e.g. localisation, multi-language support, personalisation

Abstract

The embodiment of the application is applicable to the technical field of electronics, and provides an icon detection method, electronic equipment, a readable storage medium and a program product. The method comprises the steps of obtaining data to be detected, wherein the data to be detected comprises an original icon file, and the original icon file refers to an icon file which is not subjected to mirror image processing; if the original icon file is determined to be the icon file needing mirror image display, acquiring a target calling file in the data to be detected according to first identification information of the original icon file, wherein the target calling file is a file for calling the icon file according to the first identification information to display the icon; and determining whether the original icon file is subjected to mirror image processing or not according to the target calling file and/or the first identification information. The icon detection method provided by the embodiment of the application can improve the icon detection efficiency.

Description

Icon detection method, electronic device, readable storage medium, and program product
Technical Field
The embodiment of the application relates to the field of electronic technology, and in particular, to an icon detection method, an electronic device, a readable storage medium, and a program product.
Background
There are many languages in the world, and the reading and writing habits are different. For example, one language is languages such as chinese, english, japanese, etc. that are read and written from Left To Right (LTR). For such languages, the LTR layout is adopted for the display interface of the terminal device, that is, the characters are left-aligned, and the direction of the characters is from left to right, and meanwhile, the icons in the display interface also need to be designed according to the use habits of the user. For example, another language is a Right To Left (RTL) reading and writing language such as arabic, bosch, urdon, hebrew, uygur, etc. For such languages, the display interface of the terminal device adopts an RTL layout, that is, the characters are aligned right and the direction of the characters is from right to left, and meanwhile, some icons in the display interface need to be mirrored to meet the habit of the user.
However, in the development process of the display interface of the complex language, due to various reasons, some icons that need to be mirrored are not mirrored, and finally, the icons in the display interface of the terminal device in the complex language are displayed incorrectly, which affects user experience. Therefore, the icons in the display interface in the complex language need to be detected to ensure the correctness of the icons.
In the related art, the detection of the icon is mainly realized through manual detection. The problem of low detection efficiency exists in manual detection.
Disclosure of Invention
The embodiment of the application provides an icon detection method, an icon detection device, electronic equipment, a chip, a computer readable storage medium and a computer program product, which can automatically detect whether an icon file needing mirror image display in a display interface is mirror image or not, and improve the icon detection efficiency.
In a first aspect, a method for detecting an icon is provided, where the method includes:
acquiring data to be detected, wherein the data to be detected comprises an original icon file, and the original icon file refers to an icon file which is not subjected to mirror image processing; if the original icon file is determined to be the icon file needing mirror image display, acquiring a target calling file in the data to be detected according to first identification information of the original icon file, wherein the target calling file is a file for calling the icon file according to the first identification information to display the icon; and determining whether the original icon file is subjected to mirror image processing or not according to the target calling file and/or the first identification information.
Optionally, the data to be detected may be code data of a certain function module in an Android system. The original icon file may include an original Portable Network Graphics (PNG) icon file and an original renderable vector graphics (DVG) icon file. The format of the PNG icon file is PNG format, and the format of the DVG icon file is XML format. The data to be detected can be scanned, the original PNG icon file and the original DVG icon file are respectively obtained, and the original PNG icon file and the original DVG icon file are respectively judged.
The target call file may include a first target call file in XML format and a second target call file in JAVA format.
Optionally, the identification information of the mirror image icon file of the original icon file and the identification information of the original icon file may be the same, and are both the first identification information. The icon file called by the target calling file through the first identification information may be an original icon file or a mirror image icon file of the original icon file. Alternatively, the first identification information may be an icon name of the original icon file.
In the icon detection method provided by the first aspect, the data to be detected is acquired, the target call file is acquired in the data to be detected according to the first identification information of the original icon file under the condition that the original icon file in the data to be detected is the icon file needing mirror image display, and further whether mirror image processing is performed on the original icon file is determined according to at least one of the target call file and the first identification information based on the data to be detected. The icon detection method can automatically detect whether the original icon file is subjected to mirror image processing or not, manual detection is not needed, all the original icon files in the code data to be detected can be detected, omission phenomenon cannot occur, and comprehensive coverage of icon file detection needing mirror image processing is achieved. In addition, compared with manual detection, the method provided by the embodiment can realize rapid detection. In short, the method provided by the embodiment can improve the efficiency of icon detection.
In one possible implementation manner, determining whether an original icon file is subjected to mirroring processing according to a target call file and first identification information includes:
determining whether the original icon file is subjected to mirror image processing before the icon file is called by the target calling file according to the target calling file and/or the first identification information; and if the original icon file is determined not to be subjected to mirror image processing before the target calling file calls the icon file, determining whether mirror image processing is performed on the original icon file in the process of calling the icon file by the target calling file according to the target calling file.
In the implementation mode, whether the original icon file is subjected to mirror image processing before calling can be detected, and if the original icon file is not subjected to mirror image processing before calling, whether the original icon file is subjected to mirror image processing in the process that the target calling file calls the icon file is further determined. Therefore, multiple links of mirror image processing in the mirror image processing rule based on the Android system can be covered, detection omission is reduced, and the accuracy of icon detection is further improved.
In one possible implementation manner, the mirror image icon file of the original icon file is the same as the identification information of the original icon file, and the target calling file comprises a first target calling file with a first preset format; determining whether the original icon file is subjected to mirror image processing before the target calling file calls the icon file according to the target calling file and/or the first identification information, wherein the method comprises the following steps:
if at least one of the target conditions is met, determining that the original icon file is subjected to mirror image processing before the target calling file calls the icon file;
the target conditions include: an icon file with identification information being first identification information is stored in a target folder in the data to be detected, and the target folder is used for storing a mirror image icon file; the first target calling file comprises preset mirror image attribute information, and the preset mirror image attribute information is used for representing that the icon file called by the first target calling file is an icon file subjected to mirror image processing.
Optionally, the preset mirror attribute information may be "auto mirror =" true "", or other key statements that characterize the mirror attribute.
In one possible implementation, the folder name of the target folder includes a preset keyword.
Alternatively, the preset keyword may be, for example, "-ldrtl".
In one possible implementation, the format of the original icon file is a first preset format or a second preset format.
In one possible implementation, the first preset format is an XML format, and the second preset format is a PNG format.
According to an icon file mirroring principle before calling in an Android system, storing an icon file subjected to mirroring in a preset target folder, and if the icon file called by a first target calling file in an XML format is the icon file subjected to mirroring, enabling the first target calling file to comprise preset mirror image attribute information. Therefore, in this implementation manner, if the icon file with the identification information being the first identification information is stored in the target folder in the data to be detected, and/or the first target call file includes the preset mirror image attribute information, it is determined that the original icon file has been subjected to mirror image processing before the target call file calls the icon file. The icon detection method provided by the implementation mode is based on the icon file mirror image principle before calling in the Android system, and the link of the icon file mirror image before calling is backtracked and detected, so that whether the link carries out mirror image processing on the original icon file or not can be accurately determined, and the accuracy of icon detection is improved.
In a possible implementation manner, the format of the original icon file is a first preset format, and the target condition further includes: one icon file of the icon files with the first identification information as the identification information comprises preset mirror image attribute information.
Further, according to the icon file mirroring principle before calling in the Android system, the icon file (including the DVG icon file) in the XML format subjected to mirroring also includes preset mirroring attribute information. Thus, in this implementation, for the original icon file in the XML format, the target condition further includes that one of the icon files whose identification information is the first identification information includes the preset mirror image attribute information. Therefore, whether the original icon file in the XML format is subjected to mirror image processing before calling can be more accurately determined, and the accuracy of icon detection is further improved.
In a possible implementation manner, determining whether an original icon file is subjected to mirror image processing in a process of calling the icon file by a target calling file according to the target calling file includes:
if the target calling file comprises a second target calling file and the second target calling file comprises preset mirror image processing information, determining that the original icon file is subjected to mirror image processing in the process of calling the icon file by the target calling file, wherein the format of the second target calling file is a third preset format, and the preset mirror image processing information is used for indicating that the original icon file is subjected to mirror image processing.
In a possible implementation manner, the third preset format is a JAVA format.
In some practical usage scenarios, the icon files in some functional modules of the Android system may not be called, and are redundant icon files. The redundant icon file is not displayed on the interface, so that the mirror image processing is not needed, and the detection is not needed. In the implementation mode, the original icon file is subjected to mirror image processing in the process of determining the target call file to call the icon file only under the condition that the call icon file comprises the second target call file, namely under the condition that the original icon file is called by the JAVA target call file. Therefore, redundant icon files can be prevented from being used as icon files needing mirror image detection, and the accuracy of icon detection results is improved.
In a possible implementation manner, determining that an original icon file is an icon file that needs to be subjected to mirror image display includes:
preprocessing the original icon file to obtain a standard icon file, wherein the standard icon file is a visual icon file, and the format of the standard icon file is a second preset format; inputting the standard icon file into a preset icon classification model, determining that the original icon file is one of icon files of preset types according to an output result of the preset icon classification model, and determining that the original icon file is the icon file needing mirror image display; the preset type of icon file is the icon file needing mirror image display.
Optionally, the preset icon classification model may include classification submodels corresponding to the preset types. The classification submodel corresponding to the preset type can be a convolutional neural network deep learning model based on a residual error network.
In the implementation mode, the original icon file is input into the preset icon classification model for classification after being preprocessed, whether the original icon file is an icon needing mirror image display or not can be determined quickly and accurately, and the icon detection efficiency is further improved. In addition, the original icon file is preprocessed, so that the number of channels, the size and the like of icons input into the preset icon classification model are unified, the preset icon classification model is convenient to recognize and process, and the speed and the accuracy of the icon classification model classification processing are improved.
In a possible implementation manner, preprocessing an original icon file to obtain a standard icon file includes:
if the original icon file is a non-visual icon file, performing visual processing on the original icon file to obtain a visual icon file; and carrying out standardization processing on the visual icon file to obtain a standard icon file.
In the implementation mode, the non-visual original icon file is subjected to visualization processing, so that the preset icon classification model is convenient to classify.
In a possible implementation manner, the format of the original icon file is a second preset format, and the visualizing processing is performed on the original icon file to obtain a visualized icon file, including:
and carrying out layer conversion on the original icon file to obtain a visual icon file.
In a possible implementation manner, the second preset format is a PNG format, and layer conversion is performed on the original icon file to obtain a visual icon file, including:
if the values of all the pixel points in the Alpha layers of the original icon file are all 0 or 1, and the values of all the pixel points in the R layer, the G layer and the B layer are not all 0 but not 1, deleting the Alpha layers of the original icon file to obtain a visual icon file;
if the values of the pixel points in the R layer, the G layer and the B layer of the original icon file are all 0 or 1, and the values of the pixel points in the Alpha layer are not all 0 but not 1, deleting the R layer, the G layer and the B layer of the original icon file to obtain the visual icon file.
The values of all pixel points in an Alpha layer of an original icon file are 0 or 1, the values of all pixel points in an R layer, a G layer and a B layer are not 0 and not 1, the original icon file is indicated as a four-channel PNG icon file with image data stored in the R layer, the G layer and the B layer, the A layer is used for transparentization, and the icon file is a completely black or transparent icon file and is a non-visual icon file. The layer a for the transparency processing is deleted, whereby the icon file can be visualized.
The values of all pixel points in an R layer, a G layer and a B layer of an original icon file are all 0 or 1, the values of all the pixel points in an Alpha layer are not all 0 and not all 1, the original icon is an image data stored in an A layer, a R, G, B layer is used for a four-channel PNG icon file for transparentization, the icon file is an all-black or transparent icon file and is a non-visual icon file, and the icon file can be visualized by deleting a R, G, B layer for transparentization.
In the implementation mode, according to the difference of the types of the four channels of icons, the layer used for the transparentization processing in the original icon file in the PNG format is deleted, and the visualization of the PNG icon file can be rapidly and accurately realized.
In a possible implementation manner, a format of an original icon file is a first preset format, and performing visualization processing on the original icon file to obtain a visualized icon file includes:
converting the original icon file into an icon file with a second preset format to obtain a converted icon file; if the converted icon file is a non-visual icon file, performing layer conversion on the converted icon file to obtain a visual icon file; and if the converted icon file is a visual icon file, taking the converted icon file as the visual icon file.
In the implementation mode, when the format of the original icon file is the XML format, the original icon file is firstly converted into the icon file in the PNG format, and then the icon file is preprocessed according to the preprocessing method of the PNG icon file, so that the visualization of the icon file in the XML format is realized, and the classification processing of the preset icon classification model is facilitated.
In a possible implementation manner, the first preset format is an XML format, the second preset format is a PNG format, and the converting the original icon file into the icon file with the second preset format to obtain the converted icon file includes:
converting the original icon file into a Scalable Vector Graphics (SVG) icon file; and converting the SVG icon file into a converted icon file.
In a possible implementation manner, preprocessing an original icon file to obtain a standard icon file includes:
and if the original icon file is a visual icon file, standardizing the original icon file to obtain a standard icon file.
In a possible implementation, the method further includes:
if the original icon file is not subjected to mirror image processing, writing information of the original icon file into a detection report; reporting the detection report to a server; receiving new version data information pushed by a server, wherein the new version data information comprises an original icon file and a target calling file, and the original icon file in the new version data information is subjected to mirror image processing; and updating the data to be detected according to the new version data information so as to enable the display interface to display the mirror image icon file of the original icon file.
In a second aspect, the present application provides an apparatus, which is included in an electronic device, and which has a function of implementing the behavior of the electronic device in the first aspect and the possible implementation manners of the first aspect. The functions may be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above-described functions. Such as a receiving module or unit, a processing module or unit, etc.
In a third aspect, the present application provides an electronic device, comprising: a processor, a memory, and an interface; the processor, the memory and the interface cooperate with each other to enable the electronic device to perform any one of the methods of the first aspect.
In a fourth aspect, the present application provides a chip comprising a processor. The processor is adapted to read and execute the computer program stored in the memory to perform the method of the first aspect and any possible implementation thereof.
Optionally, the chip further comprises a memory, and the memory is connected with the processor through a circuit or a wire.
Further optionally, the chip further comprises a communication interface.
In a fifth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the processor is enabled to execute any one of the methods in the technical solutions of the first aspect.
In a sixth aspect, the present application provides a computer program product comprising: computer program code for causing an electronic device to perform any of the methods of the first aspect when the computer program code runs on the electronic device.
Drawings
FIG. 1 is a schematic diagram illustrating an example of a display interface in a conventional language environment and a display interface in a complex language environment according to an embodiment of the present disclosure;
FIG. 2 is a diagram illustrating an example of an icon display error in a complex language environment according to an embodiment of the present application;
FIG. 3 is a schematic diagram illustrating an example of correct icon display in a complex language environment according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device to which an example icon detection method is applied according to an embodiment of the present disclosure;
FIG. 5 is a block diagram of an exemplary icon detection system according to an embodiment of the present disclosure;
fig. 6 is a schematic flowchart illustrating an exemplary method for detecting a PNG icon according to an embodiment of the present disclosure;
fig. 7 is a schematic diagram illustrating a comparison between an example of a first PNG icon file and a first visual PNG icon file provided in the embodiment of the present application;
fig. 8 is a schematic diagram of a part of icon files of preset types and corresponding mirrored icon files provided in an embodiment of the present application;
fig. 9 is a flowchart illustrating an exemplary method for detecting a DVG icon according to an embodiment of the present application;
fig. 10 is a schematic diagram illustrating a comparison between a first DVG icon file and a second PNG icon file according to an embodiment of the present application;
fig. 11 is a flowchart illustrating an exemplary icon detecting method according to an embodiment of the present disclosure;
FIG. 12 is a schematic flowchart of another exemplary icon detecting method according to the embodiment of the present application;
fig. 13 is a schematic structural diagram of an example icon detecting device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. In the description of the embodiments herein, "/" means "or" unless otherwise specified, for example, a/B may mean a or B; "and/or" herein is merely an association relationship describing an associated object, and means that there may be three relationships, for example, a and/or B, and may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality" means two or more than two.
In the following, the terms "first", "second" and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", and "third" may explicitly or implicitly include one or more of the features.
Worldwide, there are many languages, which can be divided into two categories according to the reading and writing directions of language characters:
1) The reading and writing directions are from left to right languages, hereinafter referred to as conventional languages. Conventional languages include english, chinese, japanese, etc.
2) The reading and writing directions are from right to left languages, hereinafter referred to as complex languages. The complex languages mainly include Arabic, persian, uldu, hebrew, uygur, etc.
Based on the different reading and writing habits of the users of the two languages, the terminal device is generally adapted to different display interfaces. The display interface under the conventional language environment generally adopts LTR layout, and the display interface under the complex language environment generally adopts RTL layout.
Illustratively, fig. 1 is a schematic diagram illustrating a comparison of display interfaces in a conventional language environment and a complex language environment according to an embodiment. Fig. 1 (a) is a schematic diagram of a short message interface of a mobile phone in a chinese language environment, and fig. 1 (b) is a schematic diagram of a short message interface of a mobile phone in an arabic language environment. As shown in fig. 1 (a), in the display interface, the text is aligned to the left, and the text direction is from left to right. In addition, the icon 101a in the display interface represents "back" or "return to the previous interface". For chinese language users, they are accustomed to the left as the previous interface, and thus the arrow of icon 101a is a left facing arrow. As shown in fig. 1 (b), in the interface, the text is aligned to the right, and the text is oriented from the right to the left. The icon 101b in the display interface also indicates "rollback" or "return to previous interface". For arabic users, they are accustomed to the right as the previous interface, and thus the arrow of icon 101b is a right-facing arrow. Therefore, when designing a display interface in an arabic environment, it is necessary to mirror the icon 101a to obtain the icon 101b.
Similarly, as shown in fig. 1, the search icon customary for chinese users is icon 102a in (a) of fig. 1, and the search icon customary for arabic users is icon 102b in (b) of fig. 1. Therefore, when designing a display interface in an arabic language environment, it is necessary to mirror the icon 102a to obtain the icon 102b.
However, in the process of designing and developing the display interface, for various reasons, there may be a case where the mirrored icon is not mirrored, which eventually causes an icon display error in the display interface of the terminal device in a complex language environment. For example, fig. 2 is a schematic diagram illustrating an icon display error in a complex language environment according to an embodiment of the present application. Specifically, fig. 2 is a download interface of an application program in an arabic language environment. In fig. 2, when downloading an application, the progress increasing direction of the download progress icon 201 in the display interface is from left to right. However, according to the habit of the arabic language user, the progress increasing direction of the download progress icon should be from right to left, as shown by the icon 301 in fig. 3. Thus, the download progress icon 201 in fig. 2 displays an error. Display interface icon display errors can result in poor user experience.
In view of this, it is necessary to detect icons in a display interface in a complex language environment to determine whether an icon needing to be mirrored is mirrored, so as to reduce display errors of the icons in the interface and improve user experience.
In the related art, the detection of the icon is mainly realized by manual detection. The manual detection has weak operability and is easy to miss, especially for a specific scene and an interface with a deep layer number. In addition, manual inspection takes a long time, and inspection of one module takes hours or even days. In summary, there is a problem in the related art that detection efficiency is low for the detection of the icon.
The icon detection method provided by the embodiment of the application aims to realize automatic detection of the icons in the display interface of the terminal equipment in the complex language environment and improve the detection efficiency. The terminal device may be a mobile phone, a tablet computer, a wearable device, an in-vehicle device, an Augmented Reality (AR)/Virtual Reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a Personal Digital Assistant (PDA), and other electronic devices capable of displaying an interface, and the embodiment of the present application does not limit the specific type of the terminal device.
The icon detection method provided by the embodiment of the application mainly realizes the detection of the icon by detecting code data (or called program data, programming data and the like) in a terminal equipment software system. The software system of the terminal device may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiments of the present application all use an Android system with a software system of a terminal device as a hierarchical architecture as an example for description.
It can be understood that the Android system includes a plurality of functional modules, for example: contacts module, phone module, message module, etc. The code data of each functional module comprises an icon file, a calling file and the like. The calling file refers to a file for calling the icon file to display the icon. That is, the call file is used to call the icon file, and display of the icon is achieved.
In order to facilitate understanding, the icon files in the display interface of the Android system in the complex language environment and the mirror image rules of the icon files in the Android system are briefly described below.
Icon files in the Android system are divided into Portable Network Graphics (PNG) type icon files (hereinafter, referred to as PNG icon files) and Drawable Vector Graphics (DVG) type icon files (hereinafter, referred to as DVG icon files). The DVG icon file is also referred to as a vector drawable object icon file.
The format of the PNG icon file is PNG format (file suffix. The PNG icon files comprise a single-channel PNG icon file, a three-channel PNG icon file and a four-channel PNG icon file. The single-channel PNG icon file is also a grayscale map file, and the single-channel PNG icon file only includes one layer. The three-channel PNG icon file is an icon file formed by three layers of red (R), green (G) and blue (B). The four-channel PNG icon file is an icon file formed by R, G, B and four layers of transparency (Alpha, A for short). The single-channel PNG icon file and the three-channel PNG icon file are visual icon files. The four-channel PNG icon file may be a visual icon file or a non-visual icon file according to the difference of the transparency degree. Specifically, non-visual icon files in the PNG icon files of the four channels include two cases: in the first case, the image data is stored in the R, G, B layer, the a layer is used for the transparentization process, that is, the value of each pixel in the R, G, B layer represents the image color, and the value of each pixel in the a layer represents the opacity degree. In this case, when the values of the respective pixel points in the layer a are all 0, the four-channel PNG icon file is a fully transparent icon file, and the icon file is a non-visual icon file; or, when the values of the pixel points of the layer a are all 1, the four-channel PNG icon file is an all-black icon file, and the icon file is also a non-visual icon file. In the second case, the image data is stored in layer a, and layer R, G, B is used for the transparentization process, that is, the value of each pixel in layer a represents the image color, and the value of each pixel in layer R, G, B represents the opacity. In this case, when the values of the pixel points of the R, G, B layer are all 0, the four-channel PNG icon file is a fully transparent icon file, and the icon file is a non-visual icon file; or, when the values of all the pixel points of the R, G, B layer are 1, the four-channel PNG icon file is a completely black icon file, and the icon file is also a non-visual icon file.
The DVG icon file is an icon file for storing image data in a special vector graphics format, and the DVG icon file can save a storage space. The DVG icon file is in XML (file suffix. XML) format and is an un-visualized icon file.
In the Android system, an icon file used by each function module may be stored in a folder with a folder name res (hereinafter referred to as res folder). The icon file may be stored in a folder with a folder name beginning with "drawable" in the res folder, or a folder with a folder name beginning with "mipmap". For example, a DVG icon file named a.xml may be stored in a folder with a folder name "drawable _1" in the res folder, that is: the storage path of the icon file a.xml includes: res/drawable _1/a. Xml. PNG icon file named b.png may be stored in a folder with folder name "mipmap _2" in the res folder, namely: png's storage path includes: res/mipmap _2/b.png. Note that the icon files stored in the folder with the folder name beginning with "drawable" or beginning with "mipmap" include icon files that have not been subjected to mirroring (hereinafter referred to as original icon files) and icon files that have been subjected to mirroring (hereinafter referred to as mirrored icon files). Wherein the mirrored icon file is stored in the folder with the suffix "-ldrtl" to the folder name. In addition, the file names of the mirrored icon file and the corresponding original icon file may be the same, but the storage locations of the mirrored icon file and the original icon file are different. For example, the name of the mirrored icon file corresponding to the original icon file with the name of c.png is also c.png. The mirrored icon file may be stored in a folder with a file name "drawable-ldrtl" in the res folder, that is: png's storage path includes: res/drawable-ldrtl/c.
The invocation file in the Android system includes an invocation file (hereinafter, referred to as an XML invocation file) in an XML format (file suffix is. XML), an invocation file (hereinafter, referred to as a JAVA invocation file) in a JAVA format (file suffix is. JAVA), and the like. When a certain function module needs to display a certain icon file, the icon file needs to be called through an XML calling file of the function module, then the icon file is called through a JAVA calling file, and finally the icon file is displayed.
The mirror image processing of each functional module in the Android system on the icon file may include two situations: 1) The icon file is mirrored prior to invocation. In this case, the XML calling file and the JAVA calling file call the icon file after the mirror image processing. 2) Before calling, the icon file is not subjected to mirror image processing, and the icon file is subjected to mirror image processing in the JAVA calling file calling process, namely the icon file is subjected to mirror image processing in the JAVA calling stage. In this case, the XML call file and the JAVA call file call an icon file that is not subjected to mirroring.
In case 1) the icon file is mirrored before the call, and the mirrored icon file is generally stored in the folder with the suffix "-ldrtl" to the folder name as described above. Optionally, the XML calling file and the JAVA calling file may call the icon file by name. If the mirrored icons need to be displayed on the display interface, the XML calling file and the JAVA calling file firstly call the required icon files from the folder with the suffix of "-ldrtl" according to the names, and if the required icon files do not exist in the folder with the suffix of "-ldrtl", the XML calling file and the JAVA calling file call the original icon files from other icon-saving files according to the names. In this case, the icon file called by the XML call file is a mirrored icon file, and the XML call file includes key statements characterizing the mirror attributes, for example, "automirror =" true ". Meanwhile, for the DVG icon file, the format of the DVG icon file is XML format, and thus, in this case, the mirrored DVG icon file also includes a statement for characterizing the mirroring attribute, for example, "auto mirror =" true ".
Regarding case 2) the icon file is mirrored during the JAVA call file call, a key sentence indicating the mirroring of the icon file, for example, "setauto mirror", is included in the JAVA call file calling the icon file.
The following describes, with reference to embodiments, architectures of an electronic device and an icon detection system to which the icon detection method provided in the present application is applied.
For example, the icon detection method provided by the embodiment of the present application may be applied to the electronic device shown in fig. 4. As shown in fig. 4, the electronic apparatus includes: a processor 401, a receiver 402, a transmitter 403, a memory 404, and a bus 405. The processor 401 includes one or more processing cores, and the processor 401 executes software programs and modules to execute applications of various functions and information processing. The receiver 402 and the transmitter 403 may be implemented as one communication component, which may be a baseband chip. The memory 404 is coupled to the processor 401 via a bus 405. The memory 404 may be used for storing at least one program instruction, and the processor 401 is used for executing the at least one program instruction, so as to implement the technical solutions of the following embodiments.
Optionally, the electronic device may be a personal computer (including a desktop computer, a notebook computer, and the like), a personal digital assistant, or other electronic devices, such as a tablet computer, a mobile phone, and the like, or a cloud or a remote server, and the specific form of the electronic device is not limited in the embodiments of the present application.
When the electronic device is turned on, the processor can read the software program in the memory, interpret and execute the instructions of the software program, and process the data of the software program. When data needs to be sent through the antenna, the processor performs baseband processing on the data to be sent, and then outputs baseband signals to a control circuit in the control circuit, and the control circuit performs radio frequency processing on the baseband signals and then sends the radio frequency signals to the outside through the antenna in the form of electromagnetic waves. When data is sent to the electronic equipment, the control circuit receives radio-frequency signals through the antenna, converts the radio-frequency signals into baseband signals and outputs the baseband signals to the processor, and the processor converts the baseband signals into the data and processes the data.
Those skilled in the art will appreciate that fig. 4 shows only one memory and processor for ease of illustration. In a practical electronic device, there may be multiple processors and memories. The memory may also be referred to as a storage medium or a storage device, and the like, which is not limited in this application.
As an alternative implementation manner, the processor may include a baseband processor and a central processing unit, the baseband processor is mainly used for processing communication data, and the central processing unit is mainly used for executing a software program and processing data of the software program. Those skilled in the art will appreciate that the baseband processor and the central processing unit may be integrated into a single processor, or may be separate processors, interconnected via bus, etc. Those skilled in the art will appreciate that an electronic device may include multiple baseband processors to accommodate different network formats, multiple central processors to enhance its processing capabilities, and various components of the electronic device may be connected by various buses. The baseband processor may also be expressed as a baseband processing circuit or a baseband processing chip. The central processing unit may also be expressed as a central processing circuit or a central processing chip. The function of processing the communication protocol and the communication data may be built in the processor, or may be stored in the memory in the form of a software program, and the processor executes the software program to realize the baseband processing function. The memory may be integrated within the processor or may be separate from the processor. The memory includes a Cache, which may store frequently accessed data/instructions.
In the embodiments of the present application, the processor may be a general-purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic blocks disclosed in the embodiments of the present application. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware processor, or may be implemented by a combination of hardware and software modules in a processor.
In the embodiment of the present application, the memory may be a nonvolatile memory, such as a Hard Disk Drive (HDD) or a solid-state drive (SS), and may also be a volatile memory (volatile memory), for example, a random-access memory (RAM). The memory is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, not limited thereto.
Optionally, the icon detection method provided in the embodiment of the present application may be implemented by a computer program in Python language based on the electronic device.
Optionally, the electronic device may be installed with an Application (APP) that implements the icon detection method provided in the embodiment of the present Application. The application may have a user interaction interface for interacting with a user to effect detection. For example, the application program has an interface for receiving a detection instruction of a user, receives the detection instruction input by the user through the interface, and starts detection in response to the detection instruction. For another example, the application program may further have an interactive interface for prompting the user whether to upload the detection report to the server, receive a selection result of the user through the interface, and perform a corresponding operation.
Fig. 5 is an architecture diagram of an exemplary icon detecting system according to an embodiment of the present disclosure. As shown in fig. 5, the icon detecting system includes a data module, a model module, a judging module, and a reporting module.
The icon detection system can process icon files with different formats through different modules and methods. Specifically, the data module may include a data acquisition unit 501, an icon scanning unit 502, a DVG-PNG conversion unit 503, a layer conversion unit 504, and a normalization processing unit 505.
The data acquisition unit 501 is configured to acquire code data to be detected. The code data to be detected comprises a plurality of original icon files, calling files and the like. The icon scanning unit 502 is used for scanning and acquiring an original icon file from code data to be detected. Optionally, the icon scanning unit 502 may scan and acquire an original PNG icon file and an original DVG icon file in the code data, respectively, send the acquired original PNG icon file to the layer conversion unit 504, and input the acquired original DVG icon file into the DVG-PNG conversion unit 503. The DVG-PNG conversion unit 503 is configured to convert the original DVG icon file into a PNG icon file, and send the converted PNG icon file to the layer conversion unit 504. The layer conversion unit 504 is configured to determine whether the received original PNG icon file and/or the converted PNG icon file is a non-visual icon file, and if so, perform layer conversion on the non-visual icon file to implement visualization of the icon file. The standardization processing unit 505 is configured to standardize the visualized PNG icon file and input the standardized PNG icon file into the model module. The standardization process includes, but is not limited to, unifying parameters such as the number of channels and the size of the icon file.
The model module includes an icon classification model 506. The icon classification model 506 is used to determine whether the standardized icon file belongs to one of the preset types of icon files, where the preset type of icon file is an icon file that needs to be subjected to mirror image display, that is, mirror image processing. If the standardized icon file is one of the icon files of the preset types, the icon classification model 506 sends the name of the original icon file corresponding to the standardized icon file to the judgment module.
The judging module includes a PNG trace back judging unit 507, a DVG trace back judging unit 508 and a JAVA file scanning unit 509. Specifically, if the standardized icon file is one of the preset types of icon files, and the original icon corresponding to the standardized icon file is the original PNG icon, the icon classification model 506 sends the name of the original PNG icon file to the PNG backtracking determination unit 507. If the standardized icon file is one of the icon files of the preset type and the original icon corresponding to the standardized icon file is the original DVG icon, the icon classification model 506 sends the name of the original DVG icon file to the DVG backtracking determining unit 508.
The PNG backtracking determination unit 507 is configured to obtain an XML call file for calling the PNG icon file of the name from the code data to be detected according to the name of the original PNG icon file, and determine whether or not to mirror the original PNG icon file before calling according to at least one of the name of the original PNG icon file and the XML call file. If the original PNG icon file is not subjected to image processing before the call, the PNG trace-back determination unit 507 sends the name of the original PNG icon file to the JAVA file scanning unit 509.
The DVG trace-back determining unit 508 is configured to obtain, according to the name of the original DVG icon file, an XML call file that calls the DVG icon file of the name from the code data to be detected, and determine, according to at least one of the name of the original DVG icon file and the XML call file, whether or not the original DVG icon file is subjected to image processing before being called. If the original DVG icon file is not mirrored before the call, the DVG trace back determination unit 507 sends the name of the original DVG icon file to the JAVA file scanning unit 509.
The JAVA file scanning unit 509 is configured to obtain a JAVA call file from the code data to be detected, and scan the JAVA call file according to the name of the original PNG icon file and/or the name of the original DVG icon file to determine whether the original PNG icon file and/or the original DVG icon file is called by the JAVA call file, and if so, determine whether the JAVA call file calling the original PNG icon file and/or the original DVG icon file includes information for performing mirror processing on the original PNG icon file and/or the original DVG icon file, so as to determine whether the original PNG icon file and/or the original DVG icon file is subjected to mirror processing in a JAVA call stage. If the original PNG icon file and/or the original DVG icon file is not processed in the JAVA call stage, the JAVA file scanning unit 509 sends the name of the original PNG icon file and/or the original DVG icon file to the reporting module.
The report module may include a report generation unit 5010. The report generating unit 5010 is configured to generate a detection report according to the name of the original PNG icon file and/or the original DVG icon file transmitted by the JAVA file scanning unit 509.
It can be understood that each functional module in the icon detection system may be implemented by a hardware structure in the electronic device, may also be implemented by a software program, and may also be implemented by a combination of hardware and software, which is not limited in this application.
The detection process of the PNG icon and the DVG icon will be described below with reference to fig. 5.
Exemplarily, fig. 6 is a schematic flowchart of a method for detecting a PNG icon according to an embodiment of the present application, and as shown in fig. 6, the method includes:
s601, the data acquisition unit acquires code data to be detected.
The code data to be detected can include icon files, character string files, XML calling files, JAVA calling files and the like.
Optionally, the data obtaining unit may obtain the code data to be detected from a memory of the electronic device, or may obtain the code data to be detected from a server or a code data management system. For example, the data acquisition unit may download the code data to be detected from the Git distributed version control system.
It can be understood that when the icon files in the Android system are detected, the icon files can be divided according to the functional modules of the Android system and detected one by one. Optionally, the user may input a detection instruction for a certain function module through the detection instruction input interface, and after receiving the detection instruction, the data obtaining unit obtains the code data of the function module, and uses the code data of the function module as the code data to be detected. For example, if the user inputs "contact module" on the detection instruction input interface, the data obtaining unit may download the code data of the contacts module from the Git distributed version control system as the code data to be detected.
Certainly, the icon detection system can also detect the code data of each functional module in the Android system in sequence according to a preset program without inputting a detection instruction for the module by a user. This is not a limitation of the present application.
And S602, the data acquisition unit sends the code data to be detected to the icon scanning unit.
S603, the icon scanning unit scans and acquires a first PNG icon file from the code data to be detected, wherein the first PNG icon file is an original icon file.
Optionally, the icon scanning unit may use ". PNG" as a keyword to scan a folder called "drawable" as a beginning and a folder called "mipmap" as a beginning in the code data to be detected, so as to obtain the original PNG icon file. The original PNG icon files scanned by the icon scanning unit may be multiple, and the icon detection system may process the multiple original PNG icon files one by one. For convenience of understanding, the detection process is described below by taking a first PNG icon file of the plurality of original PNG icon files as an example, where the first PNG icon file is any one of the plurality of original PNG icon files. And repeating the following steps for the rest original PNG icon files.
S604, the icon scanning unit sends the first PNG icon file to the layer conversion unit.
S605, the layer conversion unit determines whether the first PNG icon file is a non-visual PNG icon file.
That is to say, the layer conversion unit determines whether the first PNG icon file is a four-channel PNG icon file, and determines whether the values of the respective pixel points in the layer used for the transparentization processing by the first PNG icon file are all 0 or all 1.
Specifically, the layer conversion unit may identify each layer of the first PNG icon file, and if the first PNG icon file includes R, G, B and a layer a, the first PNG icon file is a four-layer PNG icon file, and then the layer conversion unit may further determine whether values of each pixel point in each layer are both 0 or both 1. If the values of all the pixel points of the layer a of the first PNG icon file are all 0 or 1, and the values of all the pixel points of the layer R, G and the layer B are not all 0 and not all 1, it is indicated that the first PNG icon file is an icon file in which image data is stored in the layer R, G, B, the layer a is used for transparentization, and the icon file is a completely black or transparent icon file and is an invisible icon file. If the values of the pixel points in the R, G and the B layer of the first PNG icon file are both 0 or 1, and the values of the pixel points in the a layer are not all 0 and not all 1, it is indicated that the first PNG icon file is an icon file in which image data is stored in the a layer, the R, G, B layer is used for transparency processing, and the icon file is a completely black or transparent icon file and is an invisible icon file.
If the first PNG icon file is a visual PNG icon file, executing step S606;
if the first PNG icon file is a non-visualized PNG icon file, step S607 is executed.
And S606, the layer conversion unit sends the first PNG icon file to the standardization processing unit.
S607, the layer conversion unit performs layer conversion on the first PNG icon file to obtain a first visual PNG icon file.
Specifically, if the values of the pixels in the a layer of the first PNG icon file are all 0 or all 1, and the values of the pixels in the R, G and the B layer are not all 0 and not all 1, that is: the first PNG icon file is an icon file with image data stored in the layer A and R, G, B used for transparentization processing, and the layer conversion unit directly deletes the layer A of the first PNG icon file to obtain a first visual PNG icon file comprising a R, G, B layer.
For example, fig. 7 is a schematic diagram illustrating a comparison between a first PNG icon file and a first visual PNG icon file provided in an embodiment of the present application. As shown in fig. 7, the first PNG icon file 701 is a transparent icon file in which the value of each pixel point of the a layer is 0, and the layer conversion unit deletes the a layer of the first PNG icon file 701 to obtain a first visualized PNG icon file 702.
If the values of the pixel points in R, G and the layer B of the first PNG icon file are both 0 or 1, and the values of the pixel points in the layer a are not all 0 and not all 1, that is: the first PNG icon file is an icon file in which image data is stored in the layer a, and the layer R, G, B is used for transparentization processing, and then the layer conversion unit deletes R, G and the layer B of the first PNG icon file to obtain a first visual PNG icon file only including the layer a.
In this step, layer conversion is performed on the first PNG icon file, and the four-channel and non-visual PNG icon is converted into a single-channel or three-channel visual icon, so that subsequent identification and processing are facilitated.
S608, the layer conversion unit sends the first visual PNG icon file to the standardization processing unit.
And S609, the standardization processing unit standardizes the first PNG icon file or the first visual PNG icon file to obtain a first standard PNG icon file.
The size of the first PNG icon file or the first visual PNG icon file sent to the standardization processing unit by the layer conversion unit is not fixed. If the icon file sent by the layer conversion unit to the standardization processing unit is the first PNG icon file, the number of channels of the icon file may be a single channel, three channels or four channels; and if the layer conversion unit sends the first visual PNG icon file to the standardization processing unit, the number of the channels of the icon file is three or a single channel. That is to say, the number of channels of the first PNG icon file or the first visual PNG icon file sent by the layer conversion unit to the normalization processing unit is not fixed. Therefore, the standardization processing unit can carry out pretreatment on the channel number, the size and the like on the first visual PNG icon file or the first PNG icon file to obtain the first standard PNG icon file with fixed size and color, so that the next step of processing of the icon classification model is facilitated, and the processing speed and the accuracy of the icon classification model are improved.
Specifically, the size of the first standard PNG icon file may be set according to actual requirements. In one embodiment, the normalization processing unit may process the first visualized PNG icon file or the size of the first PNG icon file as 128pixels by 128pixels.
The number of channels of the first standard PNG icon file may also be set according to actual requirements. In one embodiment, the normalization processing unit may process the first visual PNG icon file or the number of channels of the first PNG icon file into three channels.
The embodiment of the application does not limit the specific method for the size and channel number standardization processing, and can be selected according to actual requirements. For example, the normalization processing unit may convert the PNG icon file of the single channel into a three-channel PNG icon file by copying data of the layer.
S6010, the standardization processing unit inputs the first standard PNG icon file into the icon classification model.
S6011, the icon classification model processes the first standard PNG icon file, and whether the first standard PNG icon file belongs to one of preset types of icon files is determined.
As described above, the icon file of the preset type is an icon file that needs to be subjected to mirroring. It is understood that the icons with the symmetrical structures do not need to be mirrored, and therefore, the icon files with the symmetrical structures may not be included in the preset type of icon files. In addition, for the icon file with the asymmetric structure, whether mirror image is needed or not can be determined according to habits of users with complex languages. Therefore, the icon file with the preset type can be determined in advance according to the structure and the type of the icon in each module in the Android system and by combining the use habits of complex language users and the like.
For example, fig. 8 is a schematic diagram of a part of icon files of preset types and corresponding mirrored icon files provided in an embodiment of the present application, where the icon files of preset types (shown as original icons) may include a back icon, a forward icon, a search icon, a download progress icon, a volume adjustment icon, a note book icon, a short message sending icon, an edit icon, and the like. It can be understood that the icon types shown in the figures are only schematic, and in practical applications, more or fewer icons of preset types may be set according to requirements, which is not limited in this embodiment of the present application.
Optionally, the output result of the icon classification model may include: "is one of the preset types of icon files" and "is not any of the preset types of icon files".
In one embodiment, the icon classification model includes at least one classification submodel corresponding to a preset type, for example, a back-off icon file classification submodel, a forward icon file classification submodel, a search icon file classification submodel, a download progress icon file classification submodel, a volume adjustment icon file classification submodel, a note book icon file classification submodel, a short message sending icon file classification submodel, an edit icon file submodel, and the like. As a possible implementation, each classification submodel may be a Convolutional Neural Network (CNN) deep learning model based on a residual neural network (ResNet).
The establishment process of each sub-model in the icon classification model is similar. Optionally, taking the classification model of the rollback icon file as an example, the model establishing process may be as follows:
1) The last layer (top layer) of the ResNet model is removed, resulting in an initial network model.
2) And (4) fixing parameters of all layers of the initial network model, and adding a full-connection layer and a fault judgment layer at the end of the initial network model in sequence.
Optionally, the number of neurons in the fully-connected layer is 32, and the input of the fully-connected layer is 128 × 3, that is, the width (W), height (H) and channel number (channel) of the image of the fully-connected layer are 128, 128 and 3, respectively.
3) And inputting a preset backspacing icon file data set into an initial network model for training to obtain a backspacing icon file classification submodel.
And the classification submodels corresponding to the preset types respectively process the first standard PNG icon file. The output result of the classification submodel corresponding to each preset type comprises the following steps: "yes" and "no", the first standard PNG icon file characterizing the input of the submodel model is the preset type of icon file and not the preset type of icon file. For example, the output result of the fallback icon file classification submodel includes: "yes" and "no", the first standard PNG icon file representing the input fallback icon file classification submodel is the fallback icon file and not the fallback icon file.
If the output result of the classification submodel corresponding to each preset type is negative, the output result of the icon classification model is that the classification submodel is not any icon file of the preset type, which indicates that the first standard PNG icon file does not belong to any icon file of the preset type, and the first PNG icon file is an icon file which does not need to be subjected to mirror image processing. Then, the first PNG icon file does not need to be detected, and the detection flow of the first PNG icon file is ended.
If at least one of the output results of the classification submodels corresponding to each preset type is 'yes', the output result of the icon classification model is 'one of the icon files of the preset type', the first standard PNG icon file belongs to the icon file of a certain preset type, and the first PNG icon file is the icon file needing mirror image processing. Then, it is necessary to detect the first PNG icon file, determine whether mirroring has been performed on the first PNG icon file, and perform step S6012.
S6012, the icon classification model sends the first name of the first PNG icon file to the PNG backtracking judgment unit.
Note that, here, the "first name" is an example of the identification information of the first PNG icon file. In this embodiment, the calling file calls the icon by the icon name, and specifically, the calling file calls the first PNG icon file or the mirror image icon file of the first PNG icon file by the first name. In some embodiments, not shown, if the calling file calls the icon file through other identification information, the icon classification model sends the other identification information of the first PNG icon file to the PNG trace-back determination unit.
S6013, the PNG backtracking judgment unit obtains the code data to be detected from the data obtaining unit.
S6014, the PNG backtracking judgment unit judges whether the first PNG icon file is subjected to mirror image processing before calling according to the code data to be detected and the first name.
Optionally, the PNG backtracking determining unit may determine, according to a mirroring rule of the PNG icon file before the Android system calls, whether mirroring is performed by the Android system before the PNG icon file named as the first name is called. Specifically, the PNG backtracking judgment unit acquires the first XML file from the code data to be detected according to the first name, and determines whether the first PNG icon file is subjected to mirror image processing before being called according to at least one of the first XML file and the first name. The first XML calling file refers to an XML calling file that calls an icon file with a first name.
As a possible implementation manner, the PNG trace-back determining unit may determine whether an icon file named as a first name is stored in the target folder, and determine whether the first XML call file includes the first preset mirror attribute information. And if at least one of the two is yes, determining that the first PNG icon file is subjected to mirror processing before calling. The target folder is used for storing the mirrored icon files. Optionally, the folder name of the target folder includes a preset keyword. Alternatively, the preset key may be "-ldrtl". The first preset mirror image attribute information is used for representing that the icon file called by the first XML calling file is a mirror image icon file. Optionally, the first preset mirror attribute information may be "auto-mirror =" true "," etc. the key statement for characterizing the mirror attribute.
Regarding the determination as to whether the icon file named as the first name is stored in the target folder, optionally, the PNG backtracking determining unit may first screen the icon file named as the first name from the data to be detected, and determine the folder in which the icon file named as the first name is located. It is understood that, as described in the above embodiments, the names of the original icon file and the mirrored icon file are the same, and thus, the icon file named as the first name may be one or more, and the folder in which the icon file is located may be one or more. The PNG trace back determination unit determines whether the folder in which these icon files named first names are located includes the target folder (i.e., whether the folder names include the preset keyword). If the name of one folder in the folders where the icon files with the first names are located comprises the preset keyword, the icon files with the first names are stored in the target folder, and the first PNG icon file is subjected to image processing before calling.
Optionally, the PNG backtracking determining unit may also screen out target folders from the data to be detected (i.e., screen out folders whose folder names include preset keywords), query the target folders, and determine whether an icon file named as the first name is stored in the target folder. If the icon file with the first name is stored in the destination folder, it is described that the first PNG icon file is mirrored before the call.
Regarding the determination of "whether the first XML call file includes the first preset mirror image attribute information", optionally, the PNG trace-back determination unit may first screen the XML call file from the data to be detected, and search for the first name in each XML call file, so as to determine whether the XML call file calls the icon file with the first name, that is, determine whether the XML call file is the first XML call file. If the XML calling file is the first XML calling file, the first preset image attribute information may be searched in the XML calling file to determine whether the first XML calling file includes the first preset image attribute information. And if the first XML calling file comprises the first preset mirror image attribute information, the first PNG icon file is subjected to mirror image processing before calling.
In summary, if the icon file named as the first name is stored in the destination folder, and/or the first XML calling file includes the first preset mirror attribute information, it indicates that the Android system performs mirror processing on the first PNG icon file before calling the icon file named as the first name, and ends the detection process for the first PNG icon file.
If the icon file with the first name is not stored in the target folder, and the XML calling file with the first name does not include the first preset mirror image attribute information, it indicates that the first PNG icon file is not subjected to mirror image processing before the Android system calls the icon file with the first name, and step S6015 is executed.
In the step, based on the principle of mirroring the PNG icon file before being called in the Android system, the link of mirroring the icon file before being called is backtracked and detected, whether the link carries out mirroring processing on the original PNG icon file or not can be accurately determined, and the accuracy of PNG icon detection is improved.
S6015, the PNG backtracking judgment unit sends the first name to the JAVA file scanning unit.
S6016, the JAVA file scanning unit obtains the JAVA calling file in the code data to be detected from the data obtaining unit.
S6017, the JAVA file scanning unit scans the acquired JAVA call file according to the first name, and determines whether the first PNG icon file is called by the JAVA call file.
It will be appreciated that if the first PNG icon file is not mirrored prior to invocation, the JAVA invocation file invokes the original icon file, i.e. the first PNG icon file. Optionally, the JAVA file scanning unit may scan all JAVA call files in the code data to be detected, and determine whether the JAVA call files include a key statement for calling the first PNG icon file, so as to determine whether the first PNG icon file is called. For example, the JAVA file scanning unit may determine whether a file name of the first PNG icon file is included in the JAVA call file, i.e., whether the first name is included.
In some practical usage scenarios, the icon files in some functional modules of the Android system may not be called, and are redundant icon files. The redundant icon file is not displayed on the interface, so that the mirror image processing is not needed, and the detection is not needed.
In this step, if the first PNG icon file is not called by the JAVA call file, the first PNG icon file is a redundant icon file, and the first PNG icon file is not an error icon file that is not mirrored, and the detection process for the first PNG icon file is ended.
If the first PNG icon file is called by a JAVA call file, step S6018 is performed.
Through the steps, whether the first PNG icon file is a redundant icon file or not can be determined, and subsequent detection is not carried out on the redundant icon file. Therefore, the redundant icon files can be prevented from being detected as the icon files needing mirror image, and the accuracy of the icon detection result is improved.
S6018, the JAVA file scanning unit determines whether a JAVA call file that calls the first PNG icon file includes first preset mirror image processing information, where the first preset mirror image processing information is used to indicate to perform mirror image processing on the first PNG icon file.
Optionally, the JAVA file scanning unit may scan a JAVA call file that calls the first PNG icon file, and determine whether the JAVA call file that calls the first PNG icon file includes first preset image processing information, for example, a key statement such as "setauto mirror".
If the JAVA call file for calling the first PNG icon file includes the first preset mirror image processing information, it indicates that the mirror image processing is performed on the first PNG icon file at the JAVA call stage by the functional module, and the detection process of the first PNG icon file is ended.
If the JAVA invocation file for invoking the first PNG icon file does not include the first preset mirroring processing information, it indicates that mirroring processing is not performed on the first PNG icon file in the JAVA invocation stage for the function module, and the first PNG icon file is an error icon file that should be subjected to mirroring processing but not subjected to mirroring processing, and step S6019 is performed.
S6019, the JAVA file scanning unit sends the information of the first PNG icon file to the report generating unit.
The information of the first PNG icon file includes, but is not limited to, a name of the first PNG icon file, a storage path of a call file calling the first PNG icon file, error contents, and the like.
S6020, the report generation unit writes the information of the first PNG icon file in the detection report.
Optionally, the detection report may be a detection report of the code data to be detected, that is, a detection report of the functional module corresponding to the detection instruction. Optionally, the form of the detection report may be a table form, a text form, or the like, which is not limited in this embodiment of the application.
The icon detection method provided by the embodiment can automatically detect whether the original PNG icon file is subjected to mirror image processing or not, does not need manual detection, can detect all the original PNG icon files in the code data to be detected, does not have omission phenomenon, and realizes comprehensive coverage of the icon file detection needing mirror image processing. In addition, the method provided by the embodiment can realize rapid detection. In summary, the method provided by the embodiment can improve the efficiency of PNG icon detection. Moreover, the icon detection method provided in this embodiment can detect whether or not the original PNG icon file is subjected to mirror image processing before the call, and if the original PNG icon file is not subjected to mirror image processing before the call, further scan the JAVA call file, and determine whether or not the JAVA call file that calls the original PNG icon file includes the first preset mirror image processing information, thereby determining whether or not the original PNG icon file is subjected to mirror image processing in the JAVA call stage. Therefore, multiple links of mirror image processing in the mirror image processing rule based on the Android system can be covered, detection omission is reduced, and the accuracy of icon detection is further improved.
Exemplarily, fig. 9 is a schematic flowchart of a method for detecting a DVG icon according to an embodiment of the present application, and as shown in fig. 9, the method includes:
s901, the data acquisition unit acquires code data to be detected.
This step is the same as step S601 in the embodiment shown in fig. 6, and is not described again here.
And S902, the data acquisition unit sends the code data to be detected to the icon scanning unit.
This step is the same as step S602 in the embodiment shown in fig. 6, and is not repeated herein.
S903, the icon scanning unit scans the code data to be detected and obtains a first DVG icon file, wherein the first DVG icon file is an original icon file.
Optionally, the icon scanning unit may use ". Xml" as a keyword to scan a folder called "drawable" as a beginning and a folder called "mipmap" as a beginning in the code data to be detected, so as to obtain the original DVG icon file. The original DVG icon files scanned by the icon scanning unit may be multiple, and the icon detection system may process the multiple original DVG icon files one by one. For convenience of understanding, the following description will be made by taking, as an example, a first DVG icon file among a plurality of original DVG icon files, the first DVG icon file being any one of the plurality of original DVG icon files. The following steps are repeatedly performed on the remaining original DVG icon files.
And S904, the icon scanning unit sends the first DVG icon file to the DVG-PNG conversion unit.
S905, the DVG-PNG conversion unit converts the first DVG icon file into an icon file in a PNG format to obtain a second PNG icon file.
Optionally, the DVG-PNG converting unit may convert the first DVG icon file into a Scalable Vector Graphics (SVG) icon file, and then convert the SVG icon file into an icon file in the PNG format. Specifically, the DVG-PNG conversion unit adapts each attribute and a value corresponding to each attribute of the first DVG icon file to an attribute and a value corresponding to the attribute corresponding to the SVG icon file, and saves them to obtain the first SVG icon file. And then, the DVG-PNG conversion unit can convert the first SVG icon file into an icon file in a PNG format through a CairoVG module in Python software to obtain a second PNG icon file.
Exemplarily, fig. 10 is a schematic diagram illustrating a comparison between a first DVG icon file and a second PNG icon file according to an embodiment of the present application. As shown in fig. 10, the first DVG icon file is in the xml format, and as shown in 1001, the DVG-PNG converting unit converts the first DVG icon file into an icon file in the PNG format, and obtains a second PNG icon file, as shown in 1002.
S906, the DVG-PNG conversion unit sends the second PNG icon file to the layer conversion unit.
S907, the layer conversion unit determines whether the second PNG icon file is a non-visual PNG icon file;
if the second PNG icon file is a visual PNG icon file, then step S908 is executed;
if the second PNG icon file is a non-visualized PNG icon file, step S909 is executed.
And S908, the layer conversion unit sends the second PNG icon file to the standardization processing unit.
And S909, the layer conversion unit performs layer conversion on the second PNG icon file to obtain a second visual PNG icon file.
And S9010, the layer conversion unit sends the second visual PNG icon file to the standardization processing unit.
And S9011, the standardization processing unit standardizes the second PNG icon file or the second visual PNG icon file to obtain a second standard PNG icon file.
And S9012, the standardization processing unit inputs the second standard PNG icon file into the icon classification model.
S9013, processing the second standard PNG icon file by the icon classification model, and determining whether the second standard PNG icon file belongs to one of preset types of icon files;
and if the output result of the icon classification model is that the icon file is not any one of the icon files of the preset types, ending the detection process of the first DVG icon file.
If the result of the output of the icon classification model is "one of the preset types of icon files", step S9014 is executed.
S9014, the icon classification model sends the second name of the first DVG icon file to the DVG backtracking judgment unit.
The steps S907 to S9014 are the same as the steps S605 to S6012 in the embodiment shown in fig. 6, and are not repeated herein.
And S9015, the DVG backtracking judgment unit acquires the code data to be detected from the data acquisition unit.
And S9016, the DVG backtracking judgment unit judges whether the first DVG icon file is subjected to mirror image processing before calling according to the code data to be detected and the second name.
Optionally, the DVG backtracking determining unit may determine, according to a mirror processing rule of the Android system for the DVG icon file before the call, whether the Android system performs mirror processing before the call is performed on the DVG icon file named as the second name. Specifically, the DVG trace-back determination unit obtains a second XML file from the code data to be detected according to the second name, and determines whether the first DVG icon file is subjected to mirror image processing before being called according to at least one of the second XML file and the second name. The second XML calling file refers to an XML calling file that calls the icon file with the second name.
As one possible implementation, the DVG trace-back judgment unit determines whether at least one of the following three conditions is satisfied: condition 1), an icon file named as a second name is stored in the target folder; condition 2), the second XML calling file comprises second preset mirror image attribute information; condition 3), the file of the first DVG icon includes second preset image attribute information. If at least one of the three conditions is satisfied, it is determined that the first DVG icon file was mirrored prior to the invocation.
The target folder is the same as that described in the embodiment shown in fig. 6, and is not described herein again. And the second preset mirror image attribute information is used for representing that the icon called by the XML calling file is a mirrored icon. Optionally, the second preset mirror image attribute information may be the same as the first preset mirror image attribute information, and is also a key statement for characterizing the mirror image attribute, such as "auto mirror =" true "".
Regarding the judgment of the condition 1), optionally, the DVG trace-back judging unit may first screen an icon file named as a second name from the data to be detected, and determine a folder where the file named as the second name is located. It is understood that, as described in the above embodiment, the names of the original icon file and the mirrored icon file are the same, and thus, there may be one or more icon files with the second name, and there may be one or more folders. The DVG trace-back judgment unit determines whether the folders in which the icon files named the second name are located include the target folder (i.e., whether the names of the folders include the preset keyword). If the name of any folder in the folders where the icon file with the name of the second name is located comprises the preset keyword, the icon file with the name of the second name is stored in the target folder, and the first DVG icon file is subjected to image processing before calling.
Optionally, the DVG icon backtracking determining unit may also screen out target folders from the data to be detected (i.e., screen out folders whose folder names include preset keywords), query the target folders, and determine whether an icon file named as a second name is stored in the target folder. If an icon file named second name is stored in these destination folders, it means that the first DVG icon file has been mirrored before the call.
Regarding the judgment of the condition 2), optionally, the DVG trace-back judgment unit may first screen an XML call file from the data to be detected, and search for the second name in each XML call file, so as to determine whether the XML call file calls an icon file with the name of the second name, that is, determine whether the XML call file is the second XML call file. If the XML calling file is the second XML calling file, the second XML calling file may be searched for the second preset image attribute information, so as to determine whether the second XML calling file includes the second preset image attribute information. And if the second XML calling file comprises second preset mirror image attribute information, the first DVG icon file is subjected to mirror image processing before calling.
Regarding the judgment of the condition 3), optionally, the DVG trace-back judgment unit searches for second preset mirror image attribute information in the first DVG icon file, and if the first DVG icon file includes the second preset mirror image attribute information, it indicates that the first DVG icon file is subjected to mirror image processing before being called.
In short, if any of the three conditions is satisfied, it is described that the Android system performs mirroring on the first DVG icon file before calling the icon file named as the second name, and ends the detection flow of the first DVG icon file.
If none of the three conditions is met, it indicates that the first DVG icon file is not subjected to mirror image processing before the Android system calls the icon file with the second name, and step S9017 is executed.
In the step, based on the principle of the mirror image of the DVG icon file before calling in the Android system, the link of detecting the mirror image of the icon file before calling is traced back, whether the link carries out mirror image processing on the original DVG icon file or not can be accurately determined, and the accuracy of DVG icon detection is improved.
And S9017, sending the second name to the JAVA file scanning unit by the DVG backtracking judgment unit.
And S9018, the JAVA file scanning unit acquires the JAVA calling file in the code data to be detected from the data acquisition unit.
And S9019, the JAVA file scanning unit scans the acquired JAVA call file according to the second name and determines whether the first DVG icon file is called by the JAVA call file.
It is to be understood that if the first DVG icon file is not mirrored before the call, the JAVA call file calls the original icon file, i.e., the first DVG icon file. Optionally, the JAVA file scanning unit may scan all JAVA call files in the code data to be detected, and determine whether the JAVA call files include a key statement for calling the first DVG icon file, so as to determine whether the first DVG icon file is called. For example, the JAVA file scanning unit may determine whether a file name of the first DVG icon file is included in the JAVA call file, i.e., whether the second name is included.
In some practical usage scenarios, the DVG icon file in some functional modules of the Android system may not be called, and is a redundant icon file. The redundant icon file is not displayed on the interface, so that the mirror image processing is not needed, and the detection is not needed.
In this step, if the first DVG icon file is not called by the JAVA call file, the first DVG icon file is a redundant icon file, and the first DVG icon file is not an error icon file that is not mirrored, and the detection process for the first DVG icon file is ended.
If the first DVG icon file is called by a JAVA call file, step S9020 is executed.
Through the steps, whether the first DVG icon file is a redundant icon file or not can be determined, and subsequent detection is not carried out on the redundant icon file. Therefore, the redundant icon files can be prevented from being detected as the icon files needing mirror image, and the accuracy of the icon detection result is improved.
S9020, the JAVA file scanning unit determines whether a JAVA call file that calls the first DVG icon file includes second preset mirror image processing information, where the second preset mirror image processing information is used to instruct to perform mirror image processing on the first DVG icon file.
Optionally, the JAVA file scanning unit may scan a JAVA call file that calls the first DVG icon file, and determine whether the JAVA call file that calls the first DVG icon file includes second preset image processing information, for example, a key statement such as "setAutoMirrored".
If the JAVA call file for calling the first DVG icon file includes the second preset mirror image processing information, it indicates that the function module performs mirror image processing on the first DVG icon file in the JAVA call stage, and ends the detection process for the first DVG icon file.
If the JAVA call file for calling the first DVG icon file does not include the second preset mirror image processing information, it indicates that the mirror image processing is not performed on the first DVG icon file in the JAVA call stage for the function module, and the first DVG icon file is an error icon file that should be subjected to mirror image processing but not subjected to mirror image processing, and step S9021 is executed.
S9021, the JAVA file scanning unit sends the information of the first DVG icon file to the report generating unit.
The information of the first DVG icon file includes, but is not limited to, a name of the first DVG icon file, a storage path of a call file calling the first DVG icon file, error contents, and the like.
S9022, the report generation unit writes the information of the first DVG icon file in the detection report.
This step is similar to step S6018 in the embodiment shown in fig. 6, and is not repeated herein.
The icon detection method provided by the embodiment can automatically detect whether the original DVG icon files are subjected to mirror image processing, does not need manual detection, can detect all the original DVG icon files in the code data to be detected, does not generate omission, and realizes comprehensive coverage of icon file detection requiring mirror image processing. In addition, the method provided by the embodiment can realize rapid detection. In short, the method provided by the embodiment can improve the efficiency of DVG icon file detection. Moreover, the icon detecting method provided in this embodiment can detect whether the original DVG icon file is subjected to image processing before invocation, and further scan the JAVA invocation file if the original DVG icon file is not subjected to image processing before invocation, and determine whether the JAVA invocation file invoking the original DVG icon file includes second preset image processing information, thereby determining whether the original DVG icon file is subjected to image processing in a JAVA invocation stage. Therefore, multiple links of mirror image processing in the mirror image processing rule based on the Android system can be covered, detection omission is reduced, and the accuracy of icon detection is further improved.
Referring to fig. 11, based on the processes described in the above embodiments, the icon detection method provided in an embodiment of the present application may include the following steps S10 to S80. In this embodiment, the icon detection method may be applied to the electronic device shown in fig. 4.
And S10, acquiring data to be detected.
The data to be detected can be the code data to be detected.
S20, acquiring an original icon file from the data to be detected; the original icon file refers to an icon file which is not subjected to mirroring processing.
The original icon file may include an original icon file formatted in a first format and an original icon file formatted in a second format. The first format may be an XML format, and the second format may be a PNG format. The icon file of the first format includes a DVG icon file. That is, the original icon file may include an original PNG icon file and a DVG icon file.
And S30, preprocessing the original icon file to obtain a standard icon file.
The standard icon file is a visual icon file, and the format of the standard icon file is a second preset format (PNG format). The standard icon file may include the first standard PNG icon file and the second standard PNG icon file in the above-described embodiment.
S40, inputting the standard icon file into a preset icon classification model, and determining whether the original icon file is an icon file needing mirror image display;
if yes, go to step S50;
if not, determining that the original icon file does not need mirror image processing, and ending the process.
And S50, acquiring a target calling file in the data to be detected according to the first identification information of the original icon file.
The target calling file is a file which calls the icon file according to the first identification information to display the icon.
Alternatively, the first identification information may include a name of the original icon file, and may include the first name and the second name in the above embodiment.
Optionally, the target call file may include a first target call file and a second target call file. The first target call file may be a call file in an XML format (i.e., an XML call file). The first target call file may include the first XML call file and the second XML call file in the above-described embodiment. The second target call file may be a JAVA format call file (i.e., JAVA call file).
S60, determining whether the original icon file is subjected to mirror image processing before the icon file is called by the target calling file according to the target calling file and/or the first identification information;
if not, executing step S70;
if yes, the original icon file is subjected to mirror image processing, and the process is ended.
S70, determining whether the original icon file is subjected to mirror image processing in the process of calling the icon file by the target calling file according to the target calling file;
if not, executing step S80;
if yes, the original icon file is subjected to mirror image processing, and the process is ended.
And S80, writing the information of the original icon file into a detection report.
In this embodiment, data to be detected is acquired, a target call file is acquired from the data to be detected according to first identification information of an original icon file when the original icon file in the data to be detected is an icon file that needs to be displayed in a mirror image manner, and further, whether mirror image processing is performed on the original icon file is determined according to at least one of the target call file and the first identification information based on the data to be detected. The icon detection method can automatically detect whether the original icon file is subjected to mirror image processing or not, manual detection is not needed, all the original icon files in the code data to be detected can be detected, omission phenomenon cannot occur, and comprehensive coverage of icon file detection needing mirror image processing is achieved. In addition, compared with manual detection, the method provided by the embodiment can realize rapid detection. In short, the method provided by the embodiment can improve the efficiency of icon detection.
For example, fig. 12 is a schematic flowchart of an icon detection method according to another embodiment of the present application, as shown in fig. 12, in this implementation, step S30, preprocessing an original icon file to obtain a standard icon file may include:
s310, determining whether the original icon file is a non-visual icon file; if the original icon file is a non-visual icon file, performing visualization processing on the original icon file to obtain a visual icon file; if the original icon file is a visual icon file, step S320 is executed.
And S320, carrying out standardization processing on the visual icon file to obtain the standard icon file.
Optionally, the visualized icon file may include the first visualized PNG icon file and the second visualized PNG icon file in the above embodiments.
In one embodiment, for an original PNG icon file (e.g., the first PNG icon file in the above embodiments), step S310 may include:
s312, judging whether the PNG icon file is a non-visual PNG icon file;
if yes, executing step S313 and the above step S320;
if not, the above step S320 is executed.
And S313, layer conversion is carried out on the non-visual PNG icon file, and the non-visual PNG icon file is converted into a visual icon file.
For an original DVG icon file (e.g., the first DVG icon file in the above embodiment), before step S312, the method further includes:
and S311, converting the original DVG icon file into a PNG icon file.
In this step, the PNG icon file obtained after the conversion, or referred to as the converted icon file, may include the second PNG icon file in the above embodiment.
In one embodiment, the step S60 of determining whether the original icon file has been subjected to mirroring before the target call file calls the icon file according to the target call file and/or the first identification information may include:
for the original PNG icon file, step S610 is performed, and it is determined whether at least one of the following conditions is satisfied:
1) An icon file with identification information being first identification information is stored in a target folder in the data to be detected, and the target folder is used for storing a mirror image icon file.
2) The first target calling file comprises preset mirror image attribute information, and the preset mirror image attribute information is used for representing that the icon file called by the first target calling file is an icon file which is subjected to mirror image processing.
The preset mirror image attribute information may include the first preset mirror image attribute information and the second preset mirror image attribute information in the above embodiments.
If at least one of the two conditions is met, determining that the original icon file is subjected to mirror image processing before the target calling file calls the icon file, and ending the process; otherwise, it indicates that the original icon file is not subjected to the mirroring process before the target call file calls the icon file, and step S70 is performed.
For the original DVG icon file, step S620 is performed, and it is determined whether at least one of the following conditions is satisfied:
1) An icon file with identification information being first identification information is stored in a target folder in the data to be detected, and the target folder is used for storing a mirror image icon file.
2) The first target calling file comprises preset mirror image attribute information, and the preset mirror image attribute information is used for representing that the icon file called by the first target calling file is an icon file subjected to mirror image processing.
3) One icon file of the icon files with the first identification information as the identification information comprises preset mirror image attribute information.
If at least one of the three conditions is met, determining that the original icon file is subjected to mirror image processing before the target calling file calls the icon file, and ending the process; otherwise, it indicates that the original icon file is not subjected to the mirror image processing before the target call file calls the icon file, and step S70 is executed.
Referring to fig. 12, in an embodiment, the step S70 of determining whether the original icon file is mirrored in the process of calling the icon file by the target call file according to the target call file may include:
s710, determining whether the target calling file comprises a second target calling file;
if yes, go to step S720;
if not, the original icon file is described as a redundant icon file, mirror image processing is not needed, and the process is ended.
S720, determining whether the second target calling file comprises preset mirror image processing information or not;
if yes, the mirror image processing is performed on the original icon file, and the process is ended.
If not, it indicates that the original icon is not mirrored, and there is an icon error, and step S80 is executed.
Optionally, the preset mirroring processing information may include first preset mirroring processing information and second preset mirroring processing information in the above embodiment.
It can be understood that the parameters, the implementation processes, the beneficial effects, and the like of the embodiments shown in fig. 11 and fig. 12 are similar to or the same as those of the embodiments shown in fig. 6 to fig. 10, and reference may be made to the embodiments, which are not described again here.
In one embodiment, the icon detection method may be applied to a terminal device, and the terminal device includes, but is not limited to, a mobile phone, a tablet computer, a personal computer, and the like as described in the above embodiments.
In this embodiment, after the step S80 of writing the information of the original icon file into the detection report, the icon detection method may further include:
the terminal equipment reports the detection report to the server; the server sends the detection report to preset operation and maintenance end equipment; the operation and maintenance personnel modify the corresponding code data according to the detection report received by the operation and maintenance end equipment, mirror image processing is carried out on the icon files which need to be mirrored but are not mirrored in the detection report, and new version information is formed after modification; the operation and maintenance personnel upload the new version information to the server through the operation and maintenance end equipment, and the server pushes the new version data information to the terminal equipment; and after the user agrees that the terminal equipment receives the new version data information, updating the system version so that a display interface can display a correct icon file.
Optionally, when the terminal device uploads the detection report to the server, the detection report may be directly uploaded to the server by default, or whether to report the detection report to the server may be prompted to the user through the user interaction interface. And if the user inputs 'yes' through the user interactive interface, indicating that the detection report is uploaded to the server, uploading the detection report to the server, and otherwise, not uploading the detection report.
In addition, it can be understood that the APP for implementing the icon detection method provided by the embodiment of the present application may further include an interface for the user to upload feedback opinions, so that the user reports an icon that shows an error in the display interface or an icon that does not conform to the user habit to the server according to the actual use condition, thereby facilitating timely adjustment of the interface and meeting the user requirements. And meanwhile, the icon detection method is convenient to update and perfect, for example, if the display of a certain icon fed back by multiple users is not in accordance with the habit of the users, the icon can be determined as the icon needing mirror image, and the icon detection submodel of the type is added into the icon classification model.
It should be noted that, in this embodiment, the "user" may be an actual user after the product is sold, or may also be a detection person in the product detection stage. That is to say, the icon detection method provided by the embodiment can be applied to the detection stage of the product, so that the accuracy of detecting the icon comprehensively in the detection stage is facilitated, and the product quality is improved. Meanwhile, the method can also be applied to the product using stage, and the user detects the icon when using the complex language to display the interface, thereby being convenient for more comprehensively finding the icon error and improving the product quality.
It will be appreciated that the electronic device, in order to implement the above-described functions, comprises corresponding hardware and/or software modules for performing the respective functions. The present application is capable of being implemented in hardware or a combination of hardware and computer software in conjunction with the exemplary algorithm steps described in connection with the embodiments disclosed herein. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, in conjunction with the embodiments, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiment of the present application, the electronic device may be divided into the functional modules according to the method example, for example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one module. It should be noted that, in the embodiment of the present application, the division of the module is schematic, and is only one logic function division, and there may be another division manner in actual implementation. It should be noted that the names of the modules in the embodiments of the present application are illustrative, and the names of the modules are not limited in actual implementation.
Fig. 13 is a schematic structural diagram of an icon detecting device according to an embodiment of the present application. As shown in fig. 13, the icon detecting apparatus provided in this embodiment may include:
the first obtaining module 1301 is configured to obtain data to be detected, where the data to be detected includes an original icon file, and the original icon file refers to an icon file that is not subjected to mirror image processing;
a second obtaining module 1302, configured to, if it is determined that the original icon file is an icon file that needs to be mirror-displayed, obtain a target call file in the to-be-detected data according to the first identification information of the original icon file, where the target call file is a file that calls the icon file according to the first identification information to perform icon display;
and the judging module 1303 is configured to determine whether the original icon file is subjected to mirror image processing according to the target call file and/or the first identification information.
Optionally, in this embodiment, the first obtaining module 1301 may include a data obtaining unit and an icon scanning unit shown in the embodiment of fig. 5. The second obtaining module 1302 may include an icon classification model, a PNG trace back determination unit, a DVG trace back determination unit, a JAVA file scanning unit, etc. shown in the embodiment of fig. 5.
In an embodiment, the determining module 1303 is specifically configured to determine, according to the target call file and/or the first identification information, whether the original icon file has been subjected to mirror image processing before the target call file calls the icon file; and if the original icon file is determined not to be subjected to mirror image processing before the target calling file calls the icon file, determining whether mirror image processing is performed on the original icon file in the process of calling the icon file by the target calling file according to the target calling file.
In one embodiment, the mirror image icon file of the original icon file is the same as the identification information of the original icon file, and the target calling file comprises a first target calling file with a first preset format; the judging module 1303 is specifically configured to determine that the original icon file has been subjected to mirror image processing before the target call file calls the icon file if at least one of the target conditions is met; the target conditions include: an icon file with first identification information as identification information is stored in a target folder in the data to be detected; the target folder is used for storing mirror image icon files; the first target calling file comprises preset mirror image attribute information; the preset mirror image attribute information is used for representing that the icon file called by the first target calling file is the icon file which is subjected to mirror image processing.
In one embodiment, the folder name of the target folder includes a preset keyword.
In one embodiment, the original icon file is in a first predetermined format or a second predetermined format.
In one embodiment, the first predetermined format is an XML format and the second predetermined format is a PNG format.
In one embodiment, the format of the original icon file is a first preset format, and the target condition further includes: one icon file of the icon files with the first identification information as the identification information comprises preset mirror image attribute information.
In an embodiment, the determining module 1303 is further specifically configured to determine that the original icon file is subjected to mirror image processing in the process of calling the icon file by the target calling file if the target calling file includes a second target calling file and the second target calling file includes preset mirror image processing information, where the second target calling file is in a third preset format and the preset mirror image processing information is used to indicate that mirror image processing is performed on the original icon file.
In one embodiment, the third predetermined format is a JAVA format.
In an embodiment, the icon detecting apparatus further includes a preprocessing module 1305, configured to preprocess the original icon file to obtain a standard icon file, where the standard icon file is a visual icon file, and a format of the standard icon file is a second preset format; the second obtaining module 1302 is further configured to input the standard icon file into a preset icon classification model, determine that the original icon file is one of the preset types of icon files according to an output result of the preset icon classification model, and determine that the original icon file is an icon file that needs to be subjected to mirror image display; the preset type of icon file is the icon file needing mirror image display.
In this embodiment, the preprocessing module 1304 may include a DVG-PNG conversion unit, a layer conversion unit, a normalization processing unit, and the like shown in the embodiment of fig. 5.
In an embodiment, the preprocessing module 1304 is specifically configured to perform visualization processing on an original icon file to obtain a visualized icon file if the original icon file is a non-visualized icon file; and carrying out standardization processing on the visual icon file to obtain a standard icon file.
In an embodiment, the format of the original icon file is a second preset format, and the preprocessing module 1304 is specifically configured to perform layer conversion on the original icon file to obtain a visual icon file.
In an embodiment, the second preset format is a PNG format, and the preprocessing module 1304 is specifically configured to delete the Alpha layer of the original icon file to obtain the visual icon file if the values of all the pixel points in the Alpha layer of the original icon file are all 0 or all 1, and the values of all the pixel points in the R layer, the G layer, and the B layer are not all 0 and not all 1; if the values of the pixel points in the R layer, the G layer and the B layer of the original icon file are all 0 or 1, and the values of the pixel points in the Alpha layer are not all 0 but not 1, deleting the R layer, the G layer and the B layer of the original icon file to obtain the visual icon file.
In one embodiment, the format of the original icon file is a first preset format, and the preprocessing module 1304 is specifically configured to convert the original icon file into an icon file with a second preset format, so as to obtain a converted icon file; if the converted icon file is a non-visual icon file, performing layer conversion on the converted icon file to obtain a visual icon file; and if the converted icon file is a visual icon file, taking the converted icon file as the visual icon file.
In one embodiment, the first predetermined format is an XML format, and the preprocessing module 1304 is specifically configured to convert the original icon file into a scalable vector graphics, SVG, icon file; and converting the SVG icon file into a converted icon file.
In an embodiment, the preprocessing module 1304 is specifically configured to, if the original icon file is a visual icon file, perform a standardization process on the original icon file to obtain a standard icon file.
In one embodiment, the icon detecting apparatus further includes an updating module 1305, configured to write information of the original icon file into the detection report if the original icon file is not subjected to mirror image processing; reporting the detection report to a server; receiving new version data information pushed by a server, wherein the new version data information comprises an original icon file and a target calling file, and the original icon file in the new version data information is subjected to mirror image processing; and updating the data to be detected according to the new version data information so as to enable the display interface to display the mirror image icon file of the original icon file.
The icon detecting apparatus provided in this embodiment is used for executing the method in the foregoing method embodiments, and the technical principle and the technical effect are similar, and are not described herein again.
The embodiment of the present application provides a computer program product, which, when the computer program product runs on an electronic product, enables the electronic product to execute the technical solutions in the above embodiments. The implementation principle and technical effect are similar to those of the related embodiments, and are not described herein again.
In addition, embodiments of the present application also provide an apparatus, which may be specifically a chip, a component or a module, and may include a processor and a memory connected to each other; when the device runs, the processor can execute the computer execution instructions stored in the memory, so that the chip can execute the icon detection method in the above method embodiments. The principle and technical effects are similar to those of the related embodiments, and are not described herein again.
The embodiment of the present application provides a computer-readable storage medium, on which program instructions are stored, and when the program instructions are executed by an electronic product, the electronic product is enabled to execute the technical solutions of the above embodiments. The principle and technical effects are similar to those of the related embodiments, and are not described herein again.
In summary, the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and these modifications or substitutions do not depart from the scope of the technical solutions of the embodiments of the present application.

Claims (19)

1. An icon detection method, characterized in that the method comprises:
acquiring data to be detected, wherein the data to be detected comprises an original icon file, and the original icon file refers to an icon file which is not subjected to mirror image processing;
if the original icon file is determined to be the icon file needing mirror image display, acquiring a target calling file in the data to be detected according to first identification information of the original icon file, wherein the target calling file is a file for calling the icon file according to the first identification information to display the icon, and comprises a first target calling file and a second target calling file;
determining whether the original icon file is subjected to mirror image processing or not according to the first target calling file; or determining whether the original icon file is subjected to mirror image processing before calling is executed according to the first identification information;
determining that the original icon file is not subjected to mirror image processing before the call is executed, and determining whether the original icon file is subjected to mirror image processing in the call execution process according to the second target call file.
2. The method of claim 1,
determining whether the original icon file is subjected to mirror image processing according to the first target call file, wherein the determining comprises the following steps:
and determining whether the first target calling file comprises preset mirror image attribute information, wherein the preset mirror image attribute information is used for representing that the icon file called by the first target calling file is an icon file subjected to mirror image processing.
3. The method of claim 1, wherein the mirror icon file of the original icon file is identical to the identification information of the original icon file,
determining whether the original icon file is subjected to mirror image processing before the call is executed according to the first identification information, wherein the determining comprises the following steps:
an icon file with identification information being the first identification information is stored in a target folder in the data to be detected, and the target folder is used for storing a mirror image icon file.
4. The method according to claim 3, wherein the folder name of the target folder comprises a preset keyword.
5. The method according to claim 1, wherein the original icon file is in a first predetermined format or a second predetermined format, and the first target call file is in the first predetermined format.
6. The method of claim 5, wherein the first predetermined format is an XML format and the second predetermined format is a PNG format.
7. The method of claim 3, wherein the format of the original icon file is a first preset format, and the determining whether the original icon file is mirrored before the call is executed according to the first identification information comprises:
and determining whether the icon file comprising the preset mirror image attribute information exists in the icon files of which the identification information is the first identification information.
8. The method of claim 1, wherein determining whether the original icon file is mirrored during the call execution process according to the second target call file comprises:
if the second target calling file comprises preset mirror image processing information, determining that mirror image processing is performed on the original icon file in the process that the target calling file calls the icon file, wherein the format of the second target calling file is a third preset format, and the preset mirror image processing information is used for indicating mirror image processing of the original icon file.
9. The method according to claim 8, wherein the third predefined format is JAVA format.
10. The method of claim 1, further comprising:
preprocessing the original icon file to obtain a standard icon file, wherein the standard icon file is a visual icon file, and the format of the standard icon file is a second preset format;
inputting the standard icon file into a preset icon classification model, determining that the original icon file is one of icon files of preset types according to an output result of the preset icon classification model, and determining that the original icon file is the icon file needing mirror image display, wherein the icon file of the preset type is the icon file needing mirror image display.
11. The method of claim 10, wherein pre-processing the original icon file to obtain a standard icon file comprises:
if the original icon file is a non-visual icon file, performing visual processing on the original icon file to obtain a visual icon file;
and standardizing the visual icon file to obtain the standard icon file.
12. The method according to claim 11, wherein the original icon file is in the second preset format, and the visualizing the original icon file to obtain a visualized icon file comprises:
and carrying out layer conversion on the original icon file to obtain the visual icon file.
13. The method according to claim 12, wherein the second preset format is a PNG format, and the performing layer conversion on the original icon file to obtain the visual icon file comprises:
if the values of all the pixel points in the Alpha layers of the original icon file are all 0 or 1, and the values of all the pixel points in the R layer, the G layer and the B layer are not all 0 but not 1, deleting the Alpha layers of the original icon file to obtain the visual icon file;
if the values of the pixel points in the R layer, the G layer and the B layer of the original icon file are all 0 or 1, and the values of the pixel points in the Alpha layer are not all 0 but not 1, deleting the R layer, the G layer and the B layer of the original icon file to obtain the visual icon file.
14. The method of claim 11, wherein the original icon file is in a first predetermined format, and the visualizing the original icon file to obtain a visualized icon file comprises:
converting the original icon file into an icon file with a format of the second preset format to obtain a converted icon file;
if the converted icon file is a non-visual icon file, performing layer conversion on the converted icon file to obtain a visual icon file;
and if the converted icon file is a visual icon file, taking the converted icon file as the visual icon file.
15. The method of claim 14, wherein the first predetermined format is an XML format and the second predetermined format is a PNG format, and the converting the original icon file into the icon file having the second predetermined format to obtain the converted icon file comprises:
converting the original icon file into a Scalable Vector Graphics (SVG) icon file;
and converting the SVG icon file into the converted icon file.
16. The method of claim 10, wherein pre-processing the original icon file to obtain a standard icon file comprises:
and if the original icon file is a visual icon file, standardizing the original icon file to obtain the standard icon file.
17. The method according to any one of claims 1 to 16, further comprising:
if the original icon file is not subjected to mirror image processing in the calling execution process, writing the information of the original icon file into a detection report;
reporting the detection report to a server;
receiving new version data information pushed by the server, wherein the new version data information comprises the original icon file and the target calling file, and the original icon file in the new version data information is subjected to mirror image processing;
updating the data to be detected according to the new version data information so as to enable a display interface to display a mirror image icon file of the original icon file;
and if the original icon file is subjected to mirror image processing before the call is executed or the original icon file is subjected to mirror image processing in the call execution process, ending the process.
18. An electronic device, comprising: a processor, a memory, and an interface;
the processor, memory and interface cooperate to cause the electronic device to perform the method of any of claims 1-17.
19. A computer-readable storage medium, in which a computer program is stored which, when executed by a processor, causes the processor to carry out the method of any one of claims 1 to 17.
CN202111307392.2A 2021-11-05 2021-11-05 Icon detection method, electronic device, readable storage medium, and program product Active CN114996226B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111307392.2A CN114996226B (en) 2021-11-05 2021-11-05 Icon detection method, electronic device, readable storage medium, and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111307392.2A CN114996226B (en) 2021-11-05 2021-11-05 Icon detection method, electronic device, readable storage medium, and program product

Publications (2)

Publication Number Publication Date
CN114996226A CN114996226A (en) 2022-09-02
CN114996226B true CN114996226B (en) 2023-03-31

Family

ID=83018888

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111307392.2A Active CN114996226B (en) 2021-11-05 2021-11-05 Icon detection method, electronic device, readable storage medium, and program product

Country Status (1)

Country Link
CN (1) CN114996226B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102457567A (en) * 2010-11-08 2012-05-16 中标软件有限公司 Mirror image backup/recovery method and tool of web management mode
CN110442376A (en) * 2019-07-19 2019-11-12 精硕科技(北京)股份有限公司 A kind of method and device for realizing Software package

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100414524B1 (en) * 2002-10-31 2004-01-16 주식회사 아이콘랩 Two-dimensional Code having superior decoding property which is possible to control the level of error correcting codes, and method for encoding and decoding the same
CN100428157C (en) * 2005-10-19 2008-10-22 联想(北京)有限公司 A computer system and method to check completely
KR100704898B1 (en) * 2006-02-27 2007-04-09 (주)폴리다임 Icon transforming system, and service method for the same
CN104090700B (en) * 2014-01-09 2017-11-28 腾讯科技(深圳)有限公司 application icon management method and device
CN103778373B (en) * 2014-01-10 2017-02-08 深圳市深信服电子科技有限公司 Virus detection method and device
CN105260184B (en) * 2015-10-15 2019-02-19 Oppo广东移动通信有限公司 A kind of adjustment method and device for restoring image file
CN107357691B (en) * 2016-05-09 2022-06-21 中兴通讯股份有限公司 Method and device for processing mirror image file
CN108717357B (en) * 2018-05-23 2023-11-10 中国平安人寿保险股份有限公司 Page display code conversion method, device, equipment and computer storage medium
CN110737502B (en) * 2018-07-19 2023-05-05 阿里巴巴集团控股有限公司 Mirror image file processing method, device and system
CN109408465B (en) * 2018-10-29 2021-07-13 Oppo广东移动通信有限公司 File attribution information recording method, device, storage medium and terminal
CN110362427A (en) * 2019-06-26 2019-10-22 苏州浪潮智能科技有限公司 A kind of processing method of image file, system, BMC and readable storage medium storing program for executing
CN110457907B (en) * 2019-07-25 2021-04-20 腾讯科技(深圳)有限公司 Firmware program detection method and device
CN111857694A (en) * 2020-07-25 2020-10-30 苏州浪潮智能科技有限公司 Code editing method and device based on cloud native program development and deployment
CN113434249A (en) * 2021-06-18 2021-09-24 杭州趣链科技有限公司 Mirror image synchronization method and device, docker host and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102457567A (en) * 2010-11-08 2012-05-16 中标软件有限公司 Mirror image backup/recovery method and tool of web management mode
CN110442376A (en) * 2019-07-19 2019-11-12 精硕科技(北京)股份有限公司 A kind of method and device for realizing Software package

Also Published As

Publication number Publication date
CN114996226A (en) 2022-09-02

Similar Documents

Publication Publication Date Title
CN114821622B (en) Text extraction method, text extraction model training method, device and equipment
CN110785736A (en) Automatic code generation
US20090110288A1 (en) Document processing apparatus and document processing method
CN109408058B (en) Front-end auxiliary development method and device based on machine learning
CN111753717B (en) Method, device, equipment and medium for extracting structured information of text
CN111144210B (en) Image structuring processing method and device, storage medium and electronic equipment
CN112507806B (en) Intelligent classroom information interaction method and device and electronic equipment
CN116049397B (en) Sensitive information discovery and automatic classification method based on multi-mode fusion
US10360286B2 (en) Color coding of layout structure elements in a flow format document
KR20210090576A (en) A method, an apparatus, an electronic device, a storage medium and a program for controlling quality
US20230334880A1 (en) Hot word extraction method and apparatus, electronic device, and medium
CN112114787A (en) Report generation method and device and storage medium
KR20210128907A (en) A method, a device, an electronic equipment and a storage medium for extracting information
CN116129452A (en) Method, application method, device, equipment and medium for generating document understanding model
CN110826619A (en) File classification method and device of electronic files and electronic equipment
CN114996226B (en) Icon detection method, electronic device, readable storage medium, and program product
CN116860747A (en) Training sample generation method and device, electronic equipment and storage medium
CN115631374A (en) Control operation method, control detection model training method, device and equipment
CN115454554A (en) Text description generation method, text description generation device, terminal and storage medium
CN114463768A (en) Form recognition method and device, readable medium and electronic equipment
CN113807056A (en) Method, device and equipment for correcting error of document name sequence number
CN113191251A (en) Method and device for detecting stroke order, electronic equipment and storage medium
CN115497112B (en) Form recognition method, form recognition device, form recognition equipment and storage medium
CN116737094B (en) Custom label printing method based on Vue framework
CN114937158A (en) Image analysis method and related device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant