File management method and related equipment

By introducing a unified media framework and media data interface into the electronic device operating system, the problem of chaotic file management is solved, the systematized security control of files is realized, file access and search efficiency is improved, and user experience is improved.

CN120295967APending Publication Date: 2025-07-11HUAWEI TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410743922.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2024-01-10
Filing Date
2024-06-07
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

File management in existing electronic devices is chaotic, applications access and modify files at will, file sources are unclear, storage directories are chaotic, and lack of systematic management mechanisms, which affects the user experience.

Method used

By introducing a unified media framework and media data interface into the operating system, standardizing file processing flow, setting file owners, managing file creation, use, storage, deletion and recovery, providing permission management and storage space management, and realizing systematic security control of files.

Benefits of technology

Improve file access and search efficiency, ensure clear file sources and orderly storage directories, improve user experience, and simplify application file processing flow.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120295967A_ABST
    Figure CN120295967A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a file management method and related equipment, the file management method is applied to electronic equipment, operating systems run on the electronic equipment, and the first operating system provides a first interface, a media data interface and a second capability; the method comprises the steps that a first application runs on a first operating system, a first user interface of the first application is displayed, and the first user interface presents a first option corresponding to a first function; the first function comprises a file access function; in response to a first user operation for the first option, starting a file access function and displaying a second user interface; and detecting a second user operation of selecting a first media file from the one or more media files, and returning a resource identifier of the first media file to the first application through the media data interface so that the first application accesses the first media file based on the resource identifier. By implementing the embodiment of the invention, the whole file system can be systematically and safely managed and controlled.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of terminals, and in particular, to a file management method and related devices. Background Art

[0002] With the continuous development of the terminal field, more and more applications are installed in electronic devices, and more and more files generated and stored based on applications are also in electronic devices. However, there is currently no management for such files in electronic devices, and users and application programs are allowed to place files randomly. For example: one can obtain the permission to access the entire internal card just by the user's consent, and create and modify files in the internal card randomly.

[0003] Although a series of system capabilities are currently provided in electronic devices to control file access, etc. Exemplarily: gradually shrinking the entry to the media library, providing the system picker ability, shielding the concept of absolute path, etc. However, the problem of chaotic file management is still difficult to completely eliminate. Currently, there are still problems such as applications randomly accessing various media files, the source of the media is not clear enough, the permission to create files is too open, and the directory for file storage is chaotic.

[0004] Therefore, how to manage the files of each application in an electronic device is a technical problem that urgently needs to be solved. Summary of the Invention

[0005] Embodiments of this application provide a file management method and related devices to systematically and securely control the entire file system.

[0006] In a first aspect, an embodiment of the present application provides a file management method, characterized in that the method is applied to a first electronic device, a first operating system is running on the first electronic device, a first application is installed on the first operating system, and the first operating system provides: a first interface, a media data interface, and a second capability; the first application includes a program code for calling the first interface, the first interface is used to start a first function provided by the first application, the first interface is used to call the media data interface, and the media data interface is used to call the second capability, and the second capability includes the ability to perform one or more of the following processing on media files: managing the creation of media files, managing the use of media files, storing media files, managing the deletion and recovery of media files, and managing the storage space of media files. The method includes: running the first application on the first operating system, displaying a first user interface of the first application, and the first user interface presenting a first option corresponding to the first function; the first function includes a file access function; in response to a first user operation on the first option, starting the file access function and displaying a second user interface, and the second user interface includes one or more media files; detecting a second user operation of selecting a first media file from the one or more media files, and returning a resource identifier of the first media file to the first application through the media data interface; accessing the first media file based on the resource identifier through the first application.

[0007] In the embodiment of the present application, the operating system of the electronic device can control the production of files and solve the problems of unclear file sources and chaotic storage. Improve the efficiency of file use, and further improve the efficiency of file access and search through means such as permission management, type management, and result management. Manage the storage of files, record the disappearance of files, and provide a new deletion recovery mechanism so that files can be traced. In this way, the electronic device systematically and safely controls the entire file system to improve the user experience. In addition, exemplarily, after the first application starts the access function for the first media file, the media data interface can return the resource identifier of the first media file to the first application, and the first application can access the first media file based on the resource identifier. That is, when the first application starts the file access function for the first media file, the first application cannot arbitrarily and cannot access the first media file without obtaining the resource identifier. The media data interface shields the first application from directly accessing the first media file, so that any application needs to go through the media data interface when accessing the first media file, avoiding the problem of chaotic file access and improving the user experience.

[0008] In a possible implementation, before returning the resource identifier of the first media file through the media data interface, the method further includes: granting the first application temporary access rights to complete the file access function for the first media file.

[0009] In an embodiment of the present application, the electronic device may query the user or the application that created the first media file. After obtaining their consent for authorization, the electronic device may grant the first application temporary access rights to the first media file, so that the first electronic device can perform unified management of the entire file system.

[0010] In a possible implementation, the method further includes: when the first application has access rights to the first media file or obtains temporary access rights to the first media file, returning the first media file to the first application through the media data interface.

[0011] In an embodiment of the present application, when the first application meets the access rights to the first media file, the media data interface can directly return the first media file to the first application, without the first application accessing the first media file according to the resource identifier, which simplifies the access process, so that the first electronic device can perform unified management of the entire file system.

[0012] In a possible implementation, the method further includes: when the first application does not obtain access rights or temporary access rights to the first media file, returning, through the media data interface, a result indicating that the file access function fails to start to the first application.

[0013] In an embodiment of the present application, the electronic device may determine whether it can start the first function for the first file according to the permissions of the first application. If it cannot start the first function for the first file, it returns a result indicating that the first function fails to start to the first application.

[0014] In a possible implementation, the parameters passed into the first interface include one or more of the following: device name, application name of the first application, and parameters passed in by the first application. Among them, the parameters passed in by the first application include parameters indicating the first function and parameter content. The parameter content includes one or more of the following: description information of the first function, the first file, and indication information of the first file.

[0015] In the embodiments of the present application, the input parameters of the interface are standardized, enabling these multiple applications to implement the same functions through the same interface. For example, both the system camera application and the third-party camera application can call the generated function interface to implement the photographing function. Compared with different applications calling different interfaces, the problem of chaotic interface calls during the operation of the application is solved, and the development difficulty of developers is reduced.

[0016] In a possible implementation manner, the media data interface encapsulates a third capability, and the third capability 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 into the media data interface include: interface indication information, indication information of the first function, and indication information of the first file or the first file; the interface indication information is used to indicate the capability called by the media data interface in the second capability, the indication information of the first file is all or part of the parameters passed in by the first application, and / or the indication information of the first file is determined by the first operating system.

[0017] In the embodiments of the present application, the media data interface encapsulates a third capability, which can support the call of each function interface upward, and can also be used to manage the underlying hardware and / or algorithms, making the file system more systematic and secure, and enabling various application programs to use it more efficiently for users to experience.

[0018] In a possible implementation manner, the parameters passed into the third capability include: indication information of the first function, and indication information of the first file or the first file; the indication information of the first file is all or part of the parameters passed in by the first application, and / or the indication information of the first file is determined by the first operating system.

[0019] In the embodiments of the present application, the indication information of the file can be passed in by the first application or by the first operating system, greatly improving the success rate and efficiency of starting the first function.

[0020] In a possible implementation manner, 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.

[0021] In the embodiments of the present application, based on different functions, the production of files can be controlled to solve problems such as unclear file sources and chaotic storage. The efficiency of file use is improved, and the efficiency of file access and search is further enhanced through means such as permission management, type management, and result management.

[0022] In a 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 permission, file storage path, file size, file type. The interface indication information is used to indicate, in the second capability, the interface for storing the first file; or, the first function is a file access function, the first file is a picture, and the indication information of the first file includes one or more of the following: file name, file owner, file storage path, picture access permission, picture access method. The interface indication information is used to indicate, in the second capability, the interface for storing the first media data; or, the first function is a file playback function, the first file is an audio or video, and the indication information of the first file includes one or more of the following: file name, file owner, file size, playback method, playback duration. The interface indication information is used to indicate, in the second capability, the interface for playing the first media data; or, the first function is a file deletion function, and the indication information of the first file includes one or more of the following: file name, file owner, file storage path, file size, file deletion method. The interface indication information is used to indicate, in the second capability, the interface for storing the first file; or, the first function is a file recovery function, and the indication information of the first file includes one or more of the following: file name, file owner, recoverable file size, recoverable content. The interface indication information is used to indicate, in the second capability, the interface for storing the first file.

[0023] In an embodiment of the present application, an exemplary way to start a file processing function through some function interfaces is provided, so that the electronic device can systematically and securely manage the entire file system and improve the user experience.

[0024] In a 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 permission, or file attribute. The first file is one of text, picture, audio, or video.

[0025] In an embodiment of the present application, the electronic device can manage the creation of files. Setting the owner information of the files can prevent the situation where the source of the files on the electronic device is unknown. Standardizing the file storage location can prevent the chaos of the stored file directories. Limiting the file usage permissions can solve problems such as excessive permissions when processing files, thereby realizing the standardized, unified, and convenient management of files and improving the user experience.

[0026] In a possible implementation, files with the same file owner in the first electronic device are sequentially stored in the same root folder.

[0027] In the embodiments of the present application, the electronic device provides the ability to uniformly process files of various applications through a unified data management framework, realizes the unified management of application files of the electronic device, and solves the problem of chaotic directory of file storage.

[0028] In a possible implementation, the third capability includes: a usage service capability, which is used to control the usage rights of the first file; or, according to the usage method corresponding to the parameter passed in by the first application, determine whether the first application meets the usage rights of the first file and return a usage result, and the usage rights include one or more of the following: access right, play right, edit right, share right.

[0029] In the embodiments of the present application, the electronic device can control the permissions of each application, thereby improving the file usage efficiency. And through means such as permission management, type management, and result management, the standardized, unified, and convenient control of files is realized, thereby enhancing the user experience.

[0030] In a possible implementation, the third capability includes: an extinction service capability, which is used to delete or restore the first file according to the parameter passed in by the first application. In the embodiments of the present application, the electronic device can manage the extinction of each file, making each file traceable and enhancing the user experience.

[0031] In a possible implementation, the third capability includes: a storage service capability, which is used to store the first file in a corresponding storage location according to the parameter passed in by the first application and return a storage result; or, back up or migrate the first file.

[0032] In the embodiments of the present application, the electronic device can store files, better realize file processing, and thus support end-to-end collaboration and end-cloud collaboration, etc.

[0033] In a possible implementation, the third capability includes: a space management capability, which is used to perform one or more of the following: manage the storage space of the first file; set the storage location of the first file in the storage space; when the free storage space in the storage space is less than a preset threshold, deduplicate or compress the files already stored in the storage space.

