CN110069458A - Method, equipment and the storage medium of invalid resource in a kind of deletion Android system - Google Patents

Method, equipment and the storage medium of invalid resource in a kind of deletion Android system Download PDF

Info

Publication number
CN110069458A
CN110069458A CN201910340988.9A CN201910340988A CN110069458A CN 110069458 A CN110069458 A CN 110069458A CN 201910340988 A CN201910340988 A CN 201910340988A CN 110069458 A CN110069458 A CN 110069458A
Authority
CN
China
Prior art keywords
component
starting
list
resource file
search
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.)
Pending
Application number
CN201910340988.9A
Other languages
Chinese (zh)
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.)
Nubia Technology Co Ltd
Original Assignee
Nubia Technology 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 Nubia Technology Co Ltd filed Critical Nubia Technology Co Ltd
Priority to CN201910340988.9A priority Critical patent/CN110069458A/en
Publication of CN110069458A publication Critical patent/CN110069458A/en
Pending legal-status Critical Current

Links

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/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/162Delete operations
    • 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/1737Details of further file system functions for reducing power consumption or coping with limited storage space, e.g. in mobile devices

Abstract

The embodiment of the invention discloses invalid resources in a kind of deletion Android system, equipment and storage medium, the method includes the starting information of component each in extraction system, formation component list, according to described the component list, it constructs and inter-related has been turned on component search tree, the successively resource file in search system application program under each catalogue, whether detection resource file is directly or indirectly quoted by any component having been turned in component search tree, if it is, then retain using the resource file as effective document, if not, then deleted using the resource file as garbage files.In this way, when detecting that resource file is quoted by alternative document, component search tree is had been turned on by building, the validity of reference document is further retrieved, ensure the validity of the resource file, to delete invalid waste resources file to the greatest extent, fundamentally solve the problems, such as that invalid resource occupies system partitioning in application program.

Description

