Data query method and device, electronic equipment and computer readable storage medium
Through the query of U disk audio data in the vehicle system, detect the preset query to the trigger conditions and inquire about the local media database, solve the problem of low -efficiency query speed and efficiency of U disk audio data in existing technology, and achieve faster and faster and faster Efficient data query.
Patent Information
- Application Number
- CN202411258783.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2025-01-21
AI Technical Summary
The prior art has problems with scanning query speed and efficiency in the process of querying USB disk audio data in vehicle-mounted systems, resulting in the user waiting time being too long.
By scanning the connected external storage device, it is detected whether the preset query triggering conditions are met, and when the conditions are met, the media data query operation is performed on the local preset media database to query whether the scanned external storage is cached. The device's media data.
This method can query in time when the media data of scanned external storage devices cached in the preset media database, thereby reducing query waiting time and improving the speed and efficiency of media data of external storage devices.
Smart Images

Figure CN119336922A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a data query method, device, electronic equipment and computer-readable storage medium. Background Art
[0002] In the in-vehicle system, multimedia applications are the applications that users use frequently. Among them, there is a USB music module in the multimedia application, which mainly provides users with the functions of scanning and querying USB flash drive audio data and playing USB flash drive music. The function of this module depends on the audio data in the external storage device, that is, the USB flash drive. When using it, you need to connect the USB flash drive. After the USB flash drive is connected, the USB music module is in a loading state when no audio data is queried, and after the audio data is queried, the corresponding audio data will be displayed for the user to select the corresponding audio to play.
[0003] However, in the prior art, after receiving the U disk scanning start broadcast to perform the audio data query operation, if the audio data of the U disk is not queried from the media database, it will wait until the U disk scanning end broadcast is received, and then the audio data query operation will be performed again. Therefore, the existing data query method has the problem of low scanning query speed and efficiency. Summary of the invention
[0004] The purpose of the present application is to provide a data query method, device, electronic device and readable storage medium, which can improve the scanning query speed and efficiency of media data of an external storage device.
[0005] To achieve the above objectives:
[0006] In a first aspect, an embodiment of the present application provides a data query method, including:
[0007] During the scanning process of the connected external storage device, detecting whether the preset query trigger condition is met;
[0008] When it is determined that the preset query trigger condition is met, a media data query operation is performed on a local preset media database to query whether the scanned media data of the external storage device is cached in the preset media database.
[0009] Optionally, the preset query trigger condition includes at least one of the following: the time interval between the last query time of the preset media database and the current time is greater than or equal to a preset time interval threshold; a callback message indicating that the media data in the preset media database has changed is obtained; and a query instruction is received.
[0010] Optionally, the method further includes:
[0011] A media data change monitoring event is created for the preset media database, so as to generate the callback message when a change in the media data in the preset media database is monitored.
[0012] Optionally, the receiving of the query instruction includes at least one of the following:
[0013] It is detected that the preset query button is triggered;
[0014] Received a preset query gesture.
[0015] Optionally, the method further includes:
[0016] In response to monitoring the start broadcast of scanning of the external storage device, performing a media data query operation on the preset media database to obtain a data query result;
[0017] When it is determined according to the data query result that the media data of the external storage device is not found in the preset media database, a step of detecting whether a preset query trigger condition is met during the scanning process of the connected external storage device is performed.
[0018] Optionally, the method further comprises:
[0019] When it is determined that the scanned media data of the external storage device is cached in the preset media database, the scanned media data of the external storage device is output.
[0020] Optionally, the method further comprises:
[0021] When it is determined according to the data query result that the media data of the external storage device is queried from the preset media database, outputting the queried media data of the external storage device;
[0022] Scanning the external storage device to obtain current media data of the external storage device;
[0023] The media data of the external storage device in the preset media database is updated according to the current media data of the external storage device.
[0024] Optionally, the method further comprises:
[0025] In response to monitoring the uninstall broadcast to the external storage device, the updated media data of the external storage device is backed up in the preset media database.
[0026] In a second aspect, an embodiment of the present application provides a data query device, the device comprising: a processing module and a detection module; wherein:
[0027] The detection module is used to detect whether a preset query trigger condition is met during the scanning process of the storage device outside the connection point;
[0028] The processing module is used to perform a media data query operation on a local preset media database when it is determined that the preset query trigger condition is met, so as to query whether the scanned media data of the external storage device is cached in the preset media database.
[0029] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory storing a computer program, and when the processor runs the computer program, the above-mentioned data query method is implemented.
[0030] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the above-mentioned data query method is implemented.
[0031] The data query method, device, electronic device and computer-readable storage medium provided by the embodiments of the present application include: in the process of scanning the connected external storage device, detecting whether the preset query trigger condition is met; when it is determined that the preset query trigger condition is met, performing a media data query operation on the local preset media database to query whether the media data of the scanned external storage device is cached in the preset media database. In this way, when it is determined that the preset query trigger condition is met during the scanning process of the connected external storage device, the query operation on the preset media database is triggered, so that the media data of the scanned external storage device cached in the preset media database can be queried in time, thereby reducing the query waiting time, and can effectively improve the scanning query speed and efficiency of the media data of the external storage device. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A schematic diagram of a data query method according to an embodiment of the present invention;
[0033] Figure 2 A schematic diagram of the architecture of the vehicle-mounted OneOs system provided in an embodiment of the present invention;
[0034] Figure 3 A timing diagram of a data query method provided by an embodiment of the present invention;
[0035] Figure 4 A schematic diagram of the structure of a data query device provided by an embodiment of the present invention;
[0036] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0037] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0038] It should be noted that, in this article, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element. In addition, components, features, and elements with the same name in different embodiments of the present application may have the same meaning or different meanings, and their specific meanings need to be determined by their explanation in the specific embodiment or further combined with the context of the specific embodiment.
[0039] It should be understood that, although the terms first, second, third, etc. may be used to describe various information in this article, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this article, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein can be interpreted as "at the time of..." or "when..." or "in response to determination". Furthermore, as used in this article, the singular forms "one", "one" and "the" are intended to also include plural forms, unless there is an opposite indication in the context. It should be further understood that the terms "comprising", "including" indicate that there are described features, steps, operations, elements, components, projects, kinds, and / or groups, but do not exclude the existence, occurrence or addition of one or more other features, steps, operations, elements, components, projects, kinds, and / or groups. The terms "or" and "and / or" used herein are interpreted as inclusive, or mean any one or any combination. Thus, “A, B, or C” or “A, B and / or C” means “any of the following: A; B; C; A and B; A and C; B and C; A, B, and C.” An exception to this definition will occur only when a combination of elements, functions, steps, or operations are inherently mutually exclusive in some manner.
[0040] It should be understood that, although the various steps in the flowchart in the embodiment of the present application are displayed in sequence according to the indication of the arrows, these steps are not necessarily performed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and it can be performed in other orders. Moreover, at least a portion of the steps in the figure may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and their execution order is not necessarily performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0041] It should be noted that, in this article, step codes such as S101, S102, etc. are used for the purpose of expressing the corresponding content more clearly and concisely, and do not constitute a substantial limitation on the sequence. When implementing the step, those skilled in the art may execute S102 first and then S101, etc., but these should all be within the scope of protection of this application.
[0042] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0043] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.
[0044] See also Figure 1 , is a data query method provided in an embodiment of the present application. The data query method can be executed by a data query device provided in an embodiment of the present application. The data query device can be implemented in software and / or hardware, such as an electronic device such as a vehicle-mounted terminal or a computer. In this embodiment, the execution subject of the data query method is an vehicle-mounted terminal as an example. The data query method provided in this embodiment includes:
[0045] Step S101: During the scanning process of the connected external storage device, it is detected whether a preset query trigger condition is met.
[0046] Specifically, after the vehicle-mounted terminal is connected to the external storage device, it will scan the connected external storage device to obtain the media data of the external storage device, and during the scanning process of the connected external storage device, it can detect in real time whether the preset query trigger condition is met.
[0047] Among them, the external storage device refers to a device with a separate storage space, including but not limited to a floppy disk storage, a hard disk storage, a mobile storage, etc. The mobile storage mainly includes a flash drive (also known as a USB flash drive), a mobile hard disk, a solid-state hard disk, etc. Here, the preset query trigger condition can be set according to actual needs, such as monitoring the change of media data in the local preset media database, reaching the query time, etc., which is not specifically limited here.
[0048] In one embodiment, during the scanning process of the connected external storage device, before detecting whether the preset query trigger condition is met, the method further includes:
[0049] In response to monitoring the start of broadcasting of scanning of the external storage device, performing a media data query operation on a preset media database to obtain a data query result;
[0050] When it is determined according to the data query result that no media data of the external storage device is found in the preset media database, a step of detecting whether a preset query trigger condition is met during the scanning process of the connected external storage device is performed.
[0051] The media data includes but is not limited to audio data, video data and picture data.
[0052] Specifically, after the vehicle terminal establishes a connection with the external storage device through a wired connection or a wireless connection, when it monitors the start of the broadcast of scanning the connected external storage device, it will perform a media data query operation on the local preset media database to query whether there is media data of the external storage device in the preset media database, thereby obtaining the corresponding data query result. If it is determined according to the data query result that the media data of the external storage device is not queried from the preset media database, the step of detecting whether the preset query trigger condition is met during the scanning process of the connected external storage device is triggered.
[0053] Here, when the external storage device is connected to the vehicle-mounted terminal for the first time, because the media data of the external storage device is not stored or backed up in the local media database, a data query result in which no media data of the external storage device is queried may be obtained. In addition, when it is determined according to the data query result that the media data of the external storage device is queried from the preset media database, the step of detecting whether the preset query trigger condition is met during the scanning process of the connected external storage device may also be triggered.
[0054] It can be understood that, in the existing related technology, when the media data of the external storage device is not queried from the preset media database based on the scanning start broadcast, the media data query operation will be performed again on the preset media database only after the scanning end broadcast of the external storage device is obtained, and there is a lot of media data in the external storage device, so the time required to scan the external storage device will be longer. For example, when there are thousands of videos or thousands of pictures, the time required for scanning may take several minutes or more than ten minutes, that is, the time required to query the media data of the external storage device from the preset media database will be longer, but before the scanning end broadcast of the external storage device is obtained, part of the media data in the external storage device may have been scanned and cached in the preset media database. Therefore, in order to enable the scanned media data of the external storage device cached in the preset media database to be queried in time, thereby reducing the query waiting time, it is possible to detect in real time whether the preset query trigger condition is met during the scanning process of the external storage device.
[0055] Step S102: when it is determined that the preset query trigger condition is met, a media data query operation is performed on a local preset media database to query whether the scanned media data of the external storage device is cached in the preset media database.
[0056] Specifically, when the vehicle terminal detects that a preset query trigger condition is met during the scanning process of the external storage device, it performs a media data query operation on the local preset media database to query whether the scanned media data of the external storage device is cached in the preset media database.
[0057] Here, based on the media data query operation performed on the local preset media database, when it is found that the media data of the scanned external storage device is cached in the preset media database, the media data of the scanned external storage device can be output, such as displaying the identification of the media data of the scanned external storage device on the display interface of the vehicle terminal, so that the user can view the media data of the external storage device in a timely manner.
[0058] In one embodiment, the preset query trigger condition includes at least one of the following: the time interval between the last query time of the preset media database and the current time is greater than or equal to the preset time interval threshold; a callback message indicating that the media data in the preset media database has changed is obtained; and a query instruction is received.
[0059] Among them, during the scanning process of the external storage device, the media data query operation can be performed on the preset media database at a preset time interval, that is, when the time interval between the last time the preset media database was queried and the current time is greater than or equal to the preset time interval threshold, the media data query operation is performed on the preset media database. Of course, it is also possible to monitor whether the media data in the preset media database has changed, so as to perform a media data query operation on the preset media database when a callback message indicating that the media data in the preset media database has changed is obtained. In addition, it is also possible to perform a media data query operation on the preset media database after receiving a query instruction input by the user. In this way, by flexibly setting the triggering conditions for performing the media data query operation on the preset media database, the flexibility and efficiency of scanning and querying the media data of the external storage device are improved.
[0060] In one embodiment, before detecting whether a preset query trigger condition is met during the scanning process of the external storage device, the method further includes:
[0061] A media data change monitoring event is created for the preset media database, so as to generate a callback message when a change in the media data in the preset media database is detected.
[0062] Here, a media data change monitoring event can be created in the media database, and the media database can be monitored through the created media data change monitoring event. When the media data in the preset media database changes, a callback message will be generated. For example, a Content Observer can be registered to monitor whether the media data in the media database changes. In this way, it can be ensured that when the media data in the preset media database changes, it can be monitored in time, further improving the scanning and querying speed and efficiency of the media data of the external storage device.
[0063] In one embodiment, receiving the query instruction includes at least one of the following: detecting that a preset query button is triggered; and receiving a preset query gesture.
[0064] Among them, the vehicle terminal can display a preset query button on the display interface. When the user presses the preset query button by finger or stylus, it will be detected that the preset query button is triggered. In addition, the vehicle terminal can also collect the gesture input by the user through an image acquisition device such as a camera, and identify whether the gesture input by the user is a preset query gesture. In addition, the user can also input the query command by voice.
[0065] In summary, in the data query method provided by the above embodiment, when it is determined that the preset query trigger condition is met during the scanning process of the external storage device, a query operation is triggered on the preset media database, so that the media data of the scanned external storage device cached in the preset media database can be queried in time, thereby reducing the query waiting time, and can effectively improve the scanning query speed and efficiency of the media data of the external storage device, and enhance the user experience.
[0066] In one embodiment, the method further comprises:
[0067] When it is determined that the scanned media data of the external storage device is cached in the preset media database, the scanned media data of the external storage device is output.
[0068] Here, when a media data query operation is performed on the preset media database, and it is found that the media data of the scanned external storage device is cached in the preset media database, it means that the media data of the external storage device scanned by the vehicle-mounted terminal from the external storage device is cached in the preset media database, and the scanned media data of the external storage device is output, so that the user can view the media data of the external storage device in time, thereby shortening the display time of the loading status.
[0069] It should be noted that the media data of the scanned external storage device may be part of the media data in the external storage device. In addition, the output mode of the media data of the scanned external storage device can also be set according to actual needs. For example, when the media data is audio data, it may be an identifier such as a name of the output audio data.
[0070] In one embodiment, the method further comprises:
[0071] When it is determined according to the data query result that media data of the external storage device is queried from the preset media database, outputting the queried media data of the external storage device;
[0072] Scan the external storage device to obtain the current media data of the external storage device;
[0073] According to the current media data of the external storage device, the media data of the external storage device in the preset media database is updated.
[0074] Here, when it is determined that the media data of the external storage device is queried from the preset media database according to the data query result, it means that the media data of the external storage device has been stored in the preset media database. For example, the vehicle-mounted terminal may back up the media data of the external storage device in the preset media database when the external storage device was connected last time, or store part or all of the media data from a third party to the external storage device in advance by copying, etc., and the media data of the queried external storage device can be output at this time. At the same time, considering that the current media data of the external storage device may be different from the media data of the external storage device in the preset media database, the external storage device can be scanned continuously to obtain the current media data of the external storage device, and the media data of the external storage device in the preset media database can be updated according to the current media data of the external storage device, and then the updated media data of the external storage device in the preset media database can be output. In this way, the media data of the external storage device is already stored in the preset media database, and the media data of the queried external storage device is output first, and then updated according to the current media data of the external storage device, which improves the scanning and querying speed and efficiency of the media data of the external storage device, reduces the query time, and improves the user experience.
[0075] In one embodiment, the method further comprises:
[0076] In response to monitoring the uninstall broadcast to the external storage device, the updated media data of the external storage device is backed up in a preset media database.
[0077] Specifically, when an uninstall broadcast to an external storage device is monitored, it indicates that the connection with the external storage device is disconnected. In order to directly query the media data of the external storage device from the preset media database the next time the external storage device is connected, so as to reduce the time consumption of scanning query and improve the speed of scanning query, the updated media data of the external storage device can be backed up in the preset media database, so that the media data of the backed-up external storage device can be output preferentially the next time the external storage device is connected. In this way, when the connection with the external storage device is disconnected, the media data of the external storage device is backed up, so that the media data of the backed-up external storage device can be output preferentially the next time the external storage device is connected, which reduces the time consumption of scanning query, improves the speed of scanning query, and enhances the user experience.
[0078] Based on the same inventive concept as the aforementioned embodiment, the aforementioned embodiment is described in detail below through a specific example. In this example, the aforementioned data query method is applied to the vehicle-mounted OneOs system, and the external storage device is a USB flash drive, and the media data is audio data.
[0079] The following is an explanation of the terms that may be involved in this embodiment, as follows:
[0080] Android: A mobile operating system provided by Google, called Android in Chinese, which can be used in car systems;
[0081] USB: Universal Serial Bus;
[0082] APP: application, such as software on the car computer;
[0083] Framework: Android system framework layer, providing basic services for upper-layer applications;
[0084] AIDL: A way of communication between Android processes;
[0085] MediaCenter: Media center, providing middle-layer services for multimedia applications.
[0086] In the existing related technologies, the application side's scanning of USB audio files depends on the Android system side's corresponding broadcasts when the USB is mounted, the scan starts and ends, and the USB is unmounted. After the application side monitors the broadcasts at different times, it performs data query and clearing operations, as follows:
[0087] 1) When receiving a USB flash drive mount broadcast, update the application-side page interaction to display a scanning status prompt message.
[0088] 2) When receiving the USB flash drive scan to start broadcasting, query the audio data record in the system media database.
[0089] 3) When receiving the U disk scanning end broadcast, query the audio data record in the system media database again.
[0090] 4) When receiving the USB drive uninstall broadcast, clear the audio data cached in the media database and update the application side page display.
[0091] That is to say, for multimedia USB music, in the Android system, after the U disk is connected, a series of broadcast events will be transmitted to the application side. The application side realizes the query and clearing functions of audio media data by monitoring the system's U disk mounting, U disk scanning start, U disk scanning end, and U disk unloading broadcasts. That is, the audio data will only be queried by monitoring the U disk scanning start broadcast and the U disk scanning end broadcast. When the U disk scanning start broadcast is monitored for querying and no audio data is queried, the audio data can only be queried again after receiving the U disk scanning end broadcast. However, since there is a long process from the start of the U disk scanning to the end of the scanning, after the U disk scanning starts, if the application side directly queries the system media database, there will be audio data that has not been scanned, parsed and stored, resulting in a situation where there is no data for query. However, in the case of not receiving the U disk scanning end broadcast, since in the process of scanning the U disk, part of the audio data that has been scanned to the U disk may be cached in the media database. At this time, if there is no suitable opportunity to execute the query again, the application will fall into a long waiting time, so this waiting time can be reduced.
[0092] To solve the above problems, this embodiment provides a vehicle-mounted OneOs system, such as Figure 2 As shown in the figure, in the in-vehicle OneOs system, there is a module in the multimedia APP, namely USB music, which provides users with the function of USB music, including scanning and reading USB audio files and playing USB audio files. The following is a brief description of the various parts that make up the in-vehicle OneOs system:
[0093] OneOs system: deeply customized based on the native Android system, integrating relevant vehicle-mounted functional modules.
[0094] Multimedia APP: that is, multimedia application, including four functional modules: online music, online radio, Bluetooth music and USB music.
[0095] USB Music: A functional module in multimedia applications that provides functions such as scanning, reading and playing music from USB flash drives.
[0096] MediaCenter: Media center service, which communicates with USB music through AIDL, receives requests from USB music and passes the queried data and playback status information to USB music.
[0097] UsbService: USB music service, including data and playback services, providing the ability to monitor the status of the USB flash drive, query USB flash drive audio data, and play USB flash drive audio.
[0098] ContentResolver: A content resolution class provided by the Android system that provides the ability to query and monitor media data changes. In this example, it is used to monitor media data changes.
[0099] BroadcastReceiver: A broadcast receiver provided by the Android system, used to monitor system broadcasts such as USB mount, scan start, scan end, and USB unmount.
[0100] Framework: Android system framework layer, providing basic services for upper-level applications.
[0101] MediaStore: Media data storage and management class provided by the Android system, which can be used for USB flash drive audio data storage management.
[0102] MediaScanner: The media scanning tool class provided by the Android system can be used to scan various media files, such as pictures or audio files in USB flash drives.
[0103] StorageVolume: A storage device entity class provided by the Android system that can obtain the path and name of a USB flash drive.
[0104] MediaPlayer: A player class provided by the Android system that can be used to play audio files in a USB flash drive and read the audio playback status and progress.
[0105] For the U disk scanning process, the corresponding query operation is performed after receiving the U disk scanning start broadcast and the U disk scanning end broadcast, and the query operation is performed after receiving the multimedia content change message, see Figure 3 , which is a timing diagram of the data query method provided in this embodiment, mainly includes the following processes:
[0106] 1. UsbService, i.e. USB music service, triggers UsbServicempl to initialize and create the service, i.e. onCreate.
[0107] 2. UsbScanner, the USB flash drive scanning tool class, registers the USB flash drive status broadcast (registerReceiver). Here, the USB flash drive scanning tool class, such as the USB scanning interface, will register the relevant broadcasts of the USB flash drive during initialization, such as USB flash drive mounting, USB flash drive scanning start, USB flash drive scanning end, USB flash drive unmounting, etc., so that the relevant broadcasts of the system can be received after the USB flash drive is connected.
[0108] 3. UsbServicempl, the USB music service implementation class, registers the media content change monitoring event (registerMediaObserver) so that when the system multimedia content changes, it can receive the corresponding event monitoring and perform corresponding operations.
[0109] 4. UsbServicempl receives the scanning start broadcast (Broadcast Scanner started) and executes the scanning start callback (onScannerStart).
[0110] 5. Based on the scan start callback, UsbServicempl sends a scan start query (scanOnStart) request to the USB disk audio query class to query the media data.
[0111] 6. UsbMediaImpl, the U disk audio query class, will execute the operation of querying the system media database after receiving the scan start query request to query the U disk audio data in pages (ScanMediaByPage). At this time, the queried data is part of the audio data of the scanned U disk.
[0112] 7. After UsbServicempl receives the scanning end broadcast (Broadcast Scanner finished), it executes the scanning end callback (onScannerFinished).
[0113] 8. Based on the scan end callback, UsbServicempl sends a scan end query (scanOnFinished) request to the USB disk audio query class to query the media data.
[0114] 9. After receiving the scan end query request, UsbMediaImpl queries the USB flash drive audio data in the system media database (ScanMediaByAll). The data queried at this time is the complete audio data of the scanned USB flash drive.
[0115] 10. After receiving the audio media content change callback (ContentObserver onChange), UsbServicempl executes the audio content change callback (onChange).
[0116] 11. Based on the audio content change callback, UsbServicempl sends an audio change query (scanOnContentChanged) request to the U disk audio query class.
[0117] 12. When UsbMediaImpl receives an audio change query request, it queries the USB audio data in the system media database (ScanMediaByChanged).
[0118] 13. UsbMediaImpl returns the audio scan results (onUsbMediaScanCallback) to UsbServicempl.
[0119] 14. After receiving the audio scan result, UsbServicempl returns the audio scan result (onUsbMediaScanCallback) to the media center service.
[0120] 15. After receiving the audio scan result, the media center service returns the audio scan result (onUsbMediaScanCallback) to the USB music module, completing the entire data query and transmission sequence.
[0121] Through the above scheme provided by this embodiment, in the Android system, after the picture or audio and video media database changes, the purpose of monitoring the change of media data can be achieved by registering the media content data change monitoring callback. Based on this monitoring mechanism, when the audio data of the U disk changes, the audio content data change can be registered to monitor the change, and the audio record of the media database can be queried when the change callback is received, so as to avoid the situation of querying no data. At the same time, since the native Android system does not have the above-mentioned implementation of the media change notification application side, the above scheme is implemented on the Framework side in the OneOs system in this embodiment, that is, after the audio media data changes, the application layer is notified of the media data change through the interface provided by the system, the application layer monitors the change interface, and the system media database is queried after receiving the media content change, thereby reducing the query waiting time, and then improving the entire scanning query speed of the U disk. In addition, after connecting to the U disk, the multimedia USB music will display the loading status, and in the entire U disk scanning process, the loading status will be displayed all the time if no data is scanned. In this embodiment, data query is performed based on the changes in audio content data monitored. The audio data scanned from the USB flash drive will be passed to the application layer for display, and the unfinished scanning process will be continued. This can reduce invalid scanning waiting time and optimize the speed of the entire scanning query, thereby improving the product experience to a certain extent.
[0122] It should be noted that when receiving the U disk scan to start broadcasting and querying for no data, the audio data can also be queried in the system media database at intervals by means of timed polling. In addition, considering that the Android system side will store the scanned audio data records in the system media database when the U disk is connected, and clear the audio data records when the U disk is disconnected, so that when the same U disk is connected for the second time, it is necessary to re-execute the scan, and the whole process is basically the same in time consumption. At the same time, it is common for general users to use the same U disk to play USB music. In this embodiment, when the U disk is uninstalled, the Android system side does not clear the audio data cached in the system media database, so that when the same U disk is connected next time, the audio data of the U disk can be directly obtained from the data cached in the system media database, thereby reducing the time of the same U disk connection query and optimizing the query speed.
[0123] Based on the same inventive concept as the above embodiments, the embodiment of the present invention provides a data query device, such as Figure 4 As shown, it includes: a processing module and a detection module; wherein,
[0124] A detection module, used to detect whether a preset query trigger condition is met during the scanning process of the connected external storage device;
[0125] The processing module is used to perform a media data query operation on a local preset media database when it is determined that the preset query trigger condition is met, so as to query whether the scanned media data of the external storage device is cached in the preset media database.
[0126] In one embodiment, the preset query trigger condition includes at least one of the following: the time interval between the last query time of the preset media database and the current time is greater than or equal to the preset time interval threshold; a callback message indicating that the media data in the preset media database has changed is obtained; and a query instruction is received.
[0127] In one embodiment, the device further includes a monitoring module, which is used to create a media data change monitoring event for a preset media database, so as to generate a callback message when a change in the media data in the preset media database is monitored.
[0128] In one embodiment, the processing module is further configured to:
[0129] In response to monitoring the start of broadcasting of scanning of the external storage device, performing a media data query operation on a preset media database to obtain a data query result;
[0130] When it is determined according to the data query result that no media data of the external storage device is found in the preset media database, a step of detecting whether a preset query trigger condition is met during the scanning process of the connected external storage device is performed.
[0131] In one implementation, the detection module receives the query instruction, including at least one of the following: detecting that a preset query button is triggered; receiving a preset query gesture.
[0132] In one embodiment, the device further includes an output module, and the detection module is further configured to output the scanned media data of the external storage device through the output module when determining that the scanned media data of the external storage device is cached in the preset media database.
[0133] In one embodiment, the device further comprises a scanning module and an output module; wherein,
[0134] The detection module is also used to determine that when media data of the external storage device is queried from the preset media database according to the data query result, output the queried media data of the external storage device through the output module;
[0135] A scanning module is used to scan the external storage device and obtain the current media data of the external storage device;
[0136] The processing module is further used to update the media data of the external storage device in the preset media database according to the current media data of the external storage device.
[0137] In one embodiment, the processing module is further configured to back up the updated media data of the external storage device in a preset media database in response to monitoring an uninstall broadcast to the external storage device.
[0138] For the specific definition of the data query device, please refer to the definition of the data query method above, which will not be repeated here. Each module in the above-mentioned data query device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor of the electronic device in the form of hardware, or can be stored in the memory of the electronic device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0139] Based on the same inventive concept as the above embodiments, an embodiment of the present invention provides an electronic device, such as Figure 5 As shown, the electronic device includes: a processor 310 and a memory 311 storing a computer program; wherein, Figure 5 The processor 310 shown in the figure is not used to indicate that the number of the processor 310 is one, but is only used to indicate the positional relationship of the processor 310 relative to other devices. In actual applications, the number of the processor 310 may be one or more; similarly, Figure 5The memory 311 shown in the figure has the same meaning, that is, it is only used to refer to the position relationship of the memory 311 relative to other devices. In practical applications, the number of memories 311 can be one or more. When the processor 310 runs the computer program, the above-mentioned data query method is implemented.
[0140] The electronic device may also include: at least one network interface 312. The various components in the electronic device are coupled together via a bus system 313. It is understood that the bus system 313 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 313 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 313 is not used in the following examples. Figure 5 Various buses are labeled as bus system 313.
[0141] The memory 311 may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories. The nonvolatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM); the magnetic surface memory may be a disk memory or a tape memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), and direct RAM bus random access memory (DRRAM, Direct Rambus Random Access Memory).The memory 311 described in the embodiments of the present invention is intended to include but is not limited to these and any other suitable types of memories.
[0142] The memory 311 in the embodiment of the present invention is used to store various types of data to support the operation of the electronic device. Examples of these data include: any computer program used to operate on the electronic device, such as an operating system and an application; contact data; phone book data; messages; pictures; videos, etc. Among them, the operating system includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application program may include various applications, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application services. Here, the program that implements the method of the embodiment of the present invention may be included in the application program.
[0143] Based on the same inventive concept as the above-mentioned embodiment, this embodiment further provides a computer storage medium, in which a computer program is stored. The computer storage medium may be a ferromagnetic random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM) or other memory; it may also be various devices including one or any combination of the above-mentioned memories, such as a mobile phone, a computer, a tablet device, a personal digital assistant, etc. When the computer program stored in the computer storage medium is executed by the processor, the above-mentioned data query method is implemented. For the specific steps implemented when the computer program is executed by the processor, please refer to Figure 1 The description of the illustrated embodiment will not be repeated here.
[0144] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0145] In this document, the terms "comprises," "comprising," or any other variations thereof, are intended to cover a non-exclusive inclusion of elements other than those listed and may also include additional elements not expressly listed.
[0146] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A data query method, characterized in that: include: During the scanning process of the connected external storage device, detecting whether the preset query trigger condition is met; When it is determined that the preset query trigger condition is met, a media data query operation is performed on a local preset media database to query whether the scanned media data of the external storage device is cached in the preset media database.
2. The method according to claim 1, characterized in that The preset query trigger condition includes at least one of the following: the time interval between the last query time of the preset media database and the current time is greater than or equal to the preset time interval threshold; a callback message indicating that the media data in the preset media database has changed is obtained; and a query instruction is received.
3. The method according to claim 2, characterized in that The method further includes: before detecting whether a preset query trigger condition is met during the scanning process of the connected external storage device: A media data change monitoring event is created for the preset media database, so as to generate the callback message when a change in the media data in the preset media database is monitored.
4. The method according to claim 2, characterized in that: The method further includes: before detecting whether a preset query trigger condition is met during the scanning process of the connected external storage device: In response to monitoring the start broadcast of scanning of the external storage device, performing a media data query operation on the preset media database to obtain a data query result; When it is determined according to the data query result that the media data of the external storage device is not found in the preset media database, a step of detecting whether a preset query trigger condition is met during the scanning process of the connected external storage device is performed.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: When it is determined that the scanned media data of the external storage device is cached in the preset media database, the scanned media data of the external storage device is output.
6. The method according to claim 4, characterized in that The method further comprises: When it is determined according to the data query result that the media data of the external storage device is queried from the preset media database, outputting the queried media data of the external storage device; Scanning the external storage device to obtain current media data of the external storage device; The media data of the external storage device in the preset media database is updated according to the current media data of the external storage device.
7. The method according to claim 6, characterized in that The method further comprises: In response to monitoring the uninstall broadcast to the external storage device, backing up the updated media data of the external storage device in the preset media database.
8. A data query device, characterized in that: The device comprises: a processing module and a detection module; wherein, The detection module is used to detect whether a preset query trigger condition is met during the scanning process of the connected external storage device; The processing module is used to perform a media data query operation on a local preset media database when it is determined that the preset query trigger condition is met, so as to query whether the scanned media data of the external storage device is cached in the preset media database.
9. An electronic device, characterized in that: include: A processor and a memory storing a computer program, wherein when the processor runs the computer program, the data query method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: A computer program is stored, and when the computer program is executed by a processor, the data query method according to any one of claims 1 to 7 is implemented.