WO2024114344A1 - 一种文件管理方法及电子设备 - Google Patents

一种文件管理方法及电子设备 Download PDF

Info

Publication number
WO2024114344A1
WO2024114344A1 PCT/CN2023/131103 CN2023131103W WO2024114344A1 WO 2024114344 A1 WO2024114344 A1 WO 2024114344A1 CN 2023131103 W CN2023131103 W CN 2023131103W WO 2024114344 A1 WO2024114344 A1 WO 2024114344A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
electronic device
external storage
storage device
recycle bin
Prior art date
Application number
PCT/CN2023/131103
Other languages
English (en)
French (fr)
Inventor
颜宏
肖翰
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2024114344A1 publication Critical patent/WO2024114344A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • G06F3/04817Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance using icons
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04842Selection of displayed objects or displayed text elements

Definitions

  • the present application relates to the technical field of electronic equipment, and in particular to a file management method and electronic equipment.
  • electronic devices can establish communication connections with external storage devices in a variety of ways. Depending on the type of external storage device and electronic device, the way in which the electronic device establishes a connection with the external storage device is also different.
  • the electronic device as a computer as an example, if the external storage device is a USB flash drive, the computer can establish a connection through the USB port of the USB flash drive; if the external storage device is an external device such as a mobile phone or tablet computer with a USB interface, the computer can establish a connection with these external devices through a USB cable; if the external storage device is a smart terminal (mobile phone, tablet computer, smart TV, smart wearable device), the computer can establish a connection with the smart terminal through screen collaboration technology.
  • the files stored in the external storage device can be managed.
  • the current file management solutions are relatively simple and the user experience is poor.
  • the present application provides a file management method and an electronic device, which are used to improve the flexibility of file management, thereby improving user experience.
  • an embodiment of the present application provides a file management method, which can be applied to a communication system including an electronic device and an external storage device.
  • the method comprises the following steps:
  • the electronic device After the electronic device establishes a connection with the external storage device, the electronic device displays an icon of a first file stored in the external storage device in a first window on a display screen; when the electronic device detects a first operation, the icon of the first file is not displayed in the first window; wherein the first operation is used to delete the first file; when the electronic device detects a second operation, a recycle bin window containing the icon of the first file is displayed on the display screen; wherein the second operation is used to open the recycle bin of the electronic device.
  • the icon of the first file can be displayed in the recycle bin window of the electronic device, thereby reminding the user that the first file has been deleted.
  • This method can improve the flexibility of electronic device file management and improve user experience.
  • the electronic device may also not display the icon of the first file in the recycle bin window, and display the icon of the first file in the first window; wherein the third operation is used to restore the first file.
  • the user can restore the deleted first file of the external storage device through the recycle bin window displayed on the electronic device, thereby further improving the flexibility of file management of the electronic device and the user experience.
  • the electronic device detects the second operation and displays a Recycle Bin window that does not contain an icon of the first file on the display screen; when the electronic device is connected to the external storage device again, the electronic device detects the second operation and displays a Recycle Bin window containing an icon of the first file on the display screen.
  • the recycle bin window of the electronic device no longer displays the first deleted file of the external storage device, and when the external storage device is connected to the electronic device again, the recycle bin window of the electronic device can display the first file again. In this way, it can be ensured that each time the external storage device is connected to the electronic device, the recycle bin window of the electronic device can display the deleted files of the external storage device, so as to prompt the user and facilitate the user to manage these deleted files.
  • the electronic device after the electronic device establishes a connection with the external storage device, stores the external storage device.
  • a virtual recycle bin of a storage device is mapped to the recycle bin; wherein the virtual recycle bin is a hidden system folder created for the external storage device; when the electronic device detects the first operation, it sends a file deletion instruction to the external storage device; wherein the file deletion instruction is used to instruct the external storage device to delete the first file; after the external storage device receives the file deletion instruction from the electronic device, according to the file deletion instruction, it modifies the file attribute of the first file from a default value to deleted, and creates first link information in the virtual recycle bin; wherein the first link information is used to indicate the first file.
  • the virtual recycle bin only saves the link information of the deleted file, and does not need to save the deleted file. Therefore, the virtual recycle bin does not actually occupy a large storage space of the external storage device.
  • creating the first link information in the virtual recycle bin can facilitate the external storage device to find the first file through the first link information later.
  • a Recycle Bin window containing an icon of the first file is displayed on the display screen, including: when the electronic device detects the second operation, a Recycle Bin window containing an icon of at least one deleted file is displayed on the display screen; wherein the at least one deleted file contains a file indicated by at least one link information in the virtual Recycle Bin, and the at least one link information contains the first link information; and the at least one deleted file contains the first file.
  • the recycle bin window can display icons of files indicated by all link information in the virtual recycle bin.
  • the external storage device may also delete the media information of the first file in the media library according to the file deletion instruction.
  • This design can prevent the media library from scanning the file when performing file scanning, thereby ensuring that the user interface of the external storage device does not display the first file.
  • the electronic device when it detects the third operation, it can also send a file recovery instruction to the external storage device; wherein the file recovery instruction is used to instruct the external storage device to restore the first file; after the external storage device receives the file recovery instruction from the electronic device, it restores the file attributes of the first file to the default value according to the file recovery instruction, and deletes the first link information in the virtual recycle bin.
  • the user can restore deleted files in the external storage device by operating the electronic device.
  • the external storage device is a smart terminal device
  • the electronic device establishes a connection with the external storage device, including: the electronic device establishes a wireless communication connection with the external storage device through short-range wireless communication technology. Based on this, after the electronic device establishes a connection with the external storage device, the electronic device can establish a device collaboration channel with the external storage device through the wireless communication connection; the electronic device receives the screen projection data from the external storage device through the device collaboration channel; the electronic device displays the first window on the display screen according to the screen projection data; wherein the first window is the screen window currently displayed by the external storage device.
  • the user can manage files on the external storage device by operating the electronic device.
  • the electronic device may map the virtual recycle bin of the external storage device to the recycle bin through the following steps:
  • the electronic device generates a file management instruction according to the media transfer protocol MTP; wherein the file management instruction is used to instruct the external storage device to mount the virtual recycle bin as a virtual disk of the electronic device; the electronic device sends the file management instruction to the external storage device through the device collaborative channel according to the network control mode NCM technology; the external storage device receives the file management instruction from the electronic device through the device collaborative channel according to the NCM technology, and mounts the virtual recycle bin as a virtual disk of the electronic device according to the file management instruction; the electronic device maps the virtual recycle bin to the recycle bin through a disk management program.
  • MTP media transfer protocol
  • the electronic device and the external storage device can complete the transmission of MTP messages through the NCM technology, and then map the virtual recycle bin of the external storage device to the recycle bin of the electronic device.
  • the electronic device may send a file deletion instruction to the external storage device when the first operation is detected through the following steps:
  • the electronic device When the electronic device detects the first operation, the electronic device generates a file path request according to the MTP; according to the NCM technology, The file path request is sent to the external storage device through the device collaborative channel; wherein the file path request is used to request the storage path of the first file; the external storage device receives the file path request from the electronic device through the device collaborative channel according to the NCM technology; obtains the storage path of the first file according to the file path request, and generates a file path response including the storage path of the first file according to the MTP; sends the file path response to the electronic device through the device collaborative channel according to the NCM technology; the electronic device receives the file path response from the external storage device through the device collaborative channel according to the NCM technology; generates a file deletion instruction including the storage path of the first file; the electronic device sends the file deletion instruction to the external storage device through the device collaborative channel.
  • the electronic device can complete the transmission of MTP messages through NCM technology, thereby obtaining the storage path of the first file from the external storage device, and then send a file deletion instruction containing the storage path of the first file to the external storage device to instruct the external storage device to perform a deletion operation on the first file.
  • the electronic device may send a file recovery instruction to the external storage device when the third operation is detected in the recycle bin window through the following steps:
  • the electronic device When the electronic device detects the third operation in the recycle bin window, the electronic device generates a file information request according to the MTP; and according to the NCM technology, sends the file information request to the external storage device through the device collaborative channel, wherein the file information request is used to request the storage path and file name of the first file indicated by the first link information; the external storage device receives the file information request from the electronic device through the device collaborative channel according to the NCM technology; determines the storage path and file name of the first file indicated by the first link information according to the file information request; generates a file information response including the storage path and file name of the first file according to the MTP; sends the file information response to the electronic device through the device collaborative channel according to the NCM technology; the electronic device receives the file information response from the external storage device through the device collaborative channel according to the NCM technology; generates a file recovery instruction including the storage path and file name of the first file; and the electronic device sends the file recovery instruction to the external storage device through the device collaborative channel.
  • the electronic device can complete the transmission of MTP messages through NCM technology, thereby obtaining the storage path and file name of the first file from the external storage device, and then send a file recovery instruction containing the storage path and file name of the first file to the external storage device to instruct the external storage device to restore the first file.
  • the external storage device and the electronic device have a communication interface, and the electronic device establishes a connection with the external storage device, including: the electronic device and the external storage device establish a physical communication connection through the communication interface. Based on this, after the electronic device establishes a connection with the external storage device, the electronic device can map the storage space of the external storage device to the first disk of the electronic device according to the communication protocol corresponding to the communication interface; after the electronic device detects the fourth operation, the first window is displayed on the display screen; wherein the fourth operation is used to open the first disk, and the first window is a display window of the first disk.
  • the user can manage files on the external storage device by operating the electronic device.
  • the electronic device may map the virtual recycle bin of the external storage device to the recycle bin through the following steps:
  • the electronic device generates a file management instruction based on the communication protocol; wherein the file management instruction is used to instruct the external storage device to mount the virtual recycle bin as a virtual disk of the electronic device; the electronic device sends the file management instruction to the external storage device through the communication interface; the external storage device receives the file management instruction from the electronic device through the communication interface, and mounts the virtual recycle bin as a virtual disk of the electronic device according to the file management instruction; the electronic device maps the virtual recycle bin to the recycle bin through a disk management program.
  • the electronic device and the external storage device can complete message transmission through a communication interface, thereby mapping the virtual recycle bin of the external storage device to the recycle bin of the electronic device.
  • the electronic device may send a file deletion instruction to the external storage device when the first operation is detected through the following steps:
  • the electronic device When the electronic device detects the first operation, it generates a file path request according to the communication protocol, and sends the file path request to the external storage device through the communication interface; wherein the file path request is used to obtain the storage path of the first file; the external storage device receives the file path request from the electronic device through the communication interface; obtains the storage path of the first file according to the file path request, and generates a file path response including the storage path of the first file according to the communication protocol; sends the file path response to the electronic device through the communication interface; the electronic device receives the file path request from the electronic device through the communication interface; After receiving the file path acquisition response, the electronic device generates a file deletion instruction including the storage path of the first file; and the electronic device sends the file deletion instruction to the external storage device through the communication interface.
  • the electronic device can complete the transmission of messages through the communication interface, thereby obtaining the storage path of the first file from the external storage device, and then send a file deletion instruction containing the storage path of the first file to the external storage device to instruct the external storage device to perform a deletion operation on the first file.
  • the electronic device may send a file recovery instruction to the external storage device when the third operation is detected in the recycle bin window through the following steps:
  • the electronic device When the electronic device detects the third operation in the recycle bin window, it generates a file information request according to the communication protocol; and sends the file information request to the external storage device through the communication interface, wherein the file information request is used to request the storage path and file name of the first file indicated by the first link information; the external storage device receives the file information request from the electronic device through the communication interface; determines the storage path and file name of the first file indicated by the first link information according to the file information request; generates a file information response including the storage path and file name of the first file according to the communication protocol; sends the file information response to the electronic device through the communication interface; the electronic device receives the file information response from the external storage device through the communication interface; generates a file recovery instruction including the storage path and file name of the first file; and the electronic device sends the file recovery instruction to the external storage device through the communication interface.
  • the electronic device can complete the transmission of messages through the communication interface, thereby obtaining the storage path and file name of the first file from the external storage device, and then send a file recovery instruction containing the storage path and file name of the first file to the external storage device to instruct the external storage device to recover the first file.
  • an embodiment of the present application provides an electronic device, comprising a display screen, a memory and one or more processors; wherein the memory is used to store computer program code, and the computer program code comprises computer instructions; when the instructions are called and executed by the one or more processors, the electronic device is enabled to execute the method provided by the above-mentioned first aspect and any possible design.
  • an embodiment of the present application provides an external storage device, the external storage device comprising a memory and at least one processor; wherein the memory is used to store computer program code, the computer program code comprising computer instructions; when the computer instructions are called and executed by the at least one processor, the external storage device is enabled to execute the method provided by the first aspect and any possible design.
  • the external storage device may also include a display screen.
  • an embodiment of the present application provides a chip, comprising a processor and a memory, wherein the processor is coupled to the memory, and the processor is used to call a computer program stored in the memory during runtime to implement the method provided by the above-mentioned first aspect and any possible design.
  • an embodiment of the present application provides a computer storage medium storing a computer program.
  • the computer program runs on an electronic device, the computer executes the method of the first aspect or any possible design of the first aspect.
  • an embodiment of the present application provides a computer program product, which includes a computer program; when the computer program runs on a computer, the computer executes the first aspect or any possible design method of the first aspect.
  • FIG1A is a schematic diagram of a connection method between an electronic device and an external storage device provided in an embodiment of the present application
  • FIG1B is a schematic diagram of a connection method between an electronic device and an external storage device provided in an embodiment of the present application
  • FIG1C is a schematic diagram of a connection method between an electronic device and an external storage device provided in an embodiment of the present application.
  • FIG2 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
  • FIG3 is a schematic diagram of a software structure of an electronic device or an external storage device provided in an embodiment of the present application
  • FIG4 is a flow chart of a file management method provided in an embodiment of the present application.
  • FIG5 is a flowchart of an interaction between an electronic device and an external storage device provided by an embodiment of the present application
  • FIG6 is a flowchart of an interaction between an electronic device and an external storage device provided by an embodiment of the present application.
  • FIG7 is a flowchart of an interaction between an electronic device and an external storage device provided by an embodiment of the present application.
  • FIG8A is a schematic diagram of establishing a device collaboration channel between a smart phone and a PC provided in an embodiment of the present application
  • FIG8B is a schematic diagram of a smart phone mounted as a virtual disk of a PC provided in an embodiment of the present application;
  • FIG8C is a schematic diagram of mapping a virtual recycle bin of a smart phone to a recycle bin of a PC provided by an embodiment of the present application;
  • FIG8D is a schematic diagram of deleting PIC1 provided in an embodiment of the present application.
  • FIG8E is a schematic diagram of permanently deleting PIC1 provided in an embodiment of the present application.
  • FIG8F is a schematic diagram of restoring PIC1 provided in an embodiment of the present application.
  • FIG9A is a schematic diagram of screen states of a PC and a smart phone during a file management process provided by an embodiment of the present application;
  • FIG9B is a schematic diagram of screen states of a PC and a smart phone during a file management process provided by an embodiment of the present application;
  • FIG9C is a schematic diagram of screen states of a PC and a smart phone during a file management process provided by an embodiment of the present application;
  • FIG10A is a schematic diagram of a PC screen status during a file management process provided by an embodiment of the present application.
  • FIG10B is a schematic diagram of a PC screen status during a file management process provided by an embodiment of the present application.
  • FIG10C is a schematic diagram of a PC screen status during a file management process provided by an embodiment of the present application.
  • FIG11 is a structural diagram of an electronic device provided in an embodiment of the present application.
  • FIG. 12 is a structural diagram of an external storage device provided in an embodiment of the present application.
  • the present application provides a file management method and electronic device for improving the flexibility of file management, thereby improving user experience.
  • the method and the device are based on the same technical concept. Since the method and the device solve the problem in a similar way, the implementation of the device and the method can refer to each other, and the repeated parts will not be repeated.
  • An electronic device is a device with a display screen that can establish a connection with other external storage devices and can act as a master device (or control management device) to manage files stored in the external storage device.
  • the electronic device may be a personal computer (PC), a laptop, a computer, a netbook, a tablet computer, a car computer, etc.
  • the electronic device may also be various portable devices, car terminal devices, personal digital assistants (PDAs), smart home devices (e.g., smart TVs, etc.), and other smart devices.
  • the electronic device may be, but is not limited to, equipped with Or other operating systems.
  • the electronic device is taken as a PC for example.
  • the solution provided in the embodiments of the present application does not limit the type of electronic device, and it can be replaced by other types of electronic devices.
  • the recycle bin of an electronic device is a system folder in the operating system of an electronic device, which is mainly used to store files temporarily deleted by users. Files stored in the recycle bin can be restored. When the user empties the recycle bin, the files in the recycle bin will be permanently deleted.
  • the operating system of the electronic device will create a separate space for each disk of the electronic device, that is, create a system folder named $Recycle.bin (i.e. a hidden system folder, hereinafter referred to as a hidden folder).
  • $Recycle.bin i.e. a hidden system folder, hereinafter referred to as a hidden folder.
  • the operating system of the electronic device can map the hidden folders corresponding to each disk to the recycle bin. Therefore, when the user opens the recycle bin window, the recycle bin window can display the contents deleted by the user in the hidden folders of each disk.
  • System folder refers to the folder that stores the main files of the operating system. It is usually created automatically when the operating system is first run or installed. The files stored in the system folder usually affect the operation of the system.
  • External storage device a device with data storage capability.
  • the external storage device can establish a connection with the electronic device in 1).
  • the external storage device may be a portable storage product, a terminal device with a communication interface, an intelligent terminal device capable of screen collaboration with an electronic device, etc.
  • the portable storage product may be a USB flash drive, a mobile hard disk, a card reader, etc.
  • terminal devices or intelligent terminal devices with communication interfaces include: smart phones, wearable devices, VR devices, AR devices, smart home devices, smart TVs, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, various smart meters (smart water meters, smart electricity meters, smart gas meters), on-board electronic control units (ECU), on-board computers, on-board cruise systems, telematics boxes (T-BOX), and terminal devices in future networks.
  • smart phones wearable devices, VR devices, AR devices, smart home devices, smart TVs
  • wireless terminals in industrial control wireless terminals in self-driving
  • wireless terminals in remote medical surgery wireless terminals in smart grids
  • wireless terminals in transportation safety wireless terminals in smart cities, wireless terminals in smart homes, various smart meters (smart water meters, smart electricity meters, smart gas meters), on-board electronic control units (ECU), on-board computers, on
  • Screen collaboration also known as multi-screen collaboration, screen projection, same screen, flying screen, screen sharing, refers to the real-time display of the screen output on device A (such as mobile phone, tablet, notebook, computer, etc.) to device B (such as tablet, notebook, computer, TV, all-in-one machine, etc.).
  • the screen changes of screen a caused by the user operating device A will be synchronously displayed in the setting area of screen b.
  • the screen changes caused by the user operating the setting area of screen b of device B will also be synchronously displayed in the screen of screen a.
  • the files involved in the embodiments of the present application may be texts, multimedia files (such as images, videos, audios, etc.), office files (such as word files, excel files, powerpoint files, etc.), documents, compressed files, executable files, non-executable files, etc. This application does not limit the type of files.
  • At least one refers to one or more
  • plural refers to two or more.
  • “And/or” describes the association relationship of associated objects, indicating that three relationships may exist.
  • a and/or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural.
  • the character “/” generally indicates that the objects associated before and after are in an “or” relationship.
  • “At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items.
  • At least one of a, b or c can represent: a, b, c, a and b, a and c, b and c, or a, b and c, where a, b, c can be single or multiple.
  • the file management method provided in the embodiment of the present application can be applied to a communication system in which an electronic device and an external storage device are connected.
  • the electronic device and the external storage device can be connected in a variety of ways. The following is an exemplary description of the connection method between the electronic device and the external storage device in conjunction with the scenario provided in the accompanying drawings.
  • the external storage device has a communication interface, and the electronic device also has a communication interface.
  • a physical connection can be established between the external storage device and the electronic device through the communication interface.
  • the following is an exemplary description of the connection between the external storage device and the electronic device:
  • connection method 1 The communication interface (male port) of the external storage device can be inserted into the communication interface (female port) of the electronic device, and the two establish a physical connection, as shown in FIG1A.
  • the external storage device is a USB flash drive as an example, and other types of external storage devices such as card readers can also establish a physical connection with the electronic device through method 1.
  • Connection method 2 The communication interface of the external storage device is connected to the communication interface of the electronic device through a cable, thereby realizing a physical connection between the two, as shown in FIG1B.
  • the external device is a mobile hard disk as an example, and other external storage devices with communication interfaces (for example, mobile phones, mp3, mp4 and other terminal devices) can also use method 2 to establish a physical connection with the electronic device using a cable.
  • the present application does not limit the type of communication interface of the external storage device or electronic device.
  • the communication interface may be, but is not limited to, a universal serial bus (USB) interface.
  • USB universal serial bus
  • the electronic device maps the storage space of the external storage device physically connected to it to a virtual disk of the electronic device.
  • the user can manage the files stored in the external storage device by managing (deleting, modifying, copying, cutting, pasting, etc.) the files in the virtual disk on the electronic device.
  • Scenario 2 When the external storage device is a smart terminal device, there is a communication connection between the electronic device and the external storage device, and then a device collaboration channel can be established based on the communication connection to achieve screen collaboration, as shown in Figure 1C.
  • the communication connection between the electronic device and the external storage device can be a wireless communication connection or a wired communication connection, which is not limited in this application.
  • Figure 1C takes a wireless communication connection as an example for exemplary description.
  • FIG1C takes a smart phone as an example of an external storage device, but other smart terminal devices (such as smart wearable devices, smart TVs, tablet computers, etc.) can also establish a device collaboration channel with the electronic device.
  • smart terminal devices such as smart wearable devices, smart TVs, tablet computers, etc.
  • the electronic device and the external storage device can be connected to the same wireless local area network (WLAN) through short-range wireless communication technology.
  • WLAN wireless local area network
  • the electronic device and the external storage device can establish a device collaboration channel through the local area network.
  • the short-range wireless communication technology may include, but is not limited to: Bluetooth technology, wireless-fidelity (Wi-Fi) technology, Wi-Fi point-to-point (P2P) technology, near field communication (NFC) technology, etc.
  • scenario 2 may also include an access point.
  • the access point supports short-range wireless communication technology.
  • the electronic device and the external storage device may first access the access point through the short-range wireless communication technology, and then the access point connects the electronic device and the external storage device to the local area network.
  • the access point may be a WIFI access point, and the electronic device and the external storage device may access the same WIFI access point.
  • an electronic device and an external storage device can be connected to the same Bluetooth beacon through Bluetooth technology, so that the two can be connected through Bluetooth technology establishes wireless communication connections and then establishes device collaboration channels.
  • an electronic device and an external storage device can trigger a communication connection through an NFC tag, and then transmit encryption through a Bluetooth module for identity authentication; after successful authentication, the two can communicate in a P2P manner.
  • the external storage device when the external storage device and the electronic device are in screen collaboration, the external storage device can project its own screen onto the screen of the electronic device. At this time, a projection window is displayed on the screen of the electronic device, and the content displayed in the projection window is the same as the content displayed on the screen window of the external storage device. It should be noted that the picture displayed in the projection window of the electronic device and the picture displayed on the screen window of the external storage device are synchronized in real time.
  • the external storage device can send the projection data to the electronic device through the device collaboration channel; the electronic device updates the projection window based on the received projection data to ensure that the projection window also changes synchronously.
  • the electronic device can send control instructions to the external storage device through the device collaboration channel; the external storage device executes the received control instructions and updates its own screen image, thereby ensuring that the screen of the external storage device changes synchronously.
  • the device collaborative channel can be divided into two sub-channels, namely the screen collaborative channel and the collaborative reverse control channel, as shown in Figure 1C.
  • the screen collaborative channel is used for the external storage device to send screen projection data to the electronic device
  • the collaborative reverse control channel is used for the electronic device to send various control instructions to the external storage device.
  • the user can manage (delete, modify, etc.) the files in the external storage device through the screen projection window on the electronic device, thereby managing the files stored in the external storage device.
  • the target file is not saved to the recycle bin of the electronic device, and the target file is also deleted from the external storage device, which causes the target file to be permanently deleted. If the user deletes the target file due to an error operation, or later hopes to restore the target file, the target file cannot be restored, further reducing the user experience.
  • some external storage devices can support putting the target files to be deleted into the local recycle bin.
  • smartphone applications system applications or third-party applications
  • image recycle bin there is an image recycle bin named "Recently Deleted" in the gallery application of a smartphone, which is used to save images temporarily deleted by users.
  • the smartphone can move the target pictures deleted by the user from the DCIM directory (i.e., the original folder where the target image is located) to the /data/media/0/Pictures/.Gallery2/recycle directory (i.e., the image recycle bin), and rename the target image and store it in the image recycle bin, so that when the smartphone's media library is scanning files, the target image will not be scanned, and then the target image will no longer be displayed when the smartphone's gallery application is never opened.
  • the DCIM directory i.e., the original folder where the target image is located
  • the /data/media/0/Pictures/.Gallery2/recycle directory i.e., the image recycle bin
  • an embodiment of the present application provides a file management method. Through this method, the recycle bin window of the electronic device can display the files of the external storage device deleted by the user through the electronic device.
  • the embodiment of the present application provides an electronic device, which can form a communication system with an external storage device to implement the file management method provided by the embodiment of the present application. Referring to FIG2 , the structure of the electronic device provided by the embodiment of the present application is introduced.
  • the electronic device 200 may include: a processor 210, an external memory interface 220, an internal memory 221, a USB interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, and a wireless Line communication module 260, audio module 270, speaker 270A, receiver 270B, microphone 270C, headphone interface 270D, sensor module 280, button 290, motor 291, indicator 292, camera 293, display screen 294, and SIM card interface 295, etc.
  • the electronic device shown in FIG2 is only an example and does not constitute a limitation on the electronic device, and the electronic device may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations.
  • the various components shown in FIG2 may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and/or application specific integrated circuits.
  • the processor 210 may include one or more processing units, for example: the processor 210 may include a central processing unit (CPU), an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and/or a neural-network processing unit (NPU), etc.
  • different processing units can be independent devices or integrated in one or more processors.
  • the controller can be the nerve center and command center of the electronic device 200. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
  • a memory may also be provided in the processor 210 for storing instructions and data.
  • the memory in the processor 210 is a cache memory.
  • the memory may store instructions or data that the processor 210 has just used or cyclically used. If the processor 210 needs to use the instruction or data again, it may be directly called from the memory. By providing the memory, the number of times the processor 210 accesses data to the internal memory 221 may be reduced, the waiting time of the processor 210 may be reduced, and thus the efficiency of the system may be improved.
  • the file management method provided in the embodiment of the present application can be controlled by the processor 210 or called by other components to complete, such as calling the processing program of the embodiment of the present application stored in the internal memory 221 to control the wireless communication module 260 to communicate data with the external storage device, and control the display screen to display the user interface.
  • the processor 210 can include different devices. For example, when the CPU and GPU are integrated, the CPU and GPU can cooperate to execute the file management method provided in the embodiment of the present application. For example, part of the algorithm in the file management method is executed by the CPU, and another part of the algorithm for displaying the user interface is executed by the GPU to obtain faster processing efficiency.
  • the display screen 294 is used to display images, videos, etc.
  • the display screen 294 includes a display panel.
  • the display panel can be a liquid crystal display (LCD), 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), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diodes (QLED), etc.
  • the electronic device 200 may include 1 or N display screens 294, where N is a positive integer greater than 1.
  • the display screen 294 can be used to display information input by a user or information provided to a user and various graphical user interfaces (GUI).
  • GUI graphical user interfaces
  • the display screen 294 can display a window, a photo, a video, a web page, or a file, etc.
  • the status bar may also include a Bluetooth icon, a Wi-Fi icon, an external device icon, etc.
  • the processor 210 detects a touch operation of a user's finger (or a stylus, etc.) on an application icon, in response to the touch operation, the user interface corresponding to the application icon is opened and displayed on the display screen 294.
  • a click operation of an external input device such as a mouse, keyboard, etc.
  • the display screen 294 can be an integrated flexible display screen, or a spliced display screen consisting of two rigid screens and a flexible screen located between the two rigid screens.
  • the processor 210 can control the display screen 294 to display the relevant results.
  • the camera 293 is used to capture still images or videos.
  • the electronic device 200 may include 1 to N cameras 293.
  • the camera 293 may include a front camera or a rear camera, or a camera 293 may be used as both a front camera and a rear camera.
  • the camera 293 may include a photosensitive element such as a lens group and an image sensor.
  • the lens group includes a plurality of lenses (convex lenses or concave lenses) for collecting light signals reflected by the object to be photographed, and transmitting the collected light signals to the image sensor.
  • the image sensor generates an original image of the object to be photographed based on the light signal.
  • the internal memory 221 can be used to store computer executable program codes, which include instructions.
  • the processor 210 executes various functional applications and data processing of the electronic device 200 by running the instructions stored in the internal memory 221.
  • the internal memory 221 may include a program storage area and a data storage area.
  • the program storage area may store an operating system, a program code of at least one application, etc.
  • the operating system may include, but is not limited to,
  • the data storage area can store data created during the use of the electronic device 200 .
  • the internal memory 221 may also store one or more computer programs for executing the file management method provided in the embodiments of the present application.
  • the one or more computer programs are stored in the internal memory 221 and are configured to be executed by one or more processors 210 .
  • the one or more computer programs include instructions, and the instructions can be used to execute the various steps in the following embodiments.
  • the internal memory 221 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
  • a non-volatile memory such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
  • the sensor module 280 may include a fingerprint sensor, a touch sensor, a pressure sensor, a magnetic sensor, an ambient light sensor, an air pressure sensor, a bone conduction sensor, and the like.
  • Touch sensor also known as "touch panel”.
  • the touch sensor can be set on the display screen 294.
  • the touch sensor is used to detect touch operations acting on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • Visual output related to the touch operation can be provided through the display screen 294.
  • the touch sensor can also be set on the surface of the electronic device 200, which is different from the position of the display screen 294.
  • the wireless communication function of the electronic device 200 can be implemented through the antenna 1, the antenna 2, the mobile communication module 250, the wireless communication module 260, the modem processor and the baseband processor.
  • Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in the electronic device 200 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas.
  • antenna 1 can be reused as a diversity antenna for a wireless local area network.
  • the antenna can be used in combination with a tuning switch.
  • the mobile communication module 250 can provide solutions for wireless communications including 2G/3G/4G/5G, etc., applied to the electronic device 200.
  • the mobile communication module 250 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc.
  • the mobile communication module 250 may receive electromagnetic waves from the antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the mobile communication module 250 may also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1.
  • at least some of the functional modules of the mobile communication module 250 may be arranged in the processor 210.
  • at least some of the functional modules of the mobile communication module 250 may be arranged in the same device as at least some of the modules of the processor 210.
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal.
  • the demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the application processor outputs a sound signal through an audio device (not limited to a speaker 270A, a receiver 270B, etc.), or displays an image or video through a display screen 294.
  • the modem processor may be an independent device.
  • the modem processor may be independent of the processor 210 and be set in the same device as the mobile communication module 250 or other functional modules.
  • the wireless communication module 260 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) and the like applied to the electronic device 200.
  • the wireless communication module 260 can be one or more devices integrating at least one communication processing module.
  • the wireless communication module 260 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 210.
  • the wireless communication module 260 can also receive the signal to be sent from the processor 210, modulate the frequency of the signal, amplify the signal, and convert it into electromagnetic waves for radiation through the antenna 2.
  • the electronic device 200 can establish a wireless communication connection with an external storage device through the wireless communication module 260 to exchange data, or the electronic device 200 can access an access point through the wireless communication module 260, so that instructions and data can be sent to a network device or other electronic device through the access point.
  • the electronic device 200 can establish a device collaboration channel with an external storage device (smart terminal device) through the wireless communication module 260, receive the projection data of the external storage device through the wireless communication module 260, and send control instructions to the external storage device through the wireless communication module 260.
  • the electronic device 200 can implement audio functions through the audio module 270, the speaker 270A, the receiver 270B, the microphone 270C, the headphone interface 270D, and the application processor. For example, music playback, recording, etc.
  • the electronic device 200 can receive input from the key 290 and generate key signal input related to the user settings and function control of the electronic device 200.
  • the electronic device 200 can generate vibration prompts using the motor 291.
  • the indicator 292 in the electronic device 200 can be an indicator light, which can be used to indicate the charging status, power changes, and can also be used to indicate messages, missed calls, notifications, etc.
  • the SIM card interface 295 in the electronic device 200 is used to connect the SIM card. The SIM card can be inserted into the SIM card interface 295, or pulled out from the SIM card interface 295, to achieve contact and separation with the electronic device 200.
  • the electronic device 200 shown in FIG. 2 is only an example, and the electronic device 200 may have more or fewer components than those shown in the figure, may combine two or more components, or may have a different component configuration.
  • the various components shown may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and/or application specific integrated circuits.
  • the electronic device 200 may not include the motor 291 and the SIM card interface 295, etc.
  • the external storage device is a smart terminal device such as a smart phone, a tablet computer, a smart TV, etc.
  • its structure is similar to the electronic device 200 in Figure 2. Please refer to the above description for details, and this application will not repeat them.
  • the electronic device 200 or the external storage device (for example, when the external storage device is a smart terminal device) provided in the embodiment of the present application, its software system can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture.
  • the embodiment of the present application takes the Android system of the layered architecture as an example, and exemplifies the software structure of the electronic device or the external storage device as shown in FIG3.
  • the layered architecture divides the software into several layers, each with a clear role and division of labor.
  • the layers communicate with each other through software interfaces.
  • the software architecture can be divided into four layers, from top to bottom: application layer, application framework layer (framework, FWK), Android runtime (Android runtime) and system library, and kernel layer.
  • application layer application framework layer (framework, FWK)
  • Android runtime Android runtime
  • system library system library
  • kernel layer e.g., a hardware layer.
  • the application layer is the top layer of the operating system, including native applications of the operating system and third-party applications, such as camera, gallery, calendar, Bluetooth, music, video, information, etc.
  • application APP
  • APP is a software program that can realize one or more specific functions.
  • the application layer may include a screen projection service for managing interfaces or windows related to screen collaboration on a display screen in a screen collaboration scenario, such as monitoring user operation information on these interfaces or windows received by other software layers, controlling display windows on the display screen based on the monitored user operation information, interacting with the screen projection services of other electronic devices for information related to screen collaboration, obtaining content to be displayed in the interface or window, etc.
  • a screen projection service for managing interfaces or windows related to screen collaboration on a display screen in a screen collaboration scenario, such as monitoring user operation information on these interfaces or windows received by other software layers, controlling display windows on the display screen based on the monitored user operation information, interacting with the screen projection services of other electronic devices for information related to screen collaboration, obtaining content to be displayed in the interface or window, etc.
  • the application layer may also include an application window service for managing local application windows displayed on the electronic device display screen, or managing application windows projected from certain specific electronic devices, such as monitoring user operation information on these windows received by other layers, and controlling the display windows on the display screen based on the monitored user operation information.
  • an application window service for managing local application windows displayed on the electronic device display screen, or managing application windows projected from certain specific electronic devices, such as monitoring user operation information on these windows received by other layers, and controlling the display windows on the display screen based on the monitored user operation information.
  • the application framework layer provides application programming interface (API) and programming framework for the applications in the application layer.
  • the application framework layer may include some predefined functions.
  • the application framework layer may include window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
  • the window manager is used to provide window management services.
  • the window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc.
  • the window manager can provide multiple management functions to control the transparency, position, size and other parameters of the window or interface on the display screen.
  • Content providers are used to store and retrieve data and make these data accessible to applications.
  • the data may include files (such as documents, videos, images, audio), text and other information.
  • the view system includes visual controls, such as controls for displaying text, images, documents, etc.
  • the view system can be used to build applications.
  • the interface in the display window can be composed of one or more controls.
  • a display interface showing a file icon can include controls for displaying text and controls for displaying images.
  • the phone manager is used to provide the communication function of the terminal device.
  • the notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages and disappear automatically after a short stay without user interaction.
  • the Android runtime includes the core library and the virtual machine.
  • the Android runtime is responsible for the scheduling and management of the Android system.
  • the core library of the Android system consists of two parts: one is the function that the Java language needs to call, and the other is the core library of the Android system.
  • the application layer and the application framework layer run in the virtual machine. Taking Java as an example, the virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.
  • the system library can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), etc.
  • the surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and graphics. Layer processing, etc.
  • the 2D graphics engine is a drawing engine for 2D drawings.
  • the kernel layer provides the core system services of the operating system, such as security, memory management, process management, network protocol stack and driver model, which are all implemented based on the kernel layer.
  • the kernel layer also serves as an abstraction layer between the hardware and software stacks. This layer has many drivers related to electronic devices, the main drivers are: display driver; keyboard driver as input device; Flash driver based on memory technology device; camera driver; audio driver; Bluetooth driver; WiFi driver, etc.
  • the kernel layer may also include an input driver service for obtaining and reporting operation information performed on an interface or window displayed on the display screen from an external input device (such as a mouse, keyboard, touchpad, etc.), a sensor (such as a touch screen, touch sensor, etc.) or other electronic device.
  • an external input device such as a mouse, keyboard, touchpad, etc.
  • a sensor such as a touch screen, touch sensor, etc.
  • the hardware layer can include various sensors, display screens, cameras, etc.
  • an embodiment of the present application provides a file management method.
  • the method is described below in conjunction with the accompanying drawings.
  • the method can be applied to a communication system including an electronic device and an external storage device, such as the scenario shown in Figures 1A-1C.
  • the method includes:
  • the icon of the first file can be displayed in the recycle bin window of the electronic device, thereby reminding the user that the first file has been deleted.
  • This method can improve the flexibility of electronic device file management and improve user experience.
  • the electronic device when it detects a third operation in the recycle bin window, it may not display the icon of the first file in the recycle bin window, and display the icon of the first file in the first window.
  • the third operation is used to restore the first file.
  • the user can restore the deleted first file of the external storage device through the recycle bin window displayed by the electronic device, further improving the flexibility of file management of the electronic device and the user experience.
  • a recycle bin window that does not contain the icon of the first file is displayed on the display screen; when the electronic device is connected to the external storage device again, when the electronic device detects the second operation, a recycle bin window that contains the icon of the first file is displayed on the display screen.
  • the recycle bin window of the electronic device no longer displays the first file that has been deleted from the external storage device, and when the external storage device is connected to the electronic device again, the recycle bin window of the electronic device can display the first file again. In this way, it can be ensured that each time the external storage device is connected to the electronic device, the recycle bin window of the electronic device can display the deleted files of the external storage device, so as to prompt the user and facilitate the user to manage these deleted files.
  • the electronic device and the external storage device can implement the above-mentioned file management method through the following interactive process, and the specific process can be referred to as shown in Figure 5.
  • the electronic device may map a virtual recycle bin of the external storage device to the recycle bin of the electronic device, wherein the virtual recycle bin is a hidden system folder created by the external storage device.
  • the virtual recycle bin (hidden system folder) of the external storage device can be mapped to the recycle bin, so that when the user opens the recycle bin of the electronic device, the recycle bin window can display the icons of the files located in the virtual recycle bin.
  • the virtual recycle bin may be created when the external storage device is first powered on or powered on. It should be noted that the virtual recycle bin does not disappear when the external storage device is powered off or powered off; the virtual recycle bin still exists when the external storage device is powered on or powered on again.
  • S502 When the electronic device detects the first operation, it sends a file deletion instruction to the external storage device; wherein, The file deletion instruction is used to instruct the external storage device to delete the first file.
  • the external storage device receives the file deletion instruction from the electronic device.
  • the external storage device modifies the file attribute of the first file from a default value to deleted according to the file deletion instruction, and creates first link information in the virtual recycle bin; wherein the first link information is used to indicate the first file.
  • this step by modifying the file attributes of the first file, it can be ensured that the first file is displayed as deleted, that is, the icon of the first file will not be displayed in either the user interface of the external storage device or the first window of the electronic device.
  • the external storage device does not move the location of the first file (i.e., does not change the storage space and storage address of the first file), which can facilitate the subsequent recovery of the first file.
  • the virtual recycle bin since the first file is not moved, the virtual recycle bin only stores the link information of the deleted file without storing the deleted file, so the virtual recycle bin does not actually occupy a large storage space of the external storage device.
  • creating the first link information in the virtual recycle bin can facilitate the external storage device to find the first file through the first link information later.
  • the external storage device may also delete the media information of the first file in the media library according to the file deletion instruction.
  • this step is an optional step and can be performed when the first file is a multimedia file and the external storage device includes a media library.
  • the external storage device deletes the media information of the first file in the media library, which can prevent the media library from scanning the file during file scanning, thereby ensuring that the user interface of the external storage device does not display the first file.
  • a recycle bin window including an icon of at least one deleted file is displayed on the display screen.
  • the at least one deleted file includes a file indicated by at least one link information in the virtual recycle bin, the at least one link information includes the first link information, and the at least one deleted file includes the first file.
  • the at least one deleted file may also include files that have been locally deleted by the electronic device.
  • the electronic device can display at least one deleted file icon in the recycle bin window by using existing technology.
  • the operating system of the electronic device can call a related API to implement the display, and the specific process is not repeated in the embodiment of the present application.
  • S506 The external storage device restores the file attribute of the first file to the default value according to the file restoration instruction, and deletes the first link information in the virtual recycle bin.
  • the external storage device Since in S503, the external storage device only changes the file attributes of the first file and creates the first link information when deleting the first file, when restoring the first file, the external storage device can also restore the file attributes of the first file to the default values and delete the first link information through step S506.
  • the electronic device and the external storage device can interact through some instructions to implement the file management method shown in Figure 4, ensuring that the icons of the deleted files in the external storage device can be displayed in the recycle bin window of the electronic device.
  • the user can also restore the deleted files in the external storage device through the recycle bin window of the electronic device.
  • Implementation method 1 Referring to FIG1C , when the external storage device is a smart terminal device, the electronic device and the external storage device establish a wireless communication connection via short-range wireless communication technology (ie, the above scenario 2). Detailed description is given below with reference to the process shown in FIG6 .
  • the electronic device can display a first window (i.e., a projection window) on a display screen by following the steps S601-S603, wherein the first window includes an icon of the first file stored in the external storage device.
  • a first window i.e., a projection window
  • the external storage device may send screen projection data to the electronic device through the device collaborative channel according to the currently displayed screen window; the electronic device may receive the screen projection data from the external storage device through the device collaborative channel.
  • S603 The electronic device displays the first window on the display screen according to the screen projection data, wherein the first window is the screen window currently displayed by the external storage device.
  • the electronic device may map the virtual recycle bin of the external storage device to the recycle bin through the following steps S604-S607 (ie, execute the above step S501).
  • the electronic device generates a file management instruction according to a media transfer protocol (MTP), wherein the file management instruction is used to instruct the external storage device to mount the virtual recycle bin as a virtual disk of the electronic device.
  • MTP media transfer protocol
  • the electronic device may trigger the execution of S604 after establishing a device collaboration channel with the external storage device.
  • S605 The electronic device sends the file management instruction to the external storage device through the device collaborative channel according to the network control model (NCM) technology.
  • NCM network control model
  • NCM technology can be used between the electronic device and the external storage device to transmit messages in MTP data format (hereinafter referred to as MTP messages). That is, the sending end and the receiving end can complete the transmission of MTP messages through the following steps:
  • the sender converts the MTP message to be sent into an Ethernet frame and sends it to the receiver through the device collaboration channel;
  • the receiving end After receiving the Ethernet frame through the device cooperation channel, the receiving end converts the received Ethernet frame into an MTP message using the NCM technology.
  • the external storage device mounts the virtual recycle bin as a virtual disk of the electronic device according to the file management instruction.
  • the external storage device may modify the properties of the virtual recycle bin according to the file management instruction, and mount the virtual recycle bin as a virtual disk of the electronic device using a disk management program.
  • S607 The electronic device maps the virtual recycle bin to the recycle bin through a disk management program.
  • the electronic device may send a file deletion instruction to the external storage device (ie, execute the above step S502 ) through the following steps S608 - S613 when the first operation is detected.
  • S608 When the electronic device detects the first operation, it generates a file path request according to the MTP, wherein the file path request is used to request a storage path of the first file.
  • the first operation may be a conventional file deletion operation of the electronic device, or a file deletion operation newly defined by the user.
  • the specific form of the first operation is not limited in the embodiment of the present application. The following examples are given:
  • the first operation may be that after the user selects the first file by clicking the mouse (single click (left click or right click), double click, multiple clicks, or long press, etc.) or touching the finger (single click, double click, multiple clicks, or long press, etc.), a file management menu pops up; the user then deletes a button in the file management menu and clicks a confirmation button in a confirmation window, and so on.
  • the first operation may be a series of continuous operations such as the user selecting the first file by clicking the mouse or touching the finger, pressing the "delete” key on the keyboard, and then clicking a confirmation button in a confirmation window.
  • the first operation may be a series of operations such as the user selecting the first file by touching with a finger and then touching a delete button in the first window.
  • the first operation may be at least one continuous operation of clicking, long pressing, or sliding performed by the user through finger touch.
  • S609 The electronic device sends the file path request to the external storage device through the device collaboration channel according to the NCM technology.
  • the external storage device receives the file path request from the electronic device through the device collaboration channel according to the NCM technology.
  • the external storage device obtains the storage path of the first file according to the file path request, and generates a file path response including the storage path of the first file according to the MTP.
  • the external storage device sends the file path response to the electronic device through the device collaborative channel according to the NCM technology.
  • the electronic device receives the file path response from the external storage device through the device collaborative channel according to the NCM technology.
  • the electronic device can obtain the storage path of the first file to be deleted based on MTP, so as to generate a file deletion instruction.
  • the electronic device obtains the storage path of the first file from the file path response, and generates a file deletion instruction including the storage path of the first file.
  • S613 The electronic device sends the file deletion instruction to the external storage device through the device cooperation channel.
  • the external storage device receives the file deletion instruction from the electronic device through the device cooperation channel.
  • the external storage device can find the first file according to the storage path of the first file in the file deletion instruction, and thus perform a corresponding operation to delete the first file.
  • the electronic device when the electronic device detects the operation of permanently deleting the first file, the electronic device can also obtain the storage path of the first file through the above S608-S611, and generate a file permanent deletion instruction containing the storage path of the first file, and send the file permanent deletion instruction through the device collaborative channel. After receiving the file permanent deletion instruction, the external storage device directly permanently deletes the first file.
  • the permanent deletion process is the same as the prior art and will not be repeated here.
  • the electronic device may send a file recovery instruction to the external storage device (i.e., execute the above step S505) through the following steps S614-S619 when the third operation is detected in the recycle bin window.
  • S614 When the electronic device detects the third operation in the recycle bin window, it generates a file information request according to the MTP, wherein the file information request is used to request the storage path and file name of the first file indicated by the first link information.
  • S615 The electronic device sends the file information request to the external storage device through the device collaboration channel according to the NCM technology.
  • the external storage device receives the file information request from the electronic device through the device collaboration channel according to the NCM technology.
  • the external storage device determines the storage path and file name of the first file indicated by the first link information according to the file information request; and generates a file information response including the storage path and file name of the first file according to the MTP.
  • the external storage device sends the file information response to the electronic device through the device collaboration channel according to the NCM technology.
  • the electronic device receives the file information response from the external storage device through the device collaboration channel according to the NCM technology.
  • S618 The electronic device obtains the storage path and file name of the first file in the file information response, and generates a file recovery instruction including the storage path and file name of the first file.
  • S619 The electronic device sends the file recovery instruction to the external storage device through the device cooperation channel.
  • the external storage device receives the file recovery instruction from the electronic device through the device cooperation channel.
  • the external storage device can find the first file according to the storage path and file name of the first file in the received file recovery instruction, and thus perform a corresponding operation, that is, execute S506 to restore the first file.
  • Implementation method 2 Referring to FIG. 1A and FIG. 1B , when the external storage device and the electronic device have a communication interface, the electronic device and the external storage device establish a physical communication connection through the communication interface (ie, the above scenario 1). Detailed description is given below with reference to the process shown in FIG.
  • the electronic device can display a first window (i.e., a display window of a virtual disk mapped by an external storage device) on a display screen through the following steps S701-S703, wherein the first window contains an icon of the first file stored by the external storage device.
  • a first window i.e., a display window of a virtual disk mapped by an external storage device
  • S701 The electronic device establishes a physical communication connection with the external storage device via a communication interface.
  • the electronic device After the electronic device establishes a connection with the external storage device, the electronic device maps the storage space of the external storage device to a first disk of the electronic device according to a communication protocol corresponding to the communication interface.
  • the first disk is a virtual disk of the electronic device.
  • the virtual disk disappears on the electronic device.
  • the communication interface may be, but is not limited to, a USB interface, and the communication protocol corresponding to the USB interface is the USB protocol.
  • S703 After the electronic device detects the fourth operation, the electronic device displays the first window on the display screen, wherein the fourth operation is used to open the first disk, and the first window is a display window of the first disk.
  • mapping the storage space of the external storage device to the first disk can refer to the conventional technology and will not be described in detail here.
  • the electronic device may map the virtual recycle bin of the external storage device to the recycle bin through the following steps S704-S707 (ie, execute the above step S501).
  • the electronic device generates a file management instruction based on the communication protocol, wherein the file management instruction is used to instruct the external storage device to mount the virtual recycle bin as a virtual disk of the electronic device.
  • the electronic device may trigger the execution of S704 after establishing a physical communication connection with the external storage device.
  • S705 The electronic device sends the file management instruction to the external storage device through the communication interface.
  • the external storage device receives the file management instruction from the electronic device through the communication interface.
  • the external storage device mounts the virtual recycle bin as a virtual disk of the electronic device according to the file management instruction.
  • the external storage device may modify the properties of the virtual recycle bin according to the file management instruction, and mount the virtual recycle bin as a virtual disk of the electronic device using a disk management program.
  • S707 The electronic device maps the virtual recycle bin to the recycle bin through a disk management program.
  • the electronic device may send a file deletion instruction to the external storage device (ie, execute the above step S502) through the following steps S708-S713 when the first operation is detected.
  • S708 When the electronic device detects the first operation, it generates a file path request according to the communication protocol, wherein the file path request is used to obtain a storage path of the first file.
  • the first operation may be a regular file deletion operation of a user on a file in a disk of the electronic device, which will not be described in detail here.
  • the electronic device sends the file path request to the external storage device through the communication interface.
  • the external storage device receives the file path request from the electronic device through the communication interface.
  • the external storage device obtains the storage path of the first file according to the file path request, and generates a file path response including the storage path of the first file according to the communication protocol.
  • the external storage device sends the file path response to the electronic device through the communication interface; the electronic device receives the file path acquisition response through the communication interface.
  • the electronic device can obtain the storage path of the first file to be deleted through the communication interface, so as to generate a file deletion instruction.
  • S712 The electronic device obtains the storage path of the first file from the file path acquisition response, and generates a file deletion instruction including the storage path of the first file.
  • S713 The electronic device sends the file deletion instruction to the external storage device through the communication interface.
  • the electronic device receives the file deletion instruction from the electronic device through the communication interface.
  • the external storage device may find the first file according to the storage path of the first file in the file deletion instruction, and execute a corresponding operation to delete the first file, thereby completing S503.
  • the electronic device when the electronic device detects the operation of permanently deleting the first file, the electronic device can also obtain the storage path of the first file through the above S708-S711, and generate a file permanent deletion instruction containing the storage path of the first file, and send the file permanent deletion instruction through the communication interface. After receiving the file permanent deletion instruction, the external storage device directly permanently deletes the first file.
  • the permanent deletion process is the same as the prior art and will not be repeated here.
  • the electronic device may send a file recovery instruction to the external storage device (i.e., execute the above step S505) through the following steps S714-S719 when the third operation is detected in the recycle bin window.
  • S714 When the electronic device detects the third operation in the recycle bin window, it generates a file information request according to the communication protocol, wherein the file information request is used to request the storage path and file name of the first file indicated by the first link information.
  • S715 The electronic device sends the file information request to the external storage device through the communication interface.
  • the external storage device receives the file information request from the electronic device through the communication interface.
  • the external storage device determines the storage path and file name of the first file indicated by the first link information according to the file information request; and generates a file information response including the storage path and file name of the first file according to the communication protocol.
  • the external storage device sends the file information response to the electronic device through the communication interface.
  • the electronic device receives the file information response from the external storage device through the communication interface.
  • S718 The electronic device obtains the storage path and file name of the first file in the file information response, and generates a file recovery instruction including the storage path and file name of the first file.
  • the electronic device sends the file recovery instruction to the external storage device through the communication interface.
  • the external storage device receives the file recovery instruction from the electronic device through the communication interface.
  • the external storage device can find the first file according to the storage path and file name of the first file in the received file recovery instruction, and thus perform a corresponding operation, that is, execute S506 to restore the first file.
  • Embodiment 1 In the scenario where a smart phone and a PC perform screen collaboration as shown in FIG1C .
  • the i_flags parameter of the file data structure is used to indicate file attributes.
  • the i_flags parameter is a 32-bit integer data, where the 31st bit can indicate the deletion status of the file.
  • the 31st bit in the i_flags parameter of the file takes the default value (e.g., 0); when the 31st bit in the i_flags parameter of the file does not take the default value (e.g., 1), it indicates that the file has been deleted.
  • the 31st bit in the i_flags parameter of the file will be marked as a non-default value, but the inode of the file will not be released; when the file is permanently deleted, not only the 31st bit in the i_flags parameter of the file will be marked as a non-default value, but the inode of the file will also be released.
  • An application for implementing screen collaboration may be installed in the PC, and the application may be referred to as a collaborative service application later.
  • the collaborative service application can not only implement screen collaboration, but also has a file management function.
  • the resource that implements the file management function in the collaborative service application is referred to as a file management submodule.
  • the file management submodule supports MTP and Wi-Fi P2P technologies.
  • the screen collaboration between smartphones and PCs can be achieved by establishing a wireless communication connection based on Wi-Fi P2P technology.
  • the conversion between Ethernet frames between devices and hosts and data packets in MTP/USB data format can be achieved between smartphones and PCs through NCM technology.
  • the PC can mount the storage space of the smartphone as a virtual disk of the PC through MTP, thereby mapping the virtual recycle bin in the smartphone to the recycle bin of the PC.
  • the file management submodule can also be used to obtain file information such as the file storage path or file name from the smartphone through MTP, thereby achieving file management.
  • the smartphone can send screen projection data to the PC through the screen collaborative channel in the device collaborative channel.
  • the PC also supports reverse control of the smartphone in the screen projection window. During the reverse control process, the PC can send control instructions to the smartphone through the collaborative reverse control channel.
  • the collaborative service applications of smartphones and PCs both support MTP. They use NCM technology to achieve conversion between data packets in MTP data format and Ethernet frames, and indirectly achieve interaction of MTP messages, thereby mounting the external storage space of the smartphone (for example, the directory of the external storage space is data/media/0) as a virtual disk (also called an external disk) of the PC through MTP, as shown in FIG8B .
  • NCM technology to achieve conversion between data packets in MTP data format and Ethernet frames, and indirectly achieve interaction of MTP messages, thereby mounting the external storage space of the smartphone (for example, the directory of the external storage space is data/media/0) as a virtual disk (also called an external disk) of the PC through MTP, as shown in FIG8B .
  • the file management submodule in the collaborative service application of the PC can also indirectly transmit MTP messages (such as the file management instructions in S604 in Figure 6) through NCM technology, modify the properties of the virtual recycle bin in the smart phone, and use the disk management program to insert the mounted virtual disk into the local disk of the PC, thereby mapping the virtual recycle bin in the smart phone to the recycle bin of the PC.
  • MTP messages such as the file management instructions in S604 in Figure 6
  • NCM technology modify the properties of the virtual recycle bin in the smart phone
  • the disk management program to insert the mounted virtual disk into the local disk of the PC, thereby mapping the virtual recycle bin in the smart phone to the recycle bin of the PC.
  • the recycle bin window can display the icon of PIC1.
  • the virtual recycle bin of the smartphone is a hidden system folder named $Recycle.bin created in the external storage directory of the smartphone based on the operating system (such as the Linux system) command.
  • the smartphone can modify the file attribute of the file to deleted during the deletion process and create link information indicating the file in the virtual recycle bin. Since the virtual recycle bin is used to save the link information of deleted files on the smartphone, the file is not actually saved. This feature is different from the recycle bin in the PC, so it is called a "virtual recycle bin.”
  • the smartphone when the user deletes PIC1 of the smartphone through the screen projection window, the smartphone only modifies the file attributes of PIC1, does not move the storage location of PIC1, and deletes the media information of PIC1 in the media library, so that the external storage directory and screen window of the smartphone no longer display PIC1.
  • the smartphone creates link information indicating PIC1 in the virtual recycle bin so that the PC's recycle bin window can display the icon of PIC.
  • the PC's collaborative service application responds to the deletion operation by generating a file path request (e.g., getObjectFilePath()) through MTP, converts the file path request into an Ethernet frame based on NCM technology, and transmits it to the smartphone through the device collaborative channel.
  • a file path request e.g., getObjectFilePath()
  • the smartphone converts the received Ethernet frame into a file path request according to the NCM technology, and obtains the storage path of PIC1 according to the file path request.
  • the smartphone generates a file path response including the storage path of PIC1 according to the MTP, and converts the file path response into an Ethernet frame according to the NCM technology, and transmits it to the PC through the device collaboration channel.
  • the collaborative service application of the PC After receiving the Ethernet frame, the collaborative service application of the PC converts the Ethernet frame into a file path response according to the NCM technology, so as to obtain the storage path of PIC1 in the file path response.
  • the collaborative service application of the PC can generate a file deletion instruction (e.g., an instruction including the storage path of PIC1 and a delete (remove) event) based on the storage path of PIC1. Then, the PC can transmit the file deletion instruction to the smartphone through the collaborative reverse control channel.
  • a file deletion instruction e.g., an instruction including the storage path of PIC1 and a delete (remove) event
  • the smart phone performs a deletion operation on PIC1 according to the file deletion instruction, including: finding PIC1 according to the storage path of PIC in the file deletion instruction, and then changing the 31st bit in the i_flags parameter of PIC1 from the default value to another value to mark PIC1 as deleted, and deleting the media information of PIC1 in the media library.
  • the smart phone also needs to create link information indicating PIC1 in the virtual recycle bin through an operating system command (such as a Linux system) (link command In-s1).
  • the collaborative service application of the PC When the user selects PIC1 on the projection window of the PC and performs a permanent deletion operation, the collaborative service application of the PC responds to the permanent deletion operation and obtains the storage path of PIC1.
  • the specific process can refer to the description in (1) and will not be repeated here.
  • the collaborative service application of the PC can generate a file permanent deletion instruction (for example, an instruction containing the storage path of PIC1 and a permanent deletion (delete) event) based on the storage path of PIC, and transmit the file permanent deletion instruction to the smartphone through the collaborative reverse control channel.
  • a file permanent deletion instruction for example, an instruction containing the storage path of PIC1 and a permanent deletion (delete) event
  • the smart phone finds PIC1 according to the storage path of PIC1 in the permanent deletion instruction of the file, and then performs a permanent deletion operation on PIC1.
  • the specific deletion process is the same as that in the prior art and will not be described in detail here.
  • PIC1 completely disappears from the external storage directory of the smartphone, and there is no link information indicating PIC1 in the virtual Recycle Bin. Therefore, when the user opens the Recycle Bin of the PC, the PIC icon will not be displayed in the Recycle Bin window, and the screen projection window will no longer display the PIC1 icon.
  • the collaborative service application of the PC When the user selects PIC1 in the Recycle Bin window of the PC and performs a restore operation, the collaborative service application of the PC generates a file information request through MTP in response to the restore operation (for example, including getObjectFilePath(). Optionally, it may also include link information indicating PIC1 (for example, link command In-s1)).
  • the collaborative service application of the PC converts the file information request into an Ethernet frame based on the NCM technology and transmits it to the smartphone through the device collaborative channel.
  • the smartphone converts the received Ethernet frame into a file information request based on the NCM technology, and obtains the storage path and file name of PIC1 based on the file information request.
  • the smartphone generates a file information response including the storage path and file name of PIC1 based on MTP, and converts the file information response into an Ethernet frame based on the NCM technology, and transmits it to the PC through the device collaboration channel.
  • the collaborative service application of the PC After receiving the Ethernet frame, the collaborative service application of the PC converts the Ethernet frame into a file information response according to the NCM technology, so as to obtain the storage path and file name of PIC1 in the file information response.
  • the collaborative service application of the PC can generate a file recovery instruction (e.g., an instruction including the storage path, file name, and recovery event of PIC1) based on the storage path and file name of PIC1. Then, the collaborative service application of the PC can transmit the file recovery instruction to the smart phone through the collaborative reverse control channel.
  • a file recovery instruction e.g., an instruction including the storage path, file name, and recovery event of PIC1
  • the smart phone performs a recovery operation on PIC1 according to the file recovery instruction, including: finding PIC1 according to the storage path of PIC in the file deletion instruction, then restoring the 31st bit in the i_flags parameter of PIC1 to the default value to mark it as not deleted, and deleting the link information indicating PIC1 in the virtual recycle bin (such as the link command In-s1)).
  • the Recycle Bin window of the PC no longer displays the PIC1, but the screen projection window of the PC can display the PIC1.
  • the screens of the PC and the smart phone change as follows:
  • the smartphone projects the currently displayed screen window onto the display screen of the PC through the device cooperative channel.
  • the projection window on the display screen of the PC has the same display content as the screen window on the smartphone.
  • the user selects image PIC1 (i.e., the last image, the image with a fill mark in the figure) in the projection window of the PC and deletes PIC1.
  • image PIC1 i.e., the last image, the image with a fill mark in the figure
  • the PC's screen projection window and the smartphone's screen window no longer display the PIC icon, as shown in Figure 9B.
  • the PC's recycle bin window displays the PIC1 icon (the image with a fill mark in the figure), as shown in Figure 9C.
  • Embodiment 2 In the scenario where the PC is connected to a USB flash drive as shown in FIG1A . It should be noted that the PC is connected to other devices through a communication interface, or the file management method in the scenario shown in FIG1B is similar to the file management method provided in Embodiment 2. Therefore, the file management method provided in Embodiment 2 can be extended to other similar scenarios, and this application will not repeat them.
  • the interaction process between the USB flash drive and the PC is similar to the interaction process between the smart phone and the PC in the first embodiment, and the similarities can be referenced to each other.
  • the differences are:
  • the PC can map the storage space of the USB flash drive to a virtual disk of the PC according to the USB protocol and the disk management program.
  • the PC displays a display window of the disk. The picture of PIC1 can be displayed in the window.
  • the file system of the USB flash drive (such as the file allocation table (FAT) system, the FAT32 system, and the extended FAT (exFAT) system) can, in addition to modifying the value of the 31st bit in the i_flags parameter of PIC1, also create or delete link information indicating PIC1 in the virtual recycle bin through a newly added interface without the need to implement it through an operating system command.
  • FAT file allocation table
  • exFAT extended FAT
  • the screen in the PC changes as follows:
  • the PC when a USB flash drive is inserted into the USB interface of a PC, the PC will map the storage space of the USB flash drive to a virtual disk of the PC (i.e., the newly added volume (F:)).
  • a display window of the newly added volume (F:) is displayed on the display screen of the PC, wherein the icon of PIC1 (the image with a filled mark in the figure) is displayed in the display window.
  • the display window no longer displays the icon of PIC, as shown in FIG10B .
  • the icon of PIC1 (the image with a filled mark in the figure) is displayed in the recycle bin window displayed by the PC, as shown in FIG10C .
  • an embodiment of the present application further provides an electronic device, as shown in FIG11, including a processor 1101, a memory 1102, a communication module 1103 and a display screen 1104.
  • the above-mentioned components can be connected via one or more communication buses.
  • the one or more computer programs are stored in the above-mentioned memory 1102 and are configured to be executed by the processor 1101, and the one or more computer programs include instructions, and the above-mentioned instructions can be used to enable the electronic device to perform each step of the method in the above-mentioned embodiments.
  • the processor 1101 may specifically be the processor 210 shown in FIG. 2 .
  • the memory 1102 may specifically be the internal memory 221 shown in FIG. 2 and/or an external memory connected to the electronic device.
  • the communication module 1103 includes a transceiver or a communication interface, wherein the transceiver may be the mobile communication module 250 and/or the wireless communication module 260 shown in FIG. 2 , and the communication interface may be the external memory interface 220 and/or the USB interface shown in FIG. 2 .
  • the display screen 1104 may specifically be the display screen 294 shown in FIG. 2 , and the present application embodiment does not impose any limitation on this.
  • an embodiment of the present application also provides an external storage device, as shown in FIG12, including a processor 1201, a memory 1202, and a transceiver 1203.
  • the external storage device may also include a display screen 1204.
  • the above-mentioned various devices may be connected via one or more communication buses.
  • the one or more computer programs are stored in the above-mentioned memory 1202 and are configured to be executed by the processor 1201, and the one or more computer programs include instructions, which can be used to enable the external storage device to perform the various steps of the methods in the above-mentioned embodiments.
  • GUI graphical user interface
  • the term “when" or “after" may be interpreted to mean “if" or “after" or “in response to determining" or “in response to detecting", depending on the context.
  • the phrase “upon determining" or “if (the stated condition or event) is detected” may be interpreted to mean “if determining" or “in response to determining" or “upon detecting (the stated condition or event)” or “in response to detecting (the stated condition or event)", depending on the context.
  • all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof.
  • all or part of the embodiments may be implemented in the form of a computer program product.
  • the computer program product may include one or more computer instructions. Command.
  • the computer program instructions When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
  • the computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.
  • the computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated.
  • the available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk (SSD)), etc.
  • SSD solid-state hard disk
  • the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
  • a computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
  • These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请实施例提供了一种文件管理方法及电子设备,用于提高文件管理的灵活性,从而提高用户体验。通过该方法,当用户通过所述电子设备显示的第一窗口删除外部存储设备存储的所述第一文件时,所述电子设备的所述回收站窗口中可以显示所述第一文件的图标,从而可以提醒用户第一文件已被删除。该方法可以提高电子设备文件管理的灵活性,提高用户体验。