Method, equipment and the storage medium of invalid resource in a kind of deletion Android system
Technical field
The present embodiments relate to field of communication technology more particularly to a kind of sides for deleting invalid resource in Android system Method, equipment and storage medium.
Background technique
With popularizing for Android android system development platform, more and more application programs are developed.Usual feelings Under condition, all Application sharing system partitionings.But since system partitioning size is limited, with various projects and application program Exploitation, cause system partitioning can be used space it is fewer and fewer.
In android system, the division of resource file category has picture resource, color resource, layout resource, character string Resource etc., some resource file significant portions are the useless waste resources that application program is not used.These waste resources are not The volume of application program is only taken up, and is difficult to find out.Which results in will increase when each iterative development application program The volume of application program, if it is desired to delete invalid resource, and need that very big manpower and time is spent open to check to program Hair brings very big puzzlement.
Summary of the invention
In view of this, the embodiment of the present invention proposes the method for invalid resource, equipment in a kind of deletion Android system and deposits Storage media, to solve the above technical problems.
Firstly, to achieve the above object, the embodiment of the present invention proposes a kind of method for deleting invalid resource in Android system, The described method includes:
The starting information of each component in extraction system generates the column of assemblies comprising each component Name and corresponding starting information Table;
According to described the component list, building is inter-related to have been turned on component search tree;
The successively resource file in search system application program under each catalogue;
Whether detection resource file is directly or indirectly quoted by any component having been turned in component search tree, if Be then retain using the resource file as effective document, if it is not, then using the resource file as garbage files into Row is deleted.
Optionally, detection resource file whether by any component having been turned in component search tree directly or indirectly Before reference further include:
Resource file is detected whether cited in any file of system, if it is not, then using the resource file as rubbish File is deleted, if it is, further detecting whether resource file is had been turned on by described in having been turned on component search tree Any component in component search tree is directly or indirectly quoted.
Optionally, in extraction system each component starting information, generate starting information list, comprising:
Each module information explicitly started in extraction system generates explicit starting the component list;
Each module information implicitly started in extraction system generates implicit starting the component list.
Optionally, each module information explicitly started in extraction system generates explicit starting the component list, concrete mode Are as follows:
Each component containing .class field is searched for, and extracts each module information containing .class field, is generated explicit Start the component list, the list includes each component Name and corresponding .class field;
Each module information implicitly started in extraction system generates implicit starting the component list, concrete mode are as follows:
Each component containing .action field is searched for, and extracts each module information containing .action field, is generated hidden Formula starts the component list, and the list includes each component Name and corresponding .action field.
Optionally, according to the component list, building is inter-related to have been turned on component search tree, concrete mode are as follows:
The first starting component that system is found by manifest.xml, the root node as search tree;
Whether search in explicitly starting the component list and implicit starting the component list has the first starting of other assemblies reference Component, if it is, establishing the association of the first starting component to the component;
Whether search in explicitly starting the component list and implicit starting the component list has other assemblies reference described and the The one starting associated component of component, if it is, establishing component associated with the first starting component to the pass of the component Connection, until generating using the first starting component as the search tree of root node.
Optionally, whether search in explicitly starting the component list and implicit starting the component list has other assemblies reference the One starting component, concrete mode are as follows:
Whether search in the java file of the first starting component has other assemblies in explicit starting the component list .class field, if it is not, then whether search has the .action field of other assemblies in implicit starting the component list.
Optionally, whether search in explicitly starting the component list and implicit starting the component list has other assemblies to quote institute State component associated with the first starting component, concrete mode are as follows:
Whether search in the java file of component associated with the first starting component has in explicit starting the component list The .class field of other assemblies, if it is not, then whether search has the .action word of other assemblies in implicit starting the component list Section.
Optionally, it is whether straight by any component in described search tree that resource file is detected in having been turned on component search tree It connects or indirect referencing, concrete mode are as follows:
By recursive lookup, searched in having been turned on component search tree resource file whether with any component in search tree There is directly or indirectly adduction relationship.
In addition, to achieve the above object, the embodiment of the present invention also provides a kind of setting for invalid resource in deletion Android system Standby, the equipment includes: memory, processor and is stored in the meter that can be run on the memory and on the processor Calculation machine program realizes the step as described in preceding method is any when the computer program is executed by the processor.
In addition, to achieve the above object, the embodiment of the present invention also provides a kind of computer readable storage medium, the calculating Machine readable storage medium storing program for executing is stored at least one executable program of computer, at least one described program is held by the computer The computer is set to execute the step in the above method when row.
Compared to the prior art, the method for deleting invalid resource in Android system that the embodiment of the present invention is proposed, works as inspection When measuring resource file and being quoted by alternative document, component search tree is had been turned on by building, to the validity of reference document into The retrieval of one step, it is ensured that the validity of the resource file, to delete invalid waste resources file to the greatest extent, fundamentally Solve the problems, such as that invalid resource occupies system partitioning in application program.
Detailed description of the invention
Fig. 1 is the hardware structural diagram for realizing a kind of mobile terminal of each embodiment of the present invention;
Fig. 2 is a kind of communications network system architecture diagram provided in an embodiment of the present invention;
Fig. 3 is a kind of hardware structural diagram of server provided in an embodiment of the present invention;
Fig. 4 is a kind of flow diagram for deleting invalid resource method in Android system provided in an embodiment of the present invention;
Fig. 5 A is that Activity provided in an embodiment of the present invention implicitly starts the component list schematic diagram;
Fig. 5 B is that Service provided in an embodiment of the present invention implicitly starts the component list schematic diagram;
Fig. 6 is the flow chart provided in an embodiment of the present invention for constructing and having been turned on component search tree;
Fig. 7 is another flow diagram for deleting invalid resource method in Android system provided in an embodiment of the present invention;
Fig. 8 is the device structure schematic diagram of invalid resource in deletion Android system provided in an embodiment of the present invention.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
In subsequent description, it is only using the suffix for indicating such as " module ", " component " or " unit " of element Be conducive to explanation of the invention, itself there is no a specific meaning.Therefore, " module ", " component " or " unit " can mix Ground uses.
Terminal can be implemented in a variety of manners.For example, terminal described in the present invention may include such as mobile phone, plate Computer, laptop, palm PC, personal digital assistant (Personal Digital Assistant, PDA), portable Media player (Portable Media Player, PMP), navigation device, wearable device, Intelligent bracelet, pedometer etc. move The fixed terminals such as dynamic terminal, and number TV, desktop computer.
It will be illustrated by taking mobile terminal as an example in subsequent descriptions, it will be appreciated by those skilled in the art that in addition to special Except element for moving purpose, the construction of embodiment according to the present invention can also apply to the terminal of fixed type.
Referring to Fig. 1, a kind of hardware structural diagram of its mobile terminal of each embodiment to realize the present invention, the shifting Dynamic terminal 100 may include: RF (Radio Frequency, radio frequency) unit 101, WiFi module 102, audio output unit 103, A/V (audio/video) input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, the components such as memory 109, processor 110 and power supply 111.It will be understood by those skilled in the art that shown in Fig. 1 Mobile terminal structure does not constitute the restriction to mobile terminal, and mobile terminal may include components more more or fewer than diagram, Perhaps certain components or different component layouts are combined.
It is specifically introduced below with reference to all parts of the Fig. 1 to mobile terminal:
Radio frequency unit 101 can be used for receiving and sending messages or communication process in, signal sends and receivees, specifically, by base station Downlink information receive after, to processor 110 handle;In addition, the data of uplink are sent to base station.In general, radio frequency unit 101 Including but not limited to antenna, at least one amplifier, transceiver, coupler, low-noise amplifier, duplexer etc..In addition, penetrating Frequency unit 101 can also be communicated with network and other equipment by wireless communication.Any communication can be used in above-mentioned wireless communication Standard or agreement, including but not limited to GSM (Global System of Mobile communication, global system for mobile telecommunications System), GPRS (General Packet Radio Service, general packet radio service), CDMA2000 (Code Division Multiple Access 2000, CDMA 2000), WCDMA (Wideband Code Division Multiple Access, wideband code division multiple access), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access, TD SDMA), FDD-LTE (Frequency Division Duplexing-Long Term Evolution, frequency division duplex long term evolution) and TDD-LTE (Time Division Duplexing-Long Term Evolution, time division duplex long term evolution) etc..
WiFi belongs to short range wireless transmission technology, and mobile terminal can help user to receive and dispatch electricity by WiFi module 102 Sub- mail, browsing webpage and access streaming video etc., it provides wireless broadband internet access for user.Although Fig. 1 shows Go out WiFi module 102, but it is understood that, and it is not belonging to must be configured into for mobile terminal, it completely can be according to need It to omit within the scope of not changing the essence of the invention.
Audio output unit 103 can be in call signal reception pattern, call mode, record mould in mobile terminal 100 When under the isotypes such as formula, speech recognition mode, broadcast reception mode, by radio frequency unit 101 or WiFi module 102 it is received or The audio data stored in memory 109 is converted into audio signal and exports to be sound.Moreover, audio output unit 103 Audio output relevant to the specific function that mobile terminal 100 executes can also be provided (for example, call signal receives sound, disappears Breath receives sound etc.).Audio output unit 103 may include loudspeaker, buzzer etc..
A/V input unit 104 is for receiving audio or video signal.A/V input unit 104 may include graphics processor (Graphics Processing Unit, GPU) 1041 and microphone 1042, graphics processor 1041 is in video acquisition mode Or the image data of the static images or video obtained in image capture mode by image capture apparatus (such as camera) carries out Reason.Treated, and picture frame may be displayed on display unit 106.Through graphics processor 1041, treated that picture frame can be deposited Storage is sent in memory 109 (or other storage mediums) or via radio frequency unit 101 or WiFi module 102.Mike Wind 1042 can connect in telephone calling model, logging mode, speech recognition mode etc. operational mode via microphone 1042 Quiet down sound (audio data), and can be audio data by such acoustic processing.Audio that treated (voice) data can To be converted to the format output that can be sent to mobile communication base station via radio frequency unit 101 in the case where telephone calling model. Microphone 1042 can be implemented various types of noises elimination (or inhibition) algorithms and send and receive sound to eliminate (or inhibition) The noise generated during frequency signal or interference.
Mobile terminal 100 further includes at least one sensor 105, such as optical sensor, motion sensor and other biographies Sensor.Specifically, optical sensor includes ambient light sensor and proximity sensor, wherein ambient light sensor can be according to environment The light and shade of light adjusts the brightness of display panel 1061, and proximity sensor can close when mobile terminal 100 is moved in one's ear Display panel 1061 and/or backlight.As a kind of motion sensor, accelerometer sensor can detect in all directions (general For three axis) size of acceleration, it can detect that size and the direction of gravity when static, can be used to identify the application of mobile phone posture (such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, percussion) etc.; The fingerprint sensor that can also configure as mobile phone, pressure sensor, iris sensor, molecule sensor, gyroscope, barometer, The other sensors such as hygrometer, thermometer, infrared sensor, details are not described herein.
Display unit 106 is for showing information input by user or being supplied to the information of user.Display unit 106 can wrap Display panel 1061 is included, liquid crystal display (Liquid Crystal Display, LCD), Organic Light Emitting Diode can be used Forms such as (Organic Light-Emitting Diode, OLED) configure display panel 1061.
User input unit 107 can be used for receiving the number or character information of input, and generate the use with mobile terminal Family setting and the related key signals input of function control.Specifically, user input unit 107 may include touch panel 1071 with And other input equipments 1072.Touch panel 1071, also referred to as touch screen collect the touch operation of user on it or nearby (for example user uses any suitable objects or attachment such as finger, stylus on touch panel 1071 or in touch panel 1071 Neighbouring operation), and corresponding attachment device is driven according to preset formula.Touch panel 1071 may include touch detection Two parts of device and touch controller.Wherein, the touch orientation of touch detecting apparatus detection user, and detect touch operation band The signal come, transmits a signal to touch controller;Touch controller receives touch information from touch detecting apparatus, and by it It is converted into contact coordinate, then gives processor 110, and order that processor 110 is sent can be received and executed.In addition, can To realize touch panel 1071 using multiple types such as resistance-type, condenser type, infrared ray and surface acoustic waves.In addition to touch panel 1071, user input unit 107 can also include other input equipments 1072.Specifically, other input equipments 1072 can wrap It includes but is not limited in physical keyboard, function key (such as volume control button, switch key etc.), trace ball, mouse, operating stick etc. It is one or more, specifically herein without limitation.
Further, touch panel 1071 can cover display panel 1061, when touch panel 1071 detect on it or After neighbouring touch operation, processor 110 is sent to determine the type of touch event, is followed by subsequent processing device 110 according to touch thing The type of part provides corresponding visual output on display panel 1061.Although in Fig. 1, touch panel 1071 and display panel 1061 be the function that outputs and inputs of realizing mobile terminal as two independent components, but in certain embodiments, it can The function that outputs and inputs of mobile terminal is realized so that touch panel 1071 and display panel 1061 is integrated, is not done herein specifically It limits.
Interface unit 108 be used as at least one external device (ED) connect with mobile terminal 100 can by interface.For example, External device (ED) may include wired or wireless headphone port, external power supply (or battery charger) port, wired or nothing Line data port, memory card port, the port for connecting the device with identification module, audio input/output (I/O) end Mouth, video i/o port, ear port etc..Interface unit 108 can be used for receiving the input from external device (ED) (for example, number It is believed that breath, electric power etc.) and the input received is transferred to one or more elements in mobile terminal 100 or can be with For transmitting data between mobile terminal 100 and external device (ED).
Memory 109 can be used for storing software program and various data.Memory 109 can mainly include storing program area The storage data area and, wherein storing program area can (such as the sound of application program needed for storage program area, at least one function Sound playing function, image player function etc.) etc.;Storage data area can store according to mobile phone use created data (such as Audio data, phone directory etc.) etc..In addition, memory 109 may include high-speed random access memory, it can also include non-easy The property lost memory, a for example, at least disk memory, flush memory device or other volatile solid-state parts.
Processor 110 is the control centre of mobile terminal, utilizes each of various interfaces and the entire mobile terminal of connection A part by running or execute the software program and/or module that are stored in memory 109, and calls and is stored in storage Data in device 109 execute the various functions and processing data of mobile terminal, to carry out integral monitoring to mobile terminal.Place Managing device 110 may include one or more processing units;Preferably, processor 110 can integrate application processor and modulatedemodulate is mediated Manage device, wherein the main processing operation system of application processor, user interface and application program etc., modem processor is main Processing wireless communication.It is understood that above-mentioned modem processor can not also be integrated into processor 110.
Mobile terminal 100 can also include the power supply 111 (such as battery) powered to all parts, it is preferred that power supply 111 Can be logically contiguous by power-supply management system and processor 110, to realize management charging by power-supply management system, put The functions such as electricity and power managed.
Although Fig. 1 is not shown, mobile terminal 100 can also be including bluetooth module etc., and details are not described herein.
Embodiment to facilitate the understanding of the present invention, the communications network system that mobile terminal of the invention is based below into Row description.
Referring to Fig. 2, Fig. 2 is a kind of communications network system architecture diagram provided in an embodiment of the present invention, the communication network system System is the LTE system of universal mobile communications technology, which includes UE (User Equipment, the use of successively communication connection Family equipment) (the land Evolved UMTS Terrestrial Radio Access Network, evolved UMTS 201, E-UTRAN Ground wireless access network) 202, EPC (Evolved Packet Core, evolved packet-based core networks) 203 and operator IP operation 204。
Specifically, UE201 can be above-mentioned terminal 100, and details are not described herein again.
E-UTRAN202 includes eNodeB2021 and other eNodeB2022 etc..Wherein, eNodeB2021 can be by returning Journey (backhaul) (such as X2 interface) is connect with other eNodeB2022, and eNodeB2021 is connected to EPC203, ENodeB2021 can provide the access of UE201 to EPC203.
EPC203 may include MME (Mobility Management Entity, mobility management entity) 2031, HSS (Home Subscriber Server, home subscriber server) 2032, other MME2033, SGW (Serving Gate Way, Gateway) 2034, PGW (PDN Gate Way, grouped data network gateway) 2035 and PCRF (Policy and Charging Rules Function, policy and rate functional entity) 2036 etc..Wherein, MME2031 be processing UE201 and The control node of signaling, provides carrying and connection management between EPC203.HSS2032 is all to manage for providing some registers Such as the function of home location register (not shown) etc, and preserves some related service features, data rates etc. and use The dedicated information in family.All customer data can be sent by SGW2034, and PGW2035 can provide the IP of UE 201 Address distribution and other functions, PCRF2036 are strategy and the charging control strategic decision-making of business data flow and IP bearing resource Point, it selects and provides available strategy and charging control decision with charge execution function unit (not shown) for strategy.
IP operation 204 may include internet, Intranet, IMS (IP Multimedia Subsystem, IP multimedia System) or other IP operations etc..
Although above-mentioned be described by taking LTE system as an example, those skilled in the art should know the present invention is not only Suitable for LTE system, be readily applicable to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA with And the following new network system etc., herein without limitation.
Referring to Fig. 3, Fig. 3 is a kind of hardware structural diagram of server provided in an embodiment of the present invention, such as Fig. 3 institute Show, the server includes: processor 300, transceiver 310, memory 320, user interface 330 and bus interface, the place Device 300 is managed, for reading the program in memory 320.In Fig. 3, bus architecture may include the total of any number of interconnection The various circuits for the memory that line and bridge, the one or more processors specifically represented by processor 300 and memory 320 represent It links together.Bus architecture can also be by the various other of such as peripheral equipment, voltage-stablizer and management circuit or the like Circuit links together, and these are all it is known in the art, and therefore, it will not be further described herein.Bus connects Mouth provides interface, and transceiver 310 can be multiple element, that is, includes transmitter and receiver, provide for over a transmission medium The unit communicated with various other devices.For different user equipmenies, user interface 330 can also be being capable of external inscribed need The interface of equipment is wanted, the equipment of connection includes but is not limited to keypad, display, loudspeaker, microphone, control stick etc..
Processor 300, which is responsible for management bus architecture and common processing, memory 320, can store processor 300 and is holding Used data when row operation.
Based on above-mentioned 100 hardware configuration of mobile terminal, communications network system and server hardware structure, the present invention is proposed The each embodiment of method.
It is a kind of the step of deleting the method for invalid resource in Android system provided in an embodiment of the present invention refering to Fig. 4, Fig. 4 Flow chart, the method are applied in Android system, as shown in Figure 4, which comprises
The starting information of each component in step 401, extraction system is generated comprising each component Name and corresponding starting information group Part list.
In Android android system, each Android application program has a manifest.xml file, In app/manifest catalogue.Manifest.xml file describe application program composition and four big groups of android system Part.Four big components include: component activity Activity, service Service, broadcasting receiver BroadcastReceiver, content Provider ContentProvider.
Therefore by Manifest.xml configuration file, the starting information of system all components can be extracted.
Since the starting of each component has explicit starting and implicitly starting two ways, according to explicit starting and implicitly Start two ways, extracts starting information.
In the present embodiment, in extraction system each component starting information, formation component list, comprising:
Each module information explicitly started in extraction system generates explicit starting the component list;
Each module information implicitly started in extraction system generates implicit starting the component list.
Further, each module information explicitly started in extraction system generates explicit starting the component list, concrete mode Are as follows:
Each component containing .class field is searched for, and extracts each module information containing .class field, is generated explicit Start the component list, the list includes each component Name and corresponding .class field.
Further, each module information implicitly started in extraction system generates implicit starting the component list, concrete mode Are as follows:
Each component containing .action field is searched for, and extracts each module information containing .action field, is generated hidden Formula starts the component list, and the list includes each component Name and corresponding .action field.
As shown in Figure 5 A and 5B, respectively Activity implicitly starts the component list and Service implicitly starts column of assemblies Table.Implicit starting the component list stores each component Name implicitly started and corresponding .action field.Other types group The component list of part is similar with Activity and Service, does not do describe one by one here.
Similarly, explicitly starting the component list stores each component Name explicitly started and corresponding .class field. Here it does not repeat them here yet.
Step 402, according to the component list, construct and inter-related have been turned on component search tree.
Referring to Fig. 6, having been turned on the flow chart of component search tree for building.As shown in figure 5, according to starting information list, Construct it is inter-related have been turned on component search tree, specifically include:
Step 601 finds the first starting component, the root node as search tree by manifest.xml.
In general, it is Activity1 that android system first, which starts component, using the first starting component as the root of search tree Node will be directly linked with the first starting component or other starting components of indirect association be as leaf node, and generation has been opened Dynamic component search tree.
Step 602 searches for whether have other starting components in explicitly starting the component list and implicit starting the component list Reference the first starting component, if it is, establishing the association of the first starting component to the starting component.
In the present embodiment, specifically in the following way:
Whether search in the java file of the first starting component has other assemblies in explicit starting the component list .class field, if it is, the association of the first starting component to the starting component is established, if it is not, then whether search has The .action field of other assemblies in implicit starting the component list, if there is implicitly starting other assemblies in the component list .action field then establishes the association of the first starting component to the starting component.
Step 603 searches for whether have other starting components in explicitly starting the component list and implicit starting the component list The reference component associated with the first starting component, is arrived if it is, establishing component associated with the first starting component The association of the starting component, until generating using the first starting component as the search tree of root node.
Whether search in the java file of component associated with the first starting component has in explicit starting the component list The .class field of other assemblies, if it is not, then whether search has the .action word of other assemblies in implicit starting the component list Section.
It being exemplified below and has been turned on component search tree construction, it is assumed that Activity1 is root node, Activity2, Activity3, Activity4, Service1 are the child node of Activity1, and Activity5, Activity6 are The child node of Activity4.
Step 403, the successively resource file in search system application program under each catalogue.
Usually, RES file is referred to as resource file, therefore successively searches for RES mesh in android system application program Resource file under record.Such as gerFiles function recursive search RES catalogue can be called, obtain all resources under the catalogue File.Which is not described herein again.
Whether step 404 detects resource file by any component in described search tree in having been turned on component search tree It directly or indirectly quotes, if it is, retaining using the resource file as effective document, if it is not, then will be described Resource file is deleted as garbage files.
In another feasible scheme, before executing step 404, following steps are first carried out:
Resource file is detected whether cited in any file of system, if it is not, then using the resource file as rubbish File is deleted, if it is, further detecting whether resource file is had been turned on by described in having been turned on component search tree Any component in component search tree is directly or indirectly quoted.
Specifically, by recursive lookup, searched in having been turned on component search tree resource file whether with search tree species Any component has directly or indirectly adduction relationship.
Assuming that resource file A is quoted by file B, file B is quoted by file C again, then file A is directly to quote with file B Relationship, file A and file C are indirect referencing relationships.
For example, detecting that resource file A is quoted by another file B of system, need further to detect, whether file B is by it Cited in his file, that is, whether file A there are also other indirect referencing files, when resource file A direct reference document B or Other indirect referencing files of person are then to determine resource file A for efficient resource when having been turned on any component in component search tree File, when recursive traversal has been turned on all components in component search tree, the direct reference document B of resource file A or other Connecing reference document is not then to determine that resource file A is invalid waste resources when having been turned on any component in component search tree File carries out delete processing.
The method of invalid resource in deletion Android system provided in this embodiment, when detecting resource file by alternative document When reference, component search tree is had been turned on by building, the validity of reference document is further retrieved, it is ensured that the resource file Validity fundamentally solve in application program and provide in vain to delete invalid waste resources file to the greatest extent Source occupies the problem of system partitioning.
Referring to Fig. 7, Fig. 7 is another method for deleting invalid resource in Android system provided in an embodiment of the present invention Flow chart of steps, which comprises
Step 701, by Manifest.xml configuration file, each module information for explicitly starting in extraction system and implicit Each module information of starting, it is corresponding to generate explicit starting the component list and implicit starting the component list.
In a feasible scheme, each module information explicitly started in extraction system generates explicit starting column of assemblies Table, concrete mode are as follows:
Each component containing .class field is searched for, and extracts each module information containing .class field, is generated explicit Start the component list, the list includes each component Name and corresponding .class field.
Each module information implicitly started in extraction system generates implicit starting the component list, concrete mode are as follows:
Each component containing .action field is searched for, and extracts each module information containing .action field, is generated hidden Formula starts the component list, and the list includes each component Name and corresponding .action field.
Step 702, basis are explicit to be started the component list and implicitly starts the component list, and building is inter-related to have been turned on group Part search tree;
In a feasible scheme, detailed process includes:
The first starting component is found by manifest.xml, the root node as search tree;
Whether search in explicitly starting the component list and implicit starting the component list has other starting component references first Start component, if it is, establishing the association of the first starting component to the starting component;
Whether search in explicitly starting the component list and implicit starting the component list has described in other starting component references Component associated with the first starting component, if it is, establishing component associated with the first starting component to the starting The association of component, until generating using the first starting component as the search tree of root node.
In general, it is Activity1 that android system first, which starts component, using the first starting component as the root of search tree Node will be directly linked with the first starting component or other starting components of indirect association be as leaf node, and generation has been opened Dynamic component search tree.
In the present embodiment, specifically in the following way:
Whether search in the java file of the first starting component has other assemblies in explicit starting the component list .class field, if it is, the association of the first starting component to the starting component is established, if it is not, then whether search has The .action field of other assemblies in implicit starting the component list, if there is implicitly starting other assemblies in the component list .action field then establishes the association of the first starting component to the starting component.
Whether search in the java file of component associated with the first starting component has in explicit starting the component list The .class field of other assemblies, if it is not, then whether search has the .action word of other assemblies in implicit starting the component list Section.
Resource file in step 703, search system application program under catalogue RES.
Usually, RES file is referred to as resource file, therefore successively searches for RES mesh in android system application program Resource file under record.Such as gerFiles function recursive search RES catalogue can be called, obtain all resources under the catalogue File.
Whether the resource file that step 704, judgement search is cited in any file of system, if so, carrying out step 705, if not, carrying out step 706.
Whether step 705 detects resource file by any component in described search tree in having been turned on component search tree It directly or indirectly quotes, if it is, retaining using the resource file as effective document, if not, carrying out step 706。
Step 706 is deleted using the resource file as garbage files.
Specifically, by recursive lookup, searched in having been turned on component search tree resource file whether with search tree species Any component has directly or indirectly adduction relationship.
For example, detecting that resource file A is quoted by another file B of system, need further to detect, whether file B is by it Cited in his file, that is, whether file A there are also other indirect referencing files, when resource file A direct reference document B or Other indirect referencing files of person are then to determine resource file A for efficient resource when having been turned on any component in component search tree File, when recursive traversal has been turned on all components in component search tree, the direct reference document B of resource file A or other Connecing reference document is not then to determine that resource file A is invalid waste resources when having been turned on any component in component search tree File carries out delete processing.
The method of invalid resource in deletion Android system provided in this embodiment, when detecting resource file by alternative document When reference, component search tree is had been turned on by building, the validity of reference document is further retrieved, it is ensured that the resource file Validity fundamentally solve in application program and provide in vain to delete invalid waste resources file to the greatest extent Source occupies the problem of system partitioning.
On the basis of previous embodiment, the embodiment of the present invention three provides another and deletes invalid resource in Android system Equipment.
Referring to Fig. 8, the equipment includes: memory 801, processor 802 and is stored on the memory 801 and can The computer program 803 of 802 operations on the processor, it is real when the computer program 803 is executed by the processor 802 Now as such as the step of first embodiment or second embodiment.
Invalid resource equipment passes through when resource file is quoted by alternative document in the deletion Android system of the present embodiment Building has been turned on component search tree, further retrieves to the validity of reference document, it is ensured that the validity of the resource file, from And invalid waste resources file is deleted to the greatest extent, it fundamentally solves invalid resource in application program and occupies system point The problem of area.
On the basis of previous embodiment, the embodiment of the present invention four provides a kind of computer readable storage medium, special Sign is, computer program is stored on the computer readable storage medium, when the computer program is executed by processor Realize as first embodiment or second embodiment the step of.
The computer readable storage medium of the present embodiment, when resource file is quoted by alternative document, by building Start component search tree, the validity of reference document is further retrieved, it is ensured that the validity of the resource file, thus maximum journey The invalid waste resources file of the deletion of degree fundamentally solves invalid resource in application program and occupies asking for system partitioning Topic.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row His property includes, so that the process, method, article or the device that include a series of elements not only include those elements, and And further include other elements that are not explicitly listed, or further include for this process, method, article or device institute it is intrinsic Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do There is also other identical elements in the process, method of element, article or device.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in a storage medium In (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that a terminal device (can be mobile phone, computer, clothes Business device, air conditioner or the network equipment etc.) execute method described in each embodiment of the present invention.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills Art field, is included within the scope of the present invention.

Claims (10)

1. a kind of method for deleting invalid resource in Android system, which is characterized in that the described method includes:
The starting information of each component in extraction system generates the component list comprising each component Name and corresponding starting information;
According to described the component list, building is inter-related to have been turned on component search tree;
The successively resource file in search system application program under each catalogue;
Whether detection resource file is directly or indirectly quoted by any component having been turned in component search tree, if it is, Retain using the resource file as effective document, if it is not, then being deleted using the resource file as garbage files It removes.
2. the method as described in claim 1, which is characterized in that whether detection resource file is had been turned in component search tree Before any component is directly or indirectly quoted further include:
Resource file is detected whether cited in any file of system, if it is not, then using the resource file as garbage files It is deleted, if it is, further detecting whether resource file by described has been turned on component in having been turned on component search tree Any component in search tree is directly or indirectly quoted.
3. the method as described in claim 1, which is characterized in that the starting information of each component in extraction system is generated comprising each The component list of component Name and corresponding starting information, comprising:
Each module information explicitly started in extraction system generates explicit starting the component list;
Each module information implicitly started in extraction system generates implicit starting the component list.
4. method as claimed in claim 3, which is characterized in that
Each module information explicitly started in extraction system generates explicit starting the component list, concrete mode are as follows:
Each component containing .class field is searched for, and extracts each module information containing .class field, generates explicit starting The component list, the list include each component Name and corresponding .class field;
Each module information implicitly started in extraction system generates implicit starting the component list, concrete mode are as follows:
Each component containing .action field is searched for, and extracts each module information containing .action field, generation is implicitly opened Dynamic the component list, the list includes each component Name and corresponding .action field.
5. method as claimed in claim 4, which is characterized in that according to the component list, building is inter-related to have been turned on component Search tree, comprising:
The first starting component that system is found by manifest.xml, the root node as search tree;
Whether search in explicitly starting the component list and implicit starting the component list has other assemblies reference the first starting component, If it is, establishing the association of the first starting component to the component;
Whether search in explicitly starting the component list and implicit starting the component list has other assemblies reference is described to open with first The dynamic associated component of component, if it is, establishing the association of component associated with the first starting component to the component, directly Start component as the search tree of root node using first to generating.
6. method as claimed in claim 5, which is characterized in that in explicitly starting the component list and implicit starting the component list Whether search has other assemblies reference the first starting component, concrete mode are as follows:
The .class word for whether there are other assemblies in explicit starting the component list is searched in the java file of the first starting component Section, if it is not, then whether search has the .action field of other assemblies in implicit starting the component list.
7. method as claimed in claim 5, which is characterized in that in explicitly starting the component list and implicit starting the component list Whether search has the other assemblies reference component associated with the first starting component, concrete mode are as follows:
Whether search in the java file of component associated with the first starting component has other in explicit starting the component list The .class field of component, if it is not, then whether search has the .action field of other assemblies in implicit starting the component list.
8. the method as described in claim 1, which is characterized in that in having been turned on component search tree detect resource file whether by Any component in described search tree is directly or indirectly quoted, concrete mode are as follows:
By recursive lookup, search whether resource file has directly with any component in search tree in having been turned on component search tree It connects or indirect referencing relationship.
9. a kind of equipment for deleting invalid resource in Android system, which is characterized in that the equipment includes: memory, processor And it is stored in the computer program that can be run on the memory and on the processor, the computer program is described The step as described in any in claim 1 to 8 is realized when processor executes.
10. a kind of computer readable storage medium, the computer-readable recording medium storage has computer executable at least One program, which is characterized in that at least one described program makes the computer execute above-mentioned power when being executed by the computer Benefit requires the step in 1~8 described in any item methods.
CN201910340988.9A 2019-04-25 2019-04-25 Method, equipment and the storage medium of invalid resource in a kind of deletion Android system Pending CN110069458A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910340988.9A CN110069458A (en) 2019-04-25 2019-04-25 Method, equipment and the storage medium of invalid resource in a kind of deletion Android system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910340988.9A CN110069458A (en) 2019-04-25 2019-04-25 Method, equipment and the storage medium of invalid resource in a kind of deletion Android system

Publications (1)

Publication Number Publication Date
CN110069458A true CN110069458A (en) 2019-07-30

Family

ID=67368892

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910340988.9A Pending CN110069458A (en) 2019-04-25 2019-04-25 Method, equipment and the storage medium of invalid resource in a kind of deletion Android system

Country Status (1)

Country Link
CN (1) CN110069458A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110413282A (en) * 2019-08-01 2019-11-05 腾讯科技(深圳)有限公司 A kind of redundant resource processing method, device, equipment and storage medium
CN111625242A (en) * 2020-04-16 2020-09-04 广州华多网络科技有限公司 Item code deleting method and device, electronic equipment and storage medium
CN112433721A (en) * 2020-11-27 2021-03-02 北京五八信息技术有限公司 Application modularization processing method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5909580A (en) * 1996-02-08 1999-06-01 Inprise Corporation Development system and methods with direct compiler support for detecting invalid use and management of resources and memory at runtime
CN106599151A (en) * 2016-12-07 2017-04-26 Tcl集团股份有限公司 Method and system for parallel cleaning of Android engineering useless resources
US20180062953A1 (en) * 2016-08-29 2018-03-01 International Business Machines Corporation Identifying resources for purging in a cloud based on inter-dependency graph analysis
CN108984207A (en) * 2018-06-14 2018-12-11 珠海金山网络游戏科技有限公司 A kind of method of installation kit invalid resource file detection

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5909580A (en) * 1996-02-08 1999-06-01 Inprise Corporation Development system and methods with direct compiler support for detecting invalid use and management of resources and memory at runtime
US20180062953A1 (en) * 2016-08-29 2018-03-01 International Business Machines Corporation Identifying resources for purging in a cloud based on inter-dependency graph analysis
CN106599151A (en) * 2016-12-07 2017-04-26 Tcl集团股份有限公司 Method and system for parallel cleaning of Android engineering useless resources
CN108984207A (en) * 2018-06-14 2018-12-11 珠海金山网络游戏科技有限公司 A kind of method of installation kit invalid resource file detection

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110413282A (en) * 2019-08-01 2019-11-05 腾讯科技(深圳)有限公司 A kind of redundant resource processing method, device, equipment and storage medium
CN110413282B (en) * 2019-08-01 2024-01-30 腾讯科技(深圳)有限公司 Redundant resource processing method, device, equipment and storage medium
CN111625242A (en) * 2020-04-16 2020-09-04 广州华多网络科技有限公司 Item code deleting method and device, electronic equipment and storage medium
CN111625242B (en) * 2020-04-16 2023-08-29 广州方硅信息技术有限公司 Project code deleting method and device, electronic equipment and storage medium
CN112433721A (en) * 2020-11-27 2021-03-02 北京五八信息技术有限公司 Application modularization processing method and device, electronic equipment and storage medium
CN112433721B (en) * 2020-11-27 2022-03-04 北京五八信息技术有限公司 Application modularization processing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN108536481A (en) A kind of application program launching method, mobile terminal and computer storage media
CN107508892A (en) A kind of page access method, server and computer-readable recording medium
CN109725866A (en) Application interface display methods, terminal and computer readable storage medium
CN107341011A (en) A kind of desktop display method, mobile terminal and computer-readable recording medium
CN108241752A (en) Photo display methods, mobile terminal and computer readable storage medium
CN110069458A (en) Method, equipment and the storage medium of invalid resource in a kind of deletion Android system
CN107656743A (en) A kind of discharging method of application, terminal and readable storage medium storing program for executing
CN107273433A (en) A kind of file scanning method, equipment and computer-readable recording medium
CN109584897A (en) Vedio noise reduction method, mobile terminal and computer readable storage medium
CN108897846A (en) Information search method, equipment and computer readable storage medium
CN107133350A (en) Data-updating method, mobile terminal and storage medium based on search engine
CN109254972A (en) A kind of offline order Word library updating method, terminal and computer readable storage medium
CN109710338A (en) A kind of searching method of mobile terminal, mobile terminal and storage medium
CN108595672A (en) The method, apparatus and readable storage medium storing program for executing of file type are downloaded in a kind of identification
CN108984590A (en) A kind of page data methods of exhibiting, terminal and computer readable storage medium
CN107231469A (en) A kind of terminal applies management method, terminal and computer-readable recording medium
CN107943397A (en) A kind of note generation method, mobile terminal and computer-readable recording medium
CN107391593A (en) A kind of document handling method, mobile terminal and computer-readable recording medium
CN110167004A (en) A kind of network registering method, mobile terminal and computer readable storage medium
CN109062688A (en) A kind of memory allocation method, server and mobile terminal
CN110046151A (en) A kind of data cleaning method, server and computer readable storage medium
CN109656649A (en) A kind of desktop application control method, terminal and computer readable storage medium
CN108900696A (en) A kind of data processing method, terminal and computer readable storage medium
CN109818967A (en) A kind of notification method, server, mobile terminal and computer readable storage medium
CN109740121A (en) A kind of searching method of mobile terminal, mobile terminal and storage medium

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