A file management method and related device
By introducing a unified media framework and media data interface into the operating system of electronic devices, the problems of unclear file sources and chaotic storage are solved, systematic and secure management of the file system is achieved, file access and search efficiency is improved, and user experience is enhanced.
Patent Information
- Application Number
- CN202510056194.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2024-01-10
- Filing Date
- 2024-06-07
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2044-06-07
AI Technical Summary
File management on current electronic devices is chaotic, file sources are unclear, creation permissions are too open, storage directories are disorganized, and the user experience is poor.
By introducing a unified media framework and media data interface into the operating system, the file processing flow is standardized, the concept of file owner is introduced, and the lifecycle of files is managed in a unified manner, including creation, use, storage, deletion and recovery, and permission management and storage optimization methods are adopted.
It achieves systematic and secure management of the file system, improves file access and search efficiency, standardizes file storage and use, and enhances user experience.
Smart Images

Figure CN120104563B_ABST
Abstract
Description
[0001] This application is a divisional application. The original application has the application number 202410743922.5 and the original application date is June 7, 2024. The entire contents of the original application are incorporated herein by reference. Technical Field
[0002] This application relates to the field of terminal technology, and in particular to a file management method and related equipment. Background Technology
[0003] With the continuous development of the terminal field, more and more applications are installed on electronic devices, and more and more files are generated and stored on electronic devices based on these applications. However, current electronic devices have no management over these files, allowing users and applications to place files at will. For example, with just the user's consent, access to the entire internal card can be obtained, and files can be created and modified arbitrarily on the internal card.
[0004] Although current electronic devices offer a range of system capabilities to manage file access—for example, gradually narrowing the entry point 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. Issues still exist such as applications arbitrarily accessing various media files, unclear media sources, 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 urgently needs to be solved. Summary of the Invention
[0006] This application provides a file management method and related equipment to systematically and securely manage the entire file system.
[0007] In a first aspect, embodiments of this application provide a file management method, characterized in that the method is applied to a first electronic device, the first electronic device running a first operating system, the first operating system having a first application installed, the first operating system providing: a first interface, a media data interface, and a second capability; the first application includes program code that calls the first interface, the first interface being used to start a first function provided by the first application, the first interface being used to call the media data interface, the media data interface being used to call the second capability, the second capability including the ability to perform one or more of the following processes 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 method comprising: 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 including a file access function; responding 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 that selects a first media file from the one or more media files, returning a resource identifier of the first media file to the first application through the media data interface; and accessing the first media file through the first application based on the resource identifier.
[0008] In this embodiment, the operating system of the electronic device can manage file production, solving problems such as unclear file sources and chaotic storage. It improves file usage efficiency by managing permissions, file types, and results, further enhancing the efficiency of file access and searching. It manages file storage, records file deletions, and provides a new deletion recovery mechanism, ensuring files are traceable. This allows the electronic device to systematically and securely manage the entire file system, improving user experience. Furthermore, for example, after the first application initiates access to the first media file, the media data interface can return the resource identifier of the first media file to the first application. The first application can then access the first media file based on this resource identifier. That is, when the first application initiates file access for the first media file, the first application cannot arbitrarily access the first media file without obtaining the resource identifier. The media data interface blocks the first application's direct access to the first media file, ensuring that any application accessing the first media file must go through the media data interface, avoiding chaotic file access and improving user experience.
[0009] In one 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 permissions to complete the file access function for the first media file.
[0010] In this embodiment of the application, the electronic device may ask the user or the application that created the first media file, and after the user agrees to the authorization, grant the first application temporary access to the first media file so that the first electronic device can perform unified management of the entire file system.
[0011] In one possible implementation, the method further includes: returning the first media file to the first application through the media data interface when the first application has access to the first media file or has obtained temporary access to the first media file.
[0012] In this embodiment, the media data interface can directly return the first media file to the first application if the first application satisfies the access permissions of the first media file, without requiring the first application to access the first media file based on the resource identifier, thus simplifying the access process and enabling the first electronic device to perform unified management of the entire file system.
[0013] In one possible implementation, the method further includes: if the first application does not obtain access permission or temporary access permission to the first media file, returning a result indicating that starting the file access function failed to the first application through the media data interface.
[0014] In this embodiment of the application, the electronic device can determine whether it can start the first function on the first file based on the permissions of the first application. If it cannot start the first function on the first file, it returns a result of failure to start the first function to the first application.
[0015] In one possible implementation, the parameters passed to the first interface include one or more of the following: device name, application name of the first application, and parameters passed to the first application. The parameters passed to 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 file, and indication information of the first file.
[0016] This application's embodiments standardize the input parameters of the interface, enabling multiple applications to achieve the same function through the same interface. For example, the system camera application and third-party camera applications can all call the function interface to implement the photo-taking function. Compared to different applications calling different interfaces, this solves the problem of interface confusion during application operation and reduces the development difficulty for developers.
[0017] In one possible implementation, 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 playback; the parameters passed to the media data interface include: interface indication information, indication information for the first function, and indication information for the first file; the interface indication information is used to indicate the capability invoked by the media data interface in the second capability, the indication information for the first file is all or part of the parameters passed to the first application, and / or, the indication information for the first file is determined by the first operating system.
[0018] In this embodiment, the media data interface is encapsulated with third capabilities, which can support calls to various functional interfaces and can also be used to manage underlying hardware and / or algorithms, making the file system more systematic and secure, enabling various applications to use it more efficiently, and improving the user experience.
[0019] In one possible implementation, the parameters passed by the third capability include: indication information of the first function, and the first file or indication information of the first file, wherein the indication information of the first file is all or part of the parameters passed by the first application, and / or the indication information of the first file is determined by the first operating system.
[0020] In this embodiment of the application, the instruction information of the file can be transmitted 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 one possible implementation, 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.
[0022] In this embodiment, file production can be controlled based on different functions, resolving issues such as unclear file sources and disorganized storage. File usage efficiency is improved through permission management, type management, and result management, further enhancing the efficiency of file access and searching.
[0023] In one possible implementation, the first function is a file creation function, the first file is a data stream, and the indication information of the first 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 interface for performing storage for the first file in the second capability. Alternatively, the first function is a file access function, the first file is an image, and the indication information of the first file includes one or more of the following: file name, file owner, file storage path, image access permissions, and image access method. The interface indication information is used to indicate the interface for performing storage for the first media data in the second capability. Alternatively, the first function is a file playback function, the first file is audio or video. The instruction information includes one or more of the following: file name, file owner, file size, playback mode, and playback duration. The interface instruction information is used to indicate the interface in the second capability that performs playback for the first media data; or, the first function is a file deletion function, and the instruction information for the first file includes one or more of the following: file name, file owner, file storage path, file size, and file deletion mode. The interface instruction information is used to indicate the interface in the second capability that performs storage for the first file; or, the first function is a file recovery function, and the instruction information for the first file includes one or more of the following: file name, file owner, recoverable file size, and recoverable content. The interface instruction information is used to indicate the interface in the second capability that performs storage for the first file.
[0024] In this application embodiment, an exemplary method is provided for launching file processing functions through partial functional interfaces, 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: a service generation 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, wherein the first file is one of text, image, audio or video.
[0026] In this embodiment, the electronic device can manage the creation of files, setting file owner information can prevent files from having unknown origins on the electronic device, standardizing file storage locations can prevent the storage file directory from being chaotic, and restricting file usage permissions can solve problems such as excessive permissions when processing files, thereby achieving standardized, unified, and convenient control over files to improve user experience.
[0027] In one possible implementation, files with the same owner in the first electronic device are stored sequentially in the same root folder.
[0028] In this embodiment, the electronic device provides the ability to process files from various applications in a unified manner through a unified data management framework, thereby realizing unified management of files from various applications and solving the problem of chaotic file storage directories.
[0029] In one possible implementation, the third capability includes: a service capability for managing the usage permissions of the first file; or, based on the usage method corresponding to the parameters passed by the first application, determining whether the first application meets the usage permissions of the first file and returning the usage result, wherein the usage permissions include one or more of the following: access permission, playback permission, editing permission, and sharing permission.
[0030] In this embodiment, the electronic device can manage the permissions of each application, thereby improving file usage efficiency. Furthermore, through permission management, type management, and result management, it achieves standardized, unified, and convenient control over files, thus enhancing the user experience.
[0031] In one possible implementation, the third capability includes a file deletion service capability, which is used to delete or restore the first file based on parameters passed from the first application. In this embodiment, the electronic device can manage the deletion of each file, making each file traceable and improving the user experience.
[0032] In one possible implementation, the third capability includes: a storage service capability, which is used to store the first file to a corresponding storage location according to the parameters passed by the first application and return the storage result; or, to back up or migrate the first file.
[0033] In this embodiment of the application, the electronic device can store files, thereby better realizing file processing and supporting end-to-end collaboration and end-to-cloud collaboration.
[0034] In one possible implementation, the third capability includes: a 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 already stored in the storage space when the free storage space in the storage space is less than a preset threshold.
[0035] In this embodiment, the storage space of the first file can be managed in a unified and standardized manner, improving the utilization efficiency of the storage space. For example, files can be stored in corresponding storage spaces according to different storage priority rules.
[0036] Secondly, embodiments of this application provide an electronic device on which a first operating system runs and a first application is installed. The first operating system provides: a first interface, a media data interface, and a second capability. The first application includes program code that calls 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 processes 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. The processor executes the computer program to implement the file management method provided in the first aspect.
[0037] Thirdly, embodiments of this application provide a computer-readable storage medium. The computer program includes a first operating system, on which a first application is installed. The first operating system provides: a first interface, a media data interface, and a second capability. The first application includes program code that calls 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 processes 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 a file management method provided in the first aspect.
[0038] Fourthly, embodiments of this application provide a computer program product, which includes a computer program, a first operating system, and a first application 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 that calls 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 processes 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 a file management method provided in the first aspect.
[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 first aspect above, and will not be repeated here. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of this application or the background art, the accompanying drawings used in the embodiments of this application or the background art will be described below.
[0041] Figure 1 A schematic diagram illustrating the difference between a method for accessing files in an application and the file management method provided in the embodiments of this application is shown.
[0042] Figure 2 This is a schematic diagram of the architecture of an OS provided in an embodiment of this application.
[0043] Figure 3 This is a schematic diagram of another OS architecture provided in an embodiment of this application.
[0044] Figure 4 This is a schematic diagram of the first application-specific function call interface provided in the embodiments of this application.
[0045] Figures 5-9 This is a schematic diagram illustrating the calling relationship of a set of first applications calling various functional interfaces, provided in an embodiment of this application.
[0046] Figure 10 This is a schematic diagram of a file owner provided in an embodiment of this application.
[0047] Figures 11A-11D These are a set of user interface diagrams provided in the embodiments of this application.
[0048] Figure 12 This is a schematic diagram illustrating the detailed usage permissions provided in an embodiment of this application.
[0049] Figure 13 This is a schematic diagram illustrating the storage service capabilities supported by an embodiment of this application.
[0050] Figure 14 This is a schematic diagram of the recovery process corresponding to different deletion methods provided in the embodiments of this application.
[0051] Figure 15 This is a compression diagram provided in an embodiment of this application.
[0052] Figure 16 This is a flowchart illustrating a file management method provided in an embodiment of this application.
[0053] Figure 17 This is a schematic diagram of a user interface provided in an embodiment of this application.
[0054] Figure 18 This is a schematic diagram of the interface call relationship when starting a file access function, as provided in an embodiment of this application.
[0055] Figure 19 and Figure 20 This is another set of user interface diagrams provided in the embodiments of this application.
[0056] Figure 21 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0057] The embodiments of this application will now be described with reference to the accompanying drawings.
[0058] The terms "first" and "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such processes, methods, products, or apparatus.
[0059] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0060] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0061] As used in this specification, the terms "component," "module," "system," etc., are used to refer to computer-related entities, hardware, firmware, combinations 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. As illustrated, applications running on computing devices and computing devices can both be components. One or more components may reside in a process and / or an execution thread, and components may be located on a single computer and / or distributed among two or more computers. Furthermore, these components can be executed from various computer-readable media on which various data structures are stored. 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 between 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)" used in the following embodiments of this application refers to the medium interface through which an application or operating system interacts and exchanges information with the user. It realizes the conversion between the internal form of information and the form that the user can accept. The user interface is source code written in a specific computer language such as Java or Extensible Markup Language (XML). The interface source code is parsed and rendered on the electronic device, ultimately presenting content that the user can recognize. A common form of user interface is the graphical user interface (GUI), which refers to a user interface related to computer operation displayed graphically. It can be visible interface elements such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and widgets displayed on the screen of an electronic device.
[0063] First, to facilitate understanding of the embodiments of this application, the following detailed analysis addresses the technical problems to be solved and the applicable application scenarios of the embodiments of this application.
[0064] File processing can be understood as the management of a file's entire lifecycle and the ability to persist file data. For a single file, the activities during its lifecycle include: file creation, file access and searching, file sharing, backup, migration, and file deletion, etc.
[0065] With the continuous development of the terminal field, more and more applications are installed on electronic devices, and the number of files generated and stored on these devices based on the applications or services themselves, or files generated and stored through user operations (such as images, audio, and video), is also increasing. Although current electronic devices provide a series of system capabilities to manage file access, such as gradually narrowing the entry point to the media library, providing system picker capabilities, and disabling the concept of absolute paths, current electronic devices still allow users and applications to handle files arbitrarily.
[0066] For example, while current electronic devices restrict applications' access to internal storage (i.e., the internal memory card mentioned in the following examples), various applications can obtain access to the entire internal memory card with the user's consent, freely accessing, creating, and modifying files under most applications on the internal memory card. Furthermore, each application requests file permissions on a per-internal-memory basis, and the requested permissions are entirely defined by the developer and cannot be controlled by the electronic device. For instance, an end user might not want certain third-party applications to access portrait images taken by the camera in the gallery, but currently, once the gallery grants permission to a third-party application, that application can access all images in the gallery, uncontrollable by the electronic device. Moreover, since these permissions are defined by the developers of the third-party applications, end users cannot truly determine whether an application should access certain files or what files it should access.
[0067] Furthermore, since any application can request memory permissions to create files at will, electronic devices accumulate a large number of junk files. The devices cannot detect the source of these files or identify their owners. This also leads to a chaotic file storage directory, allowing files created by one application to be freely accessed, modified, or shared by another. For example, users often find various image files of unknown origin in their photo library.
[0068] For example, regarding file access, please refer to the appendix. Figure 1 , Figure 1 A schematic diagram illustrating the difference between a method for accessing files in an application and the file management method provided in the embodiments of this application is shown. Figure 1 Figure (1) shows a current method for applications to access data, and provides a schematic diagram of the principle of application data access. Figure 1Figure (2) shows a schematic diagram of the data management method provided in the embodiments of this application, which is a schematic diagram of the principle of application access to data.
[0069] like Figure 1 Any of the applications A, B, and C shown in (1) can freely access one or more of the gallery, audio, or file manager on the electronic device according to the business requirements. For example, any application can access or save images or videos in the gallery. Another example is that any application can access or delete audio files on the electronic device, such as recordings or music. Yet another example is that any application can freely access documents in the file manager. In other words, for various applications, creating, using, sharing, or deleting files only requires initial authorization from the electronic device or user for the internal card, allowing them to process these operations freely.
[0070] In summary, after electronic devices grant permissions to various applications, these applications are essentially no longer under the control of the electronic devices when processing files. This results in problems such as unclear file creation sources, overly open file processing permissions, and chaotic file storage directories. This is not conducive to the systematic and secure management of the entire file system by electronic devices, and leads to a poor user experience.
[0071] In this regard, embodiments of this application provide a file management method and related equipment, wherein the file management method is implemented by the operating system (OS) of the electronic device.
[0072] An OS can combine one or more commands to underlying hardware and / or algorithms to build a new file processing solution on the basis of the current unified media framework. This enables full lifecycle management of files for each application, solving problems such as unclear file origins, overly open file creation permissions, and chaotic file storage directories in current electronic devices.
[0073] For example, such as Figure 1Any of the applications A, B, and C shown in (2) use the Unified Media Framework to process files in the gallery, audio, and file manager. For example, the application's user interface has corresponding file processing options, and the application can call the file processing function interface to start the file processing function. After detecting that the application has called the file processing function interface, the media data interface of the Unified Media Framework in the OS can start the file processing function or return the result of calling the file processing function interface. For example, the user interface of application A has an option to access files, and the application can call the file access function interface to start the file access function. After detecting that the application has called the file access function interface, the media data interface of the Unified Media Framework in the OS can start the file access function and complete the access to the file. That is, when any application in the embodiments of this application creates, uses, destroys, or manages media files in electronic devices, it does not need to issue commands to the underlying hardware and / or algorithms. 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 media data interface to return the file or response based on the command.
[0074] The media data interface can be seen as a unified abstraction of hardware and / or software capabilities, a high-level concept based on command abstraction throughout the entire file lifecycle. This allows electronic devices to process application files without using different interfaces for each application to command the underlying hardware and / or algorithms. Instead, they can directly manage files in a standardized, unified, and convenient manner through the media data interface. Furthermore, the OS can manage file creation, introducing the concept of a file owner to address issues such as unclear origins and disorganized storage. File usage efficiency is improved through permission management, type management, and result management, further enhancing access and search efficiency. File storage management, including sharing, backup, and migration, is enhanced through unified registration and end-to-cloud collaboration, improving file processing. File deletion is recorded, providing a new deletion recovery mechanism, ensuring file traceability. Storage space is managed to ensure rational space utilization. Specific implementation methods can be further described in the following embodiments, which will not be elaborated upon here.
[0075] The electronic device can be a portable terminal device running HarmonyOS, iOS, Android, Microsoft, or other operating systems, such as a mobile phone, tablet computer, or wearable device. It can also be a non-portable terminal device such as a laptop computer or desktop computer with a touch-sensitive surface or touch panel. The software system of the electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the layered architecture of HarmonyOS as an example to illustrate the software structure of the electronic device 100.
[0076] Please refer to the attached document. Figure 2 , Figure 2 This is a schematic diagram of the architecture of an OS provided in an embodiment of this application.
[0077] like Figure 2 As shown, a layered architecture divides software into several layers, each with a clear role and function. 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. Higher layers have more interaction with the user; lower layers represent more system capabilities. Figure 2 The OS shown is merely an example, and it may contain more or fewer modules. This application does not limit this.
[0078] The application layer can include a series of application packages, primarily used for the production and use of media files. For example: Figure 2 As shown, the media file can be a camera, gallery, recorder, file manager, or other applications. For example, the media file can be an image, video, audio, text, installation package, etc., and this embodiment does not specifically limit this.
[0079] Understandably, besides Figure 2 The application layer shown may also include more or fewer applications, such as various system applications, self-developed applications, third-party applications, etc., similar to other applications such as gallery applications, music applications, and video applications, as well as the first application or second application mentioned in the relevant embodiments below. This application embodiment does not limit these.
[0080] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications within the application layer. The application framework layer includes some predefined functions. The framework layer may also include modules such as a window manager, content provider, view system, phone manager, and resource manager, which will not be discussed in detail here.
[0081] like Figure 2 As shown, the unified media framework in the application framework layer can be referred to as a unified file framework, unified media file framework, file management framework, media file management framework, etc. This unified media framework may include a first interface for providing file processing functions to applications in the application layer; this first interface may also be called a first selector. Different first interfaces can be used to initiate different file processing functions. For example, the first interface may include, but is not limited to, the following interfaces: creation function interface, usage function interface, storage function interface, destruction function interface, space management function interface, and other related interfaces. This first interface can also be an AMS (Activity Manager Service) interface used for starting, switching, scheduling, and managing and scheduling application processes. These multiple different first interfaces can be called by various applications in the application layer to assist them in processing media files.
[0082] For example, a generation function interface can initiate file generation functionality, enabling applications to create media files, etc. Multiple different generation function interfaces can also be encapsulated; one interface can initiate a specific generation function, such as image generation, audio generation, video generation, etc. The generation function interface selects the appropriate interface from among these multiple interfaces based on the parameters passed in by the application.
[0083] The functional interface can be used to initiate file usage functions, that is, to enable applications to access, search, edit, or run media files. Different file usage functions require different input parameters.
[0084] The storage function interface can enable file storage functionality, that is, it supports applications in storing media files.
[0085] The file deletion function interface can initiate file deletion functionality, enabling applications to delete or restore media files. Accordingly, different file deletion types require different input parameters.
[0086] The space management function interface can activate the space management function, which supports applications in managing the space of media files, enabling electronic devices to use files efficiently.
[0087] It should be understood that the other functional interfaces mentioned above are similar to the descriptions of the functional interfaces, and will not be repeated here.
[0088] As can be seen, the application framework layer can provide a unified interface for multiple applications in the application layer to call, enabling these 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 function interface to implement the photo-taking function. Compared to different applications calling different interfaces, this solves the problem of interface confusion during application runtime.
[0089] In other embodiments, the interfaces providing file processing functions described above are merely exemplary descriptions; please refer to the appendix. Figure 3 , Figure 3 This is a schematic diagram of another OS architecture provided in an embodiment of this application. For example... Figure 3 As shown, more granular interfaces can also be provided to applications in the application layer for different file processing functions. For example, the first interface may also include, but is not limited to, the following interfaces: creation function interface, access function interface, sharing function interface, editing function interface, migration function interface, deletion function interface, recovery function interface, compression function interface, deduplication function interface, etc., and this application embodiment does not limit this.
[0090] Additionally, 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, also known as a media data picker. The media data interface can be used to implement file creation, use (e.g., editing, access, playback), storage, destruction (e.g., deletion and recovery), space management, and more. Furthermore, when used to implement the use of media files such as images, this media data interface can also be a photo picker, etc.
[0091] This media data interface encapsulates multiple third-party capabilities, including the ability to perform one or more of the following processes on media files: acquisition, encoding, storage, sharing, decoding, playback, and others. These third-party capabilities can also be referred to as basic capabilities, assisting the OS system in enabling unified processing of media files by allowing applications at the application layer to invoke underlying hardware and / or software capabilities when calling relevant upper-level file processing interfaces. Of course, in other implementations, providing file processing interfaces to the OS can also be made available to third-party applications.
[0092] This media data interface can support calls to various functional interfaces, including those for file generation, usage, storage, destruction, and space management. It can also be used to manage underlying hardware and / or algorithms, systematizing and securing the entire file system, enabling more efficient use by various applications and improving the user experience. Specifically, the aforementioned functional interfaces for generation, usage, storage, destruction, and space management can call the media data interface. In this case, the media data interface can select from multiple third-party capabilities to run the supporting functional interface based on the called interface. For example, capture, encoding, and storage can support the file generation function; encoding, transmission, decoding, playback, or storage can support the file usage function. This third-party capability can also be referred to as the fundamental capability supporting file processing.
[0093] For example, when electronic device 100 detects that a user accesses a picture through a gallery application, the gallery application can call the usage function interface, which in turn 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 access the saved picture.
[0094] It is understood that the application framework layer may include more or fewer functional modules, and this application embodiment does not limit this.
[0095] The service layer can be used to interface with media data interfaces, and it includes several secondary capabilities. These secondary capabilities include the ability to perform one or more of the following processes on media files: generation service capability, usage service capability, storage service capability, destruction service capability, space management service capability, or others.
[0096] The generation service can be used to manage the creation of media files and implement the business logic generated during the creation of media files. For example, taking the first media file as an example, the generation 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, where 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 business logic for using media files. For example, taking the use of a first media file by a first application, 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, it can 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 permission, playback permission, editing permission, sharing permission, etc.
[0098] Storage services can be used to store media files and implement the business logic of storing media files. For example, taking the storage of a first media file by a first application as an example, it can be used to store the first media file in the corresponding storage location according to the parameters passed by the first application and return the storage result; or, to back up or migrate the first media file.
[0099] The deletion service can be used to manage the deletion and recovery of media files, implementing the business logic for deleting or recovering media files. For example, taking the deletion or recovery of a first media file by a first application as an example, the deletion service can delete or recover 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, realizing the business logic of unified storage space management for media files. For example, taking the first application managing the storage space of the first media file as an example, the space management service can be 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; and 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.
[0101] In other embodiments, the multiple second capabilities of this service layer can also be set in the application framework layer, facilitating the media data interface to call them through a third capability. This application does not impose specific limitations on this aspect. In this way, each application in the application layer only needs to call the corresponding file processing function interface and transmit the input parameters to it, allowing the OS to start the corresponding file processing function for the application. This simplifies application operations and ensures the consistency of the file processing function's effect across different applications.
[0102] The kernel layer is the layer between hardware and software, and it is compatible with different hardware devices. Different electronic devices may use different models or types of processing chips, meaning there are differences in hardware. The kernel layer in this application embodiment can be used to support the processing of hardware, drivers, and algorithms. The kernel layer includes at least input / output I / O drivers, storage drivers, and low-level algorithm processing.
[0103] Through the various interface modules in the framework layer provided in this application, the aforementioned unified media file management can be achieved. For example, after an application calls the file processing function interface corresponding to the file processing function and inputs the corresponding parameters, it can run the media data interface in the framework layer. The media data interface selects from multiple third capabilities to run the third capability that supports the file processing function interface; the third capability then selects to run the second capability corresponding to the file processing function in the service layer. This provides unified management capabilities for the file lifecycle, offers corresponding interface capabilities according to user needs, and enables the processing of file generation, use, storage, and destruction, meeting user needs for file processing in different scenarios.
[0104] Based on the above Figure 2 The software architecture shown, taking the first application calling the first function as an example, illustrates the calling relationship of the interfaces at each layer.
[0105] The parameters passed through the first interface include one or more of the following: device name, application name of the first application, and parameters passed through the first application. The device name and application name of the first application can be determined by the first operating system. The parameters passed through the first application include parameters indicating the first function and parameter content. The parameters indicating the first function and parameter content are in key-value format, where the key represents the first function, and the parameter content can also be called parameter value or value. 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. The indication information of the first media file can be understood as the storage path of the first media file (i.e., indicating the storage location of the first media file), the file size of the first media file, the file name of the first media file, the method of accessing the first media file, etc. The first media file can be one of multiple media files in the electronic device.
[0106] Then, the first interface can continue to call the media data interface, the parameters passed to the media data interface including: 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 capability invoked by the media data interface in the third capability. This interface indication information and the indication information of the first media file are all or part of the parameters passed to 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 can continue to invoke a third capability, the parameters of which include: the indication information of the first function, and the first media file or the indication information of the first media file. It is understood that the indication information of the first media file can also be all or part of the parameters passed by the first application, and / or the indication information of the first media file can also be determined by the first operating system.
[0108] Finally, the third ability can invoke one or more second abilities to achieve the first function.
[0109] Please refer to the attached document. Figure 4 , Figure 4 This is a schematic diagram of the first application-specific function call interface provided in the embodiments of this application.
[0110] like Figure 4 As shown, the first application may refer to the above. Figure 2 or Figure 3 The application layer mentioned above includes camera apps, gallery apps, music apps, or video apps, etc. XXMode can refer to any of the above. Figure 2 or Figure 3 The first interface corresponding to any of the functions mentioned, such as the file management function interface (FileManageMode), the editing function (EditMode), the storage function (StorageMode), the sharing function (ShareMode), etc., MediaDataKit is the media data interface.
[0111] The user interface of the first application can present options corresponding to any function. After detecting user operation, a function can be triggered to start. The function can include one or more of the following processes: generation, use, storage, destruction, space management, etc., of a media file.
[0112] The XXMode interface takes the form XXMode(DeviceName, AppName, AppParameter, extend).
[0113] Device Name can be the device name of the device to which the first application calling this interface belongs.
[0114] The application name (AppName) can 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's operation. For example, if the user's operation is a file creation operation, the parameters passed by the first application may include file name, file owner, file permissions, file storage path, file size, file type, etc.
[0116] The extended field can be used to build pre-embedded capabilities or differentiated capabilities.
[0117] Understandably, the device name, application name, and extended fields are optional.
[0118] After the first application calls the XXMode interface, the XXMode interface can call MediaDataKit. The MediaDataKit interface is in the form of MediaDataKit(type, key, value, extend).
[0119] The type indicates the type of processing performed on the file. Types can include, but are not limited to, the following: normal, acquisition, code, storage, share, decode, play, and others. The type can be determined by the preceding interface to the MediaDataKit call. For example, if a camera application calls the FileManageMode interface, the electronic device can determine that it needs photo creation functionality and performs storage processing on the acquired photo stream; therefore, this is considered a storage type.
[0120] The function point indicator (key) indicates the function point to be activated. Each type can include multiple different function points; for example, for the capture type, there could be shooting, recording, and audio recording functions. The function point indicator (key) can be directly determined by the name of the previous interface in MediaDataKit or the AppParameter passed in MediaDataKit. For example, if the previous interface is FileManageMode, then the function point indicator (key) could be Create File Mode.
[0121] The required value for a function point indicates the data needed to implement that function. For example, for an image creation function, a picture flow is required. The required value can be obtained from the parameters (AppParameter) passed by the first application. If some values cannot be obtained from the parameters (AppParameter) passed by the first application, the operating system can automatically fill in those values. In other words, the required value for a function point can include some or all of the parameters (AppParameter) passed by the first application, and / or parameters determined by the operating system.
[0122] The indicator parameter (key) of a function point and the value required by the function point can form a key-value pair. That is, there is a correspondence between the indicator parameter (key) of a function point and the value required by the function point. One 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 can be used to build pre-embedded capabilities or differentiated capabilities.
[0124] Once the MediaDataKit interface is invoked, it can continue to call other capabilities provided by the framework layer based on the type. For example, if the type is encoding, the encoding capability can be invoked to encode the file; if the type is storage, the storage capability can be invoked to store the file; if the type is sharing, the sharing capability can be invoked to share the file; if the type is decoding, the decoding capability can be invoked to decode the file; and if the type is playback, the playback capability can be invoked to play the file. The parameters passed in the acquisition, encoding, storage, sharing, decoding, or playback capabilities can include: key, value, and extend.
[0125] During the invocation of any capability such as acquisition, encoding, storage, sharing, decoding, or playback, multiple capabilities such as creation service capability, usage service capability, storage service capability, destruction service capability, space management service capability, or others can also be invoked to achieve standardization and unification of media data. Specifically, the creation service capability can be used to manage the creation of the first media file; the usage service capability can be used to manage the use of the first media file; the storage service capability can be used to store the first media file; the destruction service capability can be used to manage the deletion and restoration of the first media file; and the space management service capability can be used to manage the storage space of the first media file. Specific methods can be found in the relevant descriptions of the embodiments below, which will not be elaborated upon here.
[0126] In some implementations, during the process of invoking any capability such as acquisition, encoding, storage, sharing, decoding, or playback, some capabilities among the capabilities of generating service capabilities, using service capabilities, storing service capabilities, destroying service capabilities, space management service capabilities, or others can be invoked, and the specifics can be determined by the application or the first operating system.
[0127] In some implementations, after the XX Mode interface is called, it can bypass MediaDataKit and directly call other framework layer interfaces under MediaDataKit to achieve 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, MediaDataKit can also be subdivided into multiple interfaces with more detailed functions, so that the XXMode interface can select the appropriate interface to call from these multiple interfaces.
[0129] After the framework layer interface is called, it will continue to call the service layer and kernel layer interfaces to implement the corresponding file processing functions.
[0130] Based on the calling relationships of the above interfaces, please refer to the appendix for an example. Figures 5-9 , Figures 5-9 This is a schematic diagram illustrating the calling relationship of a set of first applications calling various functional interfaces, provided in an embodiment of this application.
[0131] Take the function generated by the first application 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 ability to perform storage for the first media file in the third capability.
[0133] like Figure 5 As shown, the first application can be a camera application. After receiving a user's command to save the currently captured photo, the first application calls the file management mode interface and passes the following parameters to the interface: DeviceName, AppName, key1, value1, key2, value2, extend. After the first application calls the file management mode interface, the file management mode interface calls MediaDataKit. The parameters passed by MediaDataKit include: Storage, Create File Mode, [name, owner, ...], extend.
[0134] Here, key1 can be used to indicate the function point of image creation, and value1 can be the image stream obtained after taking a picture, 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 call next. CreateFileMode is the starting function point. [name, owner, ...] indicates the parameter information for the file being created, where name is the file name and owner is the file owner. The owner can be the DeviceName and AppName parameters passed when calling MediaDataKit from the file manage mode interface. 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 then calls the storage capability. The parameters passed to the storage capability can include: CreateFileMode, [name, owner, ...], extend.
[0137] Then, during the operation of the storage capability, one or more of the following can be invoked: the creation service capability, the usage service capability, the storage service capability, the termination service capability, the space management service capability, or others, to create photos. For example, the creation service capability can be invoked to create photos, and the storage service capability can be invoked to store the created photos in the storage location specified by the space management service.
[0138] Take the access function in the first application's call-and-use function as an example.
[0139] In some embodiments, the first function is a file access function, the first media file is an image, and the indication information of the first media file includes one or more of the following: file name, file owner, file storage path, image access permission, and image access method. The interface indication information is used to indicate the ability to perform storage for the first media data in the third capability.
[0140] The first application can be a gallery application, the first function is an access function, and the first media file includes one or more of the following: large image, thumbnail, and the processing performed on the first media data by the first function includes: storage.
[0141] like Figure 6 As shown, after the gallery application detects a user's access to an image, it can call the PhotosMode interface for image access. The parameters passed to the PhotosMode interface include: DeviceName, AppName, key1, value1, key2, value2, and extend.
[0142] For a detailed description of the parameters passed by the PhotosMode interface, please refer to the above. Figure 5 The relevant content will not be repeated here.
[0143] After the camera application calls the PhotosMode interface, the PhotosMode interface then calls MediaDataKit. The parameters passed by MediaDataKit include: Storage, PhotosMode, [BigPicture, ...], extend. The passed parameters may also include the file owner, file storage path, file size, etc., which are not specifically limited in this embodiment.
[0144] Among them, Storage indicates the storage interface, PhotosMode is the function point to be launched, and BigPicture is the large image. BigPicture is the large image that the user is accessing in the large image access mode in the photo library application.
[0145] After the PhotosMode interface calls MediaDataKit, MediaDataKit can determine the next interface to be called as a storage capability based on the Storage parameter passed to it. The parameters passed to the storage capability can include: PhotosMode, [BigPicture, ...], extend.
[0146] Then, during the operation of the storage capability, one or more of the following can be invoked to access the image: the creation service capability, the usage service capability, the storage service capability, the termination service capability, the space management service capability, or others. For example, the usage service capability can be invoked to determine whether the first application meets the access permissions for the first media file. If not, the storage capability operation fails, and a result indicating that the file access function failed to start is returned. If not, the storage capability continues to run to complete the file access function.
[0147] Take the playback function in the first application 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, playback duration, and the interface indication information is used to indicate the ability to perform playback on the first media data in the third capability.
[0149] The first application can 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 can include: playback.
[0150] like Figure 7 As shown, after the music application detects the user's music playback action, it can call the PlayMode interface. After the music application calls the PlayMode interface, the PlayMode interface then calls MediaDataKit. The parameters passed by MediaDataKit include: Play, PlayMusic, [MusicName, size, time, ...], extend.
[0151] In this context, `Play` indicates the playback interface that MediaDataKit will call next, `PlayMusic` is the function point to be started, and `[MusicName, size, time, ...]` indicates the music to be played, where `MusicName` is the music name, `size` is the music file size, and `time` is the music duration. The parameters passed may also include the file owner, file storage path, playback mode, etc., which are not specifically limited in this embodiment.
[0152] After the PlayMode interface calls MediaDataKit, MediaDataKit then calls the playback interface. The parameters passed to the playback interface can include: PlayMusic, [MusicName, size, time, ...], extend.
[0153] Then, during the operation of the playback capability, one or more of the following can be invoked to play music: the generation service capability, the usage service capability, the storage service capability, the termination service capability, the space management service capability, or others.
[0154] Take the deletion function in the first application's call-to-delete 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 ability to perform storage for the first media file in the third capability.
[0156] like Figure 8 As shown, the first application can be a storage application such as a gallery or file manager. After the storage application detects that the user has deleted a file, it can call the FileManageMode interface. Then, the FileManageMode interface calls MediaDataKit, and the parameters passed by MediaDataKit include: Storage, DeleteFileMode, [name, owner, ...], extend.
[0157] In this context, Storage indicates the storage interface that MediaDataKit will call next, DeleteFileMode is the function point to be initiated, and [name, owner, ...] indicates the file to be deleted, where name is the file name and owner is the file owner. The parameters passed may also include the 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 then calls the storage interface. The parameters passed to the storage interface can include: DeleteFileMode, [name, owner, ...], extend.
[0159] Then, during the operation of the storage capability, one or more of the following can be invoked to delete the first media file: the generation service capability, the use service capability, the storage service capability, the termination service capability, the space management service capability, or others.
[0160] Take the recovery function in the first application's call to 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, recoverable content, and the interface indication information is used to indicate the ability to perform storage for the first media file in the third capability.
[0162] like Figure 9 As shown, the first application can be a storage application such as a recycle bin. After the storage application detects the user's operation to restore files, it can call the FileManageMode interface. Then, the FileManageMode interface calls MediaDataKit, and the parameters passed by MediaDataKit include: Storage, RestoreFileMode, [name, owner, ...], extend.
[0163] Here, Storage indicates the storage interface that MediaDataKit will call next, RestoreFileMode is the starting function point, and [name, owner, ...] indicates the file to be restored, where name is the file name and owner is the file owner. The parameters passed may also include the recoverable file size, recoverable content, etc., which are not specifically limited in this embodiment.
[0164] After the FileManageMode interface calls MediaDataKit, MediaDataKit then calls the storage interface. The parameters passed to the storage interface can include: RestoreFileMode, [name, owner, ...], extend.
[0165] Then, during the operation of the storage capability, one or more of the following can be invoked to delete the first media file: the generation service capability, the use service capability, the storage service capability, the termination service capability, the space management service capability, or others.
[0166] It is understandable that the calling methods for other related functional interfaces can also refer to the above. Figures 5-9 The relevant descriptions of the embodiments shown are not repeated in this application.
[0167] Based on the above call relationships for different interfaces, the following will combine the above... Figure 2 The OS of the electronic device provided in the illustrated embodiments exemplifies the implementation of file processing based on third-party capabilities in different application scenarios. The files mentioned in the embodiments of this application can be understood as the media files mentioned in the above embodiments.
[0168] Regarding the generation of the file
[0169] Each application can create, use, and delete files during operation. However, this application embodiment can standardize and manage the file creation process of each application based on the generation capabilities of the OS. For example, when an application starts the file creation function, the input parameters of the file creation function interface include the 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 disordered storage from the source.
[0170] That is, when a file is created, the electronic device can determine one or more of the following parameters of the first media file based on the parameters passed in by the first application: file owner, file name, file permissions, file storage path, file size, file type, etc. Among them, the file owner, file permissions, and file storage path can better assist the unified media framework in standardizing the management of files.
[0171] The file owner is used to record the application that created the file. In scenarios with multiple interconnected devices, the device on which the application was located when the file was created can also be recorded. The file owner includes the application identifier information of the application that created the file, and the device identifier of the device to which the application belonged when the file was created, such as: a first application identifier and a first electronic device identifier. It should be noted that the first application can refer to a system application or a third-party application running on the electronic device, or it can refer to an application service or system service running on the electronic device. For example, mini-program services on electronic devices that rely on a system platform, and various mini-program services that rely on third-party application platforms (such as Alipay and WeChat), etc. This application embodiment does not specifically limit this.
[0172] Please refer to the attached document. Figure 10 , Figure 10 This is a schematic diagram of a file owner provided in an embodiment of this application. For example... Figure 10As shown, when creating a file, a unique file owner is specified. For example, if file 1 is created by application B on device A, then the owner of file 1 is (Device A + Application B); if file 2 is created by application B on device B, then the owner of file 2 is (Device B + Application B). This demonstrates that even if both file 1 and file 2 are created by application B, the electronic device can quickly distinguish the file's origin based solely on the owner information. Similarly, if file 3 is created by service A on device A, then the owner of file 3 is (Device A + Service A). This again shows that even if both file 1 and file 3 are created on device A, the electronic device can still quickly distinguish the file's origin based solely on the owner information.
[0173] All files on an electronic device have a defined owner upon creation. This owner is then used as an input parameter for different file processing functions throughout the file's lifecycle. This facilitates traceability during file processing within the unified media framework, directly preventing issues related to unclear file creation origins. Furthermore, the owner can be used as a cache record; file creation operations within applications are recorded in the application's cache for system-level security control, ensuring all creation is traceable. When the ownership of a detected file is unclear, it can also trace back to an illegitimate application, allowing the electronic device to delete it. For example, if an application creates files with permissions that can be shared with other applications, deleting that application requires deleting all related files. In this case, iterating through the file owners on the electronic device can achieve complete erasure. Backup scenarios follow a similar pattern, enabling application-level control.
[0174] In some embodiments, the file storage path can be a relative or absolute path indicating the file's storage location within the electronic device. Files with the same owner in the first electronic device are created sequentially and stored in the same root folder.
[0175] It is understandable that an application can only create one folder named after itself on the first electronic device, and all subsequent files or folders can only be created under this root folder directory. Furthermore, files in this root directory can be categorized or sorted according to an attribute such as creation time, file name, or file size. This method facilitates the management of files created by each application based on the owner on the electronic device, and significantly controls the number of root folders. The format of files under each root folder can be recursively determined according to this requirement. When the number of root folders becomes excessive, space management capabilities can be periodically invoked to perform clustering optimization to reduce the number of root folders. It is also understandable that the determination of file storage locations can be controlled by space management capabilities; this application embodiment does not impose specific limitations on this.
[0176] In some embodiments, file permissions can be used to record the usage permissions for creating the file, which may 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, but this embodiment does not impose specific limitations on this.
[0177] Therefore, creating service management files and setting file owner information can prevent files from having unknown origins on electronic devices. Standardizing file storage locations can prevent chaotic file directories. Restricting file access permissions can solve problems such as excessive permissions when processing files, thereby achieving standardized, unified, and convenient management of files.
[0178] Regarding the use of files
[0179] The service can manage the usage permissions of the first media file; or, based on the usage method corresponding to the parameters passed by the first application, it can 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 permission, playback permission, editing permission, sharing permission, etc.
[0180] This example illustrates file usage by showing how a first, second, and third application with different permissions access a file created by a second application. See the appendix for further details. Figures 11A-11D , Figures 11A-11D These are a set of user interface diagrams provided in the embodiments of this application.
[0181] Figure 11AAn exemplary illustration shows the user interface 10 displayed by the electronic device 100 when running a second application, such as a camera app, beauty camera app, WeChat, or Taobao. The user interface 10 can be a preview page for photos taken by the second application. After taking a photo, the user can preview it to decide whether to save it. Clicking the "Save Photo" option 101 initiates the file creation function, completing the photo creation. At this point, the successfully created photo can be set to have access permissions only from the second application and system applications, while other third-party applications cannot access it.
[0182] Figure 11B An example is shown of the user interface 20 displayed by the second application after the photo creation function is completed. The image access option 102 in the user interface 10 is a thumbnail of the created photo. When the user clicks the image access option 102, the OS can activate the file access function so that the user can access the currently captured photo.
[0183] Figure 11C An exemplary illustration shows the user interface 30 displayed by the electronic device 100 when running a first application, which can be a gallery-type application. The user interface 10 can be a preview page of the first application. This preview page can be used to display photos created after being taken by various camera applications, such as photo 103 created by a second application. The user can click on photo 103 to activate the file access function to access the photo created by the second application.
[0184] Figure 11D An exemplary illustration shows the user interface 40 displayed by the electronic device 100 when running a third application, which is a third-party application. The user interface 10 can access the gallery preview page for the third-party application. However, since the third-party application does not have permission to access the photos 103 created by the second application, the aforementioned issues do not exist when the third-party application accesses photos accessible to it on the gallery preview page. Figure 11C Photo 103 was created using the second application.
[0185] Understandably, the operating system can determine the file's usage permissions when it's created, allowing other applications to manage its access, playback, editing, and sharing. These permissions can include access permissions, playback permissions, editing permissions, and sharing permissions. Please refer to [link / reference]. Figure 12 , Figure 12 This is a schematic diagram illustrating a detailed set of usage permissions provided in an embodiment of this application. For example... Figure 12As shown, each different usage permission can be further refined according to the folder type, application type, file type, or application scenario. For example, sharing permissions can be set for different application types, and playback permissions can include high-resolution playback, low-resolution playback, etc. Similarly, access permissions can be set for different application scenarios.
[0186] It should also be noted that this capability can determine whether the first application satisfies the usage permissions of the first media file based on the usage method corresponding to the parameters passed 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 capability determines that the usage method corresponding to the parameters satisfies the first application's usage permissions for the first media file, the electronic device can complete the first function; if the capability determines that the usage method corresponding to the parameters does not satisfy the first application's usage permissions for the first media file, the electronic device can return a result indicating that starting the first function failed; or the electronic device can request usage permissions from the second application to complete the first function. It can be understood that the usage method can be accessed as a thumbnail, preview, large image, or other forms. For example, the usage method corresponding to the parameters passed by the first application is to access the first media file created by the second application as a large image, but the first application can only access the first media file in preview mode.
[0187] In other embodiments, this usage capability can also set corresponding usage permissions for applications. For example, a file management application may have access to all files, while a third-party application may only have access to some files. For instance, it may only have access to images in the gallery and not access to audio files.
[0188] Therefore, even though current electronic devices can access the internal memory card, they cannot arbitrarily create or modify files on the card. For example, a file created by one application cannot be accessed, modified, or shared by another application without the necessary permissions. Electronic devices manage the permissions of each application, thereby improving file usage efficiency. Through permission management, type management, and result management, standardized, unified, and convenient file control can be achieved.
[0189] In addition, the capability can also support file searching in electronic devices, such as quick querying and searching based on existing parameters such as file owner, file name, file time, file location, and main content of the file. This application does not make specific limitations on this aspect.
[0190] For file storage
[0191] The storage service can store the first media file to the corresponding storage location according to the parameters passed by the first application and return the storage result; or, it can back up or migrate the first media file, thereby supporting end-to-end collaboration and end-to-cloud collaboration.
[0192] Understandably, when a file is created, after the space management service determines the storage location of the first media file, the storage service can store the first media file according to the storage path corresponding to that storage location.
[0193] Additionally, please refer to the appendix. Figure 13 , Figure 13 This is a schematic diagram illustrating the storage service capabilities supported by an embodiment of this application, such as... Figure 13 As shown, this storage service primarily supports file backup, migration, end-to-end collaboration, and end-to-cloud collaboration. It provides a unified registration capability for backup and migration; only files created by applications registered with the storage service can be backed up or migrated. Other applications cannot perform backup or migration.
[0194] Correspondingly, in backup and migration, the application can decide which files can be backed up or migrated, making file management on electronic devices more granular. It can be done by file type or by folder, and the specifications can be customized.
[0195] For example, in multi-device collaborative scenarios, the storage of current devices (including local devices and distributed devices), cloud server storage, and home storage (hard drives) can be combined to ensure full and coordinated utilization of storage space. Generally, whether a file is stored on its corresponding device can be determined by its storage parameters. These parameters can include file storage location, file size, file name, and file storage path. If the value on the device corresponding to the file's storage location is not -1, it indicates that the file is stored on that device.
[0196] Furthermore, since any application can request memory permissions to create files at will, electronic devices accumulate a large number of junk files whose origins are unknown to the user, who may not know who owns them. This also leads to a chaotic file storage directory, where users often find various image files of unknown origin in their photo libraries.
[0197] In contrast, the OS in this application embodiment can provide a unified file creation capability so that files created by each application conform to a unified specification, making management convenient.
[0198] Regarding the disappearance of documents
[0199] The deletion service can delete or restore the first media file based on parameters passed from the first application. For example: the deletion service can completely delete the first media file based on parameters passed from the first application (this method cannot recover the deleted file); it can also delete the first media file in a recoverable manner based on parameters passed from the first application (this method allows for file recovery); and it can also delete the first media file comprehensively based on parameters passed from the first application (this method simultaneously deletes files backed up or copied by all applications; for example, deleting image A from the gallery will also delete image A from the WeChat chat history).
[0200] It should be noted that in some other embodiments, the application can also set parameters related to the file's deletion method when creating the file. For example, when the application calls the file creation function, the indication information of the first media file can pass parameters such as supporting deletion methods for the file, or the first operating system can confirm the deletion methods supported by the file. For instance, if the file's deletion method is set to support recoverable deletion when calling the file creation function, then recoverable deletion of the file can be performed when calling the file deletion function. If the file's deletion method is set to not support recoverable deletion when calling the file creation function, then recoverable deletion of the file cannot be performed when calling the file deletion function.
[0201] In some embodiments, if the file was deleted using a recoverable deletion method, when the application invokes the file recovery function, the file indication information may pass one or more of the following parameters: file name, file owner, recoverable file size, recoverable content, etc. The recoverable file size refers to the size of the file that can be recovered after deletion, and can also be used as a basis for complete recovery. It is understood that if the file is corrupted during deletion, the recoverable file size will be smaller than the original file size, meaning that only a portion of the file can be recovered. The recoverable content refers to the cached content of the file, which is the content restored to the actual file.
[0202] Additionally, it's understandable that file deletion can be categorized into active deletion and passive deletion, depending on the type of file being deleted. Please refer to the appendix for details. Figure 14 , Figure 14 This is a schematic diagram of the recovery process corresponding to different deletion methods provided in the embodiments of this application.
[0203] like Figure 14As shown, this deletion service can be divided into active deletion and passive deletion. Active deletion refers to the user-initiated deletion of files, such as deleting an unsatisfactory photo from a gallery. Passive deletion mainly involves system actions, but may also be due to accidental operations, such as file deletion due to duplicates based on space management principles, illegal deletion during file clustering optimization, or deletion due to file anomalies (e.g., files being empty). This application does not impose specific limitations on these aspects in its embodiments.
[0204] In response, the deletion service can provide different recovery methods for different deletion methods. For example, recycle bin-type applications or systems can invoke the recovery service and perform recovery according to its capabilities. This can involve proactive recovery of specific deleted files, recovery of cached files in the current recovery service (one-click recovery), or partial recovery based on the file owner information of deleted files (application-level recovery), etc. This application does 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: manage the storage space of the first media file; set the storage location of the first media file in the storage space; and 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.
[0207] The storage space for files may include at least one of the following: local storage space (such as local device storage and distributed device storage), cloud storage space (such as cloud server storage), and peripheral storage space (such as storage hard drives).
[0208] Space management capabilities can store files in corresponding storage spaces according to different storage priority rules. File access efficiency is prioritized, with local storage space being superior to surrounding storage space, which is superior to cloud storage space. In terms of storage space usage requirements, cloud storage space is superior to surrounding storage space, which is superior to local storage space. Therefore, this application does not specifically limit the specific division of storage priorities for storage spaces.
[0209] Understandably, since files can be categorized as hot or cold data, files used more frequently than a preset threshold are considered hot data files, while those used less frequently are considered cold data files. Hot data should prioritize access efficiency and therefore be stored on the local device, while cold data should prioritize storage space and therefore be stored in the cloud.
[0210] In other embodiments, the space management capability can also deduplicate or compress the files already stored in the storage space when the free storage space in the storage space is less than a preset threshold. Deduplication refers to removing duplicate files, and compression refers to compressing the files.
[0211] For example, if two identical files exist in an electronic device, such as file 1 and multiple copies of file 1, then when the remaining free storage space is less than a preset threshold, the multiple copies can be deleted, leaving only one file. As another example, if file 1 already exists in the electronic device, the space management capability can prevent applications from repeatedly creating file 1, allowing them to directly use the currently saved file 1, thereby ensuring efficient use of storage space.
[0212] For example, images and videos in media files may contain many similar blocks or frames. In this regard, space management capabilities can compress existing images or videos to reduce the overall file size on electronic devices.
[0213] For example: Please refer to the appendix Figure 15 , Figure 15 This is a compression diagram provided in an embodiment of this application, such as... Figure 15 As shown, for a video file containing two adjacent similar image frames, namely frame N and frame N+1, each frame is divided into four parts. The identical parts (M2, M3, and M4) can be reused, while the different part (M1) cannot be reused. Therefore, for the two frames above, the reused portion can have six parts, and the differing portion has two parts. What originally required eight parts of space now only requires eight. Currently, this is only for two frames. If the number of frames increases, the common part may become smaller. Therefore, a dynamic parameter value A can be defined, which refers to the number of frames compressed together. For example, a value of 5 means 5 frames are compressed together. Another dynamic parameter B can be defined, representing how many blocks each frame is divided into. For example, B=20 means the current frame is divided into 20 identical modules. A larger value indicates finer division and better compression.
[0214] Therefore, it can be understood that the above-mentioned video compression method can be interpreted as utilizing the similar data between adjacent multiple frames, thus unifying these multiple frames and reducing the video's storage space. In some embodiments, the space management capability can also compress each frame of the video, thereby reducing the overall storage space of the video. For example, the space management capability can directly perform intra-frame compression on each frame of the video, that is, the information of each pixel in the compressed frame can be obtained by interpolating the information of adjacent pixels. Therefore, when compressing the image, only the information of a portion of the pixels is retained, thereby obtaining the compressed image, which in turn reduces the overall storage space of the video.
[0215] In other embodiments, to ensure video playback quality, different compression methods can be applied to different regions of each frame in the video. For the video, each frame can be divided into key and non-key regions. Key regions are areas of interest to the user, such as people and moving objects. Non-key regions are areas of less interest to the user, such as the background and static objects. Spatial management capabilities can apply different compression methods to the key and non-key regions of each frame. For example, intra-frame compression or residual compression can be used to compress non-key regions, while conventional inter-frame compression can be used to compress key regions, and so on.
[0216] Therefore, it should be noted that the space management capability in this application embodiment does not specifically limit the compression method of files such as pictures or videos. The space management capability can adaptively select different compression methods according to the size of the remaining storage space, the compression methods supported by the electronic device, the usage of the file, or the type of compressed file, so as to ensure a more rational use of storage space without affecting the user's use.
[0217] It is also understandable that the compression triggering mechanism in the space management service can be dynamic, allowing for both optimal user experience and full utilization of 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, ensuring the rational use of storage space. This application does not impose specific limitations on this aspect.
[0218] Based on the above Figure 2 or Figure 3 The software structure diagram shown illustrates the various functional modules and the implementation of the file management described above, exemplarily illustrating the flow of the file management method provided in this application embodiment. Please refer to the appendix. Figures 16-20 , Figure 16 This is a flowchart illustrating a file management method provided in an embodiment of this application. Figure 17 This is a schematic diagram of a user interface provided in an embodiment of this application. Figure 18 This is a schematic diagram of the interface call relationship when starting a file access function, provided by an embodiment of this application. Figure 19 and Figure 20 This is another set of user interface diagrams provided in the embodiments of this application.
[0219] like Figure 16 As shown, this 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, on which a first application is installed. The first operating system provides: a first interface, a media data interface, and a second capability. The first user interface displayed by the first application presents a first option corresponding to the first function.
[0222] The first application can be a third-party application, a system application, a self-developed application, etc. The first application includes program code that calls the first interface, which is used to start the first function provided by the first application. For example, the first application can refer to a camera application, a gallery application, a music application, a video application, a file manager application, etc.
[0223] The first function can refer to functions such as creation, use, storage, deletion, and space management. For example, if the first function is a creation function, the user interface of the first application can be a photo saving interface, the first option can be a photo saving option, the first media file can include an image, and the first function can include image storage. In some embodiments, the first function also includes at least one of the following functions: file creation, file playback, file deletion, file recovery, file backup, file migration, file sharing, and file space management.
[0224] The first interface can be used to launch a first function provided by a first application, and the first interface can be used to call a media data interface. In this embodiment, the first operating system can provide multiple first interfaces, and different first interfaces can be used to launch different functions.
[0225] The media data interface is used to invoke the second capability, which includes the ability to perform one or more of the following processes on the 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 of the first media file. The first media file may include one or more of the following types: text, images, video, and audio, etc. For detailed information regarding the first operating system, please refer to the description of the relevant content in the above embodiments.
[0226] like Figure 17 As shown, 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 option 201 for the file access function.
[0227] The first interface can be Figure 18 The AMS interface mentioned in the text. This media data interface can be... Figure 18 The mentioned photo picker.
[0228] Alternatively, the first interface can 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 embodiments. The media data interface can also be the MediaDataKit interface mentioned in the above embodiments.
[0229] S102. In response to a first user operation on the first option, the electronic device initiates a file access function and displays a second user interface.
[0230] Specifically, the first user action on the first option can be used to trigger the activation of the first function, namely the file access function, and to display the second user interface. For example... Figure 19 As shown, after the user clicked the above... Figure 17 In the first user interface shown, after option 201 for the file access function, such as clicking on an image selected from the gallery, the file access function can be activated and the following will be displayed: Figure 19 The second user interface shown may include one or more media files.
[0231] Furthermore, the first user operation can be a touch operation applied to the touchscreen, or it can refer to the user's voice command, etc. This application embodiment does not limit the form of this operation.
[0232] Understandably, as mentioned above Figure 18As shown, upon receiving a first user operation for the first option, the AMS interface (i.e., the first interface mentioned above) can be invoked in response to the first user operation for the first option. The AMS interface can further invoke the Photo Picker to initiate the file access function.
[0233] When calling the AMS interface, the parameters that can be passed include one or more of the following: device name, application name of the first application, and parameters passed by the first application. The parameters passed 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 indication information of the first media file. For detailed information regarding the passed parameters, please refer to the description of the relevant content in the above embodiments.
[0234] The photo picker, or media data interface, may encapsulate third capabilities. These third capabilities include the ability to perform one or more of the following processes on the first media file: acquisition, encoding, storage, sharing, decoding, and playback. Parameters passed when invoking the photo picker may include: interface indication information, indication information for the first function, and the first media file or its indication information. The interface indication information indicates the capabilities invoked by the media data interface within the third capabilities. The indication information for the first media file is all or part of the parameters passed by the first application, and / or the indication information for the first media file is determined by the first operating system.
[0235] It is also understandable that, in addition to activating functions through operations on options, the electronic device 100 can also activate functions based on user voice commands or operations on physical buttons when no screen is displayed or no options are displayed on the first user interface of the first application. For example, when no screen is displayed, the electronic device 100 can detect the user's voice command "take a picture" and activate the photo creation function of the camera application, which can be used to store the captured image. As another example, when no options are displayed on the first user interface of the first application, the first application can identify a photo taken at 5 AM today based on the information entered by the user on the first user interface and perform a file access function. The first application can then directly call the AMS interface to activate the access function to access the photo.
[0236] S103. The electronic device detects a second user operation that selects a first media file from one or more media files, and returns the resource identifier of the first media file to the first application through the media data interface.
[0237] Specifically, when an electronic device detects a second user operation that selects a first media file from one or more media files, it can return the resource identifier of the first media file to the first application via a media data interface. This is as described above. Figure 18 As shown, 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, 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. The resource identifier can be a Uniform Resource Identifier (URI) used to determine 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 to the photo picker may include one or more of the following: interface indication information, indication information for a first function, and indication information for a first media file. The indication information for the first media file may include some or all of the parameters passed 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 invoked 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 necessary to grant the first application temporary access permissions to complete the file access function of the first media file. That is, when the first application grants access permissions to the first media file, it needs to authorize the first application to access the first media file through the media data interface. This authorization can be granted by the media data interface, i.e., the PhotoPicker, or by the first interface, i.e., the AMS interface; this embodiment does not specifically limit the specific authorization.
[0240] It should be noted that granting the first application temporary access permission 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. This application embodiment does not specifically limit the form of authorization.
[0241] It is understandable that this media data interface can grant temporary authorization to the first application to access the first media file after the user or the application that created the first media file has been prompted for authorization. It is also understandable that the first application granted temporary access can only access the first media file within the validity period or the number of times the temporary authorization is granted; it cannot access the first media file after the temporary access expires.
[0242] S104. The electronic device accesses the first media file based on the resource identifier through the first application.
[0243] Specifically, the first application in an electronic device can access the first media file based on a resource identifier. For example... Figure 20 As shown, after a user selects a 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 example, a first application in an electronic device can access a first media file based on a resource identifier with temporary permissions.
[0245] In some embodiments, when the first application has access to the first media file, or has obtained temporary access to the first media file, the first media file is returned to the first application through the media data interface. That is, the media data interface can directly determine the first media file that the first application needs to access based on the input parameters, and if the first application meets the access requirements for the first media file, the first media file can be directly returned to the first application through the media data interface without the first application needing to access the first media file based on a resource identifier.
[0246] In other embodiments, if the first application does not obtain access permission or temporary access permission to the first media file, a result indicating failure to initiate the file access function is returned to the first application via the media data interface. For example, the first media file may be a media file created by a second application, and the second application has not granted access permission to the first media file. The method further includes: returning a result indicating failure to initiate the first function to the first application; or, querying the second application to obtain permission from the first application to complete the first function for the first media file. After initiating the first function, the electronic device can determine whether it can initiate the first function for the first media file based on the permissions of the first application. If it cannot initiate the first function for the first media file, a result indicating failure to initiate the first function is returned to the first application; or, it can query the second application to obtain temporary access permission from the first application to complete the file access function for the first media file, so that the first electronic device can perform unified management of the entire file system. The second application can be an application on the first electronic device or the second electronic device. It is understood that the second application can be a device communicating with the first application, or a device that shares the same user electronic account.
[0247] In some embodiments, files with the same 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 from various applications through a unified data management framework, achieving unified management of application files and solving the problem of disorganized file storage directories.
[0248] It should be understood that the specific content and beneficial effects of the file management method provided in the embodiments of this application can also be found in the relevant descriptions of the above embodiments, and will not be repeated here.
[0249] Secondly, the hardware structure of the electronic device involved in the embodiments of this application is described below. Please refer to the appendix. Figure 21 , Figure 21 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0250] Figure 21 A schematic diagram of the hardware structure of electronic device 100 is shown. Electronic device 100 can be the electronic device mentioned above, the first electronic device, or the second electronic device.
[0251] Electronic device 100 may be a mobile phone, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, as well as cellular phone, personal digital assistant (PDA), augmented reality (AR) device, virtual reality (VR) device, artificial intelligence (AI) device, wearable device, in-vehicle device, smart home device and / or smart city device. The embodiments of this application do not impose any special restrictions on the specific type of electronic device.
[0252] like Figure 21 As shown, 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, etc.
[0253] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0254] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.
[0255] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.
[0256] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0257] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which 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 manufactured using organic light-emitting diodes (OLEDs), active-matrix organic light-emitting diodes (AMOLEDs), flexible light-emitting diodes (FLEDs), miniled, microled, micro-OLEDs, quantum dot light-emitting diodes (QLEDs), etc. In some embodiments, the electronic device may include one or N displays 194, where N is a positive integer greater than 1.
[0259] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.
[0260] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, 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, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, converting it into an image visible to the naked eye. The ISP can also perform algorithmic optimization on image noise and brightness. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0261] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. 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, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.
[0262] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.
[0263] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0264] An NPU (Neural Processing Unit) is a neural network (NN) computing processor that borrows from the structure of biological neural networks, such as the transmission function between neurons in the human brain, to rapidly process input information and continuously learn. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.
[0265] Internal memory 121 may include one or more random access memory (RAM) and one or more non-volatile memory (NVM).
[0266] Random access memory can 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, fifth generation DDR SDRAM is generally called DDR5 SDRAM), etc.; non-volatile memory can include disk storage devices and flash memory.
[0267] Flash memory can be classified according to its operating principle, including NOR FLASH, NAND FLASH, 3D NAND FLASH, etc.; according to the level of the storage cell, including single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc.; and according to the storage specification, including universal flash storage (UFS) and embedded multimedia card (eMMC), etc.
[0268] The random access memory can be directly read and written by the processor 110. It can be used to store executable programs (such as machine instructions) of the operating system or other running programs, as well as user and application data.
[0269] Non-volatile memory can also store executable programs and user and application data, and can be pre-loaded into random access memory for direct reading and writing by the processor 110.
[0270] The external memory interface 120 can be used to connect to external non-volatile memory, thereby expanding the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to perform data storage functions. For example, music, video, and other files can be stored in the external non-volatile memory.
[0271] Microphone 170C, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals. When making a phone call or sending a voice message, the user can speak by bringing their mouth close to microphone 170C, inputting the sound signal into microphone 170C. Electronic device 100 may have at least one microphone 170C. In some embodiments, electronic device 100 may have two microphones 170C, which, in addition to collecting sound signals, can also perform noise reduction. In other embodiments, electronic device 100 may also have three, four, or more microphones 170C, which can collect sound signals, reduce noise, identify the sound source, and perform directional recording, etc.
[0272] In this embodiment, the internal memory 121 is used to store a computer program that implements the shooting method provided in this embodiment, and the processor 110 is used to execute the computer program to implement the shooting method provided in this embodiment. For example, the processor 110 can generate a basic quality map and a full quality map sequentially in a segmented shooting process, and can also be used to manage the input data stream and output data stream of the pipeline, etc.
[0273] It should be understood that each step in the above method embodiments can be completed by integrated logic circuits in the processor hardware or by instructions in software form. The method steps disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or being executed by a combination of hardware and software modules in the processor.
[0274] This application also provides an electronic device. The first electronic device runs a first operating system, and the first operating system has a first application installed on it. The first operating system provides: a first interface, a media data interface, and a second capability. The first application includes program code that calls 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 processes 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. The processor executes the computer program to implement the method performed by the electronic device as described in any of the above embodiments.
[0275] This application also provides a computer-readable storage medium. The computer program includes a first operating system, on which a first application is installed. The first operating system provides: a first interface, a media data interface, and a second capability. The first application includes program code that calls 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 processes 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 foregoing embodiments.
[0276] This application also provides a computer program product, which includes a computer program, a first operating system, and a first application 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 that calls 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 processes 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 foregoing embodiments.
[0277] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0278] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical or other forms.
[0279] The units described above as separate components may or may not be physically separate. 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 the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0280] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0281] If the integrated units described above are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, 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. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which can be a personal computer, server, or network device, specifically a processor in the computer device) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium may include various media capable of storing program code, such as a USB flash drive, portable hard drive, magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM).
[0282] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A file management method, characterized in that, The method is applied to a first electronic device, which runs a first operating system and has a first application installed on it. The first operating system provides: a first interface, a media data interface, and a second capability. The first application includes program code that calls 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 processes on a 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: The first application is run on the first operating system, and the first user interface of the first application is displayed. The first user interface presents a first option corresponding to the first function, and the first function includes a file access function. In response to a first user action on the first option, the file access function is activated and a second user interface is displayed, the second user interface including one or more media files; Upon detecting a second user operation to select a first media file from the one or more media files, the resource identifier of the first media file is returned to the first application through the media data interface; The first application accesses the first media file 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, the method further includes: Grant the first application temporary access to the file access function for the first media file.
3. The method according to claim 1, characterized in that, The method further includes: If the first application has access to the first media file, or has obtained temporary access to the first media file, the first media file is returned to the first application through the media data interface.
4. The method according to claim 3, characterized in that, The method further includes: If the first application does not obtain access permission or temporary access permission to the first media file, the application returns a result indicating that the file access function failed to be started through the media data interface.
5. The method according to claim 1, characterized in that, The parameters passed to the first interface include one or more of the following: device name, application name of the first application, and parameters passed to the first application. The parameters passed to 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 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 playback.
7. The method according to claim 6, characterized in that, The parameters passed through the media data interface include: interface indication information, indication information of the first function, and indication information of the first media file. The interface indication information is used to indicate the capability invoked 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 by the first application, and / or the indication information of the first media file is determined by the first operating system.
8. The method according to any one of claims 1-7, characterized in that, The first function also 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, or file space management function.
9. The method according to claim 7, characterized in that, The first function includes 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 usage permissions, file storage path, file size, and file type. The interface indication information is used to indicate the storage capability performed on the first media file in the third capability. or, The first function includes the file access function, the first media file is an image, and the indication information of the first media file includes one or more of the following: file name, file owner, file storage path, image access permission, and image access method. The interface indication information is used to indicate the storage capability performed on the first media file in the third capability. or, The first function includes 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 ability to perform playback on the first media file in the third capability. 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 performed on the first media file in the third capability. or, The first function includes 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 ability to perform storage for the first media file in the third capability.
10. The method according to any one of claims 1-7, characterized in that, The second capability includes: the ability to generate services. The service generation capability is used to create the first media file and, when creating the first media file, set one or more of the following fields for the first media file: file owner, file name, file storage path, file usage permissions, or file attributes, wherein the first media file is one of text, image, audio, or video.
11. The method according to claim 10, characterized in that, In the first electronic device, files with the same owner are stored sequentially in the same root folder.
12. The method according to claim 11, characterized in that, The second capability includes: using service capabilities. The usage service capability is used to manage the usage permissions of the first media file; or, based on the usage method corresponding to the parameters passed by the first application, it determines whether the first application meets the usage permissions of the first media file and returns the usage result. The usage permissions include one or more of the following: access permission, playback permission, editing permission, and sharing permission.
13. The method according to any one of claims 1-7, characterized in that, The second capability includes: the ability to terminate services. The deletion 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.
14. The method according to any one of claims 1-7, characterized in that, The second capability includes: storage service capability. The storage service capability is used to store the first media file to the 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 media file.
15. The method according to any one of claims 1-7, characterized in that, The second capability includes: 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; and 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.
16. An electronic device, characterized in that, The first electronic device runs a first operating system, on which a first application is installed. The first operating system provides: a first interface, a media data interface, and a second capability. The first application includes program code that calls 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 processes on media files: managing the creation of the media files, managing the use of the media files, storing the media files, managing the deletion and recovery of the media files, and managing the storage space of the media files. The electronic device includes: a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method as described in any one of claims 1-15.
17. A computer-readable storage medium, characterized in that, It stores a computer program, which includes a first operating system. The first operating system has a first application installed on it. The first operating system provides: a first interface, a media data interface, and a second capability. The first application includes program code that calls 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 processes on media files: managing the creation of the media files, managing the use of the media files, storing the media files, managing the deletion and recovery of the media files, and managing the storage space of the media files. When the computer program is executed by a processor, it implements the method as described in any one of claims 1-15.
18. A computer program product, characterized in that, The computer program product includes a computer program, which includes a first operating system. 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 that calls 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 processes on media files: managing the creation of the media files, managing the use of the media files, storing the media files, managing the deletion and recovery of the media files, and managing the storage space of the media files. When the computer program is executed by a processor, it implements the method as described in any one of claims 1-15.
Citation Information
Patent Citations
File management method and device and mobile terminal
CN107122429A
Media file management method and related device
CN116069731A