[0034] In the embodiments of the present application, the storage space of the first file can be uniformly and standardized managed, improving the utilization efficiency of the storage space. For example, files can be stored in the corresponding storage spaces according to different storage priority rules according to their storage priorities.

[0035] In a second aspect, an electronic device is provided in the embodiments of the present application. A first operating system runs on the electronic device, and a first application is installed on the first operating system. The first operating system provides: a first interface, a media data interface, and a second capability; the first application includes program code for calling the first interface. The first interface is used to start the 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 capability 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, managing the storage space of media files. The electronic device includes: a memory, a processor, and a computer program stored on the memory. The processor executes the computer program to implement a file management method provided in the first aspect above.

[0036] In a third aspect, a computer-readable storage medium is provided in the embodiments of the present application. The computer program includes a first operating system, and a first application is installed on the first operating system. The first operating system provides: a first interface, a media data interface, and a second capability; the first application includes program code for calling the first interface. The first interface is used to start the 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 capability 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, 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 above.

[0037] In a fourth aspect, a computer program product is provided in the embodiments of the present application. The computer program product includes a computer program, and the computer program includes a first operating system, and a first application is installed on the first operating system. The first operating system provides: a first interface, a media data interface, and a second capability; the first application includes program code for calling the first interface. The first interface is used to start the 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 capability 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, 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 above.

[0038] It should be understood that the electronic device provided by the second aspect of the present application, the computer-readable storage medium provided by the third aspect, and the computer program provided by the fourth aspect are consistent with the technical solutions of the first aspect of the present application. For the specific content and beneficial effects, reference can be made to the file management method provided in the above-mentioned first aspect, and details will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the background art, the drawings required for use in the embodiments of the present application or the background art will be described below.

[0040] Figure 1 A schematic diagram showing the difference in file access between a method for accessing an application and file access in the file management method provided by the embodiments of the present application is shown.

[0041] Figure 2 A schematic diagram of the architecture of an OS provided by the embodiments of the present application.

[0042] Figure 3 Another schematic diagram of the architecture of an OS provided by the embodiments of the present application.

[0043] Figure 4 A schematic diagram showing the specific call of the function interface by the first application provided by the embodiments of the present application.

[0044] Figures 5 - 9 A schematic diagram showing the call relationship of the first application calling each function interface provided by the embodiments of the present application.

[0045] Figure 10 A schematic diagram of a file owner provided by the embodiments of the present application.

[0046] Figures 11A - 11D A set of user interface diagrams provided by the embodiments of the present application.

[0047] Figure 12 A schematic diagram showing the refinement of usage permissions provided by the embodiments of the present application.

[0048] Figure 13 A schematic diagram showing the capabilities supported by the storage service provided by the embodiments of the present application.

[0049] Figure 14 A schematic diagram showing the recovery process corresponding to different deletion methods provided by the embodiments of the present application.

[0050] Figure 15 A schematic diagram of a compression provided by the embodiments of the present application.

[0051] Figure 16 A schematic diagram of the process of a file management method provided by the embodiments of the present application.

[0052] Figure 17 It is a schematic diagram of a user interface provided by an embodiment of the present application.

[0053] Figure 18 It is a schematic diagram of the interface call relationship when starting the file access function provided by an embodiment of the present application.

[0054] Figure 19 and Figure 20 are another group of schematic diagrams of the user interface provided by an embodiment of the present application.

[0055] Figure 21 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0056] Next, the embodiments of the present application will be described in conjunction with the accompanying drawings in the embodiments of the present application.

[0057] Terms such as "first" and "second" in the specification, claims and drawings of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products or devices.

[0058] It should be understood that in the present application, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" may mean: only A exists, only B exists, and both A and B exist at the same time. Among them, A and B can be singular or plural. The character " / " generally means that the associated objects before and after are in an "or" relationship. "At least one (one) of the following" or its similar expression means any combination of these items, including any combination of single item (one) or plural items (ones). For example, at least one (one) of a, b or c may mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0059] Reference to "embodiments" in this specification means that the specific features, structures, or characteristics described in connection with the embodiments can be included in at least one embodiment of the present application. The phrase appearing in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0060] The terms "component", "module", "system", etc. used in this specification are used to denote 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. By way of illustration, both an application running on a computing device and the computing device can be components. One or more components can reside in a process and / or an execution thread, and a component can be located on one computer and / or distributed between two or more computers. In addition, these components can execute from various computer-readable media on which various data structures are stored. A component can communicate, for example, according to a signal having one or more data packets (such as data from two components interacting with another component between a local system, a distributed system, and / or a network, such as interacting with other systems via a signal on the Internet) through local and / or remote processes.

[0061] The term "user interface (UI)" in the following embodiments of the present application is a media interface for interaction and information exchange between an application program or an operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface is source code written in a specific computer language such as Java, Extensible Markup Language (XML), etc. The interface source code is parsed and rendered on an electronic device and finally presented as content recognizable by the user. The common manifestation form of the user interface is the graphical user interface (GUI), which refers to the user interface related to computer operation presented in a graphical way. It can be visual interface elements such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, Widgets, etc. displayed on the display screen of an electronic device.

[0062] First, for the convenience of understanding the embodiments of the present application, the following specifically analyzes the technical problems to be solved and the applicable application scenarios of the embodiments of the present application.

[0063] File processing can be understood as the management of the entire life cycle of files and the persistence of file data. For a file, the activities in its life cycle include: file generation, file access and search, file sharing, backup, migration and file extinction, etc.

[0064] With the continuous development of the terminal field, more and more applications are installed in electronic devices, and more and more related files are generated and stored in electronic devices based on applications or services themselves, or files (such as pictures, audio, video, etc.) generated and stored by user operations. Although, currently electronic devices provide a series of system capabilities to control file access, for example: gradually shrinking the entrance to the media library, providing system selection (Picker) capabilities, shielding the concept of absolute paths, etc. However, current electronic devices still allow users and applications to process files at will.

[0065] For example: Although current electronic devices restrict the permissions of various applications to access the internal memory (i.e., the internal card mentioned in the following embodiments), various applications can obtain permissions to access the entire internal card with the user's consent, and can arbitrarily access, create, and modify files under most applications in the internal card. Moreover, various applications apply for file permissions based on the internal card of the entire electronic device, and the permissions applied for are completely defined by the developer himself and cannot be controlled by the electronic device. For example: terminal users do not want certain third-party applications to access the pictures of portraits taken by the camera in the gallery, but currently after the gallery authorizes the third-party application, the third-party application can access all the pictures in the gallery and cannot be controlled by the electronic device. Moreover, the above permissions are all defined by the developer of the third-party application, and for the terminal user, it is impossible to really judge whether the application should access, or what files to access.

[0066] Furthermore, since any application can apply for memory permissions to create files at will, there will be a large number of junk files on electronic devices, and the electronic devices cannot perceive the source and do not know who created the file. Moreover, it will cause confusion in the directory of file storage, and files created by one application can be accessed, modified or shared by another application at will. For example, users often find various picture files of unknown origin in the gallery.

[0067] For example, take file access as an example. Figure 1 , Figure 1 The following is a schematic diagram showing the difference between a method for application access to files and a file management method provided in an embodiment of the present application. Figure 1 (1) shows a current method for application access to data, a schematic diagram of the principle of application access to data, Figure 1Figure (2) shows a schematic diagram of the principle of the data management method provided by the embodiments of the present application in terms of application access to data.

[0068] As Figure 1 Any one of the applications such as Application A, Application B, Application C shown in Figure (1) can, according to the service, optionally access one or more of the gallery, audio, or file manager in the electronic device. For example, any application can access the pictures or videos managed by the gallery in the electronic device, or save pictures or videos in the gallery. For another example, any application can access or delete the audio files in the electronic device, such as recordings or music. For yet another example, any application can also optionally access the documents in the file manager, etc. That is to say, for various applications, operations such as file creation, use, sharing, or deletion only require obtaining the initial authorization of the electronic device or the user for the internal card, and then they can be processed at will.

[0069] To sum up, after the electronic device authorizes each application, each application is basically not controlled by the electronic device when processing files, resulting in problems such as unclear file creation sources, overly open file processing permissions, and chaotic file storage directories, which is not conducive to the systematic and secure management of the entire file system by the electronic device and the user experience is poor.

[0070] In response to this, the embodiments of the present application provide a file management method and related devices, and the file management method is implemented by the operating system (OS) of the electronic device.

[0071] The OS can combine one or more commands for the underlying hardware and / or algorithms, and on the basis of the current media unified framework, construct a new file processing solution, thereby realizing the full-life-cycle management of the files of each application and solving the problems existing in the current electronic device, such as unclear file sources, overly open file creation permissions, and chaotic file storage directories.

[0072] Exemplarily, as Figure 1Any one of the applications such as Application A, Application B, Application C, etc. shown in (2) uses a unified media framework to implement file processing for files in the gallery, audio, file manager, etc. For example, there are corresponding file processing options on the user interface of the application. The application can call the file processing function interface that starts the file processing function. After the media data interface of the unified media framework in the OS detects that the application calls this file processing function interface, it can start this file processing function or return the result of calling this file processing function interface. For example, there is an option for file access on the user interface of Application A. The application can call the file access function interface that starts the file access function. After the media data interface of the unified media framework in the OS detects that the application calls this file access function interface, it can start this file access function and complete the access to this file. That is, when any one of the applications in the embodiments of the present application creates, uses, disappears, or manages media files in an electronic device, it does not need to issue commands to the underlying hardware and / or algorithms, but only needs to send command transmission parameters to the media data interface of the unified media framework in the OS and wait for the file or response returned by the media data interface based on this command.

[0073] Among them, this media data interface can be regarded as a unified abstraction of the hardware and / or software capabilities, and is an upper-level concept abstracted from the commands based on the entire life cycle of the file. In this way, when the electronic device processes the files of the application, there is no need to use different interfaces corresponding to each application to issue commands to the underlying hardware and / or algorithms to implement file processing. Instead, it directly realizes the standardized, unified, and convenient control of files through the media data interface of this electronic device. Moreover, further, the OS can control the production of files, introduce the concept of file owner, and solve problems such as unclear sources and chaotic storage from the source. Improve the file usage efficiency, and further improve the efficiency of file access and search through means such as permission management, type management, and result management. Manage the storage of files, mainly including sharing, backup, and migration. Through unified registration and end-cloud collaboration, better file processing is realized. Record the disappearance of files, provide a new delete and recovery mechanism, and make the files traceable. Manage the storage space and ensure the rational use of the space. Among them, the specific implementation manners can also refer to the relevant descriptions of the following embodiments for corresponding reference. The embodiments of the present application will not be elaborated here for the time being.

