File management method and related device
By introducing a unified media framework and media data interface into the electronic device operating system, the problem of chaotic file management is solved, the systematized file management is realized, file access and search efficiency is improved, and user experience is improved.
Patent Information
- Application Number
- PCT/CN2025/071193
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-06-07
- Filing Date
- 2025-01-08
- Publication Date
- 2025-07-17
AI Technical Summary
Currently, file management in electronic devices is chaotic, applications access and modify media files at will, file sources are unclear, storage directories are chaotic, and lack of systematic management mechanisms, resulting in poor user experience.
By introducing a unified media framework and media data interface into the operating system, standardizing file processing flow, setting file owners, managing file creation, use, storage and deletion permissions, providing full life cycle management, realizing standardized, unified and convenient management of files.
Improve file access and search efficiency, ensure clear file sources and orderly storage directories, improve user experience, simplify application operations, and support end-end collaboration and end-cloud collaboration.
Smart Images

Figure CN2025071193_17072025_PF_FP_ABST
Abstract
Description
A file management method and related equipment
[0001] This application claims priority to the Chinese patent application with application number 202410039486.3 filed with the State Intellectual Property Office of China on January 10, 2024, priority to the Chinese patent application with invention name “A media file processing method”, and priority to the Chinese patent application with application number 202410743922.5 filed with the State Intellectual Property Office of China on June 7, 2024, priority to the Chinese patent application with invention name “A file management method and related equipment”, all contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of terminal technology, and in particular to a file management method and related equipment. Background Art
[0003] With the continuous development of the terminal field, more and more applications are installed in electronic devices, and more and more files are generated and stored in electronic devices based on applications. However, current electronic devices have no management of such files, allowing users and applications to place files at will. For example, with the user's consent, you can obtain permission to access the entire internal card and create and modify files on the internal card at will.
[0004] While electronic devices currently offer a range of system capabilities to manage file access, for example, gradually narrowing access to the media library, providing system picker capabilities, and disabling the concept of absolute paths, the problem of chaotic file management remains difficult to completely eliminate. Problems still exist, such as applications arbitrarily accessing individual media files, unclear sources of media, overly open file creation permissions, and disorganized file storage directories.
[0005] Therefore, how to manage the files of various applications in electronic devices is a technical problem that needs to be solved urgently. Summary of the Invention
[0006] The embodiments of the present application provide a file management method and related equipment to systematically and securely manage the entire file system.
[0007] In a first aspect, an embodiment of the present application provides a file management method, characterized in that the method is applied to a first electronic device, wherein the first electronic device runs a first operating system, a first application is installed on the first operating system, and the first operating system provides: a first interface, a media data interface, and a second capability; the first application includes program code for calling the first interface, the first interface is used to start a first function provided by the first application, the first interface is used to call the media data interface, and the media data interface is used to call the second capability, the second capability including the ability to perform one or more of the following processing on media files: managing the creation of media files, managing the use of media files, storing media files, managing the deletion and recovery of media files, and managing storage space for media files. The method includes: running the first application on the first operating system, displaying a first user interface of the first application, the first user interface presenting a first option corresponding to the first function; the first function includes a file access function; in response to a first user operation on the first option, starting the file access function and displaying a second user interface, the second user interface including one or more media files; detecting a second user operation of selecting a first media file from the one or more media files, returning a resource identifier of the first media file to the first application via the media data interface; and accessing the first media file based on the resource identifier via the first application.
[0008] In an embodiment of the present application, the operating system of an electronic device can manage file production, solving problems such as unclear file sources and chaotic storage. It improves file usage efficiency by further enhancing file access and search efficiency through means such as permission management, type management, and result management. It manages file storage, records file expiration, and provides a new deletion and recovery mechanism, allowing files to be traced. This allows the electronic device to systematically and securely manage the entire file system, improving the user experience. Furthermore, illustratively, after a first application initiates access to a first media file, the media data interface can return a resource identifier for the first media file to the first application, allowing the first application to access the first media file based on the resource identifier. That is, when the first application initiates file access to the first media file, the first application cannot arbitrarily or without obtaining the resource identifier to access the first media file. The media data interface blocks the first application from directly accessing the first media file, requiring any application to access the first media file through the media data interface, avoiding the problem of chaotic file access and improving the user experience.
[0009] In a possible implementation, before returning the resource identifier of the first media file through the media data interface, the method further includes granting the first application temporary access rights to complete the file access function for the first media file.
[0010] In an embodiment of the present application, the electronic device may ask the user or the application that created the first media file, and after the user agrees to authorize, the first application may be granted temporary access rights to the first media file so that the first electronic device can uniformly manage the entire file system.
[0011] In a possible implementation, the method further includes: returning the first media file to the first application through the media data interface if the first application has access rights to the first media file or obtains temporary access rights to the first media file.
[0012] In an embodiment of the present application, the media data interface can directly return the first media file to the first application if the first application meets the access rights of the first media file, without the first application having to access the first media file based on the resource identifier, thereby simplifying the access process so that the first electronic device can uniformly manage the entire file system.
[0013] In a possible implementation, the method further includes: if the first application does not obtain the access permission or temporary access permission for the first media file, returning a result indicating a failure in starting the file access function to the first application through the media data interface.
[0014] In an embodiment of the present application, the electronic device can determine whether the first function can be started for the first file based on the permissions of the first application. If the first function cannot be started for the first file, a result of failure to start the first function is returned to the first application.
[0015] In one possible implementation, the parameters passed in by the first interface include one or more of the following: device name, application name of the first application, and parameters passed in by the first application, wherein the parameters passed in by the first application include parameters indicating the first function and parameter content, wherein the parameter content includes one or more of the following: description information of the first function, the first file, and indication information of the first file.
[0016] In the embodiments of this application, the interface input parameters are standardized, allowing multiple applications to achieve the same functionality through the same interface. For example, the system camera application and third-party camera applications can all call the generated functional interface to implement the photo function. Compared with different applications calling different interfaces, this solves the problem of confusing interfaces called during application operation and reduces the development difficulty for developers.
[0017] In one possible implementation, the media data interface encapsulates a third capability, and the third capability includes the ability to perform one or more of the following processing on the first media file: acquisition, encoding, storage, sharing, decoding and playback; the parameters passed in by the media data interface include: interface indication information, indication information of the first function, and indication information of the first file or the first file; the interface indication information is used to indicate the capability called by the media data interface in the second capability, the indication information of the first file is all or part of the parameters passed in by the first application, and / or the indication information of the first file is determined by the first operating system.
[0018] In an embodiment of the present application, the media data interface encapsulates a third capability, which can support the calling of various functional interfaces upward, and can also be used to manage the underlying hardware and / or algorithms, making the file as a whole systematic and secure, so that various applications can use it more efficiently and allow users to experience it.
[0019] In one possible implementation, the parameters passed in by the third capability include: indication information of the first function, and indication information of the first file or the first file, the indication information of the first file is all or part of the parameters passed in by the first application, and / or the indication information of the first file is determined by the first operating system.
[0020] In the embodiment of the present application, the instruction information of the file can be input by the first application or by the first operating system, which greatly improves the success rate and efficiency of starting the first function.
[0021] In a possible implementation, the first function further includes at least one of the following functions: a file creation function, a file playback function, a file deletion function, a file recovery function, a file backup function, a file migration function, a file sharing function, and a file space management function.
[0022] In the embodiments of this application, the production of files can be controlled based on different functions, solving problems such as unclear file sources and chaotic storage. The efficiency of file use is improved, and the efficiency of file access and search is further improved through means such as permission management, type management, and result management.
[0023] In one possible implementation, the first function is a file creation function, the first file is a data stream, the indication information of the first file includes one or more of the following: file name, file owner, file permission, file storage path, file size, file type, and the interface indication information is used to indicate the interface for executing storage for the first file in the second capability; or, the first function is a file access function, the first file is a picture, the indication information of the first file includes one or more of the following: file name, file owner, file storage path, picture access permission, and picture access method, and the interface indication information is used to indicate the interface for executing storage for the first media data in the second capability; or, the first function is a file playback function, the first file is audio or video, and the first file The indication information includes one or more of the following: file name, file owner, file size, playback mode, and playback duration, and the interface indication information is used to indicate the interface for performing playback on the first media data in the second capability; or, the first function is a file deletion function, and the indication information of the first file includes one or more of the following: file name, file owner, file storage path, file size, and file deletion mode, and the interface indication information is used to indicate the interface for performing storage on the first file in the second capability; or, the first function is a file recovery function, and the indication information of the first file includes one or more of the following: file name, file owner, recoverable file size, and recoverable content, and the interface indication information is used to indicate the interface for performing storage on the first file in the second capability.
[0024] In the embodiment of the present application, an exemplary method of starting the file processing function through a partial functional interface is provided, so that the electronic device can systematically and securely manage the entire file system and improve the user experience.
[0025] In one possible implementation, the third capability includes: generating service capability, which is used to create the first file and set one or more of the following fields for the first file when creating the first file: file owner, file name, file storage path, file usage permissions or file attributes, and the first file is one of text, picture, audio or video.
[0026] In an embodiment of the present application, the electronic device can manage the creation of files, setting the owner information of the file can avoid the generation of files of unknown origin on the electronic device, the standardization of the file storage location can avoid confusion in the stored file directory, and the restriction of file usage permissions can solve problems such as excessive permissions when processing files, thereby realizing standardized, unified and convenient management and control of files to enhance the user experience.
[0027] In a possible implementation, files with the same file owner in the first electronic device are stored in sequence in the same root folder.
[0028] In the embodiment of the present application, the electronic device provides the ability to uniformly process files of various applications through a unified data management framework, thereby realizing unified management of various application files by the electronic device and solving the problem of directory confusion in file storage.
[0029] In one possible implementation, the third capability includes: usage service capability, which is used to manage the usage rights of the first file; or, based on the usage method corresponding to the parameters passed in by the first application, determining whether the first application meets the usage rights of the first file and returning the usage result, the usage rights include one or more of the following: access rights, playback rights, editing rights, and sharing rights.
[0030] In the embodiments of the present application, the electronic device can manage the permissions of each application, thereby improving the efficiency of file use. And through means such as permission management, type management, and result management, standardized, unified, and convenient file management is achieved, thereby improving the user experience.
[0031] In one possible implementation, the third capability includes a destruction service capability, which is used to delete or restore the first file based on parameters passed by the first application. In this embodiment of the present application, the electronic device can manage the destruction of each file, so that each file can be traced and the user experience is improved.
[0032] In one possible implementation, the third capability includes: a storage service capability, which is used to store the first file in a corresponding storage location according to the parameters passed in by the first application and return the storage result; or, to back up or migrate the first file.
[0033] In the embodiments of the present application, the electronic device can store files, better implement file processing, and further support end-to-end collaboration and end-cloud collaboration.
[0034] In one possible implementation, the third capability includes: space management capability, which is used to perform one or more of the following: managing the storage space of the first file; setting the storage location of the first file in the storage space; and deduplicating or compressing the files stored in the storage space when the free storage space in the storage space is less than a preset threshold.
[0035] In the embodiment of the present application, the storage space of the first file can be managed in a unified and standardized manner to improve the utilization efficiency of the storage space. For example, files can be stored in corresponding storage spaces according to storage priority according to different storage priority rules.
[0036] In a second aspect, an embodiment of the present application provides an electronic device, wherein a first operating system is running on the electronic device, a first application is installed on the first operating system, and the first operating system provides: a first interface, a media data interface, and a second capability; the first application includes a program code for calling the first interface, the first interface is used to start a first function provided by the first application, the first interface is used to call the media data interface, and the media data interface is used to call the second capability, the second capability includes the ability to perform one or more of the following processing on media files: managing the creation of media files, managing the use of media files, storing media files, managing the deletion and recovery of media files, and managing the storage space of media files. The electronic device includes: a memory, a processor, and a computer program stored on the memory, and the processor executes the computer program to implement a file management method provided in the first aspect above.
[0037] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, wherein a computer program includes a first operating system, a first application is installed on the first operating system, and the first operating system provides: a first interface, a media data interface, and a second capability; the first application includes a program code for calling the first interface, the first interface is used to start a first function provided by the first application, the first interface is used to call the media data interface, and the media data interface is used to call the second capability, the second capability including the ability to perform one or more of the following processing on media files: managing the creation of media files, managing the use of media files, storing media files, managing the deletion and recovery of media files, and managing the storage space of media files; when the computer program is executed by a processor, a file management method provided in the first aspect above is implemented.
[0038] In a fourth aspect, an embodiment of the present application provides a computer program product, which includes a computer program, the computer program including a first operating system, a first application installed on the first operating system, and the first operating system providing: a first interface, a media data interface, and a second capability; the first application includes a program code for calling the first interface, the first interface is used to start a first function provided by the first application, the first interface is used to call the media data interface, the media data interface is used to call the second capability, the second capability includes the ability to perform one or more of the following processing on media files: managing the creation of media files, managing the use of media files, storing media files, managing the deletion and recovery of media files, and managing the storage space of media files; when the computer program is executed by a processor, a file management method provided in the first aspect above is implemented.
[0039] It should be understood that the electronic device provided in the second aspect of this application, the computer-readable storage medium provided in the third aspect, and the computer program provided in the fourth aspect are consistent with the technical solution of the first aspect of this application. Their specific contents and beneficial effects can be referred to the file management method provided in the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the background technology, the drawings required for use in the embodiments of the present application or the background technology will be described below.
[0041] FIG1 is a schematic diagram showing the difference between a method for an application to access a file and a file access method in a file management method provided in an embodiment of the present application.
[0042] FIG2 is a schematic diagram of the architecture of an OS provided in an embodiment of the present application.
[0043] FIG3 is a schematic diagram of the architecture of another OS provided in an embodiment of the present application.
[0044] FIG4 is a schematic diagram of a first application-specific calling function interface provided in an embodiment of the present application.
[0045] 5-9 are schematic diagrams of a group of calling relationships of a first application calling various functional interfaces provided in an embodiment of the present application.
[0046] FIG10 is a schematic diagram of a file owner provided in an embodiment of the present application.
[0047] Figures 11A-11D are a set of user interface diagrams provided in an embodiment of the present application.
[0048] FIG12 is a schematic diagram of a detailed description of usage permissions provided in an embodiment of the present application.
[0049] FIG13 is a schematic diagram of capabilities supported by a storage service provided in an embodiment of the present application.
[0050] FIG14 is a schematic diagram of the recovery process corresponding to different deletion methods provided in an embodiment of the present application.
[0051] FIG15 is a compression schematic diagram provided in an embodiment of the present application.
[0052] FIG16 is a flow chart of a file management method provided in an embodiment of the present application.
[0053] FIG17 is a schematic diagram of a user interface provided in an embodiment of the present application.
[0054] Figure 18 is a schematic diagram of the interface call relationship when starting a file access function provided in an embodiment of the present application.
[0055] Figures 19 and 20 are another set of user interface schematic diagrams provided in an embodiment of the present application.
[0056] FIG21 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] The embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0058] The terms "first," "second," and the like in the specification, claims, and accompanying drawings of this application are used to distinguish between different objects, not to describe a particular order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements, but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.
[0059] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0060] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0061] As used in this specification, the terms "component," "module," "system," and the like are used to represent computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program, and / or a computer. By way of illustration, both an application running on a computing device and a computing device can be a component. One or more components can reside in a process and / or an execution thread, and a component can be located on a computer and / or distributed between two or more computers. In addition, these components can be executed from various computer-readable media having various data structures stored thereon. Components can communicate, for example, via local and / or remote processes based on signals having one or more data packets (e.g., data from two components interacting with another component on a local system, a distributed system, and / or a network, such as the Internet interacting with other systems via signals).
[0062] The term "user interface (UI)" in the following embodiments of this application refers to a medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface is a source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on an electronic device and finally presented as content that the user can recognize. The commonly used form of user interface is graphical user interface (GUI), which refers to a user interface related to computer operations that is displayed in a graphical manner. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. displayed on the display screen of an electronic device.
[0063] First, in order to facilitate understanding of the embodiments of the present application, the technical problems that need to be solved and the applicable application scenarios of the embodiments of the present application are analyzed in detail below.
[0064] File processing can be understood as the management of a file's entire lifecycle and the persistence of file data. Activities in a file's lifecycle include: file creation, file access and search, file sharing, backup, migration, and file extinction.
[0065] With the continuous development of the terminal industry, more and more applications are installed in electronic devices. The number of related files generated and stored by applications or services themselves, or files generated and stored by user operations (such as images, audio, and video) is also increasing. Although electronic devices currently provide a series of system capabilities to control file access, such as gradually narrowing the entry point to the media library, providing system selection (Picker) capabilities, and disabling the concept of absolute paths, current electronic devices still allow users and applications to arbitrarily process files.
[0066] For example: Although current electronic devices restrict the permissions of various applications to access the internal memory (i.e., the internal card mentioned in the following embodiments), various applications can obtain permissions to access the entire internal card with the user's consent, and can arbitrarily access, create, and modify files under most applications in the internal card. Moreover, various applications apply for file permissions based on the internal card of the entire electronic device, and the permissions applied for are completely defined by the developer himself and cannot be controlled by the electronic device. For example: the terminal user does not want certain third-party applications to access the pictures of portraits taken by the camera in the gallery, but currently after the gallery authorizes the third-party application, the third-party application can access all the pictures in the gallery and cannot be controlled by the electronic device. Moreover, the above permissions are all defined by the developer of the third-party application. For the terminal user, it is impossible to really judge whether the application should access, or what files it should access.
[0067] Furthermore, since any app can request memory access permissions and create files at will, this can lead to a large amount of junk files on electronic devices, making it impossible for the device to detect the source and the owner of the created files. Furthermore, this can lead to cluttered file storage directories, allowing files created by one app to be freely accessed, modified, or shared by another. For example, users often find various image files of unknown origin in their gallery.
[0068] Taking file access as an example, please refer to Figure 1, which shows a schematic diagram illustrating the difference between a method for an application to access a file and a file access method in the file management method provided in the embodiment of the present application. Figure 1 (1) shows a schematic diagram illustrating the principle of a current application accessing data, and Figure 1 (2) shows a schematic diagram illustrating the principle of a data management method provided in the embodiment of the present application accessing data.
[0069] As shown in Figure 1 (1), any application such as Application A, Application B, Application C, etc. can arbitrarily access one or more of the gallery, audio or file manager in the electronic device according to the corresponding capabilities of the business selection. For example, any application can access pictures or videos managed in the gallery of the electronic device, or save pictures or videos in the gallery. For another example, any application can access or delete audio files in the electronic device, such as recordings or music. For another example, any application can also arbitrarily access documents in the file manager, etc. In other words, operations such as creating, using, sharing or deleting files for various applications only need to obtain the initial authorization of the electronic device or user for the internal card, and then they can be processed at will.
[0070] In summary, after the electronic device authorizes each application, the application is basically not controlled by the electronic device when processing files, resulting in unclear sources of file creation, overly open file processing permissions, chaotic file storage directories, and other problems. This is not conducive to the electronic device's systematic and secure control of the entire file system, and the user experience is poor.
[0071] In this regard, an embodiment of the present application provides a file management method and related devices, where the file management method is implemented by an operating system (OS) of an electronic device.
[0072] The OS can combine one or more commands to the underlying hardware and / or algorithms to build a new file processing solution based on the current media unified framework, thereby achieving full life cycle management of each application's files, and solving problems such as unclear file sources, overly open file creation permissions, and chaotic file storage directories in current electronic devices.
[0073] For example, any of the applications A, B, and C shown in (2) in FIG1 uses the unified media framework to implement file processing for files such as gallery, audio, and file manager. For example, if there is a corresponding file processing option on the user interface of the application, the application can call the file processing function interface to start the file processing function. After the media data interface of the unified media framework in the OS detects that the application has called the file processing function interface, it can start the file processing function or return the result of calling the file processing function interface. For example, if there is an option to perform file access on the user interface of application A, the application can call the file access function interface to start the file access function. After the media data interface of the unified media framework in the OS detects that the application has called the file access function interface, it can start the file access function and complete the access to the file. That is, when any application in the embodiment of the present application creates, uses, eliminates, or manages media files in an electronic device, it does not need to issue commands to the underlying hardware and / or algorithm. It only needs to send command transmission parameters to the media data interface of the unified media framework in the OS and wait for the file or response returned by the media data interface based on the command.
[0074] Among them, the media data interface can be regarded as a unified abstraction of hardware and / or software capabilities, and is an upper-level concept abstracted from the commands of the entire file life cycle. In this way, when the electronic device processes the files of the application, it does not need to use different interfaces corresponding to each application to issue commands to the underlying hardware and / or algorithm to realize file processing. It can directly realize standardized, unified and convenient management and control of files through the media data interface of the electronic device. Moreover, the OS can further control the production of files and introduce the concept of file owner to solve problems such as unclear sources and chaotic storage from the source. Improve the efficiency of file use and further improve the efficiency of file access and search through means such as permission management, type management, and result management. Manage file storage, mainly including sharing, backup and migration. Through unified registration and end-cloud collaboration, better file processing is realized. Record the disappearance of files and provide a new deletion and recovery mechanism so that files can be traced. Manage storage space to ensure the rational use of space. Among them, the specific implementation method can also refer to the relevant description of the following embodiment. The embodiment of this application will not be repeated here.
[0075] The electronic device can be a portable terminal device equipped with HarmonyOS, iOS, Android, Microsoft or other operating systems, such as a mobile phone, tablet computer, wearable device, etc., and can also be a non-portable terminal device such as a laptop computer with a touch-sensitive surface or touch panel, a desktop computer with a touch-sensitive surface or touch panel. The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a microservice architecture, or a cloud architecture. The embodiment of the present application takes the layered architecture of HarmonyOS as an example to illustrate the software structure of the electronic device 100.
[0076] Please refer to FIG2 , which is a schematic diagram of the architecture of an OS provided in an embodiment of the present application.
[0077] As shown in Figure 2, the layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the OS is divided into four layers, from top to bottom: the application layer, the application framework layer, the service layer, and the kernel layer. The higher the layer, the more interaction with the user; the lower the layer, the more system capabilities it represents. The OS shown in Figure 2 is only an example, and it may also include more or fewer modules, and the embodiments of the present application are not limited to this.
[0078] The application layer may include a series of application packages, primarily used for the production and use of media files. For example, as shown in Figure 2, these include a camera, gallery, recorder, file manager, or other applications. Exemplarily, these media files may include images, videos, audio, text, installation packages, and the like, which are not specifically limited in this embodiment of the present application.
[0079] It can be understood that in addition to the applications shown in Figure 2, the application layer can also include more or fewer applications, such as various system applications, self-developed applications, third-party applications, etc., other applications such as gallery applications, music applications, and video applications are similar, as well as the first application or second application mentioned in the following related embodiments, etc., and the embodiments of this application are not limited to this.
[0080] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions. The framework layer also includes modules such as the window manager, content provider, view system, telephony manager, and resource manager, which are not discussed in detail here.
[0081] As shown in Figure 2, the unified media framework in the application framework layer can be called a unified file framework, a unified media file framework, a file management framework, a media file management framework, etc. The unified media framework may include a first interface for providing file processing functions to applications in the application layer. The first interface may also be called a first selector. Among them, different first interfaces can be used to start different file processing functions. Exemplary: the first interface may include but is not limited to the following interfaces: generation function interface, use function interface, storage function interface, disappearance function interface, space management function interface and other related interfaces. The first interface can also be an AMS (Activity Manager Service, AMS) interface for starting, switching, scheduling and management and scheduling of application processes. The above-mentioned multiple different first interfaces can be called separately by each application in the application layer to assist the applications in the application layer in processing media files.
[0082] For example, a generation function interface can activate a file generation function to support applications in implementing media file creation functions. Multiple different generation function interfaces can also be encapsulated, with one generation function interface being used to activate a generation function, such as image generation, audio generation, or video generation. The generation function interface selects a corresponding interface from the multiple generation function interfaces based on parameters passed in by different applications.
[0083] The function interface can be used to start the file use function, that is, to support the application to access, search, edit or run the media file. Among them, different file use functions are started, and the corresponding input parameters are different.
[0084] The storage function interface can enable the file storage function, that is, support the application to implement the storage of media files.
[0085] The destruction function interface can start the file destruction function to support the application to delete or restore the media file. Accordingly, the corresponding input parameters are different depending on the type of file destruction.
[0086] The space management function interface can start the space management function to support the application program to implement space management of media files, so that the electronic device can use the files efficiently.
[0087] It should be understood that the above-mentioned other functional interfaces are similar to the description of the generation functional interface and will not be repeated here.
[0088] As can be seen, the application framework layer provides a unified interface for multiple applications in the application layer to call, allowing these multiple applications to implement the same functionality through the same interface. For example, the system camera application and third-party camera applications can all call the generated functional interface to implement the photo function. Compared to different applications calling different interfaces, this solves the problem of interface confusion during application operation.
[0089] In other embodiments, the above-mentioned interfaces for providing file processing functions are merely exemplary descriptions. Please refer to FIG3 , which is a schematic diagram of the architecture of another OS provided in an embodiment of the present application. As shown in FIG3 , a more detailed interface can also be provided to the application in the application layer for unused file processing functions. Exemplarily, the first interface can also include but is not limited to the following interfaces: a create function interface, an access function interface, a share function interface, an edit function interface, a migration function interface, a delete function interface, a restore function interface, a compression function interface, a deduplication function interface, etc., which are not limited in the embodiment of the present application.
[0090] In addition, the unified media framework in the application framework layer can also include a media data interface (MediaDataKit) that provides file processing to the OS system, which can also be called a media data picker. The media data interface can be used to implement the generation, use (such as editing, accessing, playing, etc.), storage, disappearance (such as deletion and restoration, etc.), space management, etc. of files. In addition, when used to implement the use of media files such as pictures, the media data interface can also be a picture picker (Photo Picker), etc.
[0091] The media data interface encapsulates multiple third-party capabilities, including the ability to perform one or more of the following processing on media files, such as acquisition, encoding, storage, sharing, decoding, playback, and other. These third-party capabilities, also known as foundational capabilities, assist the OS system in invoking underlying hardware and / or software capabilities to achieve unified processing of media files when applications in the application layer call upper-layer file processing interfaces. Of course, in other implementations, the file processing interfaces provided to the OS can also be made available to third-party applications.
[0092] The media data interface can support the calling of the generation function interface, the use function interface, the storage function interface, the extinction function interface, the space management function interface, etc. It can also be used to manage the underlying hardware and / or algorithms, making the file as a whole systematic and secure, so that various applications can use it more efficiently and let users experience it. That is, the above-mentioned generation function interface, use function interface, storage function interface, extinction function interface, space management function interface, etc. can call the media data interface. At this time, the media data interface can select the third capability of running the supporting function interface from multiple third capabilities according to the called function interface. For example: acquisition, encoding, and storage can be used to support the above-mentioned file generation function; encoding, transmission, decoding, playback or storage can be used to support the above-mentioned file use function, etc. This third capability can also be called the basic capability to support file processing.
[0093] For example, when the electronic device 100 detects that the user accesses a picture through the gallery application, the gallery application can call the usage function interface, and the usage function interface then calls MediaDataKit. MediaDataKit determines that the operation performed on the media data is "storage" based on the usage function interface. Therefore, MediaDataKit then calls the storage capability to achieve access to the saved pictures.
[0094] It is understandable that the application framework layer may also include more or fewer functional modules, and the embodiments of the present application are not limited to this.
[0095] The service layer can be used to connect to the media data interface and includes multiple second capabilities. The second capabilities include the ability to perform one or more of the following processing on media files: generation service capability, usage service capability, storage service capability, destruction service capability, space management service capability, or other capabilities.
[0096] The creation service can be used to manage the creation of media files and implement the business logic for creating media files. For example, taking a first media file as an example, the creation service can be used to create the first media file and set one or more of the following fields for the first media file when creating the first media file: file owner, file name, file storage path, file usage permissions, or file attributes. The first media file is one of text, image, audio, or video.
[0097] The usage service can be used to manage the use of media files and implement the business logic for using media files. For example, taking the use of a first media file by a first application as an example, the usage service can be used to control the usage permissions of the first media file; or, based on the usage method corresponding to the parameters passed by the first application, determine whether the first application meets the usage permissions of the first media file and return the usage result. The usage permissions include one or more of the following: access permissions, playback permissions, editing permissions, sharing permissions, etc.
[0098] The storage service can be used to store media files and implement the business logic for storing media files. For example, taking a first application storing a first media file as an example, the storage service can store the first media file in a corresponding storage location based on parameters passed by the first application and return the storage result; alternatively, the storage service can back up or migrate the first media file.
[0099] The Destruction Service can be used to manage the deletion and restoration of media files, implementing the business logic for deleting or restoring media files. For example, taking the example of a first application deleting or restoring a first media file, the Destruction Service can delete or restore the first media file based on the parameters passed in by the first application.
[0100] The space management service can be used to manage the storage space of media files and implement the business logic of unified storage space management for media files. For example, taking the example of a first application managing the storage space of a first media file, the space management service can be used to perform one or more of the following: managing the storage space of the first media file; setting the storage location of the first media file in the storage space; and deduplicating or compressing files stored in the storage space when the free storage space in the storage space is less than a preset threshold.
[0101] In other embodiments, the multiple second capabilities of the service layer can also be set in the application framework layer to facilitate the media data interface to call them through the third capability. This embodiment of the present application does not impose specific limitations on this. In this way, each application in the application layer only needs to call the corresponding file processing function interface and pass the input parameters to it, and the OS will activate the corresponding file processing function for the application, which simplifies application operation and ensures the consistency of the effect of the file processing function activated by each application.
[0102] The kernel layer is a layer between hardware and software that allows compatibility with different hardware devices. Different electronic devices may use different models or types of processing chips, that is, there are differences in hardware. The kernel layer in the embodiments of the present application can be used to support the processing of hardware, drivers, and algorithms. The kernel layer includes at least input and output (IO) drivers, storage drivers, and underlying algorithm processing.
[0103] The unified media file management mentioned above can be achieved through the various interface modules in the framework layer provided by this application. For example, after the application calls the file processing function interface corresponding to the file processing function and inputs the corresponding input parameters, it can run the media data interface in the framework layer. The media data interface selects a third capability that supports the file processing function interface from multiple third capabilities; the third capability selects a second capability that corresponds to the file processing function in the service layer. This can provide a unified management capability for the life cycle of files, provide corresponding interface capabilities according to user needs, realize the generation, use, storage, extinction and other processing of files, and meet the user's file processing needs in different scenarios.
[0104] Based on the software architecture shown in FIG. 2 , the calling relationship among the interfaces of the above layers is exemplarily described by taking the first application calling the first function as an example.
[0105] The parameters passed in by the first interface include one or more of the following: a device name, an application name of a first application, and parameters passed in by the first application, wherein the device name and the application name of the first application may be determined by the first operating system, and the parameters passed in by the first application include parameters indicating a first function and parameter content, wherein the parameters indicating the first function and the parameter content are in a key-value format, wherein the key represents the first function, and the parameter content may also be referred to as a parameter value or value, wherein the parameter content includes one or more of the following: description information of the first function, a first media file, and indication information of the first media file, wherein the indication information of the first media file may be understood as a storage path of the first media file (i.e., used to indicate the storage location of the first media file), a file size of the first media file, a file name of the first media file, a method for accessing the first media file, and the like. The first media file may be one of multiple media files in the electronic device.
[0106] The first interface may then continue to call the media data interface, with parameters passed into the media data interface including: interface indication information, indication information of the first function, and indication information of the first media file or the first media file. The interface indication information indicates the capability called by the media data interface in the third capability, the interface indication information and the indication information of the first media file are all or part of the parameters passed into the first application, and / or the indication information of the first media file is determined by the first operating system.
[0107] Accordingly, the media data interface may continue to invoke a third capability, where parameters passed in by the third capability include: indication information of the first function, and the first media file or indication information of the first media file. It is understood that the indication information of the first media file may also be all or part of the parameters passed in by the first application, and / or the indication information of the first media file may also be determined by the first operating system.
[0108] Finally, the third capability can call one or more second capabilities to implement the first function.
[0109] Please refer to Figure 4, which is a schematic diagram of the first application-specific calling function interface provided in an embodiment of the present application.
[0110] As shown in Figure 4 , the first application may refer to the camera application, gallery application, music application, or video application in the application layer mentioned in Figure 2 or Figure 3 . XXMode may refer to the first interface corresponding to any of the functions mentioned in Figure 2 or Figure 3 , for example, the file management interface (FileManageMode), editing interface (EditMode), storage interface (StorageMode), sharing interface (ShareMode), and MediaDataKit is the media data interface.
[0111] The user interface of the first application may present options corresponding to any function, and may trigger the start of a certain function after detecting a user operation. The function may include one or more processes such as generation, use, storage, destruction, and space management of a certain media file.
[0112] Among them, the form of the XXMode interface is XXMode(DeviceName, AppName, AppParameter, extend).
[0113] The device name (DeviceName) may be the device name of the device to which the first application calling the interface belongs.
[0114] The application name (AppName) may refer to the name of the first application that calls the XXMode interface.
[0115] The parameters passed by the first application (AppParameter) include one or more parameters passed by the first application after detecting the user operation. For example, if the user operation is to create a file, the parameters passed by the first application may include the file name, file owner, file permissions, file storage path, file size, file type, etc.
[0116] The extended field (extend) can be used to build pre-built capabilities or differentiated capabilities.
[0117] It is understandable that the device name, application name, and extension fields are optional.
[0118] After the first application calls the XXMode interface, the XXMode interface can call MediaDataKit, and the interface format of MediaDataKit is MediaDataKit(type, key, value, extend).
[0119] Type (type) indicates the type of processing performed on the file. Types may include, but are not limited to, normal, acquisition, code, storage, share, decode, play, and other. The type can be determined based on the previous interface called by MediaDataKit. For example, if a camera application calls the FileManageMode interface, the electronic device may determine that the photo creation function is currently required and perform storage processing on the captured photo stream, thus considering it as a storage type.
[0120] The function point's key parameter is used to indicate the function point to be started. Each type can include multiple different function points. For example, for the acquisition type, there may be corresponding functions such as shooting, video recording, and audio recording. The function point's key parameter can be directly determined by the name of the previous interface called by MediaDataKit or the AppParameter passed in MediaDataKit. For example, if the previous interface is the FileManageMode interface, the function point's key parameter can be Create File Mode.
[0121] The value (value) required by the function point is used to indicate the data required to implement the function point. For example, for the picture creation function, a photo flow (pictureFlow) is required. Among them, the value (value) required by the function point can be obtained from the parameters (AppParameter) passed in by the first application. If some values cannot be obtained from the parameters (AppParameter) passed in by the first application, the operating system can fill in this part of the value by itself. In other words, the value (value) required by the function point may include: part or all of the parameters (AppParameter) passed in by the first application, and / or parameters determined by the operating system.
[0122] The function point's key and its required value form a key-value pair. That is, the function point's key and its required value are in a corresponding relationship. A key can correspond to one or more values. The key and value passed in MediaDataKit can include one or more pairs, such as key1, value1, key2, value2.
[0123] The extended field (extend) can be used to build pre-built capabilities or differentiated capabilities.
[0124] After the MediaDataKit interface is called, other capabilities provided by the framework layer can be called downward according to the type. For example, if the type is encoding, the encoding capability can be called to implement file encoding. If the type is storage, the storage capability can be called to implement file storage. If the type is sharing, the sharing capability can be called to implement file sharing. If the type is decoding, the decoding capability can be called to implement file decoding. If the type is playback, the playback capability can be called to implement file playback. Among them, the parameters passed in the acquisition, encoding, storage, sharing, decoding or playback capabilities may include: key, value, and extend.
[0125] During the invocation of any of the capabilities of acquisition, encoding, storage, sharing, decoding, or playback, multiple capabilities, such as generation service capabilities, usage service capabilities, storage service capabilities, extinction service capabilities, space management service capabilities, or others, may also be invoked to achieve standardization and unification of media data. The generation service capability may be used to manage the creation of the first media file, the usage service capability may be used to manage the use of the first media file, the storage service capability may be used to store the first media file, the extinction service capability may be used to manage the deletion and restoration of the first media file, and the space management service capability may be used to manage the storage space of the first media file. For specific methods, please refer to the relevant description of the corresponding embodiments below, and the embodiments of this application will not be described in detail here.
[0126] In some embodiments, in the process of calling any one of the capabilities such as acquisition, encoding, storage, sharing, decoding or playback, some of the capabilities such as generation service capability, use service capability, storage service capability, destruction service capability, space management service capability or other capabilities may be called, which may be specifically determined by the application or the first operating system.
[0127] In some implementations, after the XX Mode interface is called, it is possible to bypass MediaDataKit and directly call other framework layer interfaces below MediaDataKit to implement the application startup function.
[0128] In some implementations, the XXMode interface can be a kit or a picker. When the XXMode interface is implemented as a picker, the MediaDataKit can also be correspondingly subdivided into multiple interfaces with more detailed functions, so that the XXMode interface can select an appropriate interface from the multiple interfaces to call.
[0129] After the framework layer interface is called, it will continue to call the interfaces of the service layer and kernel layer to implement the corresponding file processing functions.
[0130] Based on the calling relationship of the above-mentioned interfaces, for example, please refer to Figures 5 to 9, which are schematic diagrams of the calling relationship of a group of first applications calling various functional interfaces provided in an embodiment of the present application.
[0131] Take the first application calling the generating function as an example.
[0132] In some embodiments, the first function is a file creation function, the first media file is a data stream, and the indication information of the first media file includes one or more of the following: file name, file owner, file permissions, file storage path, file size, and file type. The interface indication information is used to indicate the third capability, the capability to perform storage for the first media file.
[0133] As shown in Figure 5, the first application can be a camera application. After receiving a user operation to save the currently captured photo, the first application calls the file management function interface (file manage mode) and passes the following parameters to the interface: DeviceName, AppName, key1, value1, key2, value2, extend. After the first application calls the file management function interface (file manage mode), the file management function interface (file manage mode) calls MediaDataKit, and the parameters passed by MediaDataKit include: Storage, Create File Mode, [name, owner,...], extend.
[0134] Among them, key1 can be used to indicate the function point image creation to be started, and value1 can be the photo stream obtained after taking the photo, that is, the data stream of the first media file, so as to create the image, etc.
[0135] Storage indicates the storage interface that MediaDataKit will next call. CreateFileMode is the initiating function. [name, owner, ...] indicates the parameters of the file being created. Name is the file name, and owner is the file owner. The owner can be the DeviceName and AppName parameters passed to MediaDataKit when the file manage mode interface is called. Other file information can also be passed, such as file permissions, file storage path, file size, and file type.
[0136] After the FileManageMode interface calls MediaDataKit, MediaDataKit calls storage capabilities. The parameters passed by storage capabilities may include: CreateFileMode, [name, owner, ...], extend.
[0137] Then, during the operation of the storage capability, one or more of the generation service capability, usage service capability, storage service capability, extinction service capability, space management service capability, or other capabilities can be called to create photos. For example, the generation service capability can be called to create a photo, and the storage service capability can be called to store the created photo in the storage location specified by the space management service.
[0138] Take the access function in the first application call usage function as an example.
[0139] In some embodiments, the first function is a file access function, the first media file is a picture, and the indication information of the first media file includes one or more of the following: file name, file owner, file storage path, picture access permission, and picture access method. The interface indication information is used to indicate the third capability, the ability to perform storage on the first media data.
[0140] The first application may be a gallery application, the first function may be an access function, the first media file may include one or more of the following: a large image, a thumbnail, and the processing performed by the first function on the first media data may include: storage.
[0141] As shown in FIG6 , after the gallery application detects the user's operation of accessing a picture, the gallery application can call the picture access function PhotosMode interface, where the parameters passed by the PhotosMode interface include: DeviceName, AppName, key1, value1, key2, value2, extend.
[0142] For a detailed description of the parameters passed by the PhotosMode interface, please refer to the relevant content in Figure 5 above, which will not be repeated here.
[0143] After the camera application calls the PhotosMode interface, the PhotosMode interface calls MediaDataKit. The parameters passed by MediaDataKit include: Storage, PhotosMode, [BigPicture, ...], and extend. The parameters passed may also include the file owner, file storage path, file size, etc., which are not specifically limited in this embodiment of the application.
[0144] Among them, Storage is used to indicate the storage interface, PhotosMode is the startup function point, BigPicture is the large picture, and BigPicture is the large picture accessed by the user in the large picture access mode of the gallery application.
[0145] After the PhotosMode interface calls MediaDataKit, MediaDataKit can determine that the next interface to call is storage capability based on the parameter Storage passed by it. The parameters passed by storage capability may include: PhotosMode, [BigPicture, ...], extend.
[0146] Then, during the operation of the storage capability, one or more of the creation service capability, usage service capability, storage service capability, destruction service capability, space management service capability, or other capabilities may be invoked to access the image. For example, the usage service capability may be invoked to determine whether the first application meets the access rights for the first media file. If not, the storage capability fails to execute, and a result indicating a failure to initiate the file access function is returned. If not, the storage capability continues to execute to complete the file access function.
[0147] Take the play function in the first application call usage function as an example.
[0148] In some embodiments, the first function is a file playback function, the first media file is audio or video, and the indication information of the first media file includes one or more of the following: file name, file owner, file size, playback mode, and playback duration. The interface indication information is used to indicate the third capability, the ability to perform playback on the first media data.
[0149] The first application may be a music application or a video application. When the first function is a playback function and the first media file is music, the processing performed by the first function on the first media file may include: playback.
[0150] As shown in Figure 7, after the music app detects the user's operation to play music, the music app can call the PlayMode interface. After the music app calls the PlayMode interface, the PlayMode interface calls MediaDataKit, and the parameters passed by MediaDataKit include: Play, PlayMusic, [MusicName, size, time, ...], and extend.
[0151] Among them, Play is used to indicate the playback interface that MediaDataKit will call next, PlayMusic is the function point to start, and [MusicName, size, time, ...] is used to indicate the music to be played this time, where MusicName is the music name, size is the music size, and time is the music duration. The parameters passed may also include file owner, file storage path, playback mode, etc., which are not specifically limited in this embodiment of the application.
[0152] After the PlayMode interface calls MediaDataKit, MediaDataKit calls the playback interface. The parameters passed by the playback interface may include: PlayMusic, [MusicName, size, time, ...], extend.
[0153] Then, during the operation of the playback capability, one or more of the generation service capability, use service capability, storage service capability, extinction service capability, space management service capability or others may be called to play music.
[0154] Take the first application calling the delete function in the extinction function as an example.
[0155] In some embodiments, the first function is a file deletion function, and the indication information of the first media file includes one or more of the following: file name, file owner, file storage path, file size, and file deletion method. The interface indication information is used to indicate the third capability, the capability of performing storage for the first media file.
[0156] As shown in Figure 8, the first application can be a storage-type application such as a gallery or file manager. After detecting a file deletion operation, the storage-type application can call the FileManageMode interface. The FileManageMode interface then calls MediaDataKit, passing the following parameters: Storage, DeleteFileMode, [name, owner, ...], and extend.
[0157] Storage indicates the storage interface that MediaDataKit will call next, DeleteFileMode is the enabled function, and [name, owner, ...] indicates the file to be deleted, where name is the file name and owner is the file owner. Passed parameters may also include file storage path, file size, file deletion method, etc., which are not specifically limited in this embodiment.
[0158] After the FileManageMode interface calls MediaDataKit, MediaDataKit calls the storage interface. The parameters passed by the storage interface may include: DeleteFileMode, [name, owner, ...], extend.
[0159] Then, during the operation of the storage capability, one or more of the generation service capability, the use service capability, the storage service capability, the destruction service capability, the space management service capability or others may be called to delete the first media file.
[0160] Take the first application calling the restore function in the destruction function as an example.
[0161] In some embodiments, the first function is a file recovery function, and the indication information of the first media file includes one or more of the following: file name, file owner, recoverable file size, and recoverable content. The interface indication information is used to indicate the third capability, the capability to perform storage for the first media file.
[0162] As shown in Figure 9, the first application can be a storage application such as a recycle bin. After detecting the user's attempt to restore a file, the storage application can call the FileManageMode interface. The FileManageMode interface then calls MediaDataKit, passing the following parameters: Storage, RestoreFileMode, [name, owner, ...], and extend.
[0163] Storage indicates the storage interface that MediaDataKit will call next, RestoreFileMode is the enabled function, and [name, owner, ...] indicates the file to be restored, where name is the file name and owner is the file owner. Passed parameters may also include the size of the recoverable file, the recoverable content, and other parameters, which are not specifically limited in this embodiment.
[0164] After the FileManageMode interface calls MediaDataKit, MediaDataKit calls the storage interface. The parameters passed by the storage interface may include: RestoreFileMode, [name, owner, ...], extend.
[0165] Then, during the operation of the storage capability, one or more of the generation service capability, the use service capability, the storage service capability, the destruction service capability, the space management service capability or others may be called to delete the first media file.
[0166] It is understandable that the calling methods of other relevant functional interfaces can also refer to the relevant descriptions of the embodiments shown in Figures 5 to 9 above, and the embodiments of this application will not be repeated here.
[0167] Based on the above calling relationships for different interfaces, the following describes the implementation of file processing based on the third capability in different application scenarios in combination with the OS of the electronic device provided in the embodiment shown in Figure 2. The files mentioned in the embodiments of this application can be understood as the media files mentioned in the above embodiments.
[0168] For the generation of files
[0169] Each application can create, use, and delete files during operation, but the embodiments of the present application can standardize and control the file creation process of each application based on the generation capability of the OS. For example, when the application starts the file creation function, the input parameters of the file creation function interface include file owner information. The file owner is used to indicate the source of the file, which can solve problems such as unclear file source and chaotic storage from the source.
[0170] That is, when creating a file, the electronic device can determine one or more of the file owner, file name, file permissions, file storage path, file size, file type, etc. of the first media file based on the parameters passed in by the first application. The file owner, file permissions, and file storage path can better assist the unified media framework in performing standardized management of files.
[0171] Among them, the file owner is used to record the application that created the file. In the scenario where multiple devices are interconnected, the device where the application is located when the file is created can also be recorded. Among them, the file owner includes the application identification information of the application that created the file, and the device identification of the device to which the application belongs when the file is created, such as: the first application identification and the first electronic device identification. It should be noted that the first application can refer to a system application or a third-party application running on an electronic device, and can also refer to an application service or a system service running on an electronic device. For example: applet services on electronic devices that rely on system platforms, various applet services that rely on third-party application platforms (such as: Alipay, WeChat), etc., for which the embodiments of this application do not make specific limitations.
[0172] Please refer to Figure 10, which is a schematic diagram of a file owner provided by an embodiment of the present application. As shown in Figure 10, when creating a file, the unique file owner of the file is standardized, such as: File 1 is created by application B on device A, then the owner of file 1 is: (device A + application B); File 2 is created by application B on device B, then the owner of file 2 is: (device B + application B). It can be seen from this that even if file 1 and file 2 are both created by application B, the electronic device can quickly distinguish the source of the file based only on the owner information. For another example: File 3 is created by service A on device A, then the owner of file 3 is: (device A + service A); it can be seen from this that even if file 1 and file 3 are both created on device A, the electronic device can quickly distinguish the source of the file based only on the owner information.
[0173] All files on electronic devices specify an owner upon creation. This owner is then used as an input parameter to various file processing functions throughout the file's lifecycle. This facilitates file traceability within the unified media framework during file processing, eliminating the issue of unclear file creation sources within the framework. The owner also serves as a cache record. All file-generating operations within an application are recorded in the application's cache, facilitating system-level security management and ensuring a traceable record of all file creation. If the ownership of a detected file is unclear, the illegitimate application can be identified and deleted by the electronic device. For example, if the application created a file with permissions that allow it to be shared with other applications, then upon deleting the application, all associated files must be deleted. In this case, the owner of the file on the electronic device can be traversed to achieve complete removal. A similar approach is used in backup scenarios, enabling application-level control.
[0174] In some embodiments, the file storage path may be a relative path or an absolute path of the file storage location, used to indicate the storage location of the file in the electronic device. In this case, files with the same file owner in the first electronic device are created and stored in the same root folder in sequence.
[0175] It is understandable that an application can only create one folder named after its own application in the first electronic device, and all subsequent files or folders can only be created under the root folder directory. Moreover, the files under the root directory can be classified or sorted according to an attribute such as creation time, file name, file size, etc. This method can facilitate electronic devices to manage files created by various applications based on the owner, and the number of root folders at one level can be greatly controlled. The format of the files under each root folder can be recursively deduced according to this requirement. When the number of root folders is too large, the space management capability can be called regularly to cluster and optimize them to reduce the number of root files. It can also be understood that the determination of the file storage location can also be controlled by the space management capability, and the embodiments of this application do not make specific limitations.
[0176] In some embodiments, the file permissions can be used to record the usage permissions for creating the file, which can include access permissions, playback permissions, editing permissions, and sharing permissions. Each permission can be further refined according to the folder type, application type, and file type to which it belongs, and this embodiment of the application does not specifically limit this.
[0177] Therefore, the creation of service management files and setting the owner information of the files can avoid the generation of files of unknown origin on electronic devices. The standardization of file storage locations can avoid confusion in the stored file directories. The restriction of file usage permissions can solve problems such as excessive permissions when processing files, thereby realizing standardized, unified and convenient management and control of files.
[0178] Use of files
[0179] The service can manage the use of files to control the usage permissions of the first media file; or, based on the usage method corresponding to the parameters passed by the first application, determine whether the first application meets the usage permissions of the first media file and return the usage result. The usage permissions include one or more of the following: access permissions, playback permissions, editing permissions, sharing permissions, etc.
[0180] The use of files is illustrated by taking the example of the first application, the second application and the third application with different permissions accessing the file respectively after the second application creates the file, with reference to Figures 11A-11D, which are a set of user interface diagrams provided in an embodiment of the present application.
[0181] Figure 11A exemplarily shows a user interface 10 displayed by the electronic device 100 when running a second application. The second application is an application that can call a photo-taking function, such as a camera, a beauty camera, WeChat, Taobao, etc. The user interface 10 can be a preview page for the photo taken by the second application. After the second application takes a photo, the taken photo can be previewed so that the user can determine whether to save the currently taken photo. The user clicks the save photo option 101, and the save photo option 101 can start the file creation function to complete the creation of the photo. At this time, the successfully created photo can be set to have access rights for the second application and system applications, and other third-party applications do not have access rights.
[0182] Figure 11B exemplarily shows the user interface 20 displayed by the second application after completing the photo creation function. The picture access option 102 in the user interface 10 is a thumbnail of the created photo. The user can click on the picture access option 102, and the OS can start the file access function so that the user can access the currently taken photo.
[0183] Figure 11C illustrates an exemplary user interface 30 displayed when the electronic device 100 is running a first application, which may be a photo gallery application. User interface 100 may be a preview page for the first application. The preview page of the first application may be used to display photos created by various photo-taking applications, such as photo 103 created by a second application. A user may click on photo 103 to launch a file access function to access the photo created by the second application.
[0184] FIG11D exemplarily illustrates a user interface 40 displayed when the electronic device 100 is running a third application. The third application can be a third application. The user interface 10 can be used to call a preview page of the gallery for the third-party application. Since the third-party application does not have permission to access the photos 103 created by the second application, when the third-party application calls the preview page of the gallery, the photos that the third-party application can access do not exist in FIG11C .
[0185] It is understandable that the first operating system can determine the usage permissions of the file by using capabilities when creating the file, so that other applications can subsequently control the file when accessing, playing, editing, sharing, etc. The usage permissions may include access permissions, playback permissions, editing permissions, and sharing permissions. Please refer to Figure 12, which is a schematic diagram of a usage permission refinement provided by an embodiment of the present application. As shown in Figure 12, each different usage permission can be refined into different types of permissions according to the folder type, application type, file type, or application scenario to which it belongs. For example, sharing permissions can be shared for different application types, and playback permissions can include high-resolution playback, low-resolution playback, and so on. For another example, access permissions can be accessed for different application scenarios.
[0186] It should also be noted that the usage capability can also determine whether the first application satisfies the usage permission of the first media file based on the usage method corresponding to the parameters passed in by the first application, and return the corresponding usage result. After the first application starts the first function for the first media file, if the usage capability determines that the usage method corresponding to the passed parameters satisfies the first application's usage permission for the first media file, the electronic device can complete the first function; if the usage capability determines that the usage method corresponding to the passed parameters does not satisfy the first application's usage permission for the first media file, the electronic device can return a result of failure to start the first function; or the electronic device can apply to the second application for the usage permission of the first application to complete the first function. It can be understood that the usage method can be accessed in the form of thumbnails, previews, large images, or other forms. For example: the usage method corresponding to the parameters passed in by the first application is to access the first media file created by the second application in the form of large images, but the first application can only access the first media file in the form of previews.
[0187] In other embodiments, the usage capability can also set corresponding usage permissions for applications. For example, a file management application can have access permissions to all files, while a third-party application can only have access permissions to some files. For example, a third-party application can only have access permissions to pictures in the gallery, but not to audio files.
[0188] Therefore, even though applications on current electronic devices can access the internal card, they cannot arbitrarily create or modify files on the card. For example, a file created by one application cannot be arbitrarily accessed, modified, or shared by another application that does not meet the required permissions. By managing the permissions of each application, electronic devices can improve file usage efficiency. Through the management of permissions, types, and results, file management can be standardized, unified, and convenient.
[0189] In addition, the usage capability can also support file searches in electronic devices, such as quick queries and searches based on existing parameters such as file owner, file name, file time, file location, and main file content, etc., and the embodiments of this application do not make specific limitations on this.
[0190] Storage for files
[0191] The storage service may store the first media file in a corresponding storage location according to the parameters passed in by the first application and return the storage result; or, back up or migrate the first media file, thereby supporting end-to-end collaboration and end-cloud collaboration.
[0192] It is understandable that when creating a file, after the space management service determines the storage location of the first media file, the storage service may store the first media file according to the storage path corresponding to the storage location.
[0193] In addition, please refer to Figure 13, which is a schematic diagram of the capabilities supported by a storage service provided in an embodiment of the present application. As shown in Figure 13, the storage service mainly supports backup, migration, end-to-end collaboration, and end-to-cloud collaboration, including files. The storage service provides a unified registration capability for backup and migration, that is, only files created by applications registered with the storage service can be backed up or migrated. Other applications cannot be backed up or migrated.
[0194] Accordingly, in the use of backup and migration, the application can decide which files can be backed up or migrated, making the electronic device's file management more refined. It can be based on file type or folder, and the specifications can be customized.
[0195] For example, in a multi-terminal joint scenario, the storage of the current device (including local devices and distributed devices), cloud server storage, home storage (storage hard disk), etc. can be jointly operated to ensure the full and coordinated use of storage space. In general, the storage parameters of the file can be used to determine whether the file is stored on its corresponding device. The storage parameters may include file storage location, file storage size, file name, file storage path, etc. If the value on the device corresponding to the file storage location is not -1, it indicates that the file is stored on the device.
[0196] Furthermore, since any application can request memory permissions to create files at will, a large amount of junk files will be stored on electronic devices, and users will not be able to identify the source or the owner of the files. Moreover, it will cause confusion in the file storage directory, and users will often find various image files of unknown origin in the gallery.
[0197] In contrast, the OS in the embodiment of the present application can provide a unified file creation capability so that the files created by each application conform to unified specifications and are easy to manage.
[0198] The demise of files
[0199] The destruction service capability can delete the first media file or restore the first media file based on the parameters passed in by the first application. For example, the destruction service capability can completely delete the first media file based on the parameters passed in by the first application, but this method cannot restore the deleted file; it can also delete the first media file in a recoverable manner based on the parameters passed in by the first application, but this method can restore the deleted file; it can also completely delete the first media file based on the parameters passed in by the first application, but this method can back up and copy the file for all applications and also delete the file at the same time. For example, if picture A is deleted from the gallery, picture A in the WeChat chat history will also be deleted.
[0200] It should be noted that in other embodiments, the application may also set parameters related to the deletion method of the file when creating the file. For example, when the application calls the file creation function, the indication information of the first media file may pass parameters such as the deletion method supported for the file, or the first operating system may confirm the deletion method supported by the file. For example, if the deletion method of the file is set to support recoverable deletion when the create file function is called, then the file can be deleted recoverably when the delete file function is called, etc. If the deletion method of the file is set to not support recoverable deletion when the create file function is called, then the file cannot be deleted recoverably when the delete file function is called, etc.
[0201] In some embodiments, if the file is deleted in a recoverable deletion manner, when the application calls the file recovery function, the file indication information can pass one or more of the following parameters: file name, file owner, recoverable file size, recoverable content, etc. Among them, the recoverable file size refers to the size that can be recovered after the file is deleted, and can also be used as a basis for complete recovery. It is understandable that if the file is damaged during the deletion process, the recoverable file size will be smaller than the size of the original file, which means that only part of the file can be recovered. The recoverable content refers to the content of the file cache, which is the content restored to the real file.
[0202] In addition, it can be understood that, depending on the type of deleted files, it can be divided into active deletion and passive deletion. Please refer to Figure 14, which is a schematic diagram of the recovery process corresponding to different deletion methods provided in an embodiment of the present application.
[0203] As shown in Figure 14, the extinction service can be divided into active deletion and passive deletion. Active deletion refers to the behavior of deleting files initiated by the user, such as deleting a photo in the gallery that you are not satisfied with. Passive deletion is mainly due to some system behaviors, but it may also be some erroneous operations, such as duplication of files based on the concept of space management; illegal deletion during file clustering optimization; abnormal deletion of files due to being empty, etc. This embodiment of the application does not impose specific restrictions on this.
[0204] In response to different deletion methods, the extinction service can provide different recovery methods. Specifically, a recycle bin application or system can call the recovery service and perform recovery according to the capabilities provided by the recovery service. This can proactively recover specific deleted files, or restore all files cached in the current recovery service (a one-click recovery). Partial recovery can also be performed based on the file owner information of the deleted files, per application (application-level recovery), and so on. The embodiments of this application do not specifically limit the deletion and recovery methods.
[0205] Space management for files
[0206] The space management capability can perform one or more of the following: managing the storage space of the first media file; setting the storage location of the first media file in the storage space; and deduplicating or compressing the files stored in the storage space when the free storage space in the storage space is less than a preset threshold.
[0207] Among them, the storage space of the file may include at least one of the following spaces: local storage space (such as local device storage and distributed device storage, etc.), cloud storage space (such as cloud server storage, etc.), and peripheral storage space (such as storage hard disk, etc.).
[0208] Space management capabilities can store files in corresponding storage spaces according to storage priority based on different storage priority rules. Regarding file access efficiency priority classification, local storage space is superior to peripheral storage space, which is superior to cloud storage space. Regarding storage space usage requirements, cloud storage space is superior to peripheral storage space, which is superior to local storage space. Therefore, the embodiments of this application do not impose specific restrictions on the specific division of storage space storage priorities.
[0209] As you can understand, files can be divided into hot and cold data. Files with usage frequencies exceeding a preset threshold are considered hot data, while files with usage frequencies below the preset threshold are considered cold data. Hot data prioritizes access efficiency and should be stored locally, while cold data prioritizes space usage and should be stored in the cloud.
[0210] In addition, in some other embodiments, the space management capability can further dedupe or compress files stored in the storage space when the free storage space in the storage space is less than a preset threshold. Dedupe refers to removing duplicate files, and compression refers to compressing files.
[0211] For example, if an electronic device contains two identical files, for example, File 1 and multiple copies of File 1, then when the remaining free storage space in the storage space is less than a preset threshold, the multiple copies can be deleted, leaving only the single file. For another example, if File 1 already exists on the electronic device, the space management capability can control applications to avoid duplicate creation of File 1 and allow them to directly use the currently saved File 1, thereby ensuring efficient use of storage space.
[0212] For example, there may be many similar blocks or frames in both pictures and videos in a media file. In this regard, the space management capability can compress the existing pictures or videos to reduce the overall file size in the electronic device.
[0213] For example, please refer to Figure 15, which is a compression diagram provided by an embodiment of the present application. As shown in Figure 15, within a video file, there are two adjacent, similar image frames, namely, frame N and frame N+1. The two frames are divided into four parts. The identical parts, M2, M3, and M4, can be reused, while the different parts, M1, cannot be reused. Therefore, for the two frames above, the reused parts can have six small parts, and the different parts have two parts. Instead of occupying eight small parts, only eight parts are now required. Currently, this only applies to two frames. If the number of frames increases, the shared parts may become smaller. Therefore, a dynamic parameter value A can be set. This value refers to the number of frames compressed together. For example, if this value is 5, all five frames are compressed together. A dynamic parameter B can also be set. The value B represents the number of blocks each frame is divided into. For example, if B = 20, the current frame is divided into 20 identical blocks. A larger value indicates a finer division, resulting in better compression.
[0214] Therefore, it can be understood that the above-mentioned video compression method can be understood as taking advantage of the existence of similar data between adjacent multi-frame images, so that the multi-frame images can be unified to reduce the storage space of the video. In some embodiments, the space management capability can also compress each frame of the video, thereby reducing the overall storage space of the video. Exemplarily, the space management capability can directly perform intra-frame compression on each frame of the video, that is, the information of the pixels in each compressed frame can be obtained by interpolating the information of adjacent pixels. Therefore, when compressing the image, only the information of some pixels is retained to obtain a compressed image, thereby reducing the overall storage space size of the video.
[0215] In other embodiments, in order to ensure the playback quality of the video, different compression methods can be performed on different areas of each frame image in the video, wherein, for the video, each frame image can be divided into key areas and non-key areas, wherein the key areas can be the areas of the picture that the user pays more attention to, such as people, dynamic objects, etc. Non-key areas can be the areas of the picture that the user does not pay much attention to, such as: background, static objects, etc. The spatial management capability can perform different compression methods on the non-key areas and key areas of each frame, for example: using intra-frame compression or residual compression to compress non-key areas, using conventional inter-frame compression to compress key areas, and so on.
[0216] Therefore, it should be noted that the space management capability in the embodiment of the present application does not make any specific restrictions on the compression method of files such as pictures or videos. The space management capability can adaptively select different compression methods based on the size of the remaining storage space, the compression methods supported by the electronic device, the usage method of the file or the type of compressed file, so as to ensure more rational use of the storage space without affecting user use.
[0217] It is also understood that the compression triggering mechanism in the space management service can also be dynamic, which can not only provide users with an optimal experience but also fully utilize the device's storage space. For example, compression can be performed when a storage application calls the space management function, or when the free storage space in the storage space is less than a preset threshold, to ensure the rational use of storage space. This embodiment of the present application does not impose specific limitations on this.
[0218] The following is an illustrative introduction to the process of the file management method provided in an embodiment of the present application based on the various functional modules in the software structure diagram shown in Figure 2 or Figure 3 and the implementation of the above-mentioned file management. Please refer to Figures 16 to 20. Figure 16 is a flow chart of a file management method provided in an embodiment of the present application, Figure 17 is a user interface diagram provided in an embodiment of the present application, Figure 18 is an interface call relationship diagram when starting a file access function provided in an embodiment of the present application, and Figures 19 and 20 are another set of user interface diagrams provided in an embodiment of the present application.
[0219] As shown in FIG16 , the data management method mainly involves the following steps:
[0220] S101. The electronic device runs a first application on a first operating system and displays a first user interface of the first application.
[0221] Specifically, the electronic device runs a first operating system, a first application is installed on the first operating system, and the first operating system provides: a first interface, a media data interface, and a second capability. The first application displays a first user interface that presents a first option corresponding to the first function.
[0222] The first application may be a third-party application, a system application, a self-developed application, etc. The first application includes program code for calling a first interface, and the first interface is used to start a first function provided by the first application. For example, the first application may be a camera application, a gallery application, a music application, a video application, a file manager application, etc.
[0223] The first function may refer to a generation function, a usage function, a storage function, a deletion function, a space management function, and the like. For example, if the first function is a generation function, the user interface of the first application may be a photo saving interface, the first option may be a save photo option, the first media file may include a picture, and the first function may include storing the picture. In some embodiments, the first function also includes at least one of the following functions: a file creation function, a file playback function, a file deletion function, a file recovery function, a file backup function, a file migration function, a file sharing function, and a file space management function.
[0224] The first interface can be used to start the first function provided by the first application, and the first interface can be used to call the media data interface. In the embodiment of the present application, the first operating system can provide multiple first interfaces, and different first interfaces can be used to start different functions.
[0225] The media data interface is used to invoke a second capability, which includes the ability to perform one or more of the following operations on a media file: managing the creation of the first media file, managing the use of the first media file, storing the first media file, managing the deletion and restoration of the first media file, and managing the storage space for the first media file. First media files may include one or more of the following types: text, images, video, audio, etc. For details about the first operating system, please refer to the description of the relevant content in the above embodiment.
[0226] As shown in FIG. 17 , the first application may be a memo, the first function may include a file access function, and the first user interface of the first application may include an option 201 for the file access function.
[0227] The first interface may be the AMS interface mentioned in Figure 18. The media data interface may be the photo picker mentioned in Figure 18.
[0228] In addition, the first interface may also be one or more of the camera function interface, editing function interface, storage function interface, sharing function interface, file management function interface, and playback function interface mentioned in the above embodiment. The media data interface may also be the MediaDataKit interface mentioned in the above embodiment.
[0229] S102. In response to a first user operation on a first option, the electronic device starts a file access function and displays a second user interface.
[0230] Specifically, the first user operation on the first option can be used to trigger the launch of the first function, namely the file access function, and display the second user interface. As shown in Figure 19, after the user clicks option 201 for the file access function in the first user interface shown in Figure 17, such as clicking a picture selected from the gallery, the file access function can be launched and the second user interface shown in Figure 19 can be displayed. The second user interface can include one or more media files.
[0231] In addition, the first user operation may be a touch operation on the touch screen, or may be a user's voice command, etc. The embodiment of the present application does not limit the form of the operation.
[0232] It can be understood that, as shown in Figure 18 above, after receiving the first user operation for the first option, the AMS interface (i.e., the first interface mentioned above) can be called in response to the first user operation for the first option, and the AMS interface can further call the photo picker to start the file access function.
[0233] Parameters that may be passed in when calling the AMS interface include one or more of the following: a device name, an application name of the first application, and parameters passed in by the first application. The parameters passed in by the first application include parameters indicating the first function and parameter content. The parameter content includes one or more of the following: description information of the first function, the first media file, and information indicating the first media file. For details about the passed in parameters, please refer to the description of the relevant content in the above embodiment.
[0234] Among them, the photo picker (Photo Picker), that is, the media data interface can be encapsulated with a third capability, and the third capability includes the ability to perform one or more of the following processing on the first media file: acquisition, encoding, storage, sharing, decoding and playback. The parameters passed in when calling the photo picker (Photo Picker) may include: interface indication information, indication information of the first function, and indication information of the first media file or the first media file; the interface indication information is used to indicate the capability called by the media data interface in the third capability, the indication information of the first media file is all or part of the parameters passed in by the first application, and / or the indication information of the first media file is determined by the first operating system.
[0235] It can also be understood that in addition to starting a function by operating on an option, the electronic device 100 can start a function based on the user's voice command or by operating on a physical button when the screen is not displayed or the option is not displayed in the first user interface of the first application. For example, when the electronic device 100 is not displaying a screen, the electronic device 100 can detect the user's voice command "take a photo" and start the photo creation function of the camera application, wherein the photo creation function can be used to perform storage of the photo stream. For another example: when the first user interface of the first application does not display an option, the first application can identify the file access function for the photo taken at 5 o'clock today based on the information entered by the user on the first user interface, and the first application can directly call the AMS interface to start the access function for accessing the photo.
[0236] S103: The electronic device detects a second user operation of selecting a first media file from one or more media files, and returns a resource identifier of the first media file to the first application via the media data interface.
[0237] Specifically, the electronic device detects a second user operation of selecting a first media file from one or more media files, and can return a resource identifier of the first media file to the first application through the media data interface. As shown in FIG18 above, after the electronic device 100 starts the file access function (i.e., the first function), the electronic device 100 calls the AMS interface (i.e., the first interface) through the first application, and then calls the photo picker (i.e., the media data interface) through the AMS interface, and then calls the third capability through the media data interface to obtain the resource identifier of the first media file and return it to the first application, wherein the resource identifier can be a uniform resource identifier (URI) for determining the location of the first media file. In addition, the resource identifier can also be used to indicate the storage location of the first media file, etc.
[0238] The parameters passed in by the photo picker may include one or more of the following: interface indication information, indication information of the first function, and indication information of the first media file or the first media file. The indication information of the first media file may include: some or all parameters passed in by the first application, and / or parameters determined by the first operating system. The interface indication information can be used to indicate the capability of the media data interface to be called in the third capability, and the interface indication information can be determined based on the first function.
[0239] In other embodiments, before returning the resource identifier of the first media file through the media data interface, it is also necessary to grant the first application temporary access rights to complete the file access function for the first media file, that is, when the first application opens access rights in the first media file tail box, it is necessary to authorize the first application to access the first media file through the media data interface. The authorization can be performed by the media data interface, i.e., the photo picker, or by the first interface, i.e., the AMS interface, and this is not specifically limited in the embodiments of the present application.
[0240] It should be noted that granting the first application temporary access rights to complete the file access function for the first media file may mean returning a resource identifier with temporary permissions to the first application so that the first application can access the first media file based on the resource identifier with temporary permissions. The embodiment of the present application does not specifically limit the form of authorization.
[0241] It is understood that the media data interface can temporarily authorize the first application to access the first media file after the user or the application that created the first media file has authorized it. It is also understood that the first application that has obtained the temporary access permission can only access the first media file within the validity period or the number of times the temporary authorization is valid, and cannot access the first media file after the temporary access permission expires.
[0242] S104. The electronic device accesses the first media file based on the resource identifier through the first application.
[0243] Specifically, a first application in the electronic device can access the first media file based on the resource identifier. As shown in Figure 20, after the user selects the first media file from the one or more media files, the first application can access and obtain the first media file based on the returned resource identifier, and can also display it on the user interface of the first application.
[0244] For another example, a first application in the electronic device may access the first media file based on a resource identifier with a temporary permission.
[0245] In some embodiments, if the first application has access rights to the first media file, or has obtained temporary access rights to the first media file, the first media file is returned to the first application via the media data interface. Specifically, the media data interface can directly determine the first media file that the first application wants to access based on the input parameters, and if the first application satisfies the access rights to the first media file, the first media file can be directly returned to the first application via the media data interface, without requiring the first application to access the first media file based on a resource identifier.
[0246] In other embodiments, when the first application does not obtain access rights or temporary access rights to the first media file, a result indicating a failure to start the file access function is returned to the first application via the media data interface. Exemplarily, the first media file may be a media file created by a second application, and the second application has not granted permission to use the first media file. The method further includes: returning a result indicating a failure to start the first function to the first application; or, querying the second application to obtain permission for the first application to complete the first function for the first media file. After starting the first function, the electronic device may determine whether the first function can be started for the first media file based on the permission of the first application. If the first function cannot be started for the first media file, a result indicating a failure to start the first function is returned to the first application; or, querying the second application to obtain temporary access rights for the first application to complete the file access function for the first media file, so that the first electronic device can uniformly manage the entire file system. The second application may be an application on the first electronic device or the second electronic device. It is understandable that the second application may be a device that is connected to the first application for communication, or a device that is logged into the same user electronic account.
[0247] In some embodiments, files with the same file owner in the first electronic device are stored sequentially in the same root folder. It can be seen that in this method, the electronic device provides the ability to uniformly process files of various applications through a unified data management framework, thereby achieving unified management of files of various applications by the electronic device and solving the problem of chaotic file storage directories.
[0248] It should be understood that the specific content and beneficial effects of the file management method provided in the embodiment of the present application can also be referred to the relevant description of the above embodiment, and will not be repeated here.
[0249] Next, the hardware structure of the electronic device involved in the embodiment of the present application is introduced below. Please refer to Figure 21, which is a schematic diagram of the structure of the electronic device provided in the embodiment of the present application.
[0250] 21 shows a schematic diagram of the hardware structure of the electronic device 100. The electronic device 100 may be the electronic device mentioned above, the first electronic device or the second electronic device.
[0251] The electronic device 100 may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, an in-vehicle device, a smart home device, and / or a smart city device. The embodiments of the present application do not impose any particular restrictions on the specific type of the electronic device.
[0252] As shown in FIG21 , the electronic device may include a processor 110 , an external memory interface 120 , an internal memory 121 , a microphone 170C, a camera 193 , a display screen 194 , and the like.
[0253] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0254] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0255] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0256] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0257] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0258] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD). The display panel can also be made of an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniLED, a microLED, a micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device can include one or N display screens 194, where N is a positive integer greater than one.
[0259] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.
[0260] The ISP processes data fed back by camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then passed to the ISP for processing and converted into a visible image. The ISP can also perform algorithmic optimization on image noise and brightness. It can also optimize parameters such as exposure and color temperature of the captured scene. In some embodiments, the ISP can be located within camera 193.
[0261] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0262] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0263] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. This allows electronic device 100 to play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.
[0264] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transfer function between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU can enable intelligent cognitive applications in electronic device 100, such as image recognition, face recognition, speech recognition, and text comprehension.
[0265] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
[0266] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.; non-volatile memory may include disk storage devices and flash memory.
[0267] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage cell potential level; universal flash storage (UFS) and embedded multi media card (eMMC) can be divided into according to the storage specification.
[0268] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.
[0269] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .
[0270] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 via the external memory interface 120 to implement data storage. For example, files such as music and videos can be stored in the external non-volatile memory.
[0271] Microphone 170C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 170C to input the sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the source of sound, realize directional recording function, etc.
[0272] In the embodiment of the present application, the internal memory 121 is used to store a computer program that implements the shooting method provided in the embodiment of the present application, and the processor 110 is used to execute the computer program to implement the shooting method provided in the embodiment of the present application. For example, the processor 110 can sequentially generate a basic quality map and a full quality map in a segmented shooting process, and can also be used to manage the input and output data streams of the pipeline.
[0273] It should be understood that each step in the above method embodiment can be completed by hardware integrated logic circuits in a processor or by software instructions. The method steps disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.
[0274] The present application also provides an electronic device, wherein a first operating system is running on the first electronic device, a first application is installed on the first operating system, and the first operating system provides: a first interface, a media data interface, and a second capability; the first application includes a program code for calling the first interface, the first interface is used to start a first function provided by the first application, the first interface is used to call the media data interface, and the media data interface is used to call the second capability, the second capability includes the ability to perform one or more of the following processing on media files: managing the creation of media files, managing the use of media files, storing media files, managing the deletion and recovery of media files, and managing the storage space of media files. The electronic device includes: a memory, a processor, and a computer program stored in the memory, and the processor executes the computer program to implement the method performed by the electronic device in any of the above embodiments.
[0275] An embodiment of the present application also provides a computer-readable storage medium, wherein a computer program includes a first operating system, a first application is installed on the first operating system, and the first operating system provides: a first interface, a media data interface, and a second capability; the first application includes program code for calling the first interface, the first interface is used to start a first function provided by the first application, the first interface is used to call the media data interface, and the media data interface is used to call the second capability, the second capability including the ability to perform one or more of the following processing on media files: managing the creation of media files, managing the use of media files, storing media files, managing the deletion and recovery of media files, and managing the storage space of media files; when the computer program is executed by a processor, it implements the method in any of the aforementioned embodiments.
[0276] An embodiment of the present application also provides a computer program product, which includes a computer program, the computer program including a first operating system, a first application installed on the first operating system, and the first operating system providing: a first interface, a media data interface, and a second capability; the first application includes program code for calling the first interface, the first interface is used to start a first function provided by the first application, the first interface is used to call the media data interface, and the media data interface is used to call the second capability, the second capability including the ability to perform one or more of the following processing on media files: managing the creation of media files, managing the use of media files, storing media files, managing the deletion and recovery of media files, and managing the storage space of media files; when the computer program is executed by a processor, it implements the method in any of the aforementioned embodiments.
[0277] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0278] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the above-mentioned units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0279] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0280] In addition, the functional units in the embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0281] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc., specifically a processor in a computer device) to execute all or part of the steps of the above-mentioned methods of each embodiment of the present application. Among them, the aforementioned storage medium may include: U disk, mobile hard disk, magnetic disk, optical disk, read-only memory (Read-Only Memory, abbreviated: ROM) or random access memory (Random Access Memory, abbreviated: RAM) and other media that can store program codes.
[0282] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A file management method, characterized in that, The method is applied to a first electronic device on which a first operating system runs. A first application is installed on the first operating system, and the first operating system provides: a first interface, a media data interface, and a second capability. The first application includes program code for invoking the first interface. The first interface is used to start a first function provided by the first application, the first interface is used to invoke the media data interface, and the media data interface is used to invoke the second capability. The second capability includes the ability to perform one or more of the following processes on the media file: managing the creation of the media file, managing the use of the media file, storing the media file, managing the deletion and recovery of the media file, and managing the storage space of the media file. The method includes: Running a first application on the first operating system and displaying a first user interface of the first application, where the first user interface presents a first option corresponding to the first function. The first function includes a file access function. In response to a first user operation on the first option, starting the file access function and displaying a second user interface, where the second user interface includes one or more media files. Detecting a second user operation of selecting a first media file from the one or more media files, and returning a resource identifier of the first media file to the first application through the media data interface. Accessing the first media file by the first application based on the resource identifier.
2. The method according to claim 1, characterized in that, Before returning the resource identifier of the first media file through the media data interface, it further includes: Granting the first application temporary access permission to complete the file access function for the first media file.
3. The method according to claim 1, characterized in that, The method further includes: When the first application has access permission to the first media file or obtains temporary access permission to the first media file, returning the first media file to the first application through the media data interface.
4. The method according to claim 2 or 3, characterized in that, The method further includes: When the first application does not obtain access permission or temporary access permission to the first media file, returning a result indicating that the file access function fails to start to the first application through the media data interface.
5. The method according to any one of claims 1-4, characterized in that, The parameters passed into the first interface include one or more of the following: device name, application name of the first application, and parameters passed into the first application. Among them, the parameters passed into the first application include a parameter indicating the first function and parameter content. The parameter content includes one or more of the following: description information of the first function, the first media file, and indication information of the first media file.
6. The method according to claim 5, characterized in that, The media data interface encapsulates a third capability, which includes the ability to perform one or more of the following processes on the first media file: acquisition, encoding, storage, sharing, decoding, and playing. The parameters passed into the media data interface include: interface indication information, indication information of the first function, and the first media file or indication information of the first media file. The interface indication information is used to indicate the capabilities invoked by the media data interface in the third capabilities. The indication information of the first media file is all or part of the parameters passed in by the first application, and / or the indication information of the first media file is determined by the first operating system.
7. The method according to any one of claims 1 to 6, characterized in that, The first function further includes at least one of the following functions: file creation function, file playback function, file deletion function, file recovery function, file backup function, file migration function, file sharing function, and file space management function.
8. The method according to any one of claims 5-7, wherein The first function includes a file creation function. The first media file is a data stream. The indication information of the first media file includes one or more of the following: file name, file owner, file usage permission, file storage path, file size, and file type. The interface indication information is used to indicate the storage capability for the first media file in the third capabilities. Or The first function includes the file access function. The first media file is a picture. The indication information of the first media file includes one or more of the following: file name, file owner, file storage path, picture access permission, and picture access method. The interface indication information is used to indicate the storage capability for the first media data in the third capabilities. Or The first function includes a file playback function. The first media file is audio or video. The indication information of the first media file includes one or more of the following: file name, file owner, file size, playback method, and playback duration. The interface indication information is used to indicate the playback capability for the first media data in the third capabilities. Or The first function includes a file deletion function. The indication information of the first media file includes one or more of the following: file name, file owner, file storage path, file size, and file deletion method. The interface indication information is used to indicate the storage capability for the first media file in the third capabilities. Or The first function includes a file recovery function. The indication information of the first media file includes one or more of the following: file name, file owner, recoverable file size, and recoverable content. The interface indication information is used to indicate the storage capability for the first media file in the third capabilities.
9. The method according to any one of claims 1-8, characterized in that, The second capability includes: service generation capability The service generation capability is used to create the first media file and set one or more of the following fields for the first media file when creating the first media file: file owner, file name, file storage path, file usage permission, or file attribute. The first media file is one of text, picture, audio, or video.
10. The method according to claim 9, wherein Files with the same file owner in the first electronic device are sequentially stored in the same root folder.
11. The method according to any one of claims 1-10, characterized in that, The second capability includes: service usage capability The usage service capability is used to control the usage permissions of the first media file; or, according to the usage method corresponding to the parameters passed in by the first application, determine whether the first application meets the usage permissions of the first media file and return a usage result, where the usage permissions include one or more of the following: access permission, playback permission, editing permission, sharing permission.
12. The method according to any one of claims 1 to 11, characterized in that The second capability includes: a demise service capability, The demise service capability is used to delete the first media file or restore the first media file according to the parameters passed in by the first application.
13. The method according to any one of claims 1-12, characterized in that, The second capability includes: a storage service capability, The storage service capability is used to store the first media file in a corresponding storage location according to the parameters passed in by the first application and return a storage result; or, perform backup or migration on the first media file.
14. The method according to any one of claims 1-13, characterized in that, The second capability includes: a space management capability, The space management capability is used to perform one or more of the following: manage the storage space of the first media file; set the storage location of the first media file in the storage space; when the free storage space in the storage space is less than a preset threshold, deduplicate or compress the files already stored in the storage space.
15. An electronic device, characterized in that, The first electronic device runs a first operating system, and a first application is installed on the first operating system. The first operating system provides: a first interface, a media data interface, and a second capability; the first application includes program code for invoking the first interface, the first interface is used to start the first function provided by the first application, the first interface is used to invoke the media data interface, the media data interface is used to invoke the second capability, and the second capability includes the ability to perform one or more of the following processes on the media file: manage the creation of the media file, manage the usage of the media file, store the media file, manage the deletion and restoration of the media file, manage the storage space of the media file; The electronic device includes: a memory, a processor, and a computer program stored on the memory, and the processor executes the computer program to implement the method according to any one of claims 1-14.
16. A computer-readable storage medium, characterized in that, A computer program is stored thereon, the computer program includes a first operating system, and a first application is installed on the first operating system. The first operating system provides: a first interface, a media data interface, and a second capability; the first application includes program code for invoking the first interface, the first interface is used to start the first function provided by the first application, the first interface is used to invoke the media data interface, the media data interface is used to invoke the second capability, and the second capability includes the ability to perform one or more of the following processes on the media file: manage the creation of the media file, manage the usage of the media file, store the media file, manage the deletion and restoration of the media file, manage the storage space of the media file; When the computer program is executed by the processor, it implements the method according to any one of claims 1-14.
17. A computer program product, characterized in that, The computer program product includes a computer program, the computer program includes a first operating system, a first application is installed on the first operating system, and the first operating system provides: a first interface, a media data interface, and a second capability; the first application includes program code for invoking the first interface, the first interface is used to start a first function provided by the first application, the first interface is used to invoke the media data interface, the media data interface is used to invoke the second capability, and the second capability includes the capability to perform one or more of the following processes on the media file: manage the creation of the media file, manage the use of the media file, store the media file, manage the deletion and recovery of the media file, and manage the storage space of the media file; When the computer program is executed by a processor, it implements the method according to any one of claims 1-14.
Citation Information
Patent Citations
File management method and related equipment
CN120295967A
Data synchronization method and device
CN114691631A
Media file management method and related device
CN116069731A
Data processing method and device, terminal equipment and medium
CN116305227A
Method for accelerating starting of application, and electronic device
WO2021083378A1