Description

一种文件管理方法及电子设备
相关申请的交叉引用
本申请要求在2022年11月28日提交中国专利局、申请号为202211500737.0、申请名称为“一种文件管理方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及电子设备技术领域,尤其涉及一种文件管理方法及电子设备。
背景技术
目前,电子设备可以通过多种方式与外部存储设备建立通信连接。根据外部存储设备和电子设备的类型不同,电子设备与外部存储设备建立连接的方式也不尽相同。以电子设备为计算机为例说明,若外部存储设备为U盘时,计算机可以通过U盘的USB插口建立连接;若外部存储设备为具有USB接口的手机或平板电脑等外部设备时,计算机可以通过USB线缆与这些外部设备建立连接;若外部存储设备为智能终端(手机、平板电脑、智能电视、智能可穿戴设备)时,计算机可以通过屏幕协同技术,与该智能终端建立连接。
当电子设备与外部存储设备建立通信连接后,可以对外部存储设备中存储的文件进行管理。然而,目前的文件管理方案比较单一、用户体验较差。
发明内容
本申请提供一种文件管理方法及电子设备,用于提高文件管理的灵活性,从而提高用户体验。
第一方面,本申请实施例提供了一种文件管理方法,该方法可以应用于包括电子设备和外部存储设备的通信系统。该方法包括以下步骤:
在所述电子设备与所述外部存储设备建立连接后,所述电子设备在显示屏的第一窗口中显示所述外部存储设备存储的第一文件的图标;所述电子设备检测到第一操作时,在所述第一窗口中不显示所述第一文件的图标;其中,所述第一操作用于删除所述第一文件;所述电子设备检测到第二操作时,在所述显示屏中显示包含所述第一文件的图标的回收站窗口;其中,所述第二操作用于打开所述电子设备的回收站。
通过该方法,当用户通过所述电子设备显示的所述第一窗口删除所述外部存储设备存储的所述第一文件时,所述电子设备的所述回收站窗口中可以显示所述第一文件的图标,从而可以提醒用户第一文件已被删除。该方法可以提高电子设备文件管理的灵活性,提高用户体验。
在一种可能的设计中,在所述显示屏中显示包含所述第一文件的图标的回收站窗口之后,所述电子设备在所述回收站窗口内检测到第三操作时,所述电子设备还可以在所述回收站窗口中不显示所述第一文件的图标,以及在所述第一窗口中显示所述第一文件的图标;其中,所述第三操作用于还原所述第一文件。
通过该设计,用户可以通过所述电子设备显示的所述回收站窗口,恢复还原所述外部存储设备的已被删除的所述第一文件,进一步提高电子设备文件管理的灵活性,以及用户体验。
在一种可能的设计中,在所述显示屏中显示包含所述第一文件的图标的回收站窗口之后,当所述电子设备与所述外部存储设备断开连接后,所述电子设备检测到所述第二操作时,在所述显示屏中显示不包含所述第一文件的图标的回收站窗口;当所述电子设备与所述外部存储设备再次建立连接后,所述电子设备检测到所述第二操作时,在所述显示屏中显示包含所述第一文件的图标的回收站窗口。
通过该设计,当所述外部存储设备与所述电子设备断开连接后,电子设备的回收站窗口不再显示所述外部存储设备的已被删除的所述第一文件,而当所述外部存储设备与所述电子设备再次建立连接后,所述电子设备的回收站窗口可以再次显示该第一文件。这样,可以保证每次所述外部存储设备与所述电子设备连接时,所述电子设备的回收站窗口都能显示所述外部存储设备的已被删除的文件,以便提示用户以及方便用户对这些已删除的文件进行文件管理。
在一种可能的设计中,在所述电子设备与所述外部存储设备建立连接后,所述电子设备将所述外部 存储设备的虚拟回收站映射到所述回收站;其中,所述虚拟回收站为所述外部存储设备创建的隐藏的系统文件夹;所述电子设备检测到所述第一操作时,向所述外部存储设备发送文件删除指令;其中,所述文件删除指令用于指示所述外部存储设备删除所述第一文件;所述外部存储设备接收来自所述电子设备的文件删除指令后,根据所述文件删除指令,将所述第一文件的文件属性从默认值修改为已删除,并在所述虚拟回收站中创建第一链接信息;其中,所述第一链接信息用于指示所述第一文件。
在该设计中,通过修改所述第一文件的文件属性,可以保证该第一文件对外显示为已删除状态,即无论是所述外部存储设备的用户界面,还是所述电子设备的所述第一窗口中,均不会显示该第一文件的图标。而所述外部存储设备不移动所述第一文件的位置(即不改变第一文件的存储空间和存储地址),可以便于后续恢复该第一文件。另外,由于未移动所述第一文件,因此,该虚拟回收站只保存已删除文件的链接信息,而无需保存已删除文件,因此,该虚拟回收站实际不会占用外部存储设备的较大的存储空间。另外,在所述虚拟回收站中创建该第一链接信息,可以便于所述外部存储设备后续可以通过该第一链接信息查找到所述第一文件。
在一种可能的设计中,所述电子设备检测到第二操作时,在所述显示屏中显示包含所述第一文件的图标的回收站窗口,包括:所述电子设备检测到所述第二操作时,在所述显示屏中显示包含至少一个删除文件的图标的回收站窗口;其中,所述至少一个删除文件包含所述虚拟回收站中至少一个链接信息所指示的文件,所述至少一个链接信息包含所述第一链接信息;所述至少一个删除文件包含所述第一文件。
通过该设计,由于所述外部存储设备的虚拟回收站映射到所述电子设备的回收站,因此,当用户打开回收站窗口时,该回收站窗口中可以显示虚拟回收站中所有链接信息所指示的文件的图标。
在一种可能的设计中,当所述第一文件为多媒体文件时,所述外部存储设备还可以根据所述文件删除指令,删除媒体库中所述第一文件的媒体信息。
通过该设计,可以避免媒体库在进行文件扫描时扫描到该文件,从而可以保证所述外部存储设备的用户界面不会显示该第一文件。
在一种可能的设计中,所述电子设备检查到所述第三操作时,还可以向所述外部存储设备发送文件恢复指令;其中,所述文件恢复指令用于指示所述外部存储设备还原所述第一文件;所述外部存储设备接收来自所述电子设备的文件恢复指令后,根据所述文件恢复指令,将所述第一文件的文件属性恢复为所述默认值,并删除所述虚拟回收站中的所述第一链接信息。
通过该设计,用户可以通过对电子设备进行操作,恢复外部存储设备中已删除的文件。
在一种可能的设计中,所述外部存储设备为智能终端设备,所述电子设备与所述外部存储设备建立连接,包括:所述电子设备与所述外部存储设备通过短距离无线通信技术建立无线通信连接。基于此,在所述电子设备与所述外部存储设备建立连接后,所述电子设备可以与所述外部存储设备通过所述无线通信连接建立设备协同通道;所述电子设备通过所述设备协同通道接收来自所述外部存储设备的投屏数据;所述电子设备根据投屏数据,在所述显示屏中显示所述第一窗口;其中,所述第一窗口为所述外部存储设备当前显示的屏幕窗口。
通过该设计,在所述外部存储设备与所述电子设备进行屏幕协同的场景中,用户可以通过对电子设备进行操作实现对外部存储设备的文件管理。
在一种可能的设计中,所述电子设备可以通过如下步骤,将所述外部存储设备的虚拟回收站映射到所述回收站:
所述电子设备根据媒体传输协议MTP,生成文件管理指令;其中,所述文件管理指令用于指示所述外部存储设备将所述虚拟回收站挂载为所述电子设备的虚拟磁盘;所述电子设备根据网络控制模式NCM技术,通过所述设备协同通道向所述外部存储设备发送所述文件管理指令;所述外部存储设备根据所述NCM技术,通过所述设备协同通道接收来自所述电子设备的所述文件管理指令,并根据所述文件管理指令将所述虚拟回收站挂载为所述电子设备的虚拟磁盘;所述电子设备通过磁盘管理程序,将所述虚拟回收站映射到所述回收站。
在该设计中,所述电子设备与所述外部存储设备可以通过NCM技术,完成MTP消息的传输,进而将所述外部存储设备的虚拟回收站映射到所述电子设备的回收站。
在一种可能的设计中,所述电子设备可以通过以下步骤,在检测到所述第一操作时向所述外部存储设备发送文件删除指令:
所述电子设备检测到所述第一操作时,根据所述MTP,生成文件路径请求;根据所述NCM技术, 通过所述设备协同通道向所述外部存储设备发送所述文件路径请求;其中,所述文件路径请求用于请求所述第一文件的存储路径;所述外部存储设备根据所述NCM技术,通过所述设备协同通道接收来自所述电子设备的所述文件路径请求;根据所述文件路径请求,获取所述第一文件的存储路径,并根据所述MTP,生成包含所述第一文件的存储路径的文件路径响应;根据所述NCM技术,通过所述设备协同通道向所述电子设备发送所述文件路径响应;所述电子设备根据所述NCM技术,通过所述设备协同通道接收来自所述外部存储设备的所述文件路径响应;生成包含所述第一文件的存储路径的文件删除指令;所述电子设备通过所述设备协同通道向所述外部存储设备发送所述文件删除指令。
通过该设计,所述电子设备可以通过NCM技术完成MTP消息的传输,从而从所述外部存储设备获取所述第一文件的存储路径,进而可以向所述外部存储设备发送包含该第一文件的存储路径的文件删除指令,以指示所述外部存储设备对该第一文件执行删除操作。
在一种可能的设计中,所述电子设备可以通过以下步骤,在所述回收站窗口内检测到所述第三操作时,向所述外部存储设备发送文件恢复指令:
所述电子设备在所述回收站窗口内检测到所述第三操作时,根据所述MTP,生成文件信息请求;并根据所述NCM技术,通过所述设备协同通道向所述外部存储设备发送所述文件信息请求,所述文件信息请求用于请求所述第一链接信息所指示的所述第一文件的存储路径和文件名;所述外部存储设备根据所述NCM技术,通过所述设备协同通道接收来自所述电子设备的所述文件信息请求;根据所述文件信息请求,确定所述第一链接信息所指示的所述第一文件的存储路径和文件名;根据所述MTP,生成包含所述第一文件的存储路径和文件名的文件信息响应;根据所述NCM技术,通过所述设备协同通道向所述电子设备发送所述文件信息响应;所述电子设备根据所述NCM技术,通过所述设备协同通道接收来自所述外部存储设备的所述文件信息响应;生成包含所述第一文件的存储路径和文件名的文件恢复指令;所述电子设备通过所述设备协同通道向所述外部存储设备发送所述文件恢复指令。
通过该设计,所述电子设备可以通过NCM技术完成MTP消息的传输,从而从所述外部存储设备获取所述第一文件的存储路径和文件名,进而可以向所述外部存储设备发送包含该第一文件的存储路径和文件名的文件恢复指令,以指示所述外部存储设备恢复该第一文件。
在一种可能的设计中,所述外部存储设备和所述电子设备具有通信接口,所述电子设备与所述外部存储设备建立连接,包括:所述电子设备与所述外部存储设备通过所述通信接口建立物理通信连接。基于此,在所述电子设备与所述外部存储设备建立连接后,所述电子设备可以根据所述通信接口对应的通信协议将所述外部存储设备的存储空间映射为所述电子设备的第一磁盘;所述电子设备检测到第四操作后,在所述显示屏中显示所述第一窗口;其中,所述第四操作用于打开所述第一磁盘,所述第一窗口为所述第一磁盘的显示窗口。
通过该设计,在所述外部存储设备与所述电子设备通过通信接口建立物理通信连接的场景中,用户可以通过对电子设备进行操作实现对外部存储设备的文件管理。
在一种可能的设计中,所述电子设备可以通过如下步骤,将所述外部存储设备的虚拟回收站映射到所述回收站:
所述电子设备基于所述通信协议,生成文件管理指令;其中,所述文件管理指令用于指示所述外部存储设备将所述虚拟回收站挂载为所述电子设备的虚拟磁盘;所述电子设备通过所述通信接口向所述外部存储设备发送所述文件管理指令;所述外部存储设备通过所述通信接口接收来自所述电子设备的所述文件管理指令,并根据所述文件管理指令将所述虚拟回收站挂载为所述电子设备的虚拟磁盘;所述电子设备通过磁盘管理程序,将所述虚拟回收站映射到所述回收站。
在该设计中,所述电子设备与所述外部存储设备可以通信接口完成消息传输,进而将所述外部存储设备的虚拟回收站映射到所述电子设备的回收站。
在一种可能的设计中,所述电子设备可以通过如下步骤,在检测到所述第一操作时向所述外部存储设备发送文件删除指令:
所述电子设备检测到所述第一操作时,根据所述通信协议,生成文件路径请求,并通过所述通信接口向所述外部存储设备发送所述文件路径请求;其中,所述文件路径请求用于获取所述第一文件的存储路径;所述外部存储设备通过所述通信接口接收来自所述电子设备的所述文件路径请求;根据所述文件路径请求,获取所述第一文件的存储路径,并根据所述通信协议生成包含所述第一文件的存储路径的文件路径响应;通过所述通信接口向所述电子设备发送所述文件路径响应;所述电子设备通过所述通信接 口接收所述文件路径获取响应后,生成包含所述第一文件的存储路径的文件删除指令;所述电子设备通过所述通信接口向所述外部存储设备发送所述文件删除指令。
通过该设计,所述电子设备可以通过通信接口完成消息的传输,从而从所述外部存储设备获取所述第一文件的存储路径,进而可以向所述外部存储设备发送包含该第一文件的存储路径的文件删除指令,以指示所述外部存储设备对该第一文件执行删除操作。
在一种可能的设计中,所述电子设备可以通过以下步骤,在所述回收站窗口内检测到所述第三操作时,向所述外部存储设备发送文件恢复指令:
所述电子设备在所述回收站窗口内检测到所述第三操作时,根据所述通信协议,生成文件信息请求;并通过所述通信接口向所述外部存储设备发送所述文件信息请求,所述文件信息请求用于请求所述第一链接信息所指示的所述第一文件的存储路径和文件名;所述外部存储设备通过所述通信接口接收来自所述电子设备的所述文件信息请求;根据所述文件信息请求,确定所述第一链接信息所指示的所述第一文件的存储路径和文件名;根据所述通信协议,生成包含所述第一文件的存储路径和文件名的文件信息响应;通过所述通信接口向所述电子设备发送所述文件信息响应;所述电子设备通过所述通信接口接收来自所述外部存储设备的所述文件信息响应;生成包含所述第一文件的存储路径和文件名的文件恢复指令;所述电子设备通过所述通信接口向所述外部存储设备发送所述文件恢复指令。
通过该设计,所述电子设备可以通过通信接口完成消息的传输,从而从所述外部存储设备获取所述第一文件的存储路径和文件名,进而可以向所述外部存储设备发送包含该第一文件的存储路径和文件名的文件恢复指令,以指示所述外部存储设备恢复该第一文件。
第二方面,本申请实施例提供一种电子设备,所述电子设备包括显示屏,存储器和一个或多个处理器;其中,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令;当所述指令被所述一个或多个处理器调用执行时,使得所述电子设备能够执行上述第一方面及任一种可能的设计提供的方法。
第三方面,本申请实施例提供一种外部存储设备,所述外部存储设备包括存储器和至少一个处理器;其中,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令;当所述计算机指令被所述至少一个处理器调用执行时,使得所述外部存储设备能够执行上述第一方面及任一种可能的设计提供的方法。可选的,所述外部存储设备还可以包括显示屏。
第四方面,本申请实施例提供一种芯片,所述芯片包括处理器和存储器,所述处理器与所述存储器耦合,所述处理器用于在运行时调用所述存储器中存储的计算机程序,实现上述第一方面及任一种可能的设计提供的方法。
第五方面,本申请实施例提供一种计算机存储介质,该计算机存储介质存储有计算机程序,当所述计算机程序在电子设备上运行时,使得计算机执行上述第一方面或第一方面的任一种可能的设计的方法。
第六方面,本申请实施例提供一种计算机程序产品,所述计算机程序产品中包含计算机程序;当所述计算机程序在计算机上运行时,使得所述计算机执行第一方面或第一方面的任一种可能的设计的方法。
附图说明
图1A为本申请实施例提供的一种电子设备与外部存储设备的连接方式示意图;
图1B为本申请实施例提供的一种电子设备与外部存储设备的连接方式示意图;
图1C为本申请实施例提供的一种电子设备与外部存储设备的连接方式示意图;
图2为本申请实施例提供的一种电子设备的结构示意图;
图3为本申请实施例提供的一种电子设备或外部存储设备的软件结构示意图;
图4为本申请实施例提供的一种文件管理方法的流程图;
图5为本申请实施例提供的一种电子设备与外部存储设备的交互流程图;
图6为本申请实施例提供的一种电子设备与外部存储设备的交互流程图;
图7为本申请实施例提供的一种电子设备与外部存储设备的交互流程图;
图8A为本申请实施例提供的一种智能手机与PC建立设备协同通道的示意图;
图8B为本申请实施例提供的一种智能手机挂载为PC的虚拟磁盘的示意图;
图8C为本申请实施例提供的一种智能手机的虚拟回收站映射到PC的回收站的示意图;
图8D为本申请实施例提供的一种删除PIC1的示意图;
图8E为本申请实施例提供的一种永久性删除PIC1的示意图;
图8F为本申请实施例提供的一种还原PIC1的示意图;
图9A为本申请实施例提供的一种文件管理过程中PC和智能手机的屏幕状态示意图;
图9B为本申请实施例提供的一种文件管理过程中PC和智能手机的屏幕状态示意图;
图9C为本申请实施例提供的一种文件管理过程中PC和智能手机的屏幕状态示意图;
图10A为本申请实施例提供的一种文件管理过程中PC的屏幕状态示意图;
图10B为本申请实施例提供的一种文件管理过程中PC的屏幕状态示意图;
图10C为本申请实施例提供的一种文件管理过程中PC的屏幕状态示意图;
图11为本申请实施例提供的一种电子设备的结构图;
图12为本申请实施例提供的一种外部存储设备的结构图。
具体实施方式
本申请提供一种文件管理方法及电子设备,用于提高文件管理的灵活性,从而提高用户体验。其中,方法和装置是基于同一技术构思的,由于方法及装置解决问题的原理相似,因此装置与方法的实施可以相互参见,重复之处不再赘述。
以下对本申请中的部分用语进行解释说明,以便于本领域技术人员理解。
1)、电子设备,为具有显示屏的设备,能够与其他外部存储设备建立连接,并能够作为主设备(或控制管理设备)对外部存储设备中存储的文件进行管理的设备。
本申请实施例中电子设备可以是个人计算机(personal computer,PC)、笔记本电脑、计算机、上网本、平板电脑、车载电脑等。当然,所述电子设备还可以为各种便携式设备,车载终端设备、个人数字助理(personal digital assistant,PDA)、智能家居设备(例如,智能电视等)等智能设备。示例性的,所述电子设备可以但不限于搭载或者其他操作系统。
在本申请后续实施例的描述中,以电子设备为PC为例进行说明。但需要说明的是,本申请实施例提供的方案并不对电子设备的类型构成任何限定,其可以替换为其他类型的电子设备。
2)、电子设备的回收站,电子设备的操作系统里的其中一个系统文件夹,主要用来存放用户临时删除的文件。存放在回收站中的文件可以被恢复。当用户执行清空回收站操作时,回收站内的文件才会被永久性删除。
在电子设备的操作系统会为电子设备的每个磁盘开辟单独空间,即创建命名为$Recycle.bin的系统文件夹(即隐藏的系统文件夹,后续简称为隐藏文件夹)。当某个磁盘中的文件被删除时,该文件会被重命名并移动到该磁盘对应的隐藏文件夹中。
电子设备的操作系统可以将各个磁盘对应的隐藏文件夹均映射到回收站。因此,当用户打开回收站窗口时,回收站窗口中可以显示每个磁盘的隐藏文件夹中的已经被用户删除的内容。
3)、系统文件夹,是指存储操作系统主要文件的文件夹,一般在首次运行操作系统或安装操作系统时自动创建。系统文件夹中的存储的文件一般会影响系统的运行。
4)、外部存储设备,具有数据存储能力的设备。在本申请中,外部存储设备能够与1)中的电子设备建立连接。
在本申请实施例中,所述外部存储设备可以为便携式存储产品、具有通信接口的终端设备、能够与电子设备进行屏幕协同的智能终端设备等。
示例性的,便携式存储产品可以为U盘、移动硬盘、读卡器等。
具有通信接口的终端设备或智能终端设备的一些举例包括:智能手机、可穿戴设备、VR设备、AR设备、智能家居设备、智能电视、工业控制(industrial control)中的无线终端、无人驾驶(self driving)中的无线终端、远程手术(remote medical surgery)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smart city)中的无线终端、智慧家庭(smart home)中的无线终端、各类智能仪表(智能水表、智能电表、智能燃气表)、车载电子控制单元(electronic control unit,ECU)等、车载电脑、车载巡航系统、远程信息处理器(telematics box,T-BOX),以及未来网络中的终端设备等。
5)、屏幕协同,又称多屏协同,投屏,同屏、飞屏、屏幕共享,是指设备A(如手机、平板、笔记本、电脑等)的屏幕a中输出显示的画面实时地显示到设备B(如平板、笔记本、电脑、电视、一体机 等)的屏幕b的设定区域。用户通过操作设备A引起的屏幕a的画面变化会同步显示到屏幕b的设定区域中。另外,用户操作设备B的屏幕b中设定区域,引起所述设定区域的画面变化,也会同步显示到屏幕a的画面中。
6)、本申请实施例涉及的文件,可以为文本、多媒体文件(例如图像、视频、音频等)、办公(office)文件(例如word文件、excel文件、powerpoint文件等)、文件、压缩文件、可执行文件、非可执行文件等,本申请对文件的类型不作限定。
应理解,本申请实施例中“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A、B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一(项)个”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a、b或c中的至少一项(个),可以表示:a,b,c,a和b,a和c,b和c,或a、b和c,其中a、b、c可以是单个,也可以是多个。
下面结合附图对本申请实施例提供的方案进行详细说明。
本申请实施例提供的文件管理方法可以适用于电子设备与外部存储设备建立连接的通信系统中。可选的,电子设备与外部存储设备可以通过多种方式建立连接。下面结合附图提供的场景,对电子设备与外部存储设备之间的连接方式进行示例性说明。
场景一:外部存储设备具有通信接口,且电子设备也具有通信接口。外部存储设备和电子设备之间可以通过通信接口建立物理连接。下面根据外部存储设备与电子设备之间的连接方式分别进行示例性的说明:
连接方式一:外部存储设备的通信接口(公口)可以插入电子设备的通信接口(母口),二者建立物理连接,参阅图1A所示。应注意,在图1A中以外部存储设备为U盘作为示例,读卡器等其他种类的外部存储设备也可以通过方式一与电子设备建立物理连接。
连接方式二:外部存储设备的通信接口与电子设备的通信接口之间通过线缆连接,从而实现二者的物理连接,参阅图1B所示。应注意,在图1B中以外部设备为移动硬盘作为示例,其他具有通信接口的外部存储设备(例如,手机、mp3、mp4等各种终端设备)也可以通过方式二,利用线缆与电子设备建立物理连接。
需要说明的是,本申请不限定外部存储设备、电子设备的通信接口的类型。示例性的,该通信接口可以但不限于为通用串行总线(universal serial bus,USB)接口。
在场景一中,电子设备会将与其物理连接的外部存储设备的存储空间映射为电子设备的一个虚拟磁盘。用户可以通过在电子设备上对该虚拟磁盘中的文件进行管理(删除、修改、复制、剪切、粘贴等),实现对该外部存储设备中存储的文件的管理。
场景二:当外部存储设备为智能终端设备时,电子设备与外部存储设备之间具有通信连接,进而可以基于该通信连接建立设备协同通道,实现屏幕协同,参阅图1C所示。其中,电子设备与外部存储设备之间可以的通信连接可以为无线通信连接,也可以为有线通信连接,本申请对此不作限定。图1C中以无线通信连接为例进行示例性说明。
另外,图1C中以外部存储设备为智能手机作为示例,但是其他智能终端设备(例如智能可穿戴设备、智能电视、平板电脑等)也可以与电子设备建立设备协同通道。
在一种实施方式中,在场景二中,电子设备与外部存储设备之间可以通过短距离无线通信技术,接入到同一个无线局域网(wireless local area network,WLAN)中。这样,电子设备与外部存储设备可以通过局域网建立设备协同通道。示例性的,该短距离无线通信技术可以但不限于包括:蓝牙技术、无线保真(wireless-fidelity,Wi-Fi)技术、Wi-Fi点对点(point to point,P2P)技术、近场通信(near field communication,NFC)技术等。
可选的,场景二中还可以包含接入点。该接入点支持短距离无线通信技术。电子设备和外部存储设备可以先通过短距离无线通信技术接入接入点,再由接入点将电子设备和该外部存储设备接入局域网。示例性的,该接入点可以为WIFI接入点,电子设备和外部存储设备可以接入同一个WiFi接入点。
又例如,电子设备与外部存储设备可以通过蓝牙技术接入同一个蓝牙信标下,这样,二者可以通过 蓝牙技术建立无线通信连接,进而建立设备协同通道。
再例如,电子设备与外部存储设备可以通过NFC标签触发通信连接,然后通过蓝牙模块传输加密进行身份认证;在认证成功后二者可以通过P2P的方式进行通信。
在场景二中,当外部存储设备和电子设备进行屏幕协同过程中,外部存储设备可以将自身的屏幕投射到电子设备的屏幕上,此时电子设备的屏幕上显示有投屏窗口,该投屏窗口显示的内容与外部存储设备的屏幕窗口显示的内容相同。应注意,电子设备的投屏窗口中显示的画面与外部存储设备的屏幕窗口上显示的画面是实时同步的。
当用户对外部存储设备进行操作,导致外部存储设备的屏幕画面发生变化时,那么外部存储设备可以通过设备协同通道,向电子设备发送投屏数据;电子设备根据接收到投屏数据,更新投屏窗口,以保证投屏窗口也同步发生变化。
另外,当用户对电子设备中投屏窗口进行操作,导致投屏窗口中的窗口画面发生变化时,电子设备可以通过设备协同通道,向外部存储设备发送控制指令;外部存储设备执行接收到的控制指令,更新自身的屏幕画面,从而可以保证外部存储设备的屏幕同步发生变化。
基于以上描述,根据设备协同通道传输的数据类型以及数据流方向的不同,在本申请实施例中,可以将设备协同通道分为两个子通道,即屏幕协同通道和协同反向控制通道,如图1C中所示。其中,该屏幕协同通道用于外部存储设备向电子设备发送投屏数据,而协同反向控制通道用于电子设备向外部存储设备发送各种控制指令。
综上,在场景二中,用户可以通过在电子设备上的投屏窗口对外部存储设备中的文件进行管理(删除、修改等),实现对外部存储设备中存储的文件的管理。
需要注意的是,图1A-图1C中的电子设备和外部存储设备的类型,连接方式,以及显示的界面或窗口的位置等都只是示例,并不对本申请实施例适用的场景构成任何限定。
目前,在上述场景一中,虽然用户可以对外部存储设备映射的虚拟磁盘进行管理,但是当用户通过虚拟磁盘删除外部存储设备的目标文件后,该目标文件并没有进入电子设备的回收站。因此,当用户打开电子设备的回收站时,回收站窗口不会显示该目标文件,导致用户无法看到已删除的外部存储设备内的目标文件,用户体验较差。
另外,在场景一中,用户通过虚拟磁盘删除目标文件后,由于目标文件未保存到电子设备的回收站,且外部存储设备内也会删除目标文件,这就导致该目标文件被永久性删除。如果用户由于误操作删除目标文件,或者后续期望恢复该目标文件时,无法恢复该目标文件,进一步降低用户体验。
而在场景二中,当用户通过对投屏窗口执行删除操作,删除外部存储设备内的目标文件时,该目标文件也不会进入电子设备的回收站。因此,当用户打开电子设备的回收站时,回收站窗口也不会显示该目标文件,导致用户无法看到已删除的外部存储设备内的目标文件,用户体验较差。
可选的,在场景二中,某些外部存储设备(例如智能手机等、平板电脑)中可以支持将待删除的目标文件放入本地回收站。例如,智能手机的应用(系统应用或第三方应用)支持将删除的图像、联系人信息、短信、视频、音频等文件移动本地回收站。示例性的,智能手机的图库应用中存在命名为“最近删除”的图像回收站,用于保存用户临时删除的图像。智能手机可以将用户删除的目标图片从DCIM目录(即目标图像的原所在文件夹)移动到/data/media/0/Pictures/.Gallery2/recycle目录(即图像回收站),并将目标图像重命名存储在图像回收站,这样,当智能手机的媒体库在进行文件扫描时,不会扫描到该目标图像,进而在永不打开智能手机的图库应用时,不再显示该目标图像。
综上所述,无论在场景一还是在场景二中,当电子设备与外部存储设备建立通信连接后,若用户通过对电子设备进行操作来删除外部存储设备中的某个文件时,电子设备的回收站窗口都不会显示该文件,这种文件管理方案比较单一,用户体验较差。基于此,本申请实施例提供了一种文件管理方法。通过该方法,电子设备的回收站窗口可以显示用户通过电子设备删除的外部存储设备的文件。
本申请实施例提供了一种电子设备,该电子设备可以与外部存储设备组成通信系统,实现本申请实施例提供的文件管理方法。下面参考图2,对本申请实施例提供的电子设备的结构进行介绍。
如图2所示,电子设备200可以包括:处理器210,外部存储器接口220,内部存储器221,USB接口230,充电管理模块240,电源管理模块241,电池242,天线1,天线2,移动通信模块250,无 线通信模块260,音频模块270,扬声器270A,受话器270B,麦克风270C,耳机接口270D,传感器模块280,按键290,马达291,指示器292,摄像头293,显示屏294,以及SIM卡接口295等。
可以理解的是,图2所示的电子设备仅仅是一个范例,并不构成对电子设备的限定,并且电子设备可以具有比图中所示出的更多的或者更少的部件,可以组合两个或更多的部件,或者可以具有不同的部件配置。图2中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。
处理器210可以包括一个或多个处理单元,例如:处理器210可以包括中央处理器(central processing unit,CPU),应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。其中,控制器可以是电子设备200的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器210中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器210中的存储器为高速缓冲存储器。该存储器可以保存处理器210刚用过或循环使用的指令或数据。如果处理器210需要再次使用该指令或数据,可从该存储器中直接调用。通过设置存储器,可以降低处理器210对内部存储器221进行数据存取的次数,减少了处理器210的等待时间,因而提高了系统的效率。
本申请实施例提供的文件管理方法可以由处理器210来控制或调用其他部件来完成,比如调用内部存储器221中存储的本申请实施例的处理程序,来控制无线通信模块260向外部存储设备进行数据通信,以及控制显示屏显示用户界面。处理器210可以包括不同的器件,比如集成CPU和GPU时,CPU和GPU可以配合执行本申请实施例提供的文件管理方法,比如文件管理方法中部分算法由CPU执行,另一部分关于用户界面显示的算法由GPU执行,以得到较快的处理效率。
显示屏294用于显示图像,视频等。显示屏294包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备200可以包括1个或N个显示屏294,N为大于1的正整数。显示屏294可用于显示由用户输入的信息或提供给用户的信息以及各种图形用户界面(graphical user interface,GUI)。例如,显示屏294可以显示窗口、照片、视频、网页,或者文件等。此外,可以理解的是,在一些实施例中,状态栏中还可以包括蓝牙图标、Wi-Fi图标、外接设备图标等。在一些实施例中,当处理器210检测到用户的手指(或触控笔等)针对某一应用图标的触摸操作后,响应于该触摸操作,打开与该应用图标对应的用户界面,并在显示屏294上显示该用户界面。在一些实施例中,当处理器210检测到电子设备200的外部输入设备(例如鼠标、键盘等)针对某一应用图标的点击操作后,响应于该点击操作,对该应用进行相应控制操作。
在本申请实施例中,显示屏294可以是一个一体的柔性显示屏,也可以采用两个刚性屏以及位于两个刚性屏之间的一个柔性屏组成的拼接显示屏。当处理器210运行本申请实施例提供的文件管理方法后,处理器210可以控制显示屏294对相关结果进行显示。
摄像头293用于捕获静态图像或视频。可选的,电子设备200可以包括1~N个摄像头293。例如,摄像头293中可以包括前置摄像头或者后置摄像头,又或者一个摄像头293既可作为前置摄像头,也可作为后置摄像头。通常,摄像头293可以包括感光元件比如镜头组和图像传感器。其中,镜头组包括多个透镜(凸透镜或凹透镜),用于采集待拍摄物体反射的光信号,并将采集的光信号传递给图像传感器。图像传感器根据所述光信号生成待拍摄物体的原始图像。
内部存储器221可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器210通过运行存储在内部存储器221的指令,从而执行电子设备200的各种功能应用以及数据处理。内部存储器221可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个应用程序的程序代码等。所述操作系统可以为但不限于包括等。存储数据区可存储电子设备200使用过程中所创建的数据等。
内部存储器221还可以存储用于执行本申请实施例提供的文件管理方法的一个或多个计算机程序。 该一个或多个计算机程序被存储在上述内部存储器221中并被配置为被一个或多个处理器210执行,该一个或多个计算机程序包括指令,上述指令可以用于执行以下实施例中的各个步骤。
此外,内部存储器221可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。
传感器模块280可以包括指纹传感器、触摸传感器、压力传感器、磁传感器、环境光传感器、气压传感器、骨传导传感器等。
触摸传感器,也称“触控面板”。触摸传感器可以设置在显示屏294。触摸传感器用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏294提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器也可以设置于电子设备200的表面,与显示屏294所处的位置不同。
电子设备200的无线通信功能可以通过天线1,天线2,移动通信模块250,无线通信模块260,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备200中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块250可以提供应用在电子设备200上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块250可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块250可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块250还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块250的至少部分功能模块可以被设置于处理器210中。在一些实施例中,移动通信模块250的至少部分功能模块可以与处理器210的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频装置(不限于扬声器270A,受话器270B等)输出声音信号,或通过显示屏294显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器210,与移动通信模块250或其他功能模块设置在同一个器件中。
无线通信模块260可以提供应用在电子设备200上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块260可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块260经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器210。无线通信模块260还可以从处理器210接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。本申请实施例中,电子设备200可以通过无线通信模块260与外部存储设备建立无线通信连接,进行数据交互,或者电子设备200可以通过无线通信模块260接入接入点,从而可以通过接入点与网络设备或其他电子设备发送指令和数据等。例如,电子设备200可以通过无线通信模块260,与外部存储设备(智能终端设备)建立设备协同通道,并通过该无线通信模块260接收外部存储设备的投屏数据,并通过该无线通信模块260向外部存储设备发送控制指令。
另外,电子设备200可以通过音频模块270,扬声器270A,受话器270B,麦克风270C,耳机接口270D,以及应用处理器等实现音频功能。例如音乐播放,录音等。电子设备200可以接收按键290输入,产生与电子设备200的用户设置以及功能控制有关的键信号输入。电子设备200可以利用马达291产生振动提示。电子设备200中的指示器292可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。电子设备200中的SIM卡接口295用于连接SIM卡。SIM卡可以通过插入SIM卡接口295,或从SIM卡接口295拔出,实现和电子设备200的接触和分离。
应理解,在实际应用中,图2所示的电子设备200仅是一个范例,并且电子设备200可以具有比图中所示出的更多的或者更少的部件,可以组合两个或更多的部件,或者可以具有不同的部件配置。图中 所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。例如,当电子设备200为PC时,电子设备200中可以不包含马达291和SIM卡接口295等。
还需要说明的是,在本申请实施例中,在一些场景中(例如,当外部存储设备为智能手机、平板电脑、智能电视等智能终端设备时),其结构与图2中的电子设备200类似,具体可以参考以上描述,本申请不再赘述。
在本申请实施例提供的电子设备200或外部存储设备(例如,当外部存储设备为智能终端设备时)中,其软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android系统为例,示例性说明电子设备或外部存储设备的软件结构参阅图3所示。
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。如图3所示,该软件架构可以分为四层,从上至下分别为应用程序层,应用程序框架层(framework,FWK),安卓运行时(Android runtime)和系统库,以及内核层。另外,电子设备或外部存储设备还可以包括硬件层。
应用程序层是操作系统的最上一层,包括操作系统的原生应用程序,以及第三方应用程序,例如相机、图库、日历、蓝牙、音乐、视频、信息等等。本申请实施例涉及的应用程序简称应用(application,APP),为能够实现某项或多项特定功能的软件程序。
在一些实施例中,应用程序层可以包括投屏服务,用于在屏幕协同场景下管理显示屏上与屏幕协同相关的界面或窗口,例如监听其它软件层接收到的用户针对这些界面或窗口的操作信息、根据监听到的用户操作信息对显示屏上的显示窗口进行控制、与其它电子设备的投屏服务进行屏幕协同相关的信息交互、获取界面或窗口中待显示的内容等。
在一些实施例中,应用程序层还可以包括应用窗口服务,用于管理电子设备显示屏上显示的本地的应用窗口,或者管理某些特定电子设备投屏来的应用窗口,例如监听其它层接收到的用户针对这些窗口的操作信息、根据监听到的用户操作信息对显示屏幕上的显示窗口进行控制等。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层可以包括一些预先定义的函数。应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器等。
窗口管理器用于提供窗口管理服务。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。窗口管理器可以提供多个管理函数,从而控制显示屏中窗口或界面的透明度、位置和尺寸等参数。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括文件(例如文档、视频、图像、音频),文本等信息。
视图系统包括可视控件,例如显示文字、图片、文档等内容的控件等。视图系统可用于构建应用程序。显示窗口中的界面可以由一个或多个控件组成的。例如,显示有文件图标的显示界面,可以包括显示文字的控件以及显示图片的控件。
电话管理器用于提供终端设备的通信功能。通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。
安卓运行时包括核心库和虚拟机。安卓运行时负责安卓系统的调度和管理。
安卓系统的核心库包含两部分:一部分是Java语言需要调用的功能函数,另一部分是安卓系统的核心库。应用程序层和应用程序框架层运行在虚拟机中。以Java举例,虚拟机将应用程序层和应用程序框架层的Java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(media libraries),三维图形处理库(例如:OpenGL ES),二维图形引擎(例如:SGL)等。表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了二维和三维图层的融合。媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图 层处理等。二维图形引擎是二维绘图的绘图引擎。
内核(Kernel)层提供操作系统的核心系统服务,如安全性、内存管理、进程管理、网络协议栈和驱动模型等都基于内核层实现。内核层同时也作为硬件和软件栈之间的抽象层。该层有许多与电子设备相关的驱动程序,主要的驱动有:显示驱动;作为输入设备的键盘驱动;基于内存技术设备的Flash驱动;摄像头驱动;音频驱动;蓝牙驱动;WiFi驱动等。
在一些实施例中,内核层还可以包括输入驱动服务,用于获取来自外部输入设备(例如鼠标、键盘、触控板等)、传感器(例如触摸屏、触摸传感器等)或其它电子设备的对显示屏幕上显示的界面或窗口进行的操作信息,并进行上报。
硬件层可以包括各类传感器、显示屏、摄像头等。
为了提高文件管理的灵活性,本申请实施例提供一种文件管理方法。下面结合附图对该方法进行说明。该方法可以应用于包括电子设备和外部存储设备的通信系统,例如图1A-图1C所示的场景中。参阅图4所示,该方法包括:
S401:在电子设备与外部存储设备建立连接后,所述电子设备在显示屏的第一窗口中显示所述外部存储设备存储的第一文件的图标。
S402:所述电子设备检测到第一操作时,在所述第一窗口中不显示所述第一文件的图标。其中,所述第一操作用于删除所述第一文件。
S403:所述电子设备检测到第二操作时,在所述显示屏中显示包含所述第一文件的图标的回收站窗口。其中,所述第二操作用于打开所述电子设备的回收站。
通过本申请实施例提供的方法,当用户通过所述电子设备显示的所述第一窗口删除所述外部存储设备存储的所述第一文件时,所述电子设备的所述回收站窗口中可以显示所述第一文件的图标,从而可以提醒用户第一文件已被删除。该方法可以提高电子设备文件管理的灵活性,提高用户体验。
在一种实施方式中,在S403之后,所述电子设备在所述回收站窗口内检测到第三操作时,还可以在所述回收站窗口中不显示所述第一文件的图标,以及在所述第一窗口中显示所述第一文件的图标。其中,所述第三操作用于还原所述第一文件。
通过该实施方式,用户可以通过所述电子设备显示的所述回收站窗口,恢复还原所述外部存储设备的已被删除的所述第一文件,进一步提高电子设备文件管理的灵活性,以及用户体验。
在一种实施方式中,在S403之后,当所述电子设备与所述外部存储设备断开连接后,所述电子设备检测到所述第二操作时,在所述显示屏中显示不包含所述第一文件的图标的回收站窗口;当所述电子设备与所述外部存储设备再次建立连接后,所述电子设备检测到所述第二操作时,在所述显示屏中显示包含所述第一文件的图标的回收站窗口。
通过该实施方式,当所述外部存储设备与所述电子设备断开连接后,电子设备的回收站窗口不再显示所述外部存储设备的已被删除的所述第一文件,而当所述外部存储设备与所述电子设备再次建立连接后,所述电子设备的回收站窗口可以再次显示该第一文件。这样,可以保证每次所述外部存储设备与所述电子设备连接时,所述电子设备的回收站窗口都能显示所述外部存储设备的已被删除的文件,以便提示用户以及方便用户对这些已删除的文件进行文件管理。
在本申请实施例中,所述电子设备和所述外部存储设备可以通过以下交互流程,实现上述文件管理方法,具体过程可以参阅图5所示。
S501:在所述电子设备与所述外部存储设备建立连接后,所述电子设备可以将所述外部存储设备的虚拟回收站映射到所述电子设备的所述回收站。其中,所述虚拟回收站为所述外部存储设备创建的隐藏的系统文件夹。
通过本步骤,所述外部存储设备的虚拟回收站(隐藏的系统文件夹)可以映射到该回收站,这样,当用户打开所述电子设备的回收站时,回收站窗口可以显示位于该虚拟回收站中的文件的图标。
可选的,所述虚拟回收站可以为所述外部存储设备首次开机或上电时创建的。应注意,当所述外部存储设备关机或下电时该虚拟回收站不会消失;当外部存储设备再次开机或再次上电时,该虚拟回收站依然存在。
S502:当所述电子设备检测到所述第一操作时,向所述外部存储设备发送文件删除指令;其中, 所述文件删除指令用于指示所述外部存储设备删除所述第一文件。所述外部存储设备接收来自所述电子设备的文件删除指令。
S503:所述外部存储设备根据所述文件删除指令,将所述第一文件的文件属性从默认值修改为已删除,并在所述虚拟回收站中创建第一链接信息;其中,所述第一链接信息用于指示所述第一文件。
在本步骤中,通过修改所述第一文件的文件属性,可以保证该第一文件对外显示为已删除状态,即无论是所述外部存储设备的用户界面,还是所述电子设备的所述第一窗口中,均不会显示该第一文件的图标。
而所述外部存储设备不移动所述第一文件的位置(即不改变第一文件的存储空间和存储地址),可以便于后续恢复该第一文件。另外,由于未移动所述第一文件,因此,该虚拟回收站只保存已删除文件的链接信息,而无需保存已删除文件,因此,该虚拟回收站实际不会占用外部存储设备的较大的存储空间。另外,在所述虚拟回收站中创建该第一链接信息,可以便于所述外部存储设备后续可以通过该第一链接信息查找到所述第一文件。
S503a:可选的,当所述第一文件为多媒体文件时,所述外部存储设备还可以根据所述文件删除指令,删除媒体库中所述第一文件的媒体信息。
应注意,本步骤为可选步骤。该步骤可以在所述第一文件为多媒体文件,且所述外部存储设备包含媒体库的情况下执行。
在S503a中,所述外部存储设备删除媒体库中所述第一文件的媒体信息,可以避免媒体库在进行文件扫描时扫描到该文件,从而可以保证所述外部存储设备的用户界面不会显示该第一文件。
S504:所述电子设备检测到所述第二操作时,在所述显示屏中显示包含至少一个删除文件的图标的回收站窗口。其中,所述至少一个删除文件包含所述虚拟回收站中至少一个链接信息所指示的文件,所述至少一个链接信息包含所述第一链接信息;所述至少一个删除文件包含所述第一文件。
另外,所述至少一个删除文件中可以还包含所述电子设备本地已删除的文件。
在S504中,所述电子设备可以通过现有技术实现在回收站窗口中显示至少一个删除文件的图标。例如,所述电子设备的操作系统可以调用相关API实现,具体过程本申请实施例不再赘述。
S505:所述电子设备检查到所述第三操作时,向所述外部存储设备发送文件恢复指令。其中,所述文件恢复指令用于指示所述外部存储设备还原所述第一文件。所述外部存储设备接收来自所述电子设备的文件恢复指令。
S506:所述外部存储设备根据所述文件恢复指令,将所述第一文件的文件属性恢复为所述默认值,并删除所述虚拟回收站中的所述第一链接信息。
由于在S503中,所述外部存储设备在删除第一文件时,仅改变所述第一文件的文件属性以及创建第一链接信息,因此,所述外部存储设备在还原所述第一文件时,也可以通过步骤S506,将所述第一文件的文件属性恢复为默认值,并删除该第一链接信息即可实现。
通过以上步骤S501-S506,所述电子设备与所述外部存储设备可以通过一些指令交互,实现图4所示的文件管理方法,保证所述电子设备的回收站窗口中可以显示所述外部存储设备中已删除的文件的图标。另外,用户还可以通过所述电子设备的回收站窗口,还原所述外部存储设备中已删除的文件。
下面结合不同的场景,对图5所示的交互过程进行示例性说明。
实施方式一:参考图1C所示,当所述外部存储设备为智能终端设备时,所述电子设备与所述外部存储设备通过短距离无线通信技术建立无线通信连接(即上述场景二)。下面参阅图6所示的流程进行详细说明。
所述电子设备可以通过以下步骤S601-S603,在显示屏中显示第一窗口(即投屏窗口)。其中,该第一窗口中包含所述外部存储设备存储的所述第一文件的图标。
S601:在所述电子设备与所述外部存储设备建立连接后,所述电子设备与所述外部存储设备通过所述无线通信连接建立设备协同通道。
S602:所述外部存储设备可以根据当前显示的屏幕窗口,通过所述设备协同通道向所述电子设备发送投屏数据;所述电子设备通过所述设备协同通道接收来自所述外部存储设备的投屏数据。
S603:所述电子设备根据投屏数据,在所述显示屏中显示所述第一窗口。其中,所述第一窗口为所述外部存储设备当前显示的屏幕窗口。
需要说明的是,在上述投屏过程的具体执行过程可以参考传统的投屏技术,此处不再展开描述。
可选的,在本实施方式中,所述电子设备可以通过以下步骤S604-S607,将所述外部存储设备的虚拟回收站映射到所述回收站(即执行上述步骤S501)。
S604:所述电子设备根据媒体传输协议(media transfer protocol,MTP),生成文件管理指令。其中,所述文件管理指令用于指示所述外部存储设备将所述虚拟回收站挂载为所述电子设备的虚拟磁盘。
可选的,所述电子设备可以在与所述外部存储设备建立设备协同通道后,即触发执行S604。
S605:所述电子设备根据网络控制模式(network control model,NCM)技术,通过所述设备协同通道向所述外部存储设备发送所述文件管理指令。所述外部存储设备根据所述NCM技术,通过所述设备协同通道接收来自所述电子设备的所述文件管理指令。
通过NCM技术,主机(Host)和设备(Device)之间可以MTP/USB数据格式的数据包转换为以太网帧进行传输。因此,在本申请实施例中,所述电子设备与所述外部存储设备之间可以利用NCM技术,传输MTP数据格式的消息(后续简称为MTP消息)。即发送端和接收端可以通过以下步骤,完成MTP消息的传输:
发送端将待发送的MTP消息转换成以太网帧,并通过设备协同通道发送至接收端;
接收端通过设备协同通道接收到以太网帧后,利用NCM技术将接收的以太网帧转换为MTP消息。
S606:所述外部存储设备根据所述文件管理指令将所述虚拟回收站挂载为所述电子设备的虚拟磁盘。
可选的,所述外部存储设备可以根据所述文件管理指令,修改所述虚拟回收站的属性,并利用磁盘管理程序将所述虚拟回收站挂载为所述电子设备的虚拟磁盘。
S607:所述电子设备通过磁盘管理程序,将所述虚拟回收站映射到所述回收站。
可选的,在本实施方式中,所述电子设备可以通过以下步骤S608-S613,在检测到第一操作时向所述外部存储设备发送文件删除指令(即执行上述步骤S502)。
S608:所述电子设备检测到所述第一操作时,根据所述MTP,生成文件路径请求。其中,所述文件路径请求用于请求所述第一文件的存储路径。
所述第一操作可以为电子设备的常规文件删除操作,又或者为用户新定义的文件删除操作,本申请实施例对第一操作的具体形式不作限定。下面举例说明:
例如:所述第一操作可以为用户通过鼠标点击(单击(左键单击或右键单击)、双击、多次连击,或长按等)或手指触摸(单击、双击、多次连击,或长按等)选中所述第一文件后,弹出文件管理菜单;然后用户在文件管理菜单中删除按键,并在确认窗口中点击确认按键等一系列连续操作。
又例如,所述第一操作可以为用户通过鼠标点击或手指触摸选择所述第一文件后,按键盘中的“delete”键,然后在确认窗口中点击确认按键等一系列连续操作。
再例如,所述第一操作可以为用户通过手指触摸选择所述第一文件后,并触摸第一窗口中的删除按键等一系列操作。
再例如,所述第一操作可以为用户通过手指触摸实现的点击、长按或滑动中的至少一个连续操作。
S609:所述电子设备根据所述NCM技术,通过所述设备协同通道向所述外部存储设备发送所述文件路径请求。所述外部存储设备根据所述NCM技术,通过所述设备协同通道接收来自所述电子设备的所述文件路径请求。
S610:所述外部存储设备根据所述文件路径请求,获取所述第一文件的存储路径,并根据所述MTP,生成包含所述第一文件的存储路径的文件路径响应。
S611:所述外部存储设备根据所述NCM技术,通过所述设备协同通道向所述电子设备发送所述文件路径响应。所述电子设备根据所述NCM技术,通过所述设备协同通道接收来自所述外部存储设备的所述文件路径响应。
通过以上S608-S611,所述电子设备可以基于MTP获取待删除的所述第一文件的存储路径,以便生成文件删除指令。
S612:所述电子设备从所述文件路径响应中获取所述第一文件的存储路径,并生成包含所述第一文件的存储路径的文件删除指令。
S613:所述电子设备通过所述设备协同通道向所述外部存储设备发送所述文件删除指令。所述外部存储设备通过所述设备协同通道接收来自所述电子设备的所述文件删除指令。
在S613之后,所述外部存储设备在执行S503时,可以根据所述文件删除指令中的所述第一文件的存储路径,查找到所述第一文件,从而执行相应地操作删除所述第一文件。
还需要说明的是,当所述电子设备检测到永久性删除所述第一文件的操作后,所述电子设备也可以通过上述S608-S611获取所述第一文件的存储路径,并生成包含所述第一文件的存储路径的文件永久删除指令,并通过设备协同通道发送所述文件永久删除指令。所述外部存储设备在接收到该文件永久删除指令后,直接永久性删除该第一文件。该永久性删除过程与现有技术相同,此处不再赘述。
可选的,在本实施方式中,所述电子设备可以通过以下步骤S614-S619,在所述回收站窗口内检测到所述第三操作时向所述外部存储设备发送文件恢复指令(即执行上述步骤S505)。
S614:所述电子设备在所述回收站窗口内检测到所述第三操作时,根据所述MTP,生成文件信息请求。其中,所述文件信息请求用于请求所述第一链接信息所指示的所述第一文件的存储路径和文件名。
S615:所述电子设备根据所述NCM技术,通过所述设备协同通道向所述外部存储设备发送所述文件信息请求。所述外部存储设备根据所述NCM技术,通过所述设备协同通道接收来自所述电子设备的所述文件信息请求。
S616:所述外部存储设备根据所述文件信息请求,确定所述第一链接信息所指示的所述第一文件的存储路径和文件名;根据所述MTP,生成包含所述第一文件的存储路径和文件名的文件信息响应。
S617:所述外部存储设备根据所述NCM技术,通过所述设备协同通道向所述电子设备发送所述文件信息响应。所述电子设备根据所述NCM技术,通过所述设备协同通道接收来自所述外部存储设备的所述文件信息响应。
S618:所述电子设备获取所述文件信息响应中的所述第一文件的存储路径和文件名,并生成包含所述第一文件的存储路径和文件名的文件恢复指令。
S619:所述电子设备通过所述设备协同通道向所述外部存储设备发送所述文件恢复指令。所述外部存储设备通过所述设备协同通道接收来自所述电子设备的所述文件恢复指令。
在S619之后,所述外部存储设备可以根据接收到的文件恢复指令中所述第一文件的存储路径和文件名,查到所述第一文件,从而执行相应地操作,即执行S506,恢复所述第一文件。
实施方式二:参考图1A和图1B所示,当所述外部存储设备和所述电子设备具有通信接口时,所述电子设备与所述外部存储设备通过所述通信接口建立物理通信连接(即上述场景一)。下面参考图7所示的流程进行详细说明。
所述电子设备可以通过以下步骤S701-S703,在显示屏中显示第一窗口(即外部存储设备映射的虚拟磁盘的显示窗口)。其中,该第一窗口中包含所述外部存储设备存储的所述第一文件的图标。
S701:所述电子设备与所述外部存储设备通过通信接口建立物理通信连接。
S702:在所述电子设备与所述外部存储设备建立连接后,所述电子设备根据所述通信接口对应的通信协议将所述外部存储设备的存储空间映射为所述电子设备的第一磁盘。
该第一磁盘即为所述电子设备的虚拟磁盘,当所述外部存储设备与所述电子设备的物理通信连接断开时,该虚拟磁盘在所述电子设备上消失。
示例性的,所述通信接口可以但不限于为USB接口,USB接口对应的通信协议即USB协议。
S703:所述电子设备检测到第四操作后,在所述显示屏中显示所述第一窗口。其中,所述第四操作用于打开所述第一磁盘,所述第一窗口为所述第一磁盘的显示窗口。
需要说明的是,上述将所述外部存储设备的存储空间映射为第一磁盘的具体过程可以参考传统技术,此处不再赘述。
可选的,在本实施方式中,所述电子设备可以通过以下步骤S704-S707,将所述外部存储设备的虚拟回收站映射到所述回收站(即执行上述步骤S501)。
S704:所述电子设备基于所述通信协议,生成文件管理指令。其中,所述文件管理指令用于指示所述外部存储设备将所述虚拟回收站挂载为所述电子设备的虚拟磁盘。
可选的,所述电子设备可以在与所诉外部存储设备建立物理通信连接后,即触发执行S704。
S705:所述电子设备通过所述通信接口向所述外部存储设备发送所述文件管理指令。所述外部存储设备通过所述通信接口接收来自所述电子设备的所述文件管理指令。
S706:所述外部存储设备根据所述文件管理指令将所述虚拟回收站挂载为所述电子设备的虚拟磁盘。
同S606,所述外部存储设备可以根据所述文件管理指令,修改所述虚拟回收站的属性,并利用磁盘管理程序将所述虚拟回收站挂载为所述电子设备的虚拟磁盘。
S707:所述电子设备通过磁盘管理程序,将所述虚拟回收站映射到所述回收站。
可选的,在本实施方式中,所述电子设备可以通过以下步骤S708-S713,在检测到所述第一操作时向所述外部存储设备发送文件删除指令(即执行上述步骤S502)。
S708:所述电子设备检测到所述第一操作时,根据所述通信协议,生成文件路径请求。其中,所述文件路径请求用于获取所述第一文件的存储路径。
可选的,所述第一操作可以为用户对电子设备的磁盘中文件的常规文件删除操作,此处不再赘述。
S709:所述电子设备通过所述通信接口向所述外部存储设备发送所述文件路径请求。所述外部存储设备通过所述通信接口接收来自所述电子设备的所述文件路径请求。
S710:所述外部存储设备根据所述文件路径请求,获取所述第一文件的存储路径,并根据所述通信协议生成包含所述第一文件的存储路径的文件路径响应。
S711:所述外部存储设备通过所述通信接口向所述电子设备发送所述文件路径响应;所述电子设备通过所述通信接口接收所述文件路径获取响应。
通过上述步骤S708-S711,所述电子设备可以通过通信接口获取待删除的所述第一文件的存储路径,以便生成文件删除指令。
S712:所述电子设备从所述文件路径获取响应中获取所述第一文件的存储路径,并生成包含所述第一文件的存储路径的文件删除指令。
S713:所述电子设备通过所述通信接口向所述外部存储设备发送所述文件删除指令。所述电子设备通过所述通信接口接收来自所述电子设备的所述文件删除指令。
在S713之后,所述外部存储设备可以根据所述文件删除指令中的所述第一文件的存储路径,查找到所述第一文件,并执行相应的操作删除所述第一文件,从而完成S503。
还需要说明的是,当所述电子设备检测到永久性删除所述第一文件的操作后,所述电子设备也可以通过上述S708-S711获取所述第一文件的存储路径,并生成包含所述第一文件的存储路径的文件永久删除指令,并通过通信接口发送所述文件永久删除指令。所述外部存储设备在接收到该文件永久删除指令后,直接永久性删除该第一文件。该永久性删除过程与现有技术相同,此处不再赘述。
可选的,在本实施方式中,所述电子设备可以通过以下步骤S714-S719,在所述回收站窗口内检测到所述第三操作时向所述外部存储设备发送文件恢复指令(即执行上述步骤S505)。
S714:所述电子设备在所述回收站窗口内检测到所述第三操作时,根据所述通信协议,生成文件信息请求。其中,所述文件信息请求用于请求所述第一链接信息所指示的所述第一文件的存储路径和文件名。
S715:所述电子设备通过所述通信接口向所述外部存储设备发送所述文件信息请求。所述外部存储设备通过所述通信接口接收来自所述电子设备的所述文件信息请求。
S716:所述外部存储设备根据所述文件信息请求,确定所述第一链接信息所指示的所述第一文件的存储路径和文件名;根据所述通信协议,生成包含所述第一文件的存储路径和文件名的文件信息响应。
S717:所述外部存储设备通过所述通信接口向所述电子设备发送所述文件信息响应。所述电子设备通过所述通信接口接收来自所述外部存储设备的所述文件信息响应。
S718:所述电子设备获取所述文件信息响应中的所述第一文件的存储路径和文件名,并生成包含所述第一文件的存储路径和文件名的文件恢复指令。
S719:所述电子设备通过所述通信接口向所述外部存储设备发送所述文件恢复指令。所述外部存储设备通过所述通信接口接收来自所述电子设备的所述文件恢复指令。
在S719之后,所述外部存储设备可以根据接收到的文件恢复指令中所述第一文件的存储路径和文件名,查到所述第一文件,从而执行相应地操作,即执行S506,恢复所述第一文件。
基于图4和图5所示的实施例,以及图6和图7所示的两种不同场景下的电子设备和外部存储设备之间的交互过程,本申请还提供了以下两种实施例。需要说明的是,以下实施例作为示例,并不对本申请提供的文件管理方法构成任何限定。
实施例一:在如图1C所示的智能手机与PC进行屏幕协同的场景中。
先对手机文件系统(例如闪存友好文件系统(flash friendly file system,F2FS))中文件的文件属性进行说明。
在手机文件系统(例如F2FS)中,文件数据结构的i_flags参数用于指示文件属性(file attributes)。该i_flags参数为32位整型数据,其中,第31位可以标识文件的删除状态。当文件产生时,该文件的i_flags参数中的第31位取值为默认值(例如0);当该文件的i_flags参数中的第31位取值不等于默认值(例如1),则标识该文件已删除。
还需要说明的是,当该文件被临时性删除,则该文件的i_flags参数中的第31位会被标记为非默认值,但是该文件的索引节点(inode)不会被释放;当该文件被永久性删除,则不仅该文件的i_flags参数中的第31位会被标记为非默认值,该文件的inode也会被释放。
PC中可以安装有用于实现屏幕协同的应用(例如PC管家等),后续可以将该应用称为协同服务应用。协同服务应用不仅可以实现屏幕协同,还具有文件管理功能。在本实施例中,将协同服务应用中实现文件管理功能的资源称为文件管理子模块。
其中,文件管理子模块支持MTP和Wi-Fi P2P技术。智能手机与PC的屏幕协同可以基于Wi-Fi P2P技术建立无线通信连接实现。另外,智能手机和PC之间可以通过NCM技术实现设备与主机之间的以太网帧与MTP/USB数据格式的数据包之间的转换。
通过该文件管理子模块,PC可以通过MTP将智能手机的存储空间挂载为PC的虚拟磁盘,从而将智能手机中的虚拟回收站映射到PC的回收站。
另外,在PC在对智能手机中的文件进行删除或还原时,还可以利用该文件管理子模块通过MTP从智能手机获取文件的存储路径或文件名等文件信息,从而实现文件管理。
下面结合示意图对PC对智能手机进行文件管理的过程进行示例性说明。
参阅图8A所示,当智能手机与PC通过Wi-Fi P2P技术建立设备协同通道后,智能手机可以通过设备协同通道中的屏幕协同通道向PC发送投屏数据。另外,PC也支持在投屏窗口反向控制智能手机。在反向控制过程中,PC可以通过协同反向控制通道,向智能手机发送控制指令。
智能手机和PC的协同服务应用均支持MTP,二者通过NCM技术实现MTP数据格式的数据包与以太网帧之间的转换,间接实现MTP消息的交互,从而将智能手机的外部存储空间(例如,外部存储空间的目录为data/media/0)通过MTP,挂载为PC的虚拟磁盘(又称为外部磁盘),如图8B所示。
进一步的,PC的协同服务应用中的文件管理子模块还可以通过NCM技术间接传输MTP消息(例如图6中S604中的文件管理指令),修改智能手机中虚拟回收站的属性,并利用磁盘管理程序将挂载的虚拟磁盘插入PC的本地磁盘,进而将智能手机中的虚拟回收站映射到PC的回收站。这样,当用户打开PC的回收站窗口,可以查看到用户通过投屏窗口删除的智能手机内的文件。如图8C所示,用户通过投屏窗口删除智能手机的PIC1时,打开回收站窗口时,回收站窗口即可显示PIC1的图标。
其中,智能手机的虚拟回收站为智能手机在外部存储目录,基于操作系统(例如linux系统)命令创建的一个隐藏的命名为$Recycle.bin的系统文件夹。当用户通过投屏窗口删除智能手机的某个文件时,智能手机在对该文件执行删除过程中可以将该文件的文件属性修改为已删除,并在虚拟回收站中创建指示该文件的链接信息。由于虚拟回收站用于保存智能手机已删除文件的链接信息,在实际上并没有保存该文件。这一特征与PC中的回收站不同,因此称之为“虚拟回收站”。
继续以图8C为例说明,当用户通过投屏窗口删除智能手机的PIC1时,智能手机只修改PIC1的文件属性,不移动PIC1的存储位置,同时在媒体库中删除PIC1的媒体信息,这样,智能手机的外部存储目录、屏幕窗口都不再显示PIC1。智能手机在虚拟回收站中创建指示PIC1的链接信息,以便PC的回收站窗口可以显示PIC的图标。
下面继续以PIC1为例,对用户通过PC的投屏窗口对智能手机进行文件管理的过程进行详细说明。
(1)删除PIC1,参阅图8D所示。
用户在PC的投屏窗口上选择PIC1,并执行删除操作时,PC的协同服务应用响应于此删除操作,通过MTP生成文件路径请求(例如getObjectFilePath()),根据NCM技术将该文件路径请求转换为以太网帧,并通过设备协同通道传输到智能手机。
智能手机根据NCM技术将接收到的以太网帧转换为文件路径请求,并根据该文件路径请求获取PIC1的存储路径。智能手机根据MTP生成包含PIC1的存储路径的文件路径响应,并根据NCM技术将该文件路径响应转换为以太网帧,通过设备协同通道传输到PC。
PC的协同服务应用接收到以太网帧后,根据NCM技术将该以太网帧转换为文件路径响应,从而可以获取文件路径响应中的PIC1的存储路径。PC的协同服务应用可以基于PIC1的存储路径生成文件删除指令(例如包含PIC1存储路径和删除(remove)事件的指令)。然后PC可以通过协同反向控制通道将文件删除指令传输至智能手机。
智能手机根据该文件删除指令对PIC1执行删除操作,包括:根据文件删除指令中的PIC的存储路径查找到PIC1,然后将PIC1的i_flags参数中的第31位从默认值修改为其他值,以标记PIC1已删除,同时在媒体库里删除PIC1的媒体信息。另外,智能手机还需要通过操作系统命令(例如linux系统)在虚拟回收站中创建指示PIC1的链接信息(链接命令In-s1)。
当智能手机删除PIC1之后,由于虚拟回收站映射到PC的回收站,因此,当用户打开PC的回收站时,回收站窗口中显示PIC的图标,而投屏窗口不再显示PIC1的图标。
(2)永久性删除PIC1,参阅图8E所示。
用户在PC的投屏窗口上选择PIC1,并执行永久删除操作时,PC的协同服务应用响应于该永久性删除操作,获取PIC1的存储路径,具体过程可以参考(1)中的描述,此次不再赘述。PC的协同服务应用可以基于PIC的存储路径生成文件永久删除指令(例如包含PIC1存储路径和永久删除(delete)事件的指令),并通过协同反向控制通道将该文件永久删除指令传输至智能手机。
智能手机根据该文件永久删除指令中PIC1的存储路径,查找到PIC1,然后对PIC1执行永久性删除操作,具体删除过程与现有技术相同,此处不再赘述。
当智能手机永久性删除PIC1之后,智能手机的外部存储目录中PIC1彻底消失,虚拟回收站中也不存在指示PIC1的链接信息,因此,当用户打开PC的回收站时,回收站窗口中不会显示PIC的图标,且投屏窗口也不再显示PIC1的图标。
(3)在通过上述(1)删除PIC1之后,还原PIC1,参阅图8F所示。
用户在PC的回收站窗口中选择PIC1,并执行还原操作时,PC的协同服务应用响应于此还原操作,通过MTP生成文件信息请求(例如,包含getObjectFilePath()。可选的,还可以包含指示PIC1的链接信息(例如链接命令In-s1))。PC的协同服务应用根据NCM技术将该文件信息请求转换为以太网帧,并通过设备协同通道传输到智能手机。
智能手机根据NCM技术将接收到以太网帧转换为文件信息请求,并根据该文件信息请求获取PIC1的存储路径和文件名。智能手机根据MTP生成包含PIC1的存储路径和文件名的文件信息响应,并根据NCM技术将该文件信息响应转换为以太网帧,通过设备协同通道传输到PC。
PC的协同服务应用接收到以太网帧后,根据NCM技术将该以太网帧转换为文件信息响应,从而可以获取文件信息响应中的PIC1的存储路径和文件名。PC的协同服务应用可以基于PIC1的存储路径和文件名生成文件恢复指令(例如包含PIC1存储路径、文件名,以及恢复事件的指令)。然后PC的协同服务应用可以通过协同反向控制通道将文件恢复指令传输至智能手机。
智能手机根据该文件恢复指令对PIC1执行恢复操作,包括:根据文件删除指令中的PIC的存储路径查找到PIC1,然后将PIC1的i_flags参数中的第31位恢复为默认值,以标记为未删除,以及删除虚拟回收站中指示PIC1的链接信息(例如链接命令In-s1))。
当智能手机恢复PIC1后,PC的回收站窗口不再显示该PIC1,而PC的投屏窗口可以显示该PIC1。
基于实施例一提供的文件管理方法,当用户通过PC删除智能手机中的PIC1时,PC和智能手机的屏幕变化如下:
如图9A所示,智能手机通过设备协同通道将当前显示的屏幕窗口投到PC的显示屏中。此时,PC的显示屏中的投屏窗口与智能手机的屏幕窗口显示内容相同。用户在PC的投屏窗口选中图像PIC1(即最后一个图像,图中具有填充标记的图像),并对PIC1进行删除操作。基于上述(1)中描述的过程删 除PIC1后,PC的投屏窗口,以及智能手机的屏幕窗口均不再显示PIC的图标,参阅图9B所示。而当用户打开PC的回收站时,PC显示的回收站窗口中显示PIC1的图标(图中具有填充标记的图像),参阅图9C所示。
实施例二:在如图1A所示的PC连接U盘的场景中。需要说明的是,PC通过通信接口连接其他设备,或者图1B所示的场景中的文件管理方法与实施例二提供的文件管理方法类似,因此,本实施例二提供的文件管理方法可以扩展到其他类似场景中,本申请不再赘述。
继续以对PIC1进行文件管理为例。
在本实施例中,U盘与PC的交互过程与实施例一中智能手机与PC的交互过程类似,相同之处可以相互参考,不同的是:
在PC在U盘插入PC的USB接口时,PC可以根据USB协议、磁盘管理程序将U盘的存储空间映射为PC的虚拟磁盘。当用户在PC中操作打开该虚拟磁盘时,PC显示磁盘的显示窗口。该窗口中可以显示PIC1的图片。
PC与U盘进行消息交互的过程可以通过通信接口完成,无需通过NCM技术实现。
另外,U盘的文件系统(例如文件配置表(file allocation table,FAT)系统、FAT32系统、扩展(extended)FAT(即exFAT)系统)在删除或还原PIC1时,除了修改PIC1的i_flags参数中的第31位的取值,还可以通过新增的接口来在虚拟回收站中创建或删除指示PIC1的链接信息,而无需通过操作系统命令实现。
基于实施例二提供的文件管理方法,当用户通过PC删除U盘中的PIC1时,PC中的屏幕变化如下:
如图10A所示,当U盘插入PC的USB接口时,PC会将U盘的存储空间映射为PC的虚拟磁盘(即新加卷(F:))。当用户选择打开新加卷(F:)时,PC的显示屏中显示新加卷(F:)的显示窗口,其中,该显示窗口中显示有PIC1的图标(图中具有填充标记的图像)。当用户通过该显示窗口选择并删除PIC1后,该显示窗口不再显示PIC的图标,如图10B所示。而当用户打开PC的回收站时,PC显示的回收站窗口中显示PIC1的图标(图中具有填充标记的图像),如图10C所示。
以上各个实施例可以相互结合使用,也可以单独使用,对此不作限定。
基于相同的构思,本申请实施例还提供了一种电子设备,如图11所示,包括处理器1101、存储器1102、通信模块1103和显示屏1104。示例的,上述各器件可以通过一个或多个通信总线连接。其中,该一个或多个计算机程序被存储在上述存储器1102中并被配置为被处理器1101执行,该一个或多个计算机程序包括指令,上述指令可以用于使电子设备执行上述各实施例中的方法的各个步骤。
示例性的,上述处理器1101具体可以为图2所示的处理器210。上述存储器1102具体可以为图2所示的内部存储器221和/或与电子设备连接的外部存储器。上述通信模块1103包括收发器或通信接口,其中,收发器可以为图2所示的移动通信模块250、和/或无线通信模块260,通信接口可以为图2所示的外部存储器接口220和/或USB接口等。上述显示屏1104具体可以为图2所示的显示屏294,本申请实施例对此不做任何限制。
基于相同的构思,本申请实施例还提供了一种外部存储设备,如图12所示,包括处理器1201、存储器1202,和收发器1203。可选的,该外部存储设备还可以包含显示屏1204。其中,上述各个器件可以通过一个或多个通信总线连接。其中,该一个或多个计算机程序被存储在上述存储器1202中并被配置为被处理器1201执行,该一个或多个计算机程序包括指令,上述指令可以用于使外部存储设备执行上述各实施例中的方法的各个步骤。
另外,本申请实施例还提供了一种电子设备上的图形用户界面(graphical user interface,GUI),该图形用户界面具体包括电子设备在执行上述各方法实施例时显示的图形用户界面。
以上实施例中所用,根据上下文,术语“当…时”或“当…后”可以被解释为意思是“如果…”或“在…后”或“响应于确定…”或“响应于检测到…”。类似地,根据上下文,短语“在确定…时”或“如果检测到(所陈述的条件或事件)”可以被解释为意思是“如果确定…”或“响应于确定…”或“在检测到(所陈述的条件或事件)时”或“响应于检测到(所陈述的条件或事件)”。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指 令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。在不冲突的情况下,以上各实施例的方案都可以组合使用。
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本申请是参照根据本申请的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。