[0074] The electronic device can be a portable terminal device equipped with HarmonyOS, iOS, Android, Microsoft or other operating systems, such as a mobile phone, a tablet computer, a wearable device, etc., or a non-portable terminal device such as a laptop computer with a touch-sensitive surface or a touch panel, a desktop computer with a touch-sensitive surface or a touch panel. The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In the embodiments of the present application, taking the HarmonyOS with a layered architecture as an example, the software structure of the electronic device 100 is exemplarily described.

[0075] Please refer to the appended Figure 2 , Figure 2 which is a schematic diagram of the architecture of an OS provided by the embodiments of the present application.

[0076] As Figure 2 shown, the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the OS is divided into four layers, from top to bottom, namely the application layer, the application framework layer, the service layer, and the kernel layer. The higher the layer, the more interactions with the user; the lower the layer, the more system capabilities it represents. Figure 2 The OS shown is only an example, and it may also include more or fewer modules. The embodiments of the present application do not limit this.

[0077] Among them, the application layer may include a series of application packages, mainly used for the production and use of media files. For example: as Figure 2 shown, the camera, the gallery, the recorder, the file manager or other applications, etc. Exemplarily, the media file can be a picture, a video, an audio, a text, an installation package, etc., and the embodiments of the present application do not make specific limitations on this.

[0078] It can be understood that in addition to Figure 2 the applications shown, the application layer may also include more or fewer applications, such as various system applications, self-developed applications, third-party applications, etc. Other applications such as the gallery application, the music application, and the video application are similar, as well as the first application or the second application mentioned in the following related embodiments, etc. The embodiments of the present application do not limit this.

[0079] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions. The framework layer may also include modules such as a window manager, a content provider, a view system, a telephone manager, a resource manager, etc., which will not be introduced in detail here.

[0080] As Figure 2 shown, the unified media framework in the application framework layer can be referred to as the unified file framework, unified media file framework, file management framework, media file management framework, etc. The unified media framework may include a first interface for providing file processing functions to applications in the application layer, and the first interface may also be referred to as the first selector. Among them, different first interfaces can be used to start different file processing functions. Exemplarily: The first interface may include but is not limited to the following interfaces: generation function interface, usage function interface, storage function interface, extinction function interface, space management function interface, and other related interfaces. The first interface may also be an AMS (Activity Manager Service, AMS) interface for starting, switching, scheduling, and managing and scheduling application processes. The above-mentioned multiple different first interfaces can be respectively called by each application in the application layer to assist the applications in the application layer to implement the processing of media files.

[0081] Exemplarily, the generation function interface can start the file generation function to support the application to implement functions such as creating media files. Multiple different generation function interfaces can also be encapsulated. One generation function interface can be used to start one generation function, such as: picture generation function, audio generation function, video generation function, etc. The generation function interface selects the corresponding interface from multiple generation function interfaces according to the parameters passed in by different applications.

[0082] The usage function interface can start the file usage function, that is, support the application to implement access, search, editing, or running of media files. Among them, when the started file usage function is different, the corresponding passed-in parameters are different.

[0083] The storage function interface can start the file storage function, that is, support the application to implement the storage of media files.

[0084] The extinction function interface can start the file extinction function to support the application to implement deletion or recovery of media files, etc. Correspondingly, when the type of file extinction is different, the corresponding passed-in parameters are also different.

[0085] The space management function interface can start the space management function to support the application to implement space management of media files, so that the electronic device can efficiently use files.

[0086] It should be understood that the descriptions of the above other function interfaces are similar to that of the generation function interface and will not be elaborated here.

[0087] It can be seen that the application framework layer can provide a unified interface for multiple applications in the application layer to call, so that these multiple applications can implement the same function through the same interface. For example, the system camera application and the third-party camera application can all call the generated functional interface to implement the photo function. Compared with different applications calling different interfaces, this solves the problem of confusing interfaces called during application operation.

[0088] In other embodiments, the above-mentioned interfaces providing file processing functions are only exemplary descriptions. Figure 3 , Figure 3 FIG. 1 is a schematic diagram of another OS architecture provided in an embodiment of the present application. Figure 3 As shown, a more detailed interface can also be provided to the application in the application layer for different file processing functions. Exemplarily, the first interface can also include but is not limited to the following interfaces: create function interface, access function interface, share function interface, edit function interface, migrate function interface, delete function interface, restore function interface, compress function interface, deduplication function interface, etc., which are not limited in the embodiments of the present application.

[0089] In addition, the unified media framework in the application framework layer may also include a media data interface (MediaDataKit) that provides file processing to the OS system, which may also be called a media data picker (Media Data Picker). The media data interface may be used to implement the generation, use (such as editing, accessing, playing, etc.), storage, extinction (such as deletion and restoration, etc.), space management, etc. of files. In addition, when used to implement the use of media files such as pictures, the media data interface may also be a photo picker (Photo Picker), etc.

[0090] The media data interface encapsulates multiple third capabilities, which include the ability to perform one or more of the following processing on media files, such as: acquisition, encoding, storage, sharing, decoding, playing, and other, etc. The third capability can also be called a basic capability, which can assist the OS system in calling the underlying hardware and / or software capabilities to realize unified processing of media files when the application in the application layer calls the relevant interface of the upper layer file processing. Of course, in other implementations, the relevant interface for file processing provided to the OS can also be provided to third-party applications for use.

[0091] The media data interface can support the invocation of function interfaces such as generation function interfaces, usage function interfaces, storage function interfaces, demise function interfaces, and space management function interfaces upwards. It can also be used to manage underlying hardware and / or algorithms, systematize and secure files as a whole, and enable various application programs to use them more efficiently for user experience. That is, the above-mentioned generation function interfaces, usage function interfaces, storage function interfaces, demise function interfaces, space management function interfaces, etc. can call the media data interface. At this time, the media data interface can select a third capability that runs the support function interface from multiple third capabilities according to the called function interface. For example, acquisition, encoding, and storage can be used to support the above-mentioned file generation function; encoding, dissemination, decoding, playback, or storage can be used to support the above-mentioned file usage function, etc. This third capability can also be referred to as the basic capability to support file processing.

[0092] Exemplarily, when the electronic device 100 detects that the user accesses a picture through the gallery application, the gallery application can call the usage function interface, and the usage function interface then calls MediaDataKit. MediaDataKit determines that the operation to be performed on the media data according to the usage function interface is "storage". Therefore, MediaDataKit then calls the storage capability to implement access to the saved picture.

[0093] It can be understood that the application framework layer may also include more or fewer function modules, and the embodiments of this application do not limit this.

[0094] The service layer can be used to dock with the media data interface upwards and includes multiple second capabilities. Among them, the second capabilities include the capabilities to perform one or more of the following processes on media files: generation service capabilities, usage service capabilities, storage service capabilities, demise service capabilities, space management service capabilities, or others.

[0095] The generation service can be used to manage the creation of media files and implement the business logic for creating and generating media files. Exemplarily, taking the media file as the first media file, 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 permission, or file attribute, and the first media file is one of text, picture, audio, or video.

[0096] The usage service can be used to manage the usage of media files and implement the business logic for using media files. Exemplarily, taking the first application using the first media file as an example, the usage service can be used to control the usage rights of the first media file; or, based on the usage method corresponding to the parameters passed in by the first application, determine whether the first application meets the usage rights of the first media file and return the usage result. The usage rights include one or more of the following: access rights, playback rights, editing rights, sharing rights, etc.

[0097] The storage service can be used to store media files and implement the business logic for storing media files. Exemplarily, taking the first application storing the first media file as an example, it is used to store the first media file in the corresponding storage location according to the parameters passed in by the first application and return the storage result; or, back up or migrate the first media file.

[0098] The extinction service can be used to manage the deletion and recovery of media files and implement the business logic for deleting or recovering media files. Exemplarily, taking the first application deleting or recovering the first media file as an example, the extinction service can delete the first media file or recover the first media file according to the parameters passed in by the first application.

[0099] The space management service can be used to manage the storage space of media files and implement the business logic for unified storage space management of media files. Exemplarily, 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; 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.

[0100] In some other embodiments, multiple second capabilities of the service layer can also be set in the application framework layer to facilitate the media data interface to call them through the third capability. In this regard, the embodiments of the present application do not make specific limitations. In this way, each application in the application layer only needs to call the corresponding file processing function interface and transmit the passed-in parameters to it, and the OS can start the corresponding file processing function for the application, which simplifies the application operation and can also ensure the consistency of the effects of starting the file processing function for each application.

[0101] The kernel layer is the layer between hardware and software and can be compatible with different hardware devices. The models or types of processing chips used by different electronic devices may be different, that is, there are differences in hardware. The kernel layer in the embodiments of the present application can be used to support the processing of hardware, drivers, and algorithms. The kernel layer at least includes input / output IO drivers, storage drivers, underlying algorithm processing, etc.

[0102] Through each interface module in the framework layer provided by this application, the unified media file management mentioned above can be achieved. Exemplarily, after an application calls the file processing function interface corresponding to the file processing function and inputs the corresponding incoming parameters, the media data interface can be run in the framework layer. The media data interface selects and runs a third-party capability from multiple third-party capabilities that supports the file processing function interface; the third-party capability selects and runs a second-party capability corresponding to the file processing function in the service layer. Furthermore, the unified management capability of the file life cycle can be provided, and corresponding interface capabilities can be provided according to the user's needs, realizing the processing of file generation, use, storage, extinction, etc., and meeting the user's file processing needs in different scenarios.

[0103] Based on the above Figure 2 Taking the first application calling the first function as an example in the software architecture shown, the calling relationships of the above-mentioned layer interfaces are described exemplarily.

