CN105868135A - Method and system for stopping media scanner after USB device ejection in Android system - Google Patents
Method and system for stopping media scanner after USB device ejection in Android system Download PDFInfo
- Publication number
- CN105868135A CN105868135A CN201510938840.7A CN201510938840A CN105868135A CN 105868135 A CN105868135 A CN 105868135A CN 201510938840 A CN201510938840 A CN 201510938840A CN 105868135 A CN105868135 A CN 105868135A
- Authority
- CN
- China
- Prior art keywords
- usb device
- path
- usb
- media
- device path
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/14—Handling requests for interconnection or transfer
- G06F13/20—Handling requests for interconnection or transfer for access to input/output bus
- G06F13/22—Handling requests for interconnection or transfer for access to input/output bus using successive scanning, e.g. polling
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/10—Program control for peripheral devices
- G06F13/12—Program control for peripheral devices using hardware independent of the central processor, e.g. channel or peripheral processor
- G06F13/122—Program control for peripheral devices using hardware independent of the central processor, e.g. channel or peripheral processor where hardware performs an I/O function other than control of data transfer
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Traffic Control Systems (AREA)
Abstract
The invention discloses a method for stopping a media scanner after USB device ejection in an Android system. The method includes the steps of receiving the ejected media of a USB device to obtain a USB device path; assigning the USB device path from the ejected media of the USB device to a system attribute of the USB device path; acquiring the system attribute of the USB device path to obtain the USB device path; judging whether the path of a to-be-scanned file includes the USB device path obtained from the system attribute of the USB device path, if yes, skipping the to-be-scanned file to save the scanning step. The invention also discloses a system for stopping the media scanner after USB device ejection in the Android system. After the USB device ejection, the scanning of the USB device media file is automatically stopped, the USB device can be unmounted from the Android system successfully.
Description
Technical field
Embodiments of the invention relate to Android system, more particularly, to extracting USB in Android system
Media Survey is stopped after stopping after equipment the method for Media Survey and Android system are extracted USB device
System.
Background technology
The popularity rate of the smart machine of currently used Android system is more and more higher, on these smart machines
Application USB device is more universal, such as, access USB portable hard drive in intelligent television, broadcast
Put the video of storage in USB portable hard drive, check photo of storage etc. in USB portable hard drive.
But Android system there is also deficiency in terms of USB device process: when user inserts USB device (example
Such as USB flash disk, USB portable hard drive etc.) time, Android system can send broadcast notice has new equipment to access,
One system application of Android can receive this broadcast, proceeds by Media Survey (Media Scanner)
Go to scan the media file (such as music, video, picture etc.) in USB device, obtain USB
The information such as video in equipment, music, picture also store in database, use for other application.
After user extracts USB device, Android system can perform unloading order (unmount), only unloads
Carrying order to run succeeded, Android system just will be considered that real being removed of USB device.If used
Family is extracted after inserting USB device the most in a short period of time, if the matchmaker of storage in this USB device
Body file is too much, it is more likely that during Android system is also in Media Survey, Media Survey program
Taking this USB device, this can cause USB device unloading (unmount) failure, even can
Causing system to occur can not the consequence (Application Not Responding) of response application.
Summary of the invention
It is an object of the present invention to provide and stop media after a kind of Android system extracts USB device
The new solution of scanning.
According to the first aspect of the invention, it is provided that stop after a kind of Android system extracts USB device
The only method of Media Survey (Media Scanner), comprises the following steps: receives USB device and extracts
Broadcast (MEDIA_EJECTED), therefrom obtains USB device path;To pull out from USB device
Go out the USB device path obtained in broadcast (MEDIA_EJECTED) and be assigned to USB device road
Footpath system property (USB_PATH);Obtain USB device path system attribute (USB_PATH),
Therefrom obtain USB device path;Judge whether file path the most to be scanned comprises from USB
The USB device path obtained in device path system property (USB_PATH), if comprised, then
Skip described file the most to be scanned not to be scanned.
Preferably, further comprising the steps of: to receive USB device unloading broadcast
(MEDIA_UNMOUNTED), USB device path is therefrom obtained;Obtain USB again
Device path system property (USB_PATH), therefrom obtains current USB device path;Judge
The USB device path obtained from USB device unloading broadcast (MEDIA_UNMOUNTED)
Whether in current USB device path, if, then by USB device path from USB device
Path system attribute (USB_PATH) removes.
Preferably, described extracting broadcast (MEDIA_EJECTED) from USB device obtains
To be assigned to USB device path system attribute (USB_PATH) be by setting in USB device path
Put system property function (system properties.set) and carry out assignment.
Preferably, described acquisition USB device path system attribute (USB_PATH) is by obtaining
Take attribute function (property_get) to obtain.
According to the second aspect of the invention, it is provided that stop after a kind of Android system extracts USB device
The only system of Media Survey (Media Scanner), including with lower unit: broadcast reception unit, uses
Extract broadcast (MEDIA_EJECTED) in receiving USB device, therefrom obtain USB device road
Footpath;USB device path system attribute assignment unit, for extracting broadcast from USB device
(MEDIA_EJECTED) the USB device path obtained in is assigned to USB device path system
Attribute (USB_PATH);USB device path system attribute acquiring unit, is used for obtaining USB and sets
Standby path system attribute (USB_PATH), therefrom obtains USB device path;Scanning judging unit,
For judging whether file path the most to be scanned comprises from USB device path system attribute
(USB_PATH) the USB device path obtained in, if comprised, then skips described currently waiting and sweeps
The file retouched is not scanned.
Preferably, also include that USB device path removes unit;Described broadcast reception unit, also uses
In receiving USB device unloading broadcast (MEDIA_UNMOUNTED), therefrom obtain USB and set
Standby path;Described USB device path system attribute acquiring unit, is additionally operable to obtain again USB
Device path system property (USB_PATH), therefrom obtains current USB device path;Described
USB device path removes unit, for judging from USB device unloading broadcast
(MEDIA_UNMOUNTED) whether the USB device path obtained in sets at current USB
In standby path, if, then by USB device path from USB device path system attribute
(USB_PATH) remove in.
Preferably, described USB device path system attribute assignment unit is by arranging system property
Function (system properties.set) unit carries out assignment.
Preferably, described USB device path system attribute acquiring unit is by obtaining attribute function
(property_get) USB device path system attribute (USB_PATH) is obtained.
The method and system stopping Media Survey that the present invention provides so that after USB device is extracted,
Scanning USB device media file can be automatically stopped, make unloading order be able to carry out successfully, veritably
USB device is removed from Android system.
It was found by the inventors of the present invention that in the prior art, go back and Android system is extracted USB device
The technical scheme of rear stopping Media Survey.Therefore, the present invention is to be realized technical assignment or wanted
Solve the technical problem that be that those skilled in the art never expect or it is not expected that, therefore this
Bright is a kind of new technical scheme.
By detailed description to the exemplary embodiment of the present invention referring to the drawings, its of the present invention
Its feature and advantage thereof will be made apparent from.
Accompanying drawing explanation
Combined in the description and the accompanying drawing of the part that constitutes specification shows the reality of the present invention
Execute example, and together with its explanation for explaining the principle of the present invention.
Fig. 1 be Android system is extracted USB device after stop Media Survey method first enforcement
The step schematic diagram of example.
Fig. 2 be Android system is extracted USB device after stop Media Survey method second enforcement
The step schematic diagram of example.
Fig. 3 be Android system is extracted USB device after stop Media Survey system first enforcement
The block diagram of example.
Fig. 4 be Android system is extracted USB device after stop Media Survey system second enforcement
The block diagram of example.
Detailed description of the invention
The various exemplary embodiments of the present invention are described in detail now with reference to accompanying drawing.It should also be noted that
Unless specifically stated otherwise, the parts that illustrate the most in these embodiments and step positioned opposite,
Numerical expression and numerical value do not limit the scope of the invention.
Description only actually at least one exemplary embodiment is illustrative below, never makees
For to the present invention and application thereof or any restriction of use.
May not beg in detail for technology, method and apparatus known to person of ordinary skill in the relevant
Opinion, but in the appropriate case, described technology, method and apparatus should be considered a part for specification.
Shown here with in all examples discussed, any occurrence should be construed as merely example
Property rather than as limit.Therefore, other example of exemplary embodiment can have different
Value.
It should also be noted that similar label and letter represent similar terms, therefore, one in following accompanying drawing
A certain Xiang Yi the accompanying drawing of denier is defined, then need not it is carried out further in accompanying drawing subsequently
Discuss.
Introduce shown in ginseng Fig. 1 and stop Media Survey Media after Android system is extracted USB device
The first embodiment of the method for Scanner, comprises the following steps:
101, receive USB device and extract broadcast MEDIA_EJECTED, therefrom obtain USB and set
Standby path P ath;
102, call and system property function system properties.set is set will extract from USB device
The USB device path obtained in broadcast MEDIA_EJECTED is assigned to USB device path system
Attribute USB_PATH;
103, call acquisition attribute function property_get and obtain USB device path system attribute
USB_PATH, therefrom obtains USB device path;
104, judge whether file path the most to be scanned comprises to belong to from USB device path system
Property USB_PATH in obtain USB device path, if comprised, skip literary composition the most to be scanned
Part is not scanned, and is otherwise scanned.
Through above step, Media Scanner would not take the USB device being pulled out again,
This USB device successfully can unload from Android system.
Introduce shown in ginseng Fig. 2 and stop Media Survey Media after Android system is extracted USB device
Second embodiment of the method for Scanner, compares and first embodiment, and the second embodiment also includes following
Step:
105, receive USB device unloading broadcast MEDIA_UNMOUNTED, therefrom obtain USB
Device path;
106, call acquisition attribute function property_get again and obtain USB device path system
Attribute USB_PATH, therefrom obtains current USB device path;
107, the USB obtained from USB device unloading broadcast MEDIA_UNMOUNTED is judged
Device path whether in current USB device path, if, then by USB device path from
USB device path system attribute USB_PATH removes.
Second embodiment is after USB device unloads, automatically by USB device path from USB device
Removing in path system attribute USB_PATH, so inserting USB device next time needs to carry out media
During scanning, Media Scanner will not skip scanning USB according to the USB device path not removed
Media file in equipment.
Introduce shown in ginseng Fig. 3 and stop Media Survey Media after Android system is extracted USB device
The first embodiment of the system of Scanner, including with lower unit:
Broadcast reception unit 1, is used for receiving USB device and extracts broadcast MEDIA_EJECTED,
Therefrom obtain USB device path;
USB device path system attribute assignment unit 2, is used for calling and arranges system property function
System properties.set will extract acquirement in broadcast MEDIA_EJECTED from USB device
USB device path is assigned to USB device path system attribute USB_PATH;
USB device path system attribute acquiring unit 3, is used for calling acquisition attribute function
Property_get obtains USB device path system attribute USB_PATH, therefrom obtains USB device
Path;
Scanning judging unit 4, for judging whether comprise from USB in file path the most to be scanned
The USB device path obtained in device path system property USB_PATH, if comprised, skips
File the most to be scanned is not scanned, and is otherwise scanned.
Introduce shown in ginseng Fig. 4 and stop Media Survey Media after Android system is extracted USB device
Second embodiment of the system of Scanner, compared to first embodiment, the second embodiment also includes USB
Device path removes unit 5;
Broadcast reception unit 1, is additionally operable to receive USB device unloading broadcast
MEDIA_UNMOUNTED, therefrom obtains USB device path;
USB device path system attribute acquiring unit 3, is additionally operable to call acquisition attribute function again
Property_get obtains USB device path system attribute USB_PATH, therefrom obtains current USB
Device path;
USB device path removes unit 5, for judging from USB device unloading broadcast
Whether the USB device path obtained in MEDIA_UNMOUNTED is on current USB device road
In footpath, if, then by USB device path from USB device path system attribute USB_PATH
In remove.
Second embodiment is after USB device unloads, automatically by USB device path from USB device
Removing in path system attribute USB_PATH, so inserting USB device next time needs to carry out media
During scanning, Media Scanner will not skip scanning USB according to the USB device path not removed
Media file in equipment.
According to technical scheme, after USB device is extracted, Media Scanner will not be again
Taking the USB device being pulled out, the USB device being pulled out can success from Android system
Unloading.
The present invention can be system, method and/or computer program.Computer program is permissible
Including computer-readable recording medium, containing being used for making processor realize various aspects of the invention
Computer-readable program instructions.It is well known that to those skilled in the art, the present invention is permissible
By the way of hardware mode is realized, is realized by software mode and combined by software and hardware in fact
Existing, realize in which way all belonging in protection scope of the present invention.
Although some specific embodiments of the present invention being described in detail by example, but
It should be appreciated by those skilled in the art, example above is merely to illustrate rather than in order to limit
The scope of the present invention processed.It should be appreciated by those skilled in the art, can be without departing from the scope of the present invention
In the case of spirit, above example is modified.The scope of the present invention is defined by the claims.
Claims (8)
1. after an Android system is extracted USB device, stop Media Survey (Media Scanner)
Method, it is characterised in that comprise the following steps:
Receive USB device and extract broadcast (MEDIA_EJECTED), therefrom obtain USB device
Path;
The USB device road obtained broadcast (MEDIA_EJECTED) will be extracted from USB device
Footpath is assigned to USB device path system attribute (USB_PATH);
Obtain USB device path system attribute (USB_PATH), therefrom obtain USB device road
Footpath;
Judge whether file path the most to be scanned comprises from USB device path system attribute
(USB_PATH) the USB device path obtained in, if comprised, then skips described currently waiting and sweeps
The file retouched is not scanned.
Method the most according to claim 1, it is characterised in that further comprising the steps of:
Receive USB device unloading broadcast (MEDIA_UNMOUNTED), therefrom obtain USB
Device path;
Obtain USB device path system attribute (USB_PATH) again, therefrom obtain current
USB device path;
Judge the USB obtained from USB device unloading broadcast (MEDIA_UNMOUNTED)
Device path whether in current USB device path, if, then by USB device path from
USB device path system attribute (USB_PATH) removes.
Method the most according to claim 1, it is characterised in that described will pull out from USB device
Go out the USB device path obtained in broadcast (MEDIA_EJECTED) and be assigned to USB device road
Footpath system property (USB_PATH) is by arranging system property function (system properties.set)
Carry out assignment.
Method the most according to claim 1, it is characterised in that described acquisition USB device road
Footpath system property (USB_PATH) is to be obtained by acquisition attribute function (property_get).
5. after an Android system is extracted USB device, stop Media Survey (Media Scanner)
System, it is characterised in that include with lower unit:
Broadcast reception unit, is used for receiving USB device and extracts broadcast (MEDIA_EJECTED),
Therefrom obtain USB device path;
USB device path system attribute assignment unit, for extracting broadcast from USB device
(MEDIA_EJECTED) the USB device path obtained in is assigned to USB device path system
Attribute (USB_PATH);
USB device path system attribute acquiring unit, is used for obtaining USB device path system attribute
(USB_PATH), USB device path is therefrom obtained;
Scanning judging unit, for judging whether comprise from USB in file path the most to be scanned
The USB device path obtained in device path system property (USB_PATH), if comprised, then
Skip described file the most to be scanned not to be scanned.
System the most according to claim 5, it is characterised in that also include USB device path
Remove unit;
Described broadcast reception unit, is additionally operable to receive USB device unloading broadcast
(MEDIA_UNMOUNTED), USB device path is therefrom obtained;
Described USB device path system attribute acquiring unit, is additionally operable to obtain again USB device
Path system attribute (USB_PATH), therefrom obtains current USB device path;
Described USB device path removes unit, for judging from USB device unloading broadcast
(MEDIA_UNMOUNTED) whether the USB device path obtained in sets at current USB
In standby path, if, then by USB device path from USB device path system attribute
(USB_PATH) remove in.
System the most according to claim 5, it is characterised in that described USB device path is
System attribute assignment unit is to carry out by arranging system property function (system properties.set) unit
Assignment.
System the most according to claim 5, it is characterised in that described USB device path is
Subordination acquiring unit is by obtaining attribute function (property_get) acquisition USB device path system
Subordination (USB_PATH).
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510938840.7A CN105868135A (en) | 2015-12-15 | 2015-12-15 | Method and system for stopping media scanner after USB device ejection in Android system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510938840.7A CN105868135A (en) | 2015-12-15 | 2015-12-15 | Method and system for stopping media scanner after USB device ejection in Android system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105868135A true CN105868135A (en) | 2016-08-17 |
Family
ID=56623738
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510938840.7A Pending CN105868135A (en) | 2015-12-15 | 2015-12-15 | Method and system for stopping media scanner after USB device ejection in Android system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105868135A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113312095A (en) * | 2021-04-16 | 2021-08-27 | 深圳市智微智能软件开发有限公司 | Method, device, terminal and storage medium for managing plug-pull events of display equipment |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103186487A (en) * | 2011-12-31 | 2013-07-03 | 青岛海尔软件有限公司 | Method for real-time recognition of USB device hot plugging |
CN103324459A (en) * | 2013-06-14 | 2013-09-25 | Tcl集团股份有限公司 | Method and system for implementing USB (universal serial bus) headset devices |
CN103577554A (en) * | 2013-10-19 | 2014-02-12 | 广东欧珀移动通信有限公司 | Method and device for triggering multimedia database scanning of Android equipment |
CN103686379A (en) * | 2013-12-18 | 2014-03-26 | 青岛海信电器股份有限公司 | Playing method and device for multi-media file, and television |
CN103744911A (en) * | 2013-12-26 | 2014-04-23 | 乐视网信息技术(北京)股份有限公司 | Video file scanning method and electronic device |
-
2015
- 2015-12-15 CN CN201510938840.7A patent/CN105868135A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103186487A (en) * | 2011-12-31 | 2013-07-03 | 青岛海尔软件有限公司 | Method for real-time recognition of USB device hot plugging |
CN103324459A (en) * | 2013-06-14 | 2013-09-25 | Tcl集团股份有限公司 | Method and system for implementing USB (universal serial bus) headset devices |
CN103577554A (en) * | 2013-10-19 | 2014-02-12 | 广东欧珀移动通信有限公司 | Method and device for triggering multimedia database scanning of Android equipment |
CN103686379A (en) * | 2013-12-18 | 2014-03-26 | 青岛海信电器股份有限公司 | Playing method and device for multi-media file, and television |
CN103744911A (en) * | 2013-12-26 | 2014-04-23 | 乐视网信息技术(北京)股份有限公司 | Video file scanning method and electronic device |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113312095A (en) * | 2021-04-16 | 2021-08-27 | 深圳市智微智能软件开发有限公司 | Method, device, terminal and storage medium for managing plug-pull events of display equipment |
CN113312095B (en) * | 2021-04-16 | 2024-04-16 | 深圳市智微智能软件开发有限公司 | Method, device, terminal and storage medium for managing plug event of display equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105451064B (en) | Display terminal booting plays the method and display terminal of video | |
CN110505498B (en) | Video processing method, video playing method, video processing device, video playing device and computer readable medium | |
CN106921804B (en) | Method and device for creating schedule in terminal and terminal equipment | |
CN110221747B (en) | Presentation method of e-book reading page, computing device and computer storage medium | |
CN104166694A (en) | Image classifying and storing method and electronic device | |
US20180239839A1 (en) | Method and Apparatus for Identifying To-Be-Cleaned Data, and Electronic Device | |
CN104508689A (en) | A two-dimension code processing method and a terminal | |
CN103139597A (en) | Test method and digital television terminal | |
CN106227585A (en) | Application program starting method, device and equipment | |
CN107509110A (en) | A kind of loop play method and device of video file | |
CN104537289A (en) | Method and device for protecting intended target in terminal device | |
CN114902687A (en) | Game screen recording method and device and computer readable storage medium | |
CN107330848A (en) | Image processing method, mobile terminal and storage device | |
CN111246289A (en) | Video generation method and device, electronic equipment and storage medium | |
CN108573185B (en) | Two-dimensional code picture identification method and device | |
CN106034210A (en) | Image editing method and image editing device | |
CN107370977B (en) | Method, equipment and storage medium for adding commentary in detection video | |
CN105868135A (en) | Method and system for stopping media scanner after USB device ejection in Android system | |
CN112287800A (en) | Advertisement video identification method and system under no-sample condition | |
KR102534270B1 (en) | Apparatus and method for providing meta-data | |
CN105868143A (en) | Method and system for stopping media scanner after USB device ejection in Android system | |
CN107608827B (en) | Backup method and terminal for package configuration file and related medium product | |
KR102212077B1 (en) | Method and apparatus for automatic video editing | |
CN107360460B (en) | Method, device and storage medium for detecting video added subtitles | |
CN104850551A (en) | Data processing method, data processing apparatus and mobile terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20160817 |