Claims (14)

  1. 一种文件管理方法,应用于包括电子设备和外部存储设备的通信系统,其特征在于,包括:
    在所述电子设备与所述外部存储设备建立连接后,所述电子设备在显示屏的第一窗口中显示所述外部存储设备存储的第一文件的图标;
    所述电子设备检测到第一操作时,在所述第一窗口中不显示所述第一文件的图标;其中,所述第一操作用于删除所述第一文件;
    所述电子设备检测到第二操作时,在所述显示屏中显示包含所述第一文件的图标的回收站窗口;其中,所述第二操作用于打开所述电子设备的回收站。
  2. 如权利要求1所述的方法,其特征在于,在所述显示屏中显示包含所述第一文件的图标的回收站窗口之后,所述方法还包括:
    所述电子设备在所述回收站窗口内检测到第三操作时,在所述回收站窗口中不显示所述第一文件的图标,以及在所述第一窗口中显示所述第一文件的图标;其中,所述第三操作用于还原所述第一文件。
  3. 如权利要求1或2所述的方法,其特征在于,在所述显示屏中显示包含所述第一文件的图标的回收站窗口之后,所述方法还包括:
    当所述电子设备与所述外部存储设备断开连接后,所述电子设备检测到所述第二操作时,在所述显示屏中显示不包含所述第一文件的图标的回收站窗口;
    当所述电子设备与所述外部存储设备再次建立连接后,所述电子设备检测到所述第二操作时,在所述显示屏中显示包含所述第一文件的图标的回收站窗口。
  4. 如权利要求2所述的方法,其特征在于,所述方法还包括:
    在所述电子设备与所述外部存储设备建立连接后,所述电子设备将所述外部存储设备的虚拟回收站映射到所述回收站;其中,所述虚拟回收站为所述外部存储设备创建的隐藏的系统文件夹;
    所述电子设备检测到所述第一操作时,向所述外部存储设备发送文件删除指令;其中,所述文件删除指令用于指示所述外部存储设备删除所述第一文件;
    所述外部存储设备接收来自所述电子设备的文件删除指令后,根据所述文件删除指令,将所述第一文件的文件属性从默认值修改为已删除,并在所述虚拟回收站中创建第一链接信息;其中,所述第一链接信息用于指示所述第一文件;
    所述电子设备检测到第二操作时,在所述显示屏中显示包含所述第一文件的图标的回收站窗口,包括:
    所述电子设备检测到所述第二操作时,在所述显示屏中显示包含至少一个删除文件的图标的回收站窗口;其中,所述至少一个删除文件包含所述虚拟回收站中至少一个链接信息所指示的文件,所述至少一个链接信息包含所述第一链接信息;所述至少一个删除文件包含所述第一文件。
  5. 如权利要求4所述的方法,其特征在于,当所述第一文件为多媒体文件时,所述方法还包括:
    所述外部存储设备根据所述文件删除指令,删除媒体库中所述第一文件的媒体信息。
  6. 如权利要求4或5所述的方法,其特征在于,所述方法还包括:
    所述电子设备检查到所述第三操作时,向所述外部存储设备发送文件恢复指令;其中,所述文件恢复指令用于指示所述外部存储设备还原所述第一文件;
    所述外部存储设备接收来自所述电子设备的文件恢复指令后,根据所述文件恢复指令,将所述第一文件的文件属性恢复为所述默认值,并删除所述虚拟回收站中的所述第一链接信息。
  7. 如权利要求6所述的方法,其特征在于,所述外部存储设备为智能终端设备,所述电子设备与所述外部存储设备建立连接,包括:
    所述电子设备与所述外部存储设备通过短距离无线通信技术建立无线通信连接;
    所述方法还包括:
    在所述电子设备与所述外部存储设备建立连接后,所述电子设备与所述外部存储设备通过所述无线通信连接建立设备协同通道;
    所述电子设备通过所述设备协同通道接收来自所述外部存储设备的投屏数据;
    所述电子设备根据投屏数据,在所述显示屏中显示所述第一窗口;其中,所述第一窗口为所述外部 存储设备当前显示的屏幕窗口;
    所述电子设备将所述外部存储设备的虚拟回收站映射到所述回收站,包括:
    所述电子设备根据媒体传输协议MTP,生成文件管理指令;其中,所述文件管理指令用于指示所述外部存储设备将所述虚拟回收站挂载为所述电子设备的虚拟磁盘;
    所述电子设备根据网络控制模式NCM技术,通过所述设备协同通道向所述外部存储设备发送所述文件管理指令;
    所述外部存储设备根据所述NCM技术,通过所述设备协同通道接收来自所述电子设备的所述文件管理指令,并根据所述文件管理指令将所述虚拟回收站挂载为所述电子设备的虚拟磁盘;
    所述电子设备通过磁盘管理程序,将所述虚拟回收站映射到所述回收站。
  8. 如权利要求7所述的方法,其特征在于,所述电子设备检测到所述第一操作时,向所述外部存储设备发送文件删除指令,包括:
    所述电子设备检测到所述第一操作时,根据所述MTP,生成文件路径请求;根据所述NCM技术,通过所述设备协同通道向所述外部存储设备发送所述文件路径请求;其中,所述文件路径请求用于请求所述第一文件的存储路径;
    所述外部存储设备根据所述NCM技术,通过所述设备协同通道接收来自所述电子设备的所述文件路径请求;根据所述文件路径请求,获取所述第一文件的存储路径,并根据所述MTP,生成包含所述第一文件的存储路径的文件路径响应;根据所述NCM技术,通过所述设备协同通道向所述电子设备发送所述文件路径响应;
    所述电子设备根据所述NCM技术,通过所述设备协同通道接收来自所述外部存储设备的所述文件路径响应;生成包含所述第一文件的存储路径的文件删除指令;
    所述电子设备通过所述设备协同通道向所述外部存储设备发送所述文件删除指令。
  9. 如权利要求7或8所述的方法,其特征在于,所述电子设备在所述回收站窗口内检测到所述第三操作时,向所述外部存储设备发送文件恢复指令,包括:
    所述电子设备在所述回收站窗口内检测到所述第三操作时,根据所述MTP,生成文件信息请求;并根据所述NCM技术,通过所述设备协同通道向所述外部存储设备发送所述文件信息请求,所述文件信息请求用于请求所述第一链接信息所指示的所述第一文件的存储路径和文件名;
    所述外部存储设备根据所述NCM技术,通过所述设备协同通道接收来自所述电子设备的所述文件信息请求;根据所述文件信息请求,确定所述第一链接信息所指示的所述第一文件的存储路径和文件名;根据所述MTP,生成包含所述第一文件的存储路径和文件名的文件信息响应;根据所述NCM技术,通过所述设备协同通道向所述电子设备发送所述文件信息响应;
    所述电子设备根据所述NCM技术,通过所述设备协同通道接收来自所述外部存储设备的所述文件信息响应;生成包含所述第一文件的存储路径和文件名的文件恢复指令;
    所述电子设备通过所述设备协同通道向所述外部存储设备发送所述文件恢复指令。
  10. 如权利要求6所述的方法,其特征在于,所述外部存储设备和所述电子设备具有通信接口,所述电子设备与所述外部存储设备建立连接,包括:
    所述电子设备与所述外部存储设备通过所述通信接口建立物理通信连接;
    所述方法还包括:
    在所述电子设备与所述外部存储设备建立连接后,所述电子设备根据所述通信接口对应的通信协议将所述外部存储设备的存储空间映射为所述电子设备的第一磁盘;
    所述电子设备检测到第四操作后,在所述显示屏中显示所述第一窗口;其中,所述第四操作用于打开所述第一磁盘,所述第一窗口为所述第一磁盘的显示窗口;
    所述电子设备将所述外部存储设备的虚拟回收站映射到所述回收站,包括:
    所述电子设备基于所述通信协议,生成文件管理指令;其中,所述文件管理指令用于指示所述外部存储设备将所述虚拟回收站挂载为所述电子设备的虚拟磁盘;
    所述电子设备通过所述通信接口向所述外部存储设备发送所述文件管理指令;
    所述外部存储设备通过所述通信接口接收来自所述电子设备的所述文件管理指令,并根据所述文件管理指令将所述虚拟回收站挂载为所述电子设备的虚拟磁盘;
    所述电子设备通过磁盘管理程序,将所述虚拟回收站映射到所述回收站。
  11. 如权利要求10所述的方法,其特征在于,所述电子设备检测到所述第一操作时,向所述外部存储设备发送文件删除指令,包括:
    所述电子设备检测到所述第一操作时,根据所述通信协议,生成文件路径请求,并通过所述通信接口向所述外部存储设备发送所述文件路径请求;其中,所述文件路径请求用于获取所述第一文件的存储路径;
    所述外部存储设备通过所述通信接口接收来自所述电子设备的所述文件路径请求;根据所述文件路径请求,获取所述第一文件的存储路径,并根据所述通信协议生成包含所述第一文件的存储路径的文件路径响应;通过所述通信接口向所述电子设备发送所述文件路径响应;
    所述电子设备通过所述通信接口接收所述文件路径获取响应后,生成包含所述第一文件的存储路径的文件删除指令;
    所述电子设备通过所述通信接口向所述外部存储设备发送所述文件删除指令。
  12. 如权利要求10或11所述的方法,其特征在于,所述电子设备在所述回收站窗口内检测到所述第三操作时,向所述外部存储设备发送文件恢复指令,包括:
    所述电子设备在所述回收站窗口内检测到所述第三操作时,根据所述通信协议,生成文件信息请求;并通过所述通信接口向所述外部存储设备发送所述文件信息请求,所述文件信息请求用于请求所述第一链接信息所指示的所述第一文件的存储路径和文件名;
    所述外部存储设备通过所述通信接口接收来自所述电子设备的所述文件信息请求;根据所述文件信息请求,确定所述第一链接信息所指示的所述第一文件的存储路径和文件名;根据所述通信协议,生成包含所述第一文件的存储路径和文件名的文件信息响应;通过所述通信接口向所述电子设备发送所述文件信息响应;
    所述电子设备通过所述通信接口接收来自所述外部存储设备的所述文件信息响应;生成包含所述第一文件的存储路径和文件名的文件恢复指令;
    所述电子设备通过所述通信接口向所述外部存储设备发送所述文件恢复指令。
  13. 一种电子设备,其特征在于,所述电子设备包括显示屏,存储器和一个或多个处理器;
    其中,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令;当所述计算机指令被所述一个或多个处理器执行时,使得所述电子设备执行如权利要求1-12任一项所述的方法。
  14. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质包括程序指令,当所述程序指令在终端设备上运行时,使得所述终端设备执行如权利要求1至12任一项所述的方法。