[0104] Among them, the parameters passed into the first interface include one or more of the following: device name, application name of the first application, and parameters passed in by the first application. Among them, the device name and the application name of the first application can be determined by the first operating system, and the parameters passed in by the first application include parameters indicating the first function and parameter content. The parameters indicating the first function and the parameter content are in the form of key-value, where the key represents the first function, and the parameter content can also be referred to as the parameter value or value. Among them, 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. The indication information of the first media file can be understood as the storage path of the first media file (i.e., used to indicate 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 way to access the first media file, etc. The first media file can be one of multiple media files in the electronic device.

[0105] Then, the first interface can continue to call the media data interface. The parameters passed into the media data interface include: interface indication information, indication information of the first function, and the first media file or indication information of the first media file. Among them, the interface indication information is used to indicate the capability called by the media data interface among the third-party capabilities. The interface indication information and the indication information of the first media file are all or part of the parameters passed in by the first application, and / or the indication information of the first media file is determined by the first operating system.

[0106] Correspondingly, the media data interface can continue to call the third capability, and the parameters passed into the third capability include: the indication information of the first function, and the first media file or the indication information of the first media file. It can be understood that the indication information of the first media file can also be all or part of the parameters passed in by the first application, and / or the indication information of the first media file can also be determined by the first operating system.

[0107] Finally, the third capability can call one or more second capabilities to implement the first function.

[0108] Please refer to Appendix Figure 4 , Figure 4 which is a schematic diagram of the first application specifically calling the function interface provided by the embodiments of this application.

[0109] As Figure 4 shown, the first application can refer to the camera application, gallery application, music application, video application, etc. in the application layer mentioned above Figure 2 or Figure 3 . XXMode can refer to the first interface corresponding to any one of the functions mentioned above Figure 2 or Figure 3 . For example, the interfaces corresponding to functions such as the file management function interface (FileManageMode), editing function (EditMode), storage function (StorageMode), sharing function (ShareMode), etc., and MediaDataKit is the media data interface.

[0110] The user interface of the first application can present options corresponding to any one of the functions, and after detecting a user operation, it can trigger the start of a certain function, which can include performing one or more of the processes of generating, using, storing, disappearing, space management, etc. on a certain media file.

[0111] Among them, the form of the XXMode interface is XXMode(DeviceName, AppName, AppParameter, extend).

[0112] The device name (DeviceName) can be the device name of the device to which the first application that calls this interface belongs.

[0113] The application name (AppName) can refer to the name of the first application that calls the XXMode interface.

[0114] The parameters (AppParameter) passed in by the first application, including one or more parameters passed in by the first application after detecting a user operation. For example, if the user operation is a file creation operation, the parameters passed in by the first application may include file name, file owner, file permissions, file storage path, file size, file type, and so on.

[0115] The extended field (extend) can be used for the construction of embedded capabilities or differentiated capabilities.

[0116] It can be understood that the device name, application name, and extended field are optional.

[0117] After the first application calls the XXMode interface, the XXMode interface can call MediaDataKit, and the interface form of MediaDataKit is MediaDataKit(type, key, value, extend).

[0118] The type indicates the type of processing performed on the file. The type can include but is not limited to the following: general type (normal), acquisition, encoding, storage, sharing, decoding, playing, other, etc. Among them, the type can be determined according to the previous interface that calls MediaDataKit. For example, the previous interface called by a camera application is the FileManageMode interface, and the electronic device can determine that the current photo creation function is required and perform storage processing on the captured camera stream, so it is regarded as the storage type.

[0119] The indication parameter (key) of the function point is used to indicate the function point to be started. Each type can include multiple different function points. For example, for the acquisition type, there can be corresponding shooting functions, video recording functions, recording functions, and so on. The indication parameter (key) of the function point can be directly determined by the name of the previous interface that calls MediaDataKit or the AppParameter passed in MediaDataKit. For example, if the previous interface is the FileManageMode interface, the indication parameter (key) of the function point can be Create File Mode.

[0120] The value required for a function point, which is used to indicate the data required to implement the function point. For example, for the picture creation function, a picture flow is required. Among them, the value required for the function point can be obtained from the parameters (AppParameter) passed in by the first application. If some values cannot be obtained from the parameters (AppParameter) passed in by the first application, the operating system can fill in these values by itself. That is to say, the value required for the function point can include: some or all of the parameters (AppParameter) passed in by the first application, and / or, the parameters determined by the operating system.

[0121] The indication parameter (key) of the function point and the value required for the function point can form a key-value pair. That is to say, the indication parameter (key) of the function point and the value required for the function point are in a corresponding relationship. One key can correspond to one or more values. The key and value passed in MediaDataKit can include one pair or multiple pairs, such as key1, value1, key2, value2.

[0122] The extension field (extend) can be used for the construction of pre-buried capabilities or differentiated capabilities.

[0123] After the MediaDataKit interface is called, other capabilities provided by the framework layer can be called continuously according to the type. For example, if the type is encoding, the encoding capability can be called to implement the encoding of the file. If the type is storage, the storage capability can be called to implement the storage of the file. If the type is sharing, the sharing capability can be called to implement the sharing of the file. If the type is decoding, the decoding capability can be called to implement the decoding of the file. If the type is playing, the playing capability can be called to implement the playing of the file. Among them, the parameters passed in during the transfer of capabilities such as collection, encoding, storage, sharing, decoding, or playing can include: key, value, extend.

[0124] During the process of invoking any one of the capabilities such as acquisition, encoding, storage, sharing, decoding, or playing, multiple capabilities such as service generation capability, service usage capability, service storage capability, service extinction capability, space management service capability, or others can also be invoked to achieve the standardization and unification of media data. Among them, the service generation capability can be used to manage the creation of the first media file, the service usage capability can be used to manage the usage of the first media file, the service storage capability can be used to store the first media file, the service extinction capability can be used to manage the deletion and recovery of the first media file, and the space management service capability can be used to manage the storage space of the first media file. The specific methods can also refer to the relevant descriptions in the corresponding following embodiments, which will not be elaborated here in the embodiments of this application.

[0125] In some embodiments, during the process of invoking any one of the capabilities such as acquisition, encoding, storage, sharing, decoding, or playing, some of the capabilities such as service generation capability, service usage capability, service storage capability, service extinction capability, space management service capability, or others can be invoked, which can be specifically determined by the application or the first operating system.

[0126] In some embodiments, after the XX Mode interface is invoked, it can bypass MediaDataKit and directly invoke other framework layer interfaces below MediaDataKit to implement the function of starting the application.

[0127] In some embodiments, the XXMode interface can be a kit or a selector (picker). When the XXMode interface is implemented as a picker, MediaDataKit can also be correspondingly divided into multiple interfaces with more detailed functions, so that the XXMode interface can select a suitable interface from these multiple interfaces for invocation.

[0128] After the framework layer interface is invoked, it will continue to call the interfaces of the service layer and the kernel layer below to implement the corresponding file processing function.

[0129] Based on the call relationships of the above various interfaces, for example, please refer to the attached Figures 5 - 9 , Figures 5 - 9 is a schematic diagram of the call relationships of a group of first applications invoking various function interfaces provided by the embodiments of this application.

[0130] Taking the first application invoking the generation function as an example.

[0131] 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, file type. The interface indication information is used to indicate the ability to perform storage on the first media file in the third ability.

[0132] As Figure 5 shown, the first application can be a camera application. After receiving a user operation to save the currently taken photo, the first application calls the file management function interface (file manage mode) and passes the following parameters to the interface: DeviceName, AppName, key1, value1, key2, value2, extend. After the first application calls the file management function interface (file manage mode), the parameters passed by the file management function interface (file manage mode) when calling MediaDataKit include: Storage, Create File Mode, [name, owner,...], extend.

[0133] Among them, key1 can be used to indicate the start of the function point picture creation, and value1 can be the captured data stream obtained after taking a photo, that is, the data stream of the first media file, so as to create a picture, etc.

[0134] Storage is used to indicate the storage interface that MediaDataKit will call next, CreateFileMode is the started function point, and [name, owner,...] is used to indicate the parameter information of the file created this time. Among them, name is the file name and owner is the file owner. The owner can be the parameters DeviceName and AppName passed by the file manage mode interface when calling MediaDataKit. Among them, other file indication information can be passed, such as: file permissions, file storage path, file size, file type, etc.

[0135] After the FileManageMode interface calls MediaDataKit, MediaDataKit then calls the storage ability, and the parameters passed by the storage ability can include: CreateFileMode, [name, owner,...], extend.

[0136] Then, during the operation of the storage capability, one or more of the service capabilities such as generating service capabilities, using service capabilities, storing service capabilities, disappearing service capabilities, space management service capabilities, or others can be called to create photos. For example, the service capability of generating can be called to create a photo, and the storage service capability can be called to store the created photo at the storage location specified by the space management service.

[0137] Take the access function in the usage function called by the first application as an example.

[0138] In some embodiments, the first function is a file access function, the first media file is a picture, and the indication information of the first media file includes one or more of the following: file name, file owner, file storage path, picture access permission, picture access method. The interface indication information is used to indicate the capability of storing the first media data in the third capability.

[0139] 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 picture, thumbnail. The processing performed by the first function on the first media data includes: storage.

[0140] Such as Figure 6 As shown, after the gallery application detects the user's operation of accessing a picture, the gallery application can call the PhotosMode interface of the picture access function. Among them, the parameters passed by the PhotosMode interface include: DeviceName, AppName, key1, value1, key2, value2, extend.

[0141] For the specific description of the parameters passed by the PhotosMode interface, reference can be made to the relevant content above Figure 5 and will not be elaborated here.

[0142] 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 can also include the file owner, file storage path, file size, etc., which are not specifically limited in the embodiments of the present application.

[0143] Among them, Storage is used to indicate the storage interface, PhotosMode is the started function point, BigPicture is the large picture, and BigPicture is the large picture that the gallery application accesses in the large picture access mode by the user this time.

[0144] After the PhotosMode interface calls MediaDataKit, MediaDataKit can determine that the next interface to be called is the storage capability based on the parameter Storage it passes. The parameters passed by the storage capability can include: PhotosMode, [BigPicture, …], extend.

[0145] Then, during the operation of the storage capability, one or more of generating service capabilities, using service capabilities, storing service capabilities, perishing service capabilities, space management service capabilities, or others can be called to access pictures. Exemplarily, the using service capability can be called to determine whether the first application meets the access permission for the first media file. If not, the storage capability operation fails, and as a result, a failure result of starting the file access function is returned. If not, the storage capability continues to run to complete the file access function.

[0146] Take the first application calling the play function in the using function as an example.

[0147] In some embodiments, the first function is a file play function, the first media file is an 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, play mode, play duration. The interface indication information is used to indicate the capability in the third capability to perform play on the first media data.

[0148] The first application can be a music application or a video application. When the first function is the play function and the first media file is music, the processing performed by the first function on the first media file can include: playing.

[0149] As Figure 7 shown, after the music application detects the user's operation of playing music, the music application 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.

[0150] Among them, Play is used to indicate the next play interface to be called by MediaDataKit, PlayMusic is the started function point, [MusicName, size, time, …] is used to indicate the music to be played this time, where MusicName is the music name, size is the music size, and time is the music duration. The passed parameters can also include the file owner, file storage path, play mode, etc., which are not specifically limited in the embodiments of the present application.

[0151] After the PlayMode interface calls MediaDataKit, MediaDataKit then calls the playback interface. The parameters passed by the playback interface can include: PlayMusic, [MusicName, size, time, …], extend.

[0152] Then, during the operation of the playback capability, one or more of the service capabilities such as generating service capabilities, using service capabilities, storing service capabilities, perishing service capabilities, space management service capabilities, or others can be called to play music.

[0153] Take the deletion function in the first application's call to the perishing function as an example.

[0154] 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, file deletion method. The interface indication information is used to indicate the storage capability in the third capability for the first media file.

[0155] As Figure 8 shown, the first application can be a storage application such as a gallery or a file manager. After the storage application detects the user's operation of deleting a file, the storage application can call the FileManageMode interface. Then, the FileManageMode interface calls MediaDataKit, and the parameters passed by MediaDataKit include: Storage, DeleteFileMode, [name, owner, …], extend.

[0156] Among them, Storage is used to indicate the storage interface that MediaDataKit will call next, DeleteFileMode is the started function point, [name, owner, …] is used to indicate the file to be deleted this time, where name is the file name and owner is the file owner. The parameters passed can also include the file storage path, file size, file deletion method, etc., which are not specifically limited in the embodiments of the present application.

[0157] After the FileManageMode interface calls MediaDataKit, MediaDataKit then calls the storage interface, and the parameters passed by the storage interface can include: DeleteFileMode, [name, owner, …], extend.

[0158] Then, during the operation of the storage capacity, one or more of the service generation ability, service usage ability, service storage ability, service extinction ability, space management service ability, or others can be invoked to delete the first media file.

[0159] Taking the restoration function in the extinction function called by the first application as an example.

[0160] In some embodiments, the first function is a file restoration 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. The interface indication information is used to indicate the ability to perform storage on the first media file in the third ability.

[0161] Such as 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 of restoring a file, the storage application can invoke the FileManageMode interface. Subsequently, the FileManageMode interface invokes MediaDataKit, and the parameters passed by MediaDataKit include: Storage, RestoreFileMode, [name, owner,...], extend.

[0162] Among them, Storage is used to indicate the storage interface that MediaDataKit will call next, RestoreFileMode is the function point to be started, and [name, owner,...] is used to indicate the file to be restored this time, where name is the file name and owner is the file owner. The parameters passed can also include the recoverable file size, recoverable content, etc., which are not specifically limited in the embodiments of the present application.

[0163] After the FileManageMode interface invokes MediaDataKit, MediaDataKit then invokes the storage interface, and the parameters passed by the storage interface can include: RestoreFileMode, [name, owner,...], extend.

[0164] Then, during the operation of the storage capacity, one or more of the service generation ability, service usage ability, service storage ability, service extinction ability, space management service ability, or others can be invoked to delete the first media file.

[0165] It can be understood that the invocation methods of other related function interfaces can also refer to the relevant descriptions of the embodiments shown above Figures 5 - 9 and will not be elaborated in the embodiments of the present application.

[0166] Based on the above call relationships for different interfaces, the following will combine the OS of the electronic device provided in the above Figure 2 illustrated embodiment to introduce the implementation of file processing exemplary based on the third ability in different application scenarios. Among them, the file mentioned in the embodiments of the present application can be understood as the media file mentioned in the above embodiments.

[0167] Regarding the generation of files

[0168] Each application can create, use, delete files, etc. during operation, but the embodiments of the present application can standardize and control the file creation process of each application based on the generation ability of the OS. For example, when the application starts the file creation function, the input parameters of the file creation function interface include the file owner information, which is used to indicate the file source, and can solve problems such as unclear file source and chaotic storage from the source.

[0169] That is, when the electronic device creates a file, it can determine one or more of the file owner (owner), file name, file permissions, file storage path, file size, file type, etc. of the first media file based on the parameters passed in by the first application. Among them, the file owner (owner), file permissions, and file storage path can better assist the unified media framework in standardizing the management of files.

[0170] Among them, the file owner is used to record the application that created the file. In the scenario of multi-device interconnection, the device where the application is located when the file is created can also be recorded. The file owner includes the application identification information of the application that created the file and the device identification of the device to which the application belongs when the file is created. For example: the first application identification and the first electronic device identification. It should be noted that the first application can refer to system applications, third-party applications running on the electronic device, and can also refer to application services and system services running on the electronic device. For example: mini-program services relying on the system platform on the electronic device, various mini-program services relying on third-party application platforms (such as Alipay, WeChat), etc. In this regard, the embodiments of the present application do not make specific limitations.

[0171] Please refer to the appendix Figure 10 , Figure 10 which is a schematic diagram of a file owner provided by the embodiments of the present application. As Figure 10As shown, when creating a file, standardize the unique file owner of the file. 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). It can be seen from this that even though both File 1 and File 2 are created by Application B, the electronic device can quickly distinguish the source of the file based only on the owner information. Another example: if File 3 is created by Service A on Device A, then the owner of File 3 is: (Device A + Service A); it can be seen from this that even though both File 1 and File 3 are created on Device A, the electronic device can also quickly distinguish the source of the file based only on the owner information.

[0172] When creating files, standardize the owner of all files of the electronic device, and then use this owner as an input parameter to call different file processing functions throughout the life cycle of the file, which is convenient for the unified media framework to trace the source when processing files, and directly avoid the problem of unclear source of file creation on the unified media framework. Moreover, the owner can also be used as a cache record, and all operations of generating files in the application can be recorded in the cache of the application for system-level security control, and all generations are traceable. When the file ownership checked is unclear, it can also be reversed to locate the illegal application so that the electronic device can delete it. For example: if the permission for the file created by this application is shareable with other applications, then after this application is deleted, all related files need to be deleted. At this time, by traversing the owners of the files in the electronic device, a complete deletion can be achieved, and the backup scenario is similar, and application-level control can be achieved.

[0173] In some embodiments, the file storage path may be a relative path or an absolute path of the file storage location, used to indicate the storage location of the file in the electronic device. Among them, files with the same file owner in the first electronic device are sequentially created and stored in the same root folder.

[0174] It is understandable that an application can only create a folder named after its own application in the first electronic device, and all subsequent files or folders can only be created under the root folder directory. Moreover, the files under the root directory can be classified or sorted according to an attribute such as creation time, file name, file size, etc. This method can facilitate the electronic device to manage the files created by each application based on the owner, and the number of root folders at one layer is greatly controlled. The form of the files under each root folder can be recursively deduced according to this requirement. When the number of root folders is too large, the space management capability can also be called regularly to cluster and optimize them to reduce the number of root files. It can also be understood that the determination of the file storage location can also be controlled by the space management capability, and the embodiments of the present application do not make specific limitations.

[0175] In some embodiments, the file permission can be used to record the usage permission for creating the file, and the usage permission can include access permission, play permission, edit permission, and share permission. Each permission can be refined into different types of permissions according to the folder type, application type, and file type to which it belongs, and this embodiment of the application does not make specific limitations on this.

[0176] Therefore, the creation of service management files and setting the file owner information can avoid the generation of files of unknown origin on electronic devices, the standardization of file storage locations can avoid confusion in the stored file directories, and the restriction of file usage permissions can solve problems such as excessive permissions when processing files, thereby achieving standardized, unified and convenient management and control of files.

[0177] Use of files

[0178] The use service can manage the use of files to control the use permissions of the first media file; or, based on the usage method corresponding to the parameters passed in by the first application, determine whether the first application meets the use permissions of the first media file and return the use result. The use permissions include one or more of the following: access permissions, playback permissions, editing permissions, sharing permissions, etc.

[0179] The use of files is described by taking the first application, the second application, and the third application with different permissions accessing the file after the second application creates the file as an example. Figures 11A - 11D , Figures 11A - 11D This is a set of user interface diagrams provided in an embodiment of the present application.

[0180] Figure 11AExemplarily shown is the user interface 10 displayed by the electronic device 100 when running a second application, which is an application that can call the camera function, such as a camera, a beauty camera, WeChat, Taobao, etc. The user interface 10 can be a photo preview page after taking a photo with the second application. Among them, after taking a photo with the second application, the taken photo can be previewed so that the user can determine whether to save the currently captured photo. When the user clicks the save photo option 101, the save photo option 101 can initiate a file creation function to complete the creation of the photo. At this time, the created photo can be set to have access permissions for the second application and system applications, and other third-party applications do not have access permissions.

[0181] Figure 11B Exemplarily shown is the user interface 20 displayed by the second application after completing the photo creation function. The picture access option 102 in the user interface 10 is the thumbnail of the created photo. The user can click on the picture access option 102, and the OS can initiate a file access function so that the user can access the currently captured photo.

[0182] Figure 11C Exemplarily shown is the user interface 30 displayed by the electronic device 100 when running a first application, which is a gallery-like application. The user interface 10 can be a preview page of the first application. Among them, the preview page of the first application can be used to display the photos created after taking photos by various camera applications, such as the photo 103 created by the second application. The user can click on the photo 103 to initiate a file access function to access the photo created by the second application.

[0183] Figure 11D Exemplarily shown is the user interface 40 displayed by the electronic device 100 when running a third application, which is the third application. The user interface 10 can be a preview page for the third-party application to call the gallery. Among them, since the third-party application does not have permission to access the photo 103 created by the second application, when the third-party application calls the preview page of the gallery and accesses the photos that the third-party application can access, the above-mentioned Figure 11C photo 103 created by the second application does not exist.

[0184] It can be understood that the first operating system can determine the usage permissions of the file by using capabilities when creating the file, so as to control subsequent operations such as access, playback, editing, and sharing of the file by other applications. The usage permissions can include access permissions, playback permissions, editing permissions, and sharing permissions. Please refer to Figure 12 , Figure 12 which is a schematic diagram of the refinement of usage permissions provided by an embodiment of the present application. As Figure 12As shown, each different usage permission can be refined into different types of permissions according to the folder type it belongs to, the application type it belongs to, the file type, or the application scenario, etc. For example, the sharing permission can be shared for different application types, and the playback permission can include high-resolution playback, low-resolution playback, and so on. Another example: the access permission can be accessed for different application scenarios.

[0185] It should also be noted that this usage ability can also determine whether the first application meets the usage permission of the first media file according to the usage method corresponding to the parameter passed in by the first application, and return the corresponding usage result. After the first application starts the first function for the first media file, if the usage ability determines that the usage method based on the passed parameter meets the usage permission of the first application for the first media file, the electronic device can complete the first function; if the usage ability determines that the usage method based on the passed parameter does not meet the usage permission of the first application for the first media file, the electronic device can return the result of the failure to start the first function; or the electronic device can apply to the second application for the usage permission of the first application to complete the first function. Among them, it can be understood that the usage method can be accessed in the form of thumbnail, preview, large picture, or others. For example: the usage method corresponding to the parameter passed in by the first application is to access the first media file created by the second application according to the large picture, but the first application only has the access method of previewing the first media file.