PCT/CN2023/131103 2022-11-28 2023-11-10 一种文件管理方法及电子设备 WO2024114344A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211500737.0A CN118092726A (zh) 2022-11-28 2022-11-28 一种文件管理方法及电子设备
CN202211500737.0 2022-11-28

Publications (1)

Publication Number Publication Date
WO2024114344A1 true WO2024114344A1 (zh) 2024-06-06

Family

ID=91141069

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/131103 WO2024114344A1 (zh) 2022-11-28 2023-11-10 一种文件管理方法及电子设备

Country Status (2)

Country Link
CN (1) CN118092726A (zh)
WO (1) WO2024114344A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004303053A (ja) * 2003-03-31 2004-10-28 Nippon Digital Kenkyusho:Kk ファイルの削除・復旧方法、情報処理装置、及びプログラム
CN103246429A (zh) * 2011-12-19 2013-08-14 微软公司 还原带有上下文的已删除项
US20180373409A1 (en) * 2017-05-16 2018-12-27 Apple Inc. Device, Method, and Graphical User Interface for Managing Data Stored on a Device
CN110888847A (zh) * 2019-12-16 2020-03-17 新华三技术有限公司成都分公司 一种回收站系统及文件回收方法
CN114490516A (zh) * 2022-01-30 2022-05-13 阿里巴巴(中国)有限公司 文件系统的处理方法、回收站管理方法、装置及设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004303053A (ja) * 2003-03-31 2004-10-28 Nippon Digital Kenkyusho:Kk ファイルの削除・復旧方法、情報処理装置、及びプログラム
CN103246429A (zh) * 2011-12-19 2013-08-14 微软公司 还原带有上下文的已删除项
US20180373409A1 (en) * 2017-05-16 2018-12-27 Apple Inc. Device, Method, and Graphical User Interface for Managing Data Stored on a Device
CN110888847A (zh) * 2019-12-16 2020-03-17 新华三技术有限公司成都分公司 一种回收站系统及文件回收方法
CN114490516A (zh) * 2022-01-30 2022-05-13 阿里巴巴(中国)有限公司 文件系统的处理方法、回收站管理方法、装置及设备