[0186] In some other embodiments, this usage ability can also set the corresponding usage permission for the application. Exemplarily, file management applications can have access permissions for all files, and third-party applications only have access permissions for some files, etc. For example, only have access permissions for pictures in the gallery and do not have access permissions for audio.

[0187] Therefore, although each application on the current electronic device can access the internal card, it cannot create and modify the files in the internal card at will. For example: the files created by one application cannot be accessed, modified, or shared at will by another application that does not meet the permissions. The electronic device controls the permissions of each application, and thus can improve the file usage efficiency. Through means such as permission management, type management, and result management, the standardized, unified, and convenient control of files is realized.

[0188] In addition, the usage ability can also support file search in the electronic device. For example, it can quickly query and search based on some existing parameters such as file owner, file name, file time, file location, and main content of the file. The embodiments of this application do not make specific limitations on this.

[0189] Regarding the storage of files

[0190] The storage service can store the first media file in the corresponding storage location according to the parameters passed in by the first application and return the storage result; or, back up or migrate the first media file, thereby supporting end-to-end collaboration and end-cloud collaboration.

[0191] It can be understood that when creating a file, 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 the storage location.

[0192] In addition, please refer to the attached Figure 13 , Figure 13 which is a schematic diagram of the capabilities supported by a storage service provided by an embodiment of the present application. As Figure 13 shown, the storage service mainly supports file backup, migration, end-to-end collaboration, end-cloud collaboration, etc. The storage service can provide a unified registration ability for backup and migration, that is, only the applications registered in the storage service can back up or migrate the files created by them, and other applications cannot perform backup or migration.

[0193] Correspondingly, in the use of backup and migration, the application can decide which files can be backed up or migrated, making the management of files on the electronic device more refined. It can be based on the file type or the folder, and the specifications can be customized.

[0194] Exemplarily, in the scenario of multi-end collaboration, the storage of the current device (including local devices and distributed devices), cloud server storage, home storage (storage hard disk), etc. can be jointly operated to ensure the full collaborative utilization of the storage space. Generally, it can be determined whether a file is stored on its corresponding device through the storage parameters of the file. The storage parameters can include file storage location, file storage size, file name, file storage path, etc. If the value on the device corresponding to the file storage location is not -1, it can indicate that the file is stored on the device.

[0195] Furthermore, since any application can apply for memory permissions to create files randomly, there will be a large number of junk files on the electronic device, and the user cannot perceive the source and does not know who the owner of the file is. Moreover, it will also lead to chaos in the file storage directory. Users often find various picture files of unknown origin in the photo gallery, etc.

[0196] In contrast, the OS in the embodiment of the present application can provide a unified file creation ability so that the files created by each application conform to a unified specification, which is convenient for management.

[0197] Regarding the demise of files

[0198] The extinction service capability can delete or restore the first media file according to the parameters passed in by the first application. Exemplarily: The extinction service capability can delete the first media file in a way of complete deletion according to the parameters passed in by the first application, and this way cannot restore the deleted file; it can also delete the first media file in a way of deletable and recoverable deletion according to the parameters passed in by the first application, and this way can restore the deleted file; it can also delete the first media file in a way of comprehensive deletion according to the parameters passed in by the first application, and this way can also delete the files backed up and copied by all applications for this file at the same time. For example: After the gallery deletes picture A, picture A in the WeChat chat record will also be deleted.

[0199] It should be noted that in some other embodiments, the application can also set the relevant parameters of the deletion method of the file when the file is created. For example: When the application calls the file creation function, the indication information of the first media file can pass parameters such as the parameters supporting the deletion method of the file, or the first operating system confirms the deletion method supported by the file. Exemplarily, if the deletion method of the file is set to support deletable and recoverable when calling the file creation function, then the file can be deleted in a deletable and recoverable way when calling the file deletion function and so on. If the deletion method of the file is set to not support deletable and recoverable when calling the file creation function, then the file cannot be deleted in a deletable and recoverable way when calling the file deletion function and so on.

[0200] In some embodiments, when the file is deleted in a deletable and recoverable way, when the application calls the file restoration function, the file indication information can pass one or more of the following parameters: file name, file owner, recoverable file size, recoverable content, etc. Among them, the recoverable file size refers to the size that the file can be restored after being deleted, and can also be used as the basis for complete restoration. It can be understood that if the file is damaged during the deletion process, the recoverable file size will be smaller than the size of the original file, which means that only part of the file can be restored. The recoverable content refers to the content cached by the file, which is the content restored to the real file.

[0201] In addition, it can be understood that according to the different types of deleted files, it can be divided into active deletion and passive deletion. Among them, please refer to the appendix Figure 14 , Figure 14 which is the schematic diagram of the restoration process corresponding to different deletion methods provided by the embodiments of the present application.

[0202] Such as Figure 14As shown, the deletion service can be divided into active deletion and passive deletion. Among them, active deletion refers to the behavior of the user initiating the deletion of a file, such as deleting an unsatisfactory photo in the photo gallery, etc. Passive deletion is mainly some system behaviors and may also be some misoperations. For example, based on the concept of space management, a duplicate file is deleted; a file is deleted because it is illegal during file clustering optimization, or the file is abnormally empty and is deleted, etc. The embodiments of this application do not make specific limitations on this.

[0203] In this regard, for different deletion methods, the deletion service can correspondingly provide different recovery methods. Among them, a recycle bin application or system can call the recovery service and perform recovery according to the capabilities provided by the recovery service; at this time, active recovery can be performed on the specific deleted file, and some files cached in the current recovery service can also be recovered as a whole, that is, one-key recovery; partial recovery can also be performed based on the file owner information of the deleted file according to the application, that is, application-level recovery, etc. The embodiments of this application do not make specific limitations on the deletion methods and recovery methods.

[0204] Regarding the space management of files

[0205] 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; 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.

[0206] Among them, the storage space of the file can include at least one of the following spaces: storage in local storage space (such as local device storage and distributed device storage, etc.), cloud storage space (such as cloud server storage, etc.), and peripheral storage space (such as storage hard disks, etc.).

[0207] The space management capability can store files in the corresponding storage space according to different storage priority rules. In terms of the priority classification of file access efficiency, the local storage space is superior to the peripheral storage space, which is superior to the cloud storage space. In terms of the requirements for using the storage space, the cloud storage space is superior to the peripheral storage space, which is superior to the local storage space. In this regard, the embodiments of this application do not make specific limitations on the specific division of the storage priority of the storage space.

[0208] It can be understood that since files can be divided into hot and cold data, files with a usage frequency exceeding the preset threshold are hot data files, and files with a usage frequency not exceeding the preset threshold are cold data files. Hot data should give priority to access efficiency, so it should be on this device, and cold data should give priority to space usage, so it should be in the cloud space.

[0209] In addition, in some other embodiments, when the free storage space in the storage space is less than a preset threshold, the space management capability can also deduplicate or compress the files stored in the storage space. Herein, deduplication means removing duplicate files, and compression means compressing files.

[0210] Exemplarily, if there are two identical files in an electronic device, for example, File 1 and multiple copies of File 1, when the remaining free storage space in the storage space is less than the preset threshold, the multiple copy files can be deleted, and only one file is retained. Another example: When File 1 already exists in the electronic device, the space management capability can control the application to avoid creating File 1 repeatedly and can directly use the currently saved File 1, thereby ensuring the efficient use of the storage space.

[0211] Exemplarily, there may be many similar blocks or similar frames in pictures and videos among media files. In this regard, the space management capability can compress the existing pictures or videos to reduce the overall file size in the electronic device.

[0212] For example: Please refer to the appendix Figure 15 , Figure 15 which is a compression schematic diagram provided by an embodiment of the present application. As Figure 15 shown, for a video file, there are two adjacent similar picture files, namely the Nth frame and the (N + 1)th frame; the two frames of pictures are respectively divided into 4 parts. Among them, the same parts are M2, M3, and M4, which can be reused, and the different part is M1, which cannot be reused. Therefore, for the above two frames, there can be 6 small parts in the reused part and 2 parts in the different part. Originally, it needed to occupy 8 small parts of space, but now it only needs to occupy 8 parts. Currently, this is only the case of two frames. If the number of frames increases, the common part may become smaller. Therefore, a dynamic parameter value A can be set. This value refers to the number of frames compressed together. For example: when this value is 5, 5 frames are put together for compression calculation. A dynamic parameter B can also be set. The value of B represents how many blocks each frame is divided into. For example: B = 20 means that the current frame is divided into 20 identical modules. The larger this value is, the finer the division will be and the better the compression effect will be.

[0213] Therefore, it can be understood that the above video compression method can be understood as taking advantage of the similarity of data between adjacent multiple frames of images, so the multiple frames of images can be unified to reduce the storage space of the video. In some embodiments, the space management capability can also compress each frame of the video to reduce the overall storage space of the video. Exemplarily, the space management capability can directly perform intra-frame compression on each frame of the video, that is, the information of the pixel points in each frame of the image can be interpolated from the information of adjacent pixel points. Therefore, when compressing the image, only the information of some pixel points is retained to obtain the compressed image, thereby reducing the overall storage space size of the video.

[0214] In other embodiments, in order to ensure the playback quality of the video, different compression methods can be performed on different regions of each frame of the video. For a video, each frame of the image can be divided into a key region and a non-key region. The key region can be the picture area that the user is more concerned about, such as people, moving objects, etc. The non-key region can be the picture area that the user is less concerned about, such as the background, static objects, etc. The space management capability can perform different compression methods on the non-key region and the key region of each frame respectively. Exemplarily: use intra-frame compression or residual compression methods to compress the non-key region, and use conventional inter-frame compression methods to compress the key region, etc.

[0215] Therefore, it should be noted that the space management capability in the embodiments of the present application does not specifically limit the compression method for 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 method of the file, or the type of the compressed file, etc., so as to ensure more reasonable use of the storage space without affecting the user experience.

[0216] It can also be understood that the compression trigger mechanism in the space management service can also be dynamic, which can not only provide the user with the best experience but also make full use of the device's storage space. For example: compression can be performed when a storage application calls the space management function, and compression can also be performed when the free storage space in the storage space is less than a preset threshold to ensure reasonable use of the storage space. The embodiments of the present application do not make specific limitations on this.