Also Published As

Publication number Publication date
CN118092726A (zh) 2024-05-28

Similar Documents

Publication Publication Date Title
US20220342850A1 (en) Data transmission method and related device
CN111666055B (zh) 数据的传输方法及装置
EP4040277A1 (en) Method for displaying multiple windows, and electronic device and system
CN111049935B (zh) 远程控制电子设备的系统及其电子设备
WO2022105759A1 (zh) 视频处理方法、装置及存储介质
WO2022089294A1 (zh) 一种设备间屏幕协同方法及设备
CN110865837B (zh) 一种进行系统升级的方法和终端
WO2022028494A1 (zh) 一种多设备数据协作的方法及电子设备
KR102503329B1 (ko) 이미지 분류 방법 및 전자 디바이스
US20220321629A1 (en) User Interface Content State Synchronization Across Devices
WO2023109764A1 (zh) 一种壁纸显示方法及电子设备
CN112148401A (zh) 一种视图显示方法和电子设备
WO2023237047A1 (zh) 数据处理方法及电子设备
CN117130516B (zh) 一种显示方法及电子设备
WO2023231856A1 (zh) 一种空调控制方法、电子设备及系统
WO2024114344A1 (zh) 一种文件管理方法及电子设备
WO2013016949A1 (en) User interface content state synchronization across devices
CN112711636B (zh) 数据同步方法、装置、设备及介质
JP2023539879A (ja) 共有ライブラリを再利用するための方法および電子デバイス
CN115114607A (zh) 分享授权方法、装置及存储介质
WO2024175068A1 (zh) 一种应用程序的分布式控制方法及电子设备
WO2024175070A1 (zh) 一种功能协同方法及电子设备
CN113642010A (zh) 一种获取扩展存储设备数据的方法及移动终端
WO2023226991A1 (zh) 一种应用信息的中转方法及终端
CN114513760B (zh) 字库同步方法、装置和存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23896496

Country of ref document: EP

Kind code of ref document: A1