[0217] Based on the above Figure 2 or Figure 3 shown in the software structure diagram of each functional module and the implementation of the above file management, the process of the file management method provided by the embodiments of the present application will be introduced exemplarily. Please refer to the appendix Figures 16 - 20 , Figure 16 is a flowchart of a file management method provided by an embodiment of the present application.Figure 17 It is a schematic diagram of a user interface provided by an embodiment of the present application. Figure 18 It is a schematic diagram of the interface call relationship when starting a file access function provided by an embodiment of the present application. Figure 19 and Figure 20 It is another set of schematic diagrams of user interfaces provided by an embodiment of the present application.

[0218] As Figure 16 shown, the data management method mainly involves the following steps:

[0219] S101. The electronic device runs a first application on a first operating system and displays a first user interface of the first application.

[0220] Specifically, the electronic device runs a first operating system, a first application is installed on the first operating system, and the first operating system provides: a first interface, a media data interface, and a second capability. The first user interface displayed by the first application presents a first option corresponding to the first function.

[0221] Among them, the first application can be a third-party application, a system application, a self-developed application, etc. The first application includes program code for calling the first interface, and the first interface 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, and so on.

[0222] The first function can refer to a generation function, a usage function, a storage function, an extinction function, a space management function, and so on. For example, if the first function is a generation function, the user interface of the first application can refer to a photo-taking and saving interface, the first option can refer to a photo-saving option, the first media file can include pictures, and the first function can include the storage of pictures. In some embodiments, the first function further includes at least one of the following functions: a file creation function, a file playing function, a file deletion function, a file recovery function, a file backup function, a file migration function, a file sharing function, and a file space management function.

[0223] The first interface can be used to start the first function provided by the first application, and the first interface can be used to call the media data interface. In the embodiments of the present application, the first operating system can provide multiple first interfaces, and different first interfaces can be used to start different functions.

[0224] The media data interface is used to invoke a second capability, which includes the capability to perform one or more of the following processes on a media file: managing the creation of the first media file, managing the use of the first media file, storing the first media file, managing the deletion and restoration of the first media file, and managing the storage space of the first media file. The first media file may include one or more of the following types: text, pictures, videos, audio, and so on. For specific details about the first operating system, reference may be made to the relevant descriptions in the above embodiments.

[0225] As Figure 17 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 an option 201 for the file access function.

[0226] The first interface may be Figure 18 the AMS interface mentioned in Figure 18 The media data interface may be

[0227] mentioned the Photo Picker. Additionally, the first interface may also be one or more of the camera function interface, editing function interface, storage function interface, sharing function interface, file management function interface, and playback function interface mentioned in the above embodiments. The media data interface may also be the MediaDataKit interface mentioned in the above embodiments.

[0228] S102. In response to a first user operation on the first option, the electronic device activates the file access function and displays a second user interface.

[0229] Specifically, the first user operation on the first option can be used to trigger the activation of the first function, that is, the file access function, and display the second user interface. As Figure 19 shown, after the user clicks on the option 201 for the file access function in the first user interface shown above Figure 17 shown, such as clicking on a picture selected from the gallery, the file access function can be activated and the second user interface shown in Figure 19 shown can be displayed. The second user interface may include one or more media files.

[0230] In addition, the first user operation may be a touch operation on the touch screen or a voice command of the user, etc. The embodiments of the present application do not limit the form of this operation.

[0231] It can be understood that, as described above Figure 18As shown, after receiving the 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 a Photo Picker to initiate the file access function.

[0232] Among them, the parameters that can be passed in when invoking the AMS interface include one or more of the following: device name, application name of the first application, parameters passed in by the first application. Among them, the parameters passed in by the first application include parameters indicating the first function and parameter content. Among them, 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 the specific details of the passed-in parameters, reference can be made to the relevant content described in the above embodiments.

[0233] Among them, the Photo Picker, that is, the media data interface, can encapsulate a third capability. The third capability includes the capability to perform one or more of the following processes on the first media file: acquisition, encoding, storage, sharing, decoding, and playback. The parameters passed in when invoking the Photo Picker can include: interface indication information, indication information of the first function, and the first media file or indication information of the first media file; the interface indication information is used to indicate the 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 in by the first application, and / or the indication information of the first media file is determined by the first operating system.

[0234] It can also be understood that in addition to initiating the function by operating on the option, when the electronic device 100 does not display a screen or the first user interface of the first application does not display the option, based on the user's voice command or the operation on the physical button, the function can be initiated. For example, when the electronic device 100 does not display a screen, the electronic device 100 can detect the user's voice command "take a photo" and initiate the photo creation function of the camera application. Among them, the photo creation function can be used to perform the storage of the photo stream. Another example: when the first user interface of the first application does not display the option, the first application can identify the file access function for the photo taken at 5 o'clock today according to the information input by the user on the first user interface. Then the first application can directly invoke the AMS interface to initiate the access function to access the photo.

[0235] S103. The electronic device detects a second user operation of selecting the 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.

[0236] Specifically, when the electronic device detects a second user operation of selecting 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 through the media data interface. As described above Figure 18 As shown, after the electronic device 100 activates 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. Among them, the resource identifier can be a Uniform Resource Identifier (URI) 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.

[0237] Among them, the parameters passed in by the Photo Picker can include one or more of the following: interface indication information, indication information of the first function, and indication information of the first media file or the first media file. Among them, the indication information of the first media file can include: some or all of the parameters passed in by the first application, and / or the parameters determined by the first operating system. The interface indication information can be used to indicate the capability called by the media data interface in the third capability, and the interface indication information can be determined according to the first function.

[0238] In some other embodiments, before returning the resource identifier of the first media file through the media data interface, it is also necessary to grant the first application temporary access permission to complete the file access function for the first media file, that is, when the first media file grants access permission to the first application, it is necessary to authorize the first application to access the first media file through the media data interface. Among them, it can be authorized by the media data interface, that is, the PhotoPicker, or by the first interface, that is, the AMS interface. The embodiments of the present application do not make specific limitations on this.

[0239] 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 permission to the first application, so that the first application can access the first media file based on the resource identifier with temporary permission. The embodiments of the present application do not make specific limitations on the form of authorization.

[0240] It can be understood that the media data interface can grant temporary authorization for the first application to access the first media file after obtaining authorization from the user or the application that created the first media file. It can also be understood that the first application with temporary access rights can only access the first media file within the validity period or the number of valid times of the temporary authorization, and cannot access the first media file after the temporary access rights expire.

[0241] S104. The electronic device accesses the first media file through the first application based on the resource identifier.

[0242] Specifically, the first application in the electronic device can access the first media file based on the resource identifier. As Figure 20 shown, after the user selects the first media file from the one or more media files, the first application can access and obtain the first media file based on the returned resource identifier, and can also be displayed on the user interface of the first application.

[0243] For another example, the first application in the electronic device can access the first media file based on the resource identifier with temporary permissions.

[0244] In some embodiments, when the first application has the access right to the first media file or obtains the temporary access right to the first media file, the first media file is returned to the first application through the media data interface. That is, at this time, the media data interface can directly determine the first media file to be accessed by the first application according to the incoming parameters, and when the first application meets the access right to 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 accessing the first media file according to the resource identifier.

[0245] In some other embodiments, when the first application fails to obtain the access right or temporary access right to the first media file, a result indicating the failure to start the file access function is returned to the first application through the media data interface. Exemplarily, the first media file may be a media file created by a second application, and the second application does not open the usage right to the first media file. The method further includes: returning a result indicating the failure to start the first function to the first application; or, querying the second application to obtain the permission of the first application to complete the first function for the first media file. After starting the first function, the electronic device may determine whether it can start the first function for the first media file according to the permission of the first application. If it cannot start the first function for the first media file, a result indicating the failure to start the first function is returned to the first application; or, querying the second application to obtain the temporary access right of the first application to complete the file access function for the first media file, so that the first electronic device can perform unified management on the entire file system. The second application may be an application on the first electronic device or the second electronic device. It can be understood that the second application may be a device in communication connection with the first application, or a device that logs in to the same user electronic account.

[0246] In some embodiments, files with the same file owner in the first electronic device are sequentially stored in the same root folder. It can be seen that in this method, the electronic device provides the ability to uniformly process the files of each application through a unified data management framework, realizes the unified management of the files of each application by the electronic device, and solves the problem of chaotic directory of file storage.

[0247] It should be understood that for the specific content and beneficial effects of the file management method provided in the embodiments of the present application, reference may also be made to the relevant descriptions of the above embodiments, which will not be elaborated here.

[0248] Secondly, the following introduces the hardware structure of the electronic device involved in the embodiments of the present application. Please refer to the attached Figure 21 , Figure 21 which is a schematic structural diagram of the electronic device provided in the embodiments of the present application.

[0249] Figure 21 A schematic structural diagram of the hardware of the electronic device 100 is shown. The electronic device 100 may be the electronic device, the first electronic device or the second electronic device mentioned above.

[0250] The electronic device 100 can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, a vehicle-mounted device, a smart home device, and / or a smart city device. The embodiments of the present application do not impose special restrictions on the specific type of the electronic device.

[0251] As Figure 21 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.

[0252] It can be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than those shown, or combine certain components, or split certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0253] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.

[0254] The controller may generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching and executing instructions.

[0255] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can directly call it from the said memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0256] The electronic device 100 realizes the display function through the GPU, the display screen 194, and the application processor, etc. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. The GPU is used to execute mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.

[0257] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can adopt a liquid crystal display (LCD). The display panel can also adopt an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a mini-LED, a micro-LED, a micro-OLED, a quantum dot light-emitting diode (QLED), etc. for manufacturing. In some embodiments, the electronic device may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0258] The electronic device 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, and the application processor, etc.

[0259] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light passes through the lens and is transmitted to the camera sensor. The optical signal is converted into an electrical signal, and the camera sensor transmits the said electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise and brightness of the image. The ISP can also optimize parameters such as the exposure and color temperature of the shooting scene. In some embodiments, the ISP can be provided in the camera 193.

[0260] The camera 193 is used to capture static images or videos. An object generates an optical image through a lens and projects it onto a photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transfers the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in standard formats such as RGB and YUV. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0261] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc.

[0262] The video codec is used to compress or decompress digital videos. The electronic device 100 can support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple coding formats, such as: Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0263] The NPU is a neural-network (NN) computing processor. By learning from the biological neural network structure, such as learning from the transmission function between human brain neurons, it can quickly process the input information and can also continuously self-learn. Through the NPU, applications such as intelligent cognition of the electronic device 100 can be realized, such as: image recognition, face recognition, speech recognition, text understanding, etc.

[0264] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).

[0265] Random access memory may include static random - access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double - data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth - generation DDR SDRAM is generally called DDR5 SDRAM), etc.; non - volatile memory may include disk storage devices, flash memory.

[0266] Flash memory can be classified according to its operation principle into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc., according to the number of potential levels of storage cells into single - level cell (SLC), multi - level cell (MLC), triple - level cell (TLC), quad - level cell (QLC), etc., and according to storage specifications into universal flash storage (UFS), embedded multi - media card (eMMC), etc.

[0267] Random access memory can be directly read and written by the processor 110, and can be used to store the operating system or executable programs (such as machine instructions) of other running programs, and can also be used to store data of users and application programs, etc.

[0268] Non - volatile memory can also store executable programs and data of users and application programs, etc., and can be pre - loaded into random access memory for direct reading and writing by the processor 110.

[0269] The external memory interface 120 can be used to connect to an external non - volatile memory to expand the storage capacity of the electronic device 100. The external non - volatile memory communicates with the processor 110 through the external memory interface 120 to implement the data storage function. For example, files such as music and videos are saved in the external non - volatile memory.

[0270] The microphone 170C, also known as a "microphone" or "transmitter", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak close to the microphone 170C with their mouth to input the sound signal into the microphone 170C. The electronic device 100 may be provided with at least one microphone 170C. In some other embodiments, the electronic device 100 may be provided with two microphones 170C, which can not only collect sound signals but also implement a noise reduction function. In some other embodiments, the electronic device 100 may also be provided with three, four or more microphones 170C, which can collect sound signals, reduce noise, identify the sound source, and implement functions such as directional recording.

[0271] In the embodiments of the present application, the internal memory 121 is used to store the computer program for implementing the shooting method provided by the embodiments of the present application, and the processor 110 is used to execute the computer program to implement the shooting method provided by the embodiments of the present application. For example, the processor 110 can generate a basic quality map and a full quality map successively in the segmented shooting process, and can also be used to manage the input data stream and output data stream of the pipeline, etc.

[0272] It should be understood that each step in the above method embodiments can be completed by the integrated logic circuit of the hardware in the processor or the instructions in the form of software. The method steps disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by the hardware processor, or executed and completed by the combination of the hardware and software modules in the processor.

[0273] The present application also provides an electronic device. A first operating system runs on the first electronic device, and a first application is installed on the first operating system. The first operating system provides: a first interface, a media data interface, and a second capability; the first application includes program code for calling the first interface. The first interface is used to start the 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 capability 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, managing the storage space of media files. The electronic device includes: a memory, a processor, and a computer program stored on the memory. The processor executes the computer program to implement the method executed by the electronic device in any of the above embodiments.

[0274] The embodiments of the present application further provide a computer-readable storage medium. The computer program includes a first operating system, and a first application is installed on the first operating system. The first operating system provides: a first interface, a media data interface, and a second capability; the first application includes program code for calling the first interface. The first interface is used to start the 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 capability 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.

[0275] The embodiments of the present application further provide a computer program product. The computer program product includes a computer program. The computer program includes a first operating system, and a first application is installed on the first operating system. The first operating system provides: a first interface, a media data interface, and a second capability; the first application includes program code for calling the first interface. The first interface is used to start the 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 capability 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] It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the present application is not limited by the described action sequence, because according to the present application, certain steps may be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the present application.

[0277] In several embodiments provided by the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the above-mentioned unit division is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical or other form.

[0278] The units described above as separate components may or may not be physically separated. 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 according to actual needs to achieve the purpose of the solution of this embodiment.

[0279] In addition, each functional unit in the embodiments of the present application can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.

[0280] If the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of this 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 enable a computer device (which can be a personal computer, a server, or a network device, etc., specifically, the processor in the computer device) to execute all or part of the steps of the above methods in the various embodiments of the present application. Among them, the aforementioned storage medium can include: USB flash drives, mobile hard disks, magnetic disks, optical discs, read-only memory (ROM), or random access memory (RAM), etc., various media that can store program codes.

[0281] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present application.

Claims

1. A file management method, characterized in that, The method is applied to a first electronic device on which a first operating system runs. A first application is installed on the first operating system. The first operating system provides: a first interface, a media data interface, and a second capability. The first application includes program code for invoking the first interface. The first interface is used to start a first function provided by the first application. The first interface is used to invoke the media data interface. The media data interface is used to invoke the second capability. The second capability includes the ability to perform one or more of the following processes on the media file: manage the creation of the media file, manage the use of the media file, store the media file, manage the deletion and recovery of the media file, and manage the storage space of the media file. The method includes: Run a first application on the first operating system and display a first user interface of the first application. The first user interface presents a first option corresponding to the first function. The first function includes a file access function. In response to a first user operation on the first option, start the file access function and display a second user interface, which includes one or more media files. Detect a second user operation of selecting a first media file from the one or more media files, and return a resource identifier of the first media file to the first application through the media data interface. Access the first media file based on the resource identifier through the first application.

2. The method according to claim 1, wherein Before returning the resource identifier of the first media file through the media data interface, it further includes: Grant the first application temporary access permission to complete the file access function for the first media file.

3. The method according to claim 1, characterized in that, The method further includes: When the first application has access permission to the first media file or obtains temporary access permission to the first media file, return the first media file to the first application through the media data interface.

4. The method according to claim 2 or 3, characterized in that, The method further includes: When the first application does not obtain access permission or temporary access permission to the first media file, return a result indicating that the file access function fails to start to the first application through the media data interface.

5. The method according to any one of claims 1 to 4, characterized in that, The parameters passed into the first interface include one or more of the following: device name, application name of the first application, and parameters passed in by the first application. Among them, the parameters passed in by the first application include a parameter indicating the first function and parameter content. The parameter content includes one or more of the following: description information of the first function, the first media file, and indication information of the first media file.

6. The method according to claim 5, wherein The media data interface encapsulates a third capability. The third capability includes the ability to perform one or more of the following processes on the first media file: collection, encoding, storage, sharing, decoding, and playing. The parameters passed into the media data interface include: interface indication information, indication information of the first function, and the first media file or indication information of the first media file. The interface indication information is used to indicate the capabilities invoked by the media data interface in the third capabilities. The indication information of the first media file is all or part of the parameters passed in by the first application, and / or the indication information of the first media file is determined by the first operating system.

7. The method according to any one of claims 1-6, characterized in that, The first function further includes at least one of the following functions: file creation function, file playback function, file deletion function, file recovery function, file backup function, file migration function, file sharing function, file space management function.

8. The method according to any one of claims 5-7, wherein The first function includes a file creation function. The first media file is a data stream. The indication information of the first media file includes one or more of the following: file name, file owner, file usage permission, file storage path, file size, file type. The interface indication information is used to indicate the capability to perform storage on the first media file in the third capabilities; Or, The first function includes the file access function. The first media file is a picture. The indication information of the first media file includes one or more of the following: file name, file owner, file storage path, picture access permission, picture access method. The interface indication information is used to indicate the capability to perform storage on the first media data in the third capabilities; Or, The first function includes a file playback function. The first media file is audio or video. The indication information of the first media file includes one or more of the following: file name, file owner, file size, playback method, playback duration. The interface indication information is used to indicate the capability to perform playback on the first media data in the third capabilities; Or, The first function includes a file deletion function. The indication information of the first media file includes one or more of the following: file name, file owner, file storage path, file size, file deletion method. The interface indication information is used to indicate the capability to perform storage on the first media file in the third capabilities; Or, The first function includes a file recovery function. The indication information of the first media file includes one or more of the following: file name, file owner, recoverable file size, recoverable content. The interface indication information is used to indicate the capability to perform storage on the first media file in the third capabilities.

9. The method according to any one of claims 1-8, characterized in that The second capability includes: service generation capability, The service generation capability is used to create the first media file and set one or more of the following fields for the first media file when creating the first media file: file owner, file name, file storage path, file usage permission, or file attribute. The first media file is one of text, picture, audio, or video.

10. The method according to claim 9, wherein Files with the same file owner in the first electronic device are stored in the same root folder in sequence.

11. The method according to any one of claims 1-10, characterized in that, The second capability includes: service usage capability, The service usage capability is used to control the usage rights of the first media file; or, according to the usage mode corresponding to the parameters passed in by the first application, determine whether the first application meets the usage rights of the first media file and return a usage result, where the usage rights include one or more of the following: access right, playback right, editing right, sharing right.

12. The method according to any one of claims 1-11, characterized in that, The second capability includes: a demise service capability, The demise service capability is used to delete or restore the first media file according to the parameters passed in by the first application.

13. The method according to any one of claims 1 to 12, characterized in that, The second capability includes: a storage service capability, The storage service capability is used to store the first media file in a corresponding storage location according to the parameters passed in by the first application and return a storage result; or, back up or migrate the first media file.

14. The method according to any one of claims 1-13, characterized in that, The second capability includes: a space management capability, The space management capability is used to perform one or more of the following: manage the storage space of the first media file; set the storage location of the first media file in the storage space; when the free storage space in the storage space is less than a preset threshold, deduplicate or compress the files already stored in the storage space.

15. An electronic device, characterized in that, A first operating system runs on the first electronic device, and a first application is installed on the first operating system. The first operating system provides: a first interface, a media data interface, and a second capability; the first application includes program code for invoking the first interface, the first interface is used to start the first function provided by the first application, the first interface is used to invoke the media data interface, and the media data interface is used to invoke the second capability. The second capability includes the ability to perform one or more of the following processes on the media file: manage the creation of the media file, manage the usage of the media file, store the media file, manage the deletion and restoration of the media file, and manage the storage space of the media file; The electronic device includes: a memory, a processor, and a computer program stored on the memory. The processor executes the computer program to implement the method according to any one of claims 1-14.

16. A computer-readable storage medium, characterized in that, A computer program is stored thereon, and the computer program 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 for invoking the first interface, the first interface is used to start the first function provided by the first application, the first interface is used to invoke the media data interface, and the media data interface is used to invoke the second capability. The second capability includes the ability to perform one or more of the following processes on the media file: manage the creation of the media file, manage the usage of the media file, store the media file, manage the deletion and restoration of the media file, and manage the storage space of the media file; When the computer program is executed by the processor, it implements the method according to any one of claims 1-14.

17. A computer program product, characterized in that, The computer program product includes a computer program, the computer program includes a first operating system, a first application is installed on the first operating system, and the first operating system provides: a first interface, a media data interface, and a second capability; the first application includes program code for invoking the first interface, the first interface is used to start a first function provided by the first application, the first interface is used to invoke the media data interface, the media data interface is used to invoke the second capability, and the second capability includes the ability to perform one or more of the following processes on the media file: manage the creation of the media file, manage the use of the media file, store the media file, manage the deletion and recovery of the media file, and manage the storage space of the media file; When the computer program is executed by a processor, it implements the method according to any one of claims 1-14.

Citation Information

Cited By

  • File management method and related device

    WO2025148909A1