WO2022111469A1 - File sharing method and apparatus, and electronic device - Google Patents

File sharing method and apparatus, and electronic device Download PDF

Info

Publication number
WO2022111469A1
WO2022111469A1 PCT/CN2021/132422 CN2021132422W WO2022111469A1 WO 2022111469 A1 WO2022111469 A1 WO 2022111469A1 CN 2021132422 W CN2021132422 W CN 2021132422W WO 2022111469 A1 WO2022111469 A1 WO 2022111469A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
file
identifier
electronic device
installation package
Prior art date
Application number
PCT/CN2021/132422
Other languages
French (fr)
Chinese (zh)
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 WO2022111469A1 publication Critical patent/WO2022111469A1/en

Links

Images

Classifications

    • 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/17Details of further file system functions
    • G06F16/176Support for shared access to files; File sharing support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a file sharing method, apparatus, and electronic device.
  • Electronic devices such as personal computers and smartphones have become an indispensable part of people's lives. These electronic devices often have multiple applications installed on them. Multiple applications can provide users with various services such as weather information, shopping, instant messaging, and photography.
  • Each application typically stores data related to the operation of the application in a directory of the electronic device's file system. The application can access the stored related data according to the running requirements.
  • the operating system of a general electronic device provides an application sandbox mechanism for each application in the electronic device.
  • Sandboxing is a security mechanism that provides an isolated environment for running programs. That is, each application can only access that application's data, not other applications' data. Adopting this security mechanism can prevent some applications from maliciously accessing other applications' data.
  • some applications need to share data, for example, application B needs to share data of application A (for example, a file of application A stored in the file system of the electronic device).
  • application A for example, a file of application A stored in the file system of the electronic device.
  • due to the security mechanism of the operating system in the electronic device it is difficult to share data between applications.
  • the present application provides a file sharing method, device and electronic device.
  • a specified file can be shared with a specified application program, and malicious access of the shared file by other application programs can be avoided. This enables safe and convenient data sharing between applications.
  • the present application provides a file sharing method, the method may include: acquiring an installation package of a first application, wherein the installation package of the first application includes a first file and a first identifier, and the first identifier Indicates that the shared object of the first file includes the second application; and according to the first identification, the second application is provided with the access right of the first file.
  • a specified file can be shared with a specified application.
  • the electronic device only needs to establish a sharing relationship according to the first identifier in the installation package of the first application, and provide the access right of the first file.
  • no additional operation is required to set the sharing permission of the first file. If other application programs of the electronic device are not the sharing objects of the first file indicated by the first identifier, they do not have permission to access the first file. In this way, malicious access to the first file by other applications can be avoided. In this way, data sharing between applications can be achieved in a safe and convenient manner.
  • providing the second application with the access authority of the first file according to the first identifier includes: when the electronic device installs the first application according to the installation package of the first application, reading the first application an identifier; according to the first identifier, provide the second application with the access right of the first file.
  • providing the second application with the access right of the first file according to the first identification includes: according to the first identification, adding the second application to the sharing group of the first file, wherein the sharing A group is used to indicate an application that has permission to access the first file.
  • adding the identifier of the second application program to the sharing group of the first file according to the first identifier includes: when it is determined that the identifier of the second application program is included in the first identifier, adding the identifier of the second application program to the first identifier.
  • the program is added to the sharing group of the first file; the identifier of the second application program includes the identifier carried in the installation package of the second application program.
  • the identifier of the second application program may be the public key of the second application program, and when it is determined that the identifier of the second application program is included in the first identifier, the second application program is added to the sharing group of the first file, which may be specifically : when it is determined that the first identifier contains the public key of the second application, add the public key of the second application to the sharing group of the first file.
  • adding the second application program to the sharing group of the first file according to the first identification includes: adding the identification of the second application program to the sharing group of the first file according to the first identification;
  • the identifier of the second application program includes the identifier assigned to the second application program when the electronic device installs the second application program.
  • the identifier of the second application may be a UID assigned to the second application by the electronic device.
  • the UID of each application is unique in the electronic device.
  • the UIDs of the same application in different electronic devices may be different. In this way, the identification of other application programs can be effectively prevented from being tampered with the identification of the second application program. Thus, malicious access of the first file by other applications can be effectively reduced. In this way, the security of data sharing between applications can be provided.
  • adding the identifier of the second application program to the sharing group of the first file according to the first identifier includes: when the second application program is installed, assigning the first application program the identifier of the second application program identification; according to the first identification, add the identification of the second application program to the sharing group of the first file.
  • the method before adding the identifier of the second application program to the sharing group of the first file according to the first identifier, the method further includes: when the first application program is installed, indicating in the establishment of the first identifier the sharing relationship; the sharing relationship indicates that the shared object of the first file includes the second application.
  • the method further includes: receiving an access request for the first file by the second application; confirming the second application The program has access rights to the first file; the data of the first file is provided to the second application program.
  • a file sharing apparatus may include:
  • an obtaining module which can be used to: obtain an installation package of the first application, wherein the installation package of the first application includes a first file and a first identifier, and the first identifier indicates that the shared object of the first file includes the second application ;
  • the permission setting module may be configured to: provide the second application with the access permission of the first file according to the first identifier.
  • the permission setting module can be used to:
  • the second application is added to the sharing group of the first file, wherein the sharing group is used to indicate the application having the permission to access the first file.
  • the permission setting module can be used to:
  • the second application is added to the sharing group of the first file; the identification of the second application includes the identification carried in the installation package of the second application. For example, the public key of the second application.
  • the permission setting module can be used to:
  • the identification of the second application is added to the sharing group of the first file, where the identification of the second application includes the identification assigned to the second application when the second application is installed, such as the UID of the second application .
  • the permission setting module can be used to:
  • the identification of the second application is added to the sharing group of the first file.
  • the permission setting module can be used to:
  • the sharing relationship indicated in the first identifier is established; the sharing relationship describes that the shared object of the first file includes the second application.
  • the obtaining module may also be used to: receive an access request to the first file by the second application; the permission setting module may also be used to: confirm that the second application has access permission to the first file;
  • the file sharing apparatus may further include: a providing module for: providing the data of the first file to the second application.
  • the file sharing apparatus provided in the second aspect can add the second application to the sharing group of the first file in the installation package of the first application according to the first identifier in the installation package of the first application.
  • the second application has permission to access the first file.
  • the first file can not only be shared with the designated application.
  • the second application can only access the first file in the first application, not all files of the first application. In this way, the normal operation of the first application program can be avoided.
  • the present application provides an electronic device, including: a processor and a memory; the memory is used for storing program codes, and the processor is used for calling the program codes to make the electronic device execute any possible implementation manner of any one of the above aspects file sharing methods in .
  • a computer program product containing instructions, when the instructions are executed on an electronic device, so that the electronic device executes the file sharing method in any of the possible implementations of any one of the above aspects.
  • a computer-readable storage medium comprising instructions, when the instructions are executed on an electronic device, so that the electronic device executes the file sharing method in any of the possible implementations of any of the foregoing aspects.
  • FIG. 1 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 2 is a software block diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 3 is a flowchart of an application development and installation process provided by an embodiment of the present application.
  • FIG. 4 is a logical implementation block diagram of a file sharing method provided by an embodiment of the present application.
  • FIG. 5 is a schematic flowchart of a file sharing method provided by an embodiment of the present application.
  • FIG. 6 is a schematic flowchart of a file sharing method provided by an embodiment of the present application.
  • FIG. 7 is a schematic flowchart of a file sharing method provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of a file sharing apparatus provided by an embodiment of the present application.
  • first and second are only used for descriptive purposes, and should not be understood as implying or implying relative importance or implying the number of indicated technical features. Therefore, the features defined with “first” and “second” may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, the “multiple” The meaning is two or more.
  • a developer when developing application A, a developer can add a UIFileSharingEnabled(Application supports iTunes file sharing) key to the file info.Plist in application A, and The key value is set as the first identifier, and the first identifier may be "yes". Then, the developer puts the file A that can be shared in the application A into the documents directory in the electronic device. In this way, other applications can access the data in file A of application A.
  • the file A of the application A can be shared.
  • any application program that enables the file sharing function in the electronic device can share the file A. In this way, the applications that can share file A are not single enough.
  • the developer in order to implement data sharing between application A and application B.
  • the developer can set the shareduserID in the manifest.xml file in the application A's installation package to be the same.
  • the application with the same shareduserID will be assigned the same user ID, that is, the UID.
  • application A and application B can mutually access data.
  • Application B can access all data of application A.
  • application B can access all data of application A. If improper operation is received with application B, the normal operation of application A may be affected.
  • the present application provides a file sharing method and electronic device, which can enable a specified application (eg, application B) to share a file specified in application A.
  • a specified application eg, application B
  • application A e.g., application B
  • data sharing between applications can be realized, and sharable files of one application can be avoided to be shared by all applications, and all data of one application can be avoided to be shared by other applications.
  • the exemplary electronic device 100 provided by the embodiment of the present application is introduced.
  • FIG. 1 is a schematic structural diagram of an electronic device 100 provided by an embodiment of the present application.
  • the electronic device 100 may have more or fewer components than those shown in the figures, may combine two or more components, or may have different component configurations.
  • the various components shown in the figures 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 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2.
  • Mobile communication module 150 wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, camera 193, display screen 194 and Subscriber identification module (subscriber identification module, SIM) card interface 195 and so on.
  • SIM Subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
  • the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or less components than shown, or combine some components, or separate some components, or arrange different components.
  • the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait.
  • application processor application processor, AP
  • modem processor graphics processor
  • graphics processor graphics processor
  • image signal processor image signal processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • different processing units can be independent devices, and can also be integrated in one or more processors.
  • the controller may be the nerve center and command center of the electronic device 100 .
  • the controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
  • the processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or universal serial bus (universal serial bus, USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transceiver
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL).
  • the processor 110 may contain multiple sets of I2C buses.
  • the processor 110 can be respectively coupled to the touch sensor 180K, the charger, the flash, the camera 193 and the like through different I2C bus interfaces.
  • the processor 110 may couple the touch sensor 180K through the I2C interface, so that the processor 110 and the touch sensor 180K communicate with each other through the I2C bus interface, so as to realize the touch function of the electronic device 100 .
  • the I2S interface can be used for audio communication.
  • the processor 110 may contain multiple sets of I2S buses.
  • the processor 110 may be coupled with the audio module 170 through an I2S bus to implement communication between the processor 110 and the audio module 170 .
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface, so as to realize the function of answering calls through a Bluetooth headset.
  • the PCM interface can also be used for audio communications, sampling, quantizing and encoding analog signals.
  • the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
  • the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to realize the function of answering calls through the Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • a UART interface is typically used to connect the processor 110 with the wireless communication module 160 .
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function.
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface, so as to realize the function of playing music through the Bluetooth headset.
  • the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
  • MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc.
  • the processor 110 communicates with the camera 193 through a CSI interface, so as to realize the photographing function of the electronic device 100 .
  • the processor 110 communicates with the display screen 194 through the DSI interface to implement the display function of the electronic device 100 .
  • the GPIO interface can be configured by software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface may be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like.
  • the GPIO interface can also be configured as I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the SIM interface can be used to communicate with the SIM card interface 195 to realize the function of transferring data to the SIM card or reading data in the SIM card.
  • the USB interface 130 is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones.
  • the interface can also be used to connect other electronic devices, such as AR devices.
  • the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration, and does not constitute a structural limitation of the electronic device 100 .
  • the electronic device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger may be a wireless charger or a wired charger.
  • the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140 and supplies power to the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 .
  • the wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 may provide wireless communication solutions including 2G/3G/4G/5G etc. applied on the electronic device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like.
  • the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .
  • 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 and high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the low frequency baseband signal is processed by the baseband processor and passed to the application processor.
  • the application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 .
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellites Wireless communication solutions such as global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared technology (IR).
  • WLAN wireless local area networks
  • BT Bluetooth
  • GNSS global navigation satellite system
  • FM frequency modulation
  • NFC near field communication
  • IR infrared technology
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
  • the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
  • the GNSS may include a global positioning system (global positioning system, GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the electronic device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • Display screen 194 is used to display images, videos, and the like.
  • Display screen 194 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 (active-matrix organic light).
  • LED diode AMOLED
  • flexible light-emitting diode flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on.
  • the electronic device 100 may include one or N display screens 194 , where N is a positive integer greater than one.
  • the electronic device 100 may implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
  • the ISP is used to process the data fed back by the camera 193 .
  • the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
  • ISP can also perform algorithm optimization on image noise, brightness, and skin tone.
  • ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be provided in the camera 193 .
  • Camera 193 is used to capture still images or video.
  • the object is projected through the lens to generate an optical image onto the photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
  • the ISP outputs the digital image signal to the DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
  • the electronic device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.
  • a digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy and so on.
  • Video codecs are used to compress or decompress digital video.
  • the electronic device 100 may support one or more video codecs.
  • the electronic device 100 can play or record videos of various encoding formats, such as: Moving Picture Experts Group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.
  • MPEG Moving Picture Experts Group
  • MPEG2 moving picture experts group
  • MPEG3 MPEG4
  • MPEG4 Moving Picture Experts Group
  • the NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • Applications such as intelligent cognition of the electronic device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
  • the internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
  • RAM random access memories
  • NVM non-volatile memories
  • Random access memory can include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronization Dynamic random access memory (double data rate synchronous dynamic random access memory, DDR SDRAM, such as the fifth generation DDR SDRAM is generally called DDR5 SDRAM), etc.;
  • SRAM static random-access memory
  • DRAM dynamic random access memory
  • SDRAM synchronous dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • DDR5 SDRAM double data rate synchronous dynamic random access memory
  • Non-volatile memory may include magnetic disk storage devices, flash memory.
  • Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle, and can include single-level memory cells (single-level cells, SLC), multi-level memory cells (multi-level memory cells) according to the level of storage cell potential cell, MLC), triple-level cell (TLC), quad-level cell (QLC), etc., according to storage specifications, it can include universal flash storage (UFS), embedded type multimedia memory card (embedded multi media Card, eMMC) and so on.
  • SLC single-level memory cells
  • multi-level memory cells multi-level memory cells
  • MLC multi-level memory cells
  • TLC triple-level cell
  • QLC quad-level cell
  • UFS universal flash storage
  • embedded type multimedia memory card embedded multi media Card
  • the random access memory can be directly read and written by the processor 110, and can be used to store executable programs (eg, machine instructions) of an operating system or other running programs, and can also be used to store data of users and application programs.
  • executable programs eg, machine instructions
  • the random access memory can be directly read and written by the processor 110, and can be used to store executable programs (eg, machine instructions) of an operating system or other running programs, and can also be used to store data of users and application programs.
  • the non-volatile memory can also store executable programs and store data of user and application programs, etc., and can be loaded into the random access memory in advance for the processor 110 to directly read and write.
  • the electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playback, recording, etc.
  • the audio module 170 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
  • Speaker 170A also referred to as a "speaker" is used to convert audio electrical signals into sound signals.
  • the electronic device 100 can listen to music through the speaker 170A, or listen to a hands-free call.
  • the receiver 170B also referred to as "earpiece" is used to convert audio electrical signals into sound signals.
  • the voice can be answered by placing the receiver 170B close to the human ear.
  • the microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals.
  • the user can make a sound by approaching the microphone 170C through a human mouth, and input the sound signal into the microphone 170C.
  • the electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which can implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.
  • the earphone jack 170D is used to connect wired earphones.
  • the earphone interface 170D can be the USB interface 130, or can be a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals.
  • the pressure sensor 180A may be provided on the display screen 194 .
  • the capacitive pressure sensor may be comprised of at least two parallel plates of conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes.
  • the electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
  • the electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A.
  • touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example, when a touch operation whose intensity is less than the first pressure threshold acts on the short message application icon, the instruction for viewing the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.
  • the gyro sensor 180B may be used to determine the motion attitude of the electronic device 100 .
  • the angular velocity of electronic device 100 about three axes ie, x, y, and z axes
  • the gyro sensor 180B can be used for image stabilization.
  • the gyro sensor 180B detects the shaking angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse motion to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenarios.
  • the air pressure sensor 180C is used to measure air pressure.
  • the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.
  • the magnetic sensor 180D includes a Hall sensor.
  • the electronic device 100 can detect the opening and closing of the flip holster using the magnetic sensor 180D.
  • the electronic device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D. Further, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, characteristics such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes).
  • the magnitude and direction of gravity can be detected when the electronic device 100 is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
  • the electronic device 100 can measure the distance through infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
  • Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes.
  • the light emitting diodes may be infrared light emitting diodes.
  • the electronic device 100 emits infrared light to the outside through the light emitting diode.
  • Electronic device 100 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100 . When insufficient reflected light is detected, the electronic device 100 may determine that there is no object near the electronic device 100 .
  • the electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power.
  • the proximity light sensor 180G can also be used in holster mode, pocket mode automatically unlocks and locks the screen.
  • the ambient light sensor 180L is used to sense ambient light brightness.
  • the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket, so as to prevent accidental touch.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the electronic device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, accessing application locks, taking pictures with fingerprints, answering incoming calls with fingerprints, and the like.
  • the temperature sensor 180J is used to detect the temperature.
  • the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection.
  • the electronic device 100 when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 caused by the low temperature.
  • the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • Touch sensor 180K also called “touch panel”.
  • the touch sensor 180K may be disposed on the display screen 194 , and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”.
  • the touch sensor 180K is used to detect a touch operation 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 touch operations may be provided through display screen 194 .
  • the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a different location than the display screen 194.
  • the keys 190 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key.
  • the electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
  • Motor 191 can generate vibrating cues.
  • the motor 191 can be used for vibrating alerts for incoming calls, and can also be used for touch vibration feedback.
  • touch operations acting on different applications can correspond to different vibration feedback effects.
  • the motor 191 can also correspond to different vibration feedback effects for touch operations on different areas of the display screen 194 .
  • Different application scenarios for example: time reminder, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like.
  • the SIM card interface 195 is used to connect a SIM card.
  • the SIM card can be contacted and separated from the electronic device 100 by inserting into the SIM card interface 195 or pulling out from the SIM card interface 195 .
  • the electronic device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • the SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card and so on. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different.
  • the SIM card interface 195 can also be compatible with different types of SIM cards.
  • the SIM card interface 195 is also compatible with external memory cards.
  • the electronic device 100 interacts with the network through the SIM card to realize functions such as call and data communication.
  • FIG. 2 is a block diagram of the software structure of the electronic device 100 according to the embodiment of the present application.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces.
  • the system is divided into four layers, which are, from top to bottom, an application layer, an application framework layer, a runtime (Runtime) and a system library, and a kernel layer.
  • the application layer can include a series of application packages.
  • the application package may include applications (also referred to as applications) such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and short message.
  • applications also referred to as applications
  • the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
  • the application framework layer includes some predefined functions.
  • the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, a package manager, a meta-capability manager, and the like.
  • a window manager is used to manage window programs.
  • the window manager can get the size of the display screen, determine whether there is a status bar, lock the screen, take screenshots, etc.
  • Content providers are used to store and retrieve data and make these data accessible to applications.
  • the data may include video, images, audio, calls made and received, browsing history and bookmarks, phone book, etc.
  • the view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on. View systems can be used to build applications.
  • a display interface can consist of one or more views.
  • the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
  • the phone manager is used to provide the communication function of the electronic device 100 .
  • the management of call status including connecting, hanging up, etc.).
  • the resource manager provides various resources for the application, such as localization strings, icons, pictures, layout files, video files and so on.
  • the notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages, and can disappear automatically after a brief pause without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also display notifications in the status bar at the top of the system in the form of graphs or scroll bar text, such as notifications from applications running in the background, and can also display notifications on the screen in the form of a dialog interface. For example, text information is prompted in the status bar, a prompt sound is issued, the electronic device vibrates, and the indicator light flashes.
  • a package manager can provide a package management service (Bundle Manager Service, BMS) for an application.
  • BMS can be used to implement functions such as application installation and uninstallation, component query matching, and permission management.
  • the BMS can verify the integrity of the installation package of the application through the cloud public key preset inside the device.
  • BMS can also be used to decompress the installation package of the application to obtain the public key of the application.
  • the BMS can query whether the application can share files of other applications based on the application's public key. If possible, the BMS can add the UID of the application to the user group that can share the file.
  • a meta-capability manager can provide a meta-capability management service (Ability Manager Service, AMS) for applications.
  • AMS can be used for application lifecycle management.
  • the AMS can be mainly responsible for pulling, managing, and destroying the application process.
  • a system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.
  • surface manager surface manager
  • media library Media Libraries
  • 3D graphics processing library eg: OpenGL ES
  • 2D graphics engine eg: SGL
  • the Surface Manager is used to manage the display subsystem and provides a fusion of two-dimensional (2-Dimensional, 2D) and three-dimensional (3-Dimensional, 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 still image files.
  • 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, compositing, and layer processing.
  • 2D graphics engine is a drawing engine for 2D drawing.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display drivers, camera drivers, audio drivers, sensor drivers, and virtual card drivers.
  • a corresponding hardware interrupt is sent to the kernel layer.
  • the kernel layer processes touch operations into raw input events (including touch coordinates, timestamps of touch operations, etc.). Raw input events are stored at the kernel layer.
  • the application framework layer obtains the original input event from the kernel layer, and identifies the control corresponding to the input event. Taking the touch operation as a touch click operation, and the control corresponding to the click operation is the control of the camera application icon, as an example, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer, and then starts the camera driver by calling the kernel layer.
  • the camera 193 captures still images or video.
  • application A may be referred to as a first application
  • application B may be referred to as a second application
  • File A may be referred to as the first file
  • the embodiments of the present application provide a file sharing method.
  • an identifier for sharing file A with application B is written in the installation package of application A.
  • the mobile phone can add the identifier of application B to the sharing group that can share file A. This way, application B can access file A at runtime.
  • an application program may also be referred to as an application for short.
  • file A can be shared with application B, which means that application B can access file A, read the data of file A, and execute file A. All applications in the shared group of file A can access file A.
  • the developer generates the public-private key pair of application B, the public key publickeyB and the private key privatekeyB.
  • the developer of the application can generate a pair of public and private keys of the application B in the device that develops the application B.
  • the public-private key pair 301 of application B shown in FIG. 3 may include a public key publickeyB and a private key privatekeyB. Understandably, the public and private keys come in pairs, and they can decrypt each other. Content encrypted by the public key can only be decrypted by the private key. Content encrypted by the private key can only be decrypted by the public key. Public key encryption, private key decryption; private key signature, public key verification. The public key is public and the private key is kept secret.
  • the terminal can obtain the public key of the application from the installation package of the application.
  • the developer can upload the public key of application B to the application market to apply for the corresponding application signing certificate.
  • the application B signing certificate 302 shown in FIG. 3 can contain application B's public key publickeyB.
  • the signing certificate of application B can be used to identify the identity of the developer, and it can also contain basic information of the developer.
  • the application market can also be called the application store, that is, APP STORE, which is an electronic application store that provides paid or free games and application download services for electronic devices such as mobile phones and tablet computers.
  • APP STORE is an electronic application store that provides paid or free games and application download services for electronic devices such as mobile phones and tablet computers.
  • the developer develops application B, and obtains the source program package of application B.
  • the developer develops the application program B, and obtains the source program package of the application program B, for example, the source program package 303 of the application program B shown in FIG. 3 .
  • a source package can contain multiple files, each of which can contain source code written in a specific format.
  • the developer self-signs the application B, and obtains the shelf installation package of the application B.
  • the developer uses the private key privatekeyB of application B to self-sign application B to obtain the self-signed information signatureB.
  • the developer puts the self-signed information signatureB and the public key publickeyB into the package of application B, and obtains the shelf installation package of application B.
  • the developer uses the private key of the application market to sign the on-the-shelf installation package of application B to obtain the downloaded installation package of application B.
  • the developer uploads the shelf installation package of application B to the application market.
  • the application market uses the application market private key to sign the on-air installation package of application B to obtain the signature information signature.
  • the application market puts the signature information signature into the shelf installation package of application B to form a download installation package of application B.
  • the download installation package 306 of application B shown in FIG. 3 is a download installation package of application B shown in FIG. 3 .
  • the application market holds a unified public and private key pair.
  • the application market public-private key pair 305 shown in FIG. 3 may include the application market public key and the application market private key.
  • the application market can use the private key to sign the application's installation package on the shelf to obtain the signature information.
  • the public key of the application market can verify the signature information.
  • the mobile phone downloads the application from the application market and installs the application
  • the mobile phone downloads the download and installation package of application B from the application market, takes out the signature in the download and installation package of application B, and verifies the signature with the public key of the application market saved in the mobile phone. After the verification is passed, the mobile phone takes out the download The publickeyB in the installation package verifies the signature of signatureB. If the signature is successful, application B can be installed.
  • the BMS in the mobile phone can take out the signature information signature in the download and installation package of the application B, and use the application market public key preset in the mobile phone to perform the signature information signature. Check the signature. When the download and installation package of application B is tampered with, the signature information signature in the download and installation package of application B may fail to be verified. If the signature verification fails, the mobile phone fails to install the downloaded installation package and exits the installation. If the verification is passed, it means that the source of the downloaded installation package of the application is legal.
  • the BMS in the mobile phone takes out the self-signed information signatureB and the public key publickeyB in the download and installation package of application B.
  • the BMS verifies the signature of the self-signed information signatureB through the public key publickeyB. If the verification is passed, the mobile phone can successfully install application B.
  • Application B can be successfully installed only when the source package of application B, the self-signed information signatureB, and the public key publickeyB have not been tampered with, and publickeyB is the public key that matches the self-signed signatureB.
  • FIG. 4 shows a block diagram illustrating an implementation of a file sharing method provided by an embodiment of the present application.
  • a download and installation package 401 of application A may be included;
  • a package management service BMS402 may be included;
  • a download and installation package 403 of application B may be included;
  • the installation package 401 of the application A may include a file 4011 and a file 4012 .
  • File 4011 writes the code to share the file named getHilink.so with the application whose publickey is "abcdfgh".
  • the file 4012 is a file whose file name is getHilink.so.
  • the file 4012 can be obtained by decompressing the installation package 401 of the application A.
  • the package management service BMS 402 is provided by the package manager in FIG. 2 .
  • the package management service BMS402 can save the corresponding relationship 4021 between the file named getHilink.so in the file 4011 and the application program whose public key is "abcdfgh".
  • the BMS 402 establishes a sharing group 4022 of a file named getHilink.so according to the corresponding relationship.
  • Correspondence 4021 and sharing group 4022 can be stored in a database.
  • the publickeyB of application B is "abcdfgh”.
  • the BMS can add the UID (eg UIDB) of application B to the sharing group 4022 .
  • the download and installation package 402 of the application B may contain the public key publickeyB of the application B.
  • publickeyB can be "abcdfgh”.
  • FIG. 5 shows a schematic flowchart of a file sharing method provided by an embodiment of the present application.
  • a file sharing method provided by an embodiment of the present application may include:
  • the electronic device in response to operation A, acquires an installation package of application A.
  • Operation A may be an operation for the user to obtain the installation package of the application program A, for example, the operation A may be that the user downloads the installation package of the application program A from the application market.
  • the installation package of the application A downloaded by the user from the application market may include the source package of the application A, the public key of the application A and the self-signed information of the application A.
  • the installation package of application A may be referred to as the downloaded installation package of application A.
  • FIG. 3 For the process of generating the application A and listing it on the application market to form the download and installation package of the application A, reference may be made to the description in FIG. 3 , which will not be repeated here.
  • the electronic device determines that the installation package of application A carries a first identifier, and the first identifier is used to indicate that file A in the installation package of application A is shared with a shared object, and the shared object is an application that can access file A.
  • the electronic device can read the first identifier from the installation package of the application A.
  • the first identifier may be the source code in the source package of the application A.
  • the first identifier is used to indicate that the file A in the installation package of the application A is shared with the shared object.
  • Shared objects are applications that can access file A. It is understandable that the developer of application A may agree with developers of other applications to share a certain file of application A with other applications. In this way, other applications can call to read the data of file A to realize the functions provided by the source code in file A.
  • the first identification can be as follows:
  • the first identifier may specify a file that can be shared in application A and an object to which the file can be shared.
  • the file A may be the above-mentioned first identification file "getHilink.so".
  • the shared object of file A can be an application whose public key is "abcdfgh”.
  • the file "getHilink.so" may be decompressed to the application installation, for example, /data/appA/lib.
  • the electronic device can synchronize the correspondence between the file A (for example, the file "getHilink.so") and the shared object (for example, the application whose public key is "abcdfgh") to the BMS according to the first identifier, for example, the content in the above profile information .
  • the BMS may store the correspondence between the file A (for example, the file "getHilink.so") and the shared object (for example, the application whose public key is "abcdfgh”) in the database.
  • developer can share the file A in the application A to multiple shared objects. Developers can also share multiple files in Application A to one or more shared objects.
  • the electronic device establishes a sharing group of the file A based on the first identifier.
  • the electronic device may establish a sharing group of file A through the BMS.
  • the BMS can generate the shared group ID (group ID, GID) of file A.
  • the sharing group of file A may include the user IDs (user ID, UID) of all applications that can share file A and the UID of application A. If the electronic device has not installed the application program that can be shared by the file A specified in the first identifier, only the UID of the application program A is in the sharing group. This UID can be used to identify an application.
  • the BMS in the electronic device can assign a UID to the application.
  • the UID of the application does not change while the application exists on the electronic device. And an application can only have one UID.
  • applications in the electronic device can be divided into three types: file owner users, group users, and other users.
  • An application that provides shared files can be referred to as the file owner user.
  • group users other applications other than the application providing the files
  • groups other applications other than the application providing the files
  • groups other applications other than the application providing the files
  • groups applications in the electronic device that cannot share the shared file
  • Different types of applications have different permissions for shareable files.
  • the file owner user has the permission to read, write, and execute the file
  • the group user has the permission to read, execute, but not write the file
  • other users can neither read, write nor execute the shared file.
  • Operation B may be an operation for the user to obtain the installation package of application B.
  • operation B may be that the user downloads the installation package of application B from the application market.
  • the installation package of application B downloaded by the user from the application market may include the source package of application B, the public key of application B, and the self-signed information of application B.
  • the installation package of application B may be referred to as the downloaded installation package of application B.
  • the electronic device determines that the application B is the shared object of the file A according to the identifier of the application B and the first identifier.
  • the electronic device can obtain the identifier of the application B in the download and installation package of the application B.
  • the identity of the application B may be the public key publickeyB of the application B.
  • application B's publickeyB is "abcdfgh”.
  • the first identifier indicates that the file A of the application A is shared with the application whose publickeyB is "abcdfgh". In this way, the electronic device can determine that the application B is the shared object of the file A according to the identification of the application B and the first identification.
  • the electronic device adds the application B to the sharing group of the file A.
  • the electronic device may add the UID of application B to the user group sharing the file A (eg, the file "getHilink.so"). If the GID of the user group of the file is 1001, the UID of application A is 1001, and the UID of application B is 1002. Then, at this time, the shared group whose GID of file A is 1001 contains two users: UID 1001 (application A) and UID 1002 (application B).
  • the UID of the owner (eg, application A) of the shared file eg, file A
  • the UIDs of different applications are not the same.
  • the electronic device After the electronic device adds the application B to the sharing of the file A, when the application B calls the file A, the application B can read the data in the file A and the executable file A.
  • the AMS is responsible for the life cycle management of application B.
  • the BMS in the electronic device can obtain the public key publickeyA of the application A.
  • the BMS determines whether there is a file shared with application A in the electronic device according to publickeyA, and if so, the electronic device can add application A to the sharing group of the file. Further, the UID of application A can be added to the sharing group of the file.
  • the electronic device can share the specified file in application A, that is, file A, to a specified application, such as application B.
  • application B can access the file and execute file A.
  • other programs in the electronic device cannot access file A nor execute file A.
  • application A can not only share file A with application B, but also prevent file A of application A from being maliciously accessed by other applications in the electronic device.
  • the developer of the application A writes the first identifier in the source package of the application A.
  • the first identifier indicates that file A of application A is shared with application B.
  • the developer of application A may write the first identifier in the profile file of the source package of application A.
  • Application A may be installed in the electronic device first, or application B may be installed first.
  • the file sharing method provided by the embodiment of the present application may be performed according to the steps shown in FIG. 6 .
  • FIG. 6 shows a schematic flowchart of a file sharing method provided by an embodiment of the present application.
  • the file sharing method provided by the embodiment of the present application may include:
  • the electronic device in response to operation B, acquires an installation package of application B.
  • Operation B may be an operation for the user to obtain the installation package of application B.
  • operation B may be that the user downloads the installation package of application B from the application market.
  • the installation package of application B downloaded by the user from the application market may include the source package of application B, the public key of application B, and the self-signed information of application B.
  • the installation package of application B may be referred to as the downloaded installation package of application B.
  • the electronic device determines whether there is a file A that can be shared by the application B in the electronic device; if it exists, execute step S202, and if not, execute step S203.
  • the electronic device can obtain the identity of the application B from the installation package of the application B, for example, the public key publickeyB of the application B.
  • the electronic device can determine whether there is a file shared to application B in the electronic device according to publickeyB. If there is a correspondence between publickeyB and the shared file in the BMS, the electronic device determines that there is a file shared to application B in the electronic device.
  • the electronic device may perform step S202. If there is no corresponding relationship between the publickeyB and the shared file in the BMS, the electronic device determines that there is no file shared to the application B in the electronic device.
  • the electronic device may perform step S203.
  • the electronic device adds the application B to the sharing group of the file A.
  • the electronic device may add the UID of application B to the user group sharing the file A (eg, the file "getHilink.so").
  • a file's user group has a GID of 1001.
  • the owner of file A is application A
  • the UID of application A is 1001.
  • Application B has a UID of 1002.
  • the shared group whose GID of file A is 1001 contains two users: UID 1001 (application A) and UID 1002 (application B).
  • the UID of the owner (eg, application A) of the shared file eg, file A
  • the shared file may be the same as the GID of the user group sharing the file.
  • the UIDs of different applications are not the same.
  • the BMS in the electronic device can assign a UID to the application.
  • the UID of the application does not change while the application exists on the electronic device. And an application can only have one UID.
  • the electronic device After the electronic device adds the application B to the sharing of the file A, when the application B calls the file A, the application B can read the data in the file A and the executable file A.
  • the AMS is responsible for the life cycle management of application B.
  • Step S202 can refer to the description in step S105.
  • the electronic device acquires the installation package of the application A in response to the operation A.
  • Operation A may be an operation for the user to obtain the installation package of the application program A, for example, the operation A may be that the user downloads the installation package of the application program A from the application market.
  • the installation package of the application A downloaded by the user from the application market may include the source package of the application A, the public key of the application A and the self-signed information of the application A.
  • the installation package of application A may be referred to as the downloaded installation package of application A.
  • FIG. 3 For the process of generating the application A and listing it on the application market to form the download and installation package of the application A, reference may be made to the description in FIG. 3 , which will not be repeated here.
  • the user's operation A and operation B may be discontinuous operations. That is, the user may perform the operation A after the first time period after the operation B is performed. For example, the user may perform the operation of installing application A three days after performing the operation of installing application B.
  • the first time period may be 30 minutes, or may be one day, or may be one month, which is not limited in this embodiment of the present application.
  • the electronic device determines that the installation package of the application A carries a first identifier, and the first identifier indicates that the file A in the installation package of the application A is shared with the application B.
  • the electronic device can read the first identifier from the installation package of the application A.
  • the first identifier may be the source code in the source package of the application A.
  • the first identifier is used to indicate that file A in the installation package of application A is shared with application B. It is understandable that the developer of application A may agree with the developer of application B to share the file A of application A with application B. In this way, application B can call to read the data of file A, and realize the function provided by the source code in file A.
  • the first identification can be as follows:
  • the first identifier may specify a file that can be shared in application A and an object to which the file can be shared.
  • the file A may be the above-mentioned first identification file "getHilink.so".
  • the shared object of file A can be an application whose public key is "abcdfgh”.
  • the public key of application B is "abcdfgh”. Therefore, the first identification indicates that file A is to be shared with application B.
  • the file “getHilink.so” may be decompressed to the application installation, for example, /data/appA/lib.
  • the electronic device can synchronize the correspondence between the file A (for example, the file "getHilink.so") and the shared object (for example, the application whose public key is "abcdfgh") to the BMS according to the first identifier, for example, the content in the above profile information .
  • the BMS may store the correspondence between the file A (for example, the file "getHilink.so") and the shared object (for example, the application whose public key is "abcdfgh”) in the database.
  • the electronic device adds the application B to the sharing group of the file A.
  • the electronic device may add the UID of application B to the user group sharing the file A (eg, the file "getHilink.so").
  • a file's user group has a GID of 1001.
  • the owner of file A is application A
  • the UID of application A is 1001.
  • Application B has a UID of 1002.
  • the shared group whose GID of file A is 1001 contains two users: UID 1001 (application A) and UID 1002 (application B).
  • the UID of the owner (eg, application A) of the shared file eg, file A
  • the shared file may be the same as the GID of the user group sharing the file.
  • the UIDs of different applications are not the same.
  • the electronic device After the electronic device adds the application B to the sharing of the file A, when the application B calls the file A, the application B can read the data in the file A and the executable file A.
  • the AMS is responsible for the life cycle management of application B.
  • Step S205 may refer to the description in step S105 or step S202.
  • the electronic device can share the specified file in application A, that is, file A, to a specified application, such as application B.
  • application B can access the file and execute file A.
  • other programs in the electronic device cannot access file A nor execute file A.
  • application A can not only share file A with application B, but also prevent file A of application A from being maliciously accessed by other applications in the electronic device.
  • the electronic device When the application B of the electronic device wants to access the file A of the application A, the electronic device needs to determine whether the application B has the permission to access the application A. If application B is in the sharing group of file A, the electronic device determines that application B has access to application A; otherwise, the electronic device determines that application B does not have access to application A.
  • specific reference may be made to the schematic flowchart of the file sharing method shown in FIG. 7 .
  • FIG. 7 shows a file sharing method provided by an embodiment of the present application.
  • the file sharing method provided by the embodiment of the present application may include:
  • the application B in the electronic device calls the file A, where the file A is a file in the installation package of the application A.
  • the user operation may be an operation in which the user may click the icon of the application program B in the main interface of the electronic device.
  • the electronic device starts the application B.
  • the application can call file A at startup.
  • the user operation may also be an operation in which the user clicks a control in the user interface of application B.
  • application B calls file A.
  • File A is a file in the installation package of application A.
  • the file A may be an executable file, that is, the file A is a file that can be loaded and executed by the electronic device.
  • the electronic device determines whether application B is in the shared group of file A, where the shared group of file A is used to indicate that the application in the shared group of file A has permission to access file A, and the shared group of file A is controlled by the electronic device
  • the first identifier is established according to the first identifier in the installation package of the application program A, and the first identifier is used to indicate the shared object of the file A. If yes, go to step S302a; if not, go to step S302b.
  • the electronic device may determine whether the application is in the sharing group of file A according to the UID of application B. Specifically, the electronic device can check whether the UID of application B exists in the shared group of file A in the BMS.
  • the shared group of file A is used to indicate that the application in the shared group of file A has the right to access file A, and the shared group of file A is established by the electronic device according to the first identification in the installation package of application A.
  • the first identification Used to indicate the shared object of file A.
  • the electronic device may first check whether application B is the application that provides file A. If so, the electronic device may execute step S302a. If not, the electronic device checks whether the application is in the file A's share group. If so, the electronic device can determine the permission of the application in the shared group of file A set by the system. If the application in the shared group of the system setting file A can read the file A, and can also execute the file A, the electronic device can execute step S302a.
  • the BMS in the electronic device can assign the application A a unique UID of the electronic device, such as UIDA.
  • the BMS can decompress the resource files in the downloaded installation package of application A to a certain path in the system.
  • the electronic device may set the user owner of the files and folders in the path as the UID of the application A, for example, the user owner of the file A may be set as UIDA.
  • the electronic device may set the GID of the sharing group of the file A as the UID of the application A.
  • the BMS resolves that the application B can share the file A of the application A.
  • the BMS can trigger the system of the electronic device to add the UID of the application B to the sharing group of the file A.
  • the BMS can trigger the system to execute the gpasswd command to add the UID of application B to the share group of file A.
  • the system of the electronic device can add the UID of the application B to the sharing group of the file A, which is not limited in this embodiment of the present application.
  • the electronic device provides the data of the file A to the application B.
  • the electronic device allows application B to access the file.
  • the electronic device can provide the data of file A to application B. That is, application B can read the data of file A, and application B can also execute file A.
  • the electronic device determines that the application program B fails to call the file A.
  • the electronic device determines that the application B is not in the sharing group of the file A, the application B does not have the right to call the file A.
  • the electronic device determines that application B fails to call file A.
  • the user interface of application B may display a prompt of failure to call file A, such as "no access permission", "access failed”, and so on.
  • the application B can access the file A only when the electronic device determines that the application B is a member of the sharing group of the file A. In this way, file A can not only be shared with the specified application. Avoid malicious access to file A by other applications in the electronic device. App B can only access file A in app A, not all of app A's files. In this way, the normal operation of application A can be avoided.
  • FIG. 8 is a schematic diagram of a file sharing apparatus provided by an embodiment of the present application.
  • the file sharing apparatus 800 may include an obtaining module 801 and a permission setting module 802; wherein:
  • An obtaining module 801 configured to: obtain an installation package of a first application, wherein the installation package of the first application includes a first file and a first identifier, and the first identifier indicates that the shared object of the first file includes the second application .
  • the permission setting module 802 is configured to: provide the second application with the access permission of the first file according to the first identifier.
  • the permission setting module 802 can be used to:
  • the second application is added to the sharing group of the first file, wherein the sharing group is used to indicate the application having the permission to access the first file.
  • the permission setting module 802 can be used to:
  • the second application is added to the sharing group of the first file; the identification of the second application includes the identification carried in the installation package of the second application. For example, the public key of the second application.
  • the permission setting module 802 can be used to:
  • the identification of the second application is added to the sharing group of the first file, where the identification of the second application includes the identification assigned to the second application when the second application is installed, such as the UID of the second application .
  • the permission setting module 802 can be used to:
  • the identification of the second application is added to the sharing group of the first file.
  • the permission setting module 802 can be used to:
  • the sharing relationship indicated in the first identifier is established; the sharing relationship describes that the shared object of the first file includes the second application.
  • the corresponding relationship 4021 in FIG. 4 shows the sharing relationship between a file whose file name is getHilink.so and an application whose public key is "abcdfgh".
  • the obtaining module 801 may be configured to receive an access request for the first file by the second application.
  • the permission setting module 802 may be configured to confirm that the second application program has access permission to the first file.
  • the file sharing apparatus 800 may further include a providing module 803; wherein:
  • the providing module 803 may be used to provide the data of the first file to the second application.
  • the file sharing apparatus 800 can implement the file sharing method described in steps S100-S105 shown in FIG. 5, and the file sharing method described in steps S200-step S205 shown in FIG. 6, and The file sharing method described in step S300-step S302a and step S302b shown in FIG. 7 . specifically:
  • the obtaining module 801 can be used to perform step S100 , step S103 , step 200 and step 203 .
  • the authority setting module 802 can be used to execute steps S101, 102, S104, S105, S201, 202, S204, S205, and S300 and S301.
  • the providing module 803 can be used to perform steps S302a and S302b.
  • the file sharing apparatus can add the second application program to the sharing group of the first file in the installation package of the first application program according to the first identifier in the installation package of the first application program.
  • the second application has permission to access the first file. In this way, the first file can not only be shared with the designated application. Prevent malicious access to files by other applications in the file sharing device.
  • the second application can only access the first file in the first application, not all files of the first application. In this way, the normal operation of the first application program can be avoided.
  • the term “when” may be interpreted to mean “if” or “after” or “in response to determining" or “in response to detecting" depending on the context.
  • the phrases “in determining" or “if detecting (the stated condition or event)” can be interpreted to mean “if determining" or “in response to determining" or “on detecting (the stated condition or event)” or “in response to the detection of (the stated condition or event)”.
  • the above-mentioned embodiments it may be implemented in whole or in part by software, hardware, firmware or any combination thereof.
  • software it can be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated.
  • the computer may be a general purpose computer, special purpose computer, computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server, or data center Transmission to another website site, computer, server, or data center by wire (eg, coaxial cable, optical fiber, digital subscriber line) or wireless (eg, infrared, wireless, microwave, etc.).
  • the computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, or the like that includes an integration of one or more available media.
  • the usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, solid state drives), and the like.
  • the process can be completed by instructing the relevant hardware by a computer program, and the program can be stored in a computer-readable storage medium.
  • the program When the program is executed , which may include the processes of the foregoing method embodiments.
  • the aforementioned storage medium includes: ROM or random storage memory RAM, magnetic disk or optical disk and other mediums that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Bioethics (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Telephone Function (AREA)

Abstract

The present application provides a file sharing method and apparatus, and an electronic device. The method comprises: obtaining an installation package of a first application, wherein the installation package of the first application comprises a first file and a first identifier, and the first identifier indicates that sharing objects of the first file comprise a second application; and providing an access permission of the first file to the second application according to the first identifier. The implementation of the method can enable a specified application (such as an application B) to share a file specified in an application A. Thus, data sharing between applications can be achieved, a sharable file of one application can be prevented from being shared by all applications, and all data of one application can be prevented from being shared by other applications.

Description

一种文件共享方法、装置及电子设备A file sharing method, device and electronic device
本申请要求于2020年11月24日提交中国专利局、申请号为202011332002.2、申请名称为“一种文件共享方法及电子设备”的中国专利申请的优先权,以及于2021年01月14日提交中国专利局、申请号为202110051249.5、申请名称为“一种文件共享方法、装置及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202011332002.2 and the application title "A File Sharing Method and Electronic Device" filed with the China Patent Office on November 24, 2020, and filed on January 14, 2021 The priority of the Chinese Patent Office, application number 202110051249.5, and the application title is "A file sharing method, apparatus and electronic device", the entire contents of which are incorporated in this application by reference.
技术领域technical field
本申请涉及计算机技术领域,尤其涉及一种文件共享方法、装置及电子设备。The present application relates to the field of computer technologies, and in particular, to a file sharing method, apparatus, and electronic device.
背景技术Background technique
个人电脑、智能手机等电子设备已经成为了人们生活中不可或缺的组成部分。这些电子设备上通常安装有多个应用程序。多个应用程序可以为用户提供天气资讯、购物、即时通讯、拍照等多种服务。各个应用程序通常会在电子设备的文件系统的目录中存储与该应用程序运行相关的数据。应用程序可以根据运行的需求对存储的相关数据进行访问。Electronic devices such as personal computers and smartphones have become an indispensable part of people's lives. These electronic devices often have multiple applications installed on them. Multiple applications can provide users with various services such as weather information, shopping, instant messaging, and photography. Each application typically stores data related to the operation of the application in a directory of the electronic device's file system. The application can access the stored related data according to the running requirements.
为了保证整个系统运行的稳定性和安全性。一般电子设备的操作系统会为电子设备中的每个应用程序提供应用沙盒机制。沙盒机制是一种安全机制,为运行中的程序提供隔离环境。即,每个应用程序都只能访问该应用程序的数据,不能访问其他应用程序的数据。采用这种安全机制可以避免某些应用程序恶意访问其他应用程序的数据。但是在实际情况中,部分应用程序之间需要共享数据,例如应用程序B需要共享应用程序A的数据(例如,存储在电子设备文件系统中的应用程序A的一个文件)。但是由于电子设备中操作系统的安全机制,导致应用程序之间共享数据困难。In order to ensure the stability and security of the entire system operation. The operating system of a general electronic device provides an application sandbox mechanism for each application in the electronic device. Sandboxing is a security mechanism that provides an isolated environment for running programs. That is, each application can only access that application's data, not other applications' data. Adopting this security mechanism can prevent some applications from maliciously accessing other applications' data. However, in practical situations, some applications need to share data, for example, application B needs to share data of application A (for example, a file of application A stored in the file system of the electronic device). However, due to the security mechanism of the operating system in the electronic device, it is difficult to share data between applications.
由此,如此如何既安全又便捷地在应用程序之间共享数据是亟待解决的问题。Therefore, how to share data between applications in a safe and convenient manner is an urgent problem to be solved.
发明内容SUMMARY OF THE INVENTION
本申请提供了一种文件共享方法、装置及电子设备,实施该方法,可以将指定的文件共享给指定的应用程序,可以避免用来共享的文件被其他应用程序恶意访问。从而可以实现应用程序之间安全且便捷的共享数据。The present application provides a file sharing method, device and electronic device. By implementing the method, a specified file can be shared with a specified application program, and malicious access of the shared file by other application programs can be avoided. This enables safe and convenient data sharing between applications.
第一方面,本申请提供了一种文件共享方法,该方法可以包括:获取第一应用程序的安装包,其中,第一应用程序的安装包中包括第一文件和第一标识,第一标识指示第一文件的共享对象包括第二应用程序;根据第一标识,向第二应用程序提供第一文件的访问权限。In a first aspect, the present application provides a file sharing method, the method may include: acquiring an installation package of a first application, wherein the installation package of the first application includes a first file and a first identifier, and the first identifier Indicates that the shared object of the first file includes the second application; and according to the first identification, the second application is provided with the access right of the first file.
实施第一方面提供的文件共享方法,可以将指定的文件共享给指定的应用。并且电子设备只需要根据第一应用程序的安装包中的第一标识建立共享关系,以及提供第一文件的访问权限。用户在使用电子设备时,不需要额外的操作来设置第一文件的共享权限。电子设备的其他应用程序若不是第一标识指示的第一文件的共享对象,则没有访问第一文件的权限。这样,可以避免第一文件被其他应用程序恶意访问。从而可以实现应用程序之间即安全又便捷进行数据共享。By implementing the file sharing method provided by the first aspect, a specified file can be shared with a specified application. And the electronic device only needs to establish a sharing relationship according to the first identifier in the installation package of the first application, and provide the access right of the first file. When the user uses the electronic device, no additional operation is required to set the sharing permission of the first file. If other application programs of the electronic device are not the sharing objects of the first file indicated by the first identifier, they do not have permission to access the first file. In this way, malicious access to the first file by other applications can be avoided. In this way, data sharing between applications can be achieved in a safe and convenient manner.
在一种可能的实现方式中,根据第一标识,向第二应用程序提供第一文件的访问权限,包括:在电子设备根据第一应用程序的安装包安装第一应用程序时,读取第一标识;根据第一标识,向第二应用程序提供第一文件的访问权限。In a possible implementation manner, providing the second application with the access authority of the first file according to the first identifier includes: when the electronic device installs the first application according to the installation package of the first application, reading the first application an identifier; according to the first identifier, provide the second application with the access right of the first file.
在一种可能的实现方式中,根据第一标识,向第二应用程序提供第一文件的访问权限,包括:根据第一标识,将第二应用程序加入第一文件的共享组,其中,共享组用于指示具有访问第一文件的权限的应用程序。In a possible implementation manner, providing the second application with the access right of the first file according to the first identification includes: according to the first identification, adding the second application to the sharing group of the first file, wherein the sharing A group is used to indicate an application that has permission to access the first file.
在一种可能的实现方式中,根据第一标识,将第二应用程序的标识加入第一文件的共享组,包括:当确定第一标识中包含第二应用程序的标识时,将第二应用程序加入第一文件的共享组;第二应用程序的标识包括第二应用程序的安装包中携带的标识。In a possible implementation manner, adding the identifier of the second application program to the sharing group of the first file according to the first identifier includes: when it is determined that the identifier of the second application program is included in the first identifier, adding the identifier of the second application program to the first identifier. The program is added to the sharing group of the first file; the identifier of the second application program includes the identifier carried in the installation package of the second application program.
进一步地,第二应用程序的标识可以是第二应用程序的公钥,当确定第一标识中包含第二应用程序的标识时,将第二应用程序加入第一文件的共享组,具体可以是:当确定第一标识中包含第二应用程序的公钥时,将第二应用程序的公钥加入第一文件的共享组。Further, the identifier of the second application program may be the public key of the second application program, and when it is determined that the identifier of the second application program is included in the first identifier, the second application program is added to the sharing group of the first file, which may be specifically : when it is determined that the first identifier contains the public key of the second application, add the public key of the second application to the sharing group of the first file.
在一种可能的实现方式中,根据第一标识,将第二应用程序加入第一文件的共享组,包括:根据第一标识,将第二应用程序的标识加入第一文件的共享组,第二应用程序的标识包括电子设备在安装所述第二应用程序时分配给第二应用程序的标识。In a possible implementation manner, adding the second application program to the sharing group of the first file according to the first identification includes: adding the identification of the second application program to the sharing group of the first file according to the first identification; The identifier of the second application program includes the identifier assigned to the second application program when the electronic device installs the second application program.
进一步地,第二应程序的标识可以是电子设备分配给第二应用程序的UID。每个应用程序在电子设备中的UID是唯一的。同一个应用程序在不同的电子设备中的UID可以是不相同的。这样,可以有效避免其他应用程序的标识被篡改成第二应用程序的标识。从而能够有效减少第一文件被其他应用程序恶意访问。这样,可以提供应用程序之间数据共享的安全性。Further, the identifier of the second application may be a UID assigned to the second application by the electronic device. The UID of each application is unique in the electronic device. The UIDs of the same application in different electronic devices may be different. In this way, the identification of other application programs can be effectively prevented from being tampered with the identification of the second application program. Thus, malicious access of the first file by other applications can be effectively reduced. In this way, the security of data sharing between applications can be provided.
在一种可能的实现方式中,根据第一标识,将第二应用程序的标识加入第一文件的共享组,包括:在安装第二应用程序时,给第一应用程序分配第二应用程序的标识;根据第一标识,将第二应用程序的标识加入第一文件的共享组。In a possible implementation manner, adding the identifier of the second application program to the sharing group of the first file according to the first identifier includes: when the second application program is installed, assigning the first application program the identifier of the second application program identification; according to the first identification, add the identification of the second application program to the sharing group of the first file.
在一种可能的实现方式中,根据第一标识,将第二应用程序的标识加入第一文件的共享组之前,该方法还包括:在安装第一应用程序时,建立第一标识中指示出的共享关系;共享关系指示第一文件的共享对象包括第二应用程序。In a possible implementation manner, before adding the identifier of the second application program to the sharing group of the first file according to the first identifier, the method further includes: when the first application program is installed, indicating in the establishment of the first identifier the sharing relationship; the sharing relationship indicates that the shared object of the first file includes the second application.
在一种可能的实现方式中,根据第一标识,向第二应用程序提供第一文件的访问权限之后,该方法还包括:接收第二应用程序对第一文件的访问请求;确认第二应用程序具有第一文件具有访问权限;将第一文件的数据提供给第二应用程序。In a possible implementation manner, after providing the second application with the access right of the first file according to the first identifier, the method further includes: receiving an access request for the first file by the second application; confirming the second application The program has access rights to the first file; the data of the first file is provided to the second application program.
第二方面,提供一种文件共享装置,该装置可以包括:In a second aspect, a file sharing apparatus is provided, the apparatus may include:
获取模块,可以用于:获取第一应用程序的安装包,其中,第一应用程序的安装包中包括第一文件和第一标识,第一标识指示第一文件的共享对象包括第二应用程序;an obtaining module, which can be used to: obtain an installation package of the first application, wherein the installation package of the first application includes a first file and a first identifier, and the first identifier indicates that the shared object of the first file includes the second application ;
权限设置模块,可以用于:根据第一标识,向第二应用程序提供所述第一文件的访问权限。The permission setting module may be configured to: provide the second application with the access permission of the first file according to the first identifier.
在一种可能的实现方式中,权限设置模块可以用于:In one possible implementation, the permission setting module can be used to:
根据第一标识,将第二应用程序加入第一文件的共享组,其中,共享组用于指示具有访问第一文件的权限的应用程序。According to the first identification, the second application is added to the sharing group of the first file, wherein the sharing group is used to indicate the application having the permission to access the first file.
在一种可能的实现方式中,权限设置模块可以用于:In one possible implementation, the permission setting module can be used to:
当确定第一标识中包含第二应用程序的标识时,将第二应用程序加入第一文件的共享组;第二应用程序的标识包括第二应用程序的安装包中携带的标识。例如,第二应用程序的公钥。When it is determined that the first identification contains the identification of the second application, the second application is added to the sharing group of the first file; the identification of the second application includes the identification carried in the installation package of the second application. For example, the public key of the second application.
在一种可能的实现方式中,权限设置模块可以用于:In one possible implementation, the permission setting module can be used to:
根据第一标识,将第二应用程序的标识加入第一文件的共享组,第二应用程序的标识包括在安装第二应用程序时分配给第二应用程序的标识,例如第二应用程序的UID。According to the first identification, the identification of the second application is added to the sharing group of the first file, where the identification of the second application includes the identification assigned to the second application when the second application is installed, such as the UID of the second application .
在一种可能的实现方式中,权限设置模块可以用于:In one possible implementation, the permission setting module can be used to:
在安装第二应用程序时,给第二应用程序分配第二应用程序的标识;When installing the second application, assigning the second application an identifier of the second application;
根据第一标识,将第二应用程序的标识加入第一文件的共享组。According to the first identification, the identification of the second application is added to the sharing group of the first file.
在一种可能的实现方式中,权限设置模块可以用于:In one possible implementation, the permission setting module can be used to:
在安装第一应用程序时,建立第一标识中指示出的共享关系;共享关系描述出第一文件的共享对象包括第二应用程序。When the first application is installed, the sharing relationship indicated in the first identifier is established; the sharing relationship describes that the shared object of the first file includes the second application.
在一种可能的实现方式中,获取模块还可以用于:接收第二应用程序对第一文件的访问请求;权限设置模块还可以用于:确认第二应用程序具有第一文件的访问权限;In a possible implementation manner, the obtaining module may also be used to: receive an access request to the first file by the second application; the permission setting module may also be used to: confirm that the second application has access permission to the first file;
该文件共享装置还可以包括:提供模块,用于:将第一文件的数据提供给第二应用程序。The file sharing apparatus may further include: a providing module for: providing the data of the first file to the second application.
第二方面提供的文件共享装置,可以根据第一应用程序的安装包中的第一标识,将第二应用程序加入第一应用程序的安装包中的第一文件的共享组。第二应用程序具有访问第一文件的权限。这样,第一文件不仅可以共享给指定的应用程序。避免文件共享装置中的其他应用程序恶意访问文件。第二应用程序只能访问第一应用程序中的第一文件,而不是第一应用程序的所有文件。这样,可以避免影响第一应用程序的正常运行。The file sharing apparatus provided in the second aspect can add the second application to the sharing group of the first file in the installation package of the first application according to the first identifier in the installation package of the first application. The second application has permission to access the first file. In this way, the first file can not only be shared with the designated application. Prevent malicious access to files by other applications in the file sharing device. The second application can only access the first file in the first application, not all files of the first application. In this way, the normal operation of the first application program can be avoided.
第三方面,本申请提供了一种电子设备,包括:处理器和存储器;存储器用于存储程序代码,处理器用于调用程序代码以使得该电子设备执行上述任一方面任一项可能的实现方式中的文件共享方法。In a third aspect, the present application provides an electronic device, including: a processor and a memory; the memory is used for storing program codes, and the processor is used for calling the program codes to make the electronic device execute any possible implementation manner of any one of the above aspects file sharing methods in .
第四方面,提供一种包含指令的计算机程序产品,当该指令在电子设备上运行时,以使得该电子设备执行上述任一方面任一项可能的实现方式中的文件共享方法。In a fourth aspect, there is provided a computer program product containing instructions, when the instructions are executed on an electronic device, so that the electronic device executes the file sharing method in any of the possible implementations of any one of the above aspects.
第五方面,提供一种计算机可读存储介质,包括指令,当该指令在电子设备上运行时,以使得该电子设备执行上述任一方面任一项可能的实现方式中的文件共享方法。In a fifth aspect, a computer-readable storage medium is provided, comprising instructions, when the instructions are executed on an electronic device, so that the electronic device executes the file sharing method in any of the possible implementations of any of the foregoing aspects.
附图说明Description of drawings
图1是本申请实施例提供的电子设备的结构示意图;1 is a schematic structural diagram of an electronic device provided by an embodiment of the present application;
图2是本申请实施例提供的电子设备的软件框图;2 is a software block diagram of an electronic device provided by an embodiment of the present application;
图3是本申请实施例提供的应用程序开发和安装过程流程图;3 is a flowchart of an application development and installation process provided by an embodiment of the present application;
图4是本申请实施例提供一种文件共享方法的逻辑实现框图;FIG. 4 is a logical implementation block diagram of a file sharing method provided by an embodiment of the present application;
图5是本申请实施例提供的一种文件共享方法的流程示意图;5 is a schematic flowchart of a file sharing method provided by an embodiment of the present application;
图6是本申请实施例提供的一种文件共享方法的流程示意图;6 is a schematic flowchart of a file sharing method provided by an embodiment of the present application;
图7是本申请实施例提供的一种文件共享方法的流程示意图;7 is a schematic flowchart of a file sharing method provided by an embodiment of the present application;
图8是本申请实施例提供的一种文件共享装置示意图。FIG. 8 is a schematic diagram of a file sharing apparatus provided by an embodiment of the present application.
具体实施方式Detailed ways
本申请以下实施例中所使用的术语只是为了描述特定实施例的目的,而并非旨在作为对本申请的限制。如在本申请的说明书和所附权利要求书中所使用的那样,单数表达形式“一个”、“一种”、“所述”、“上述”、“该”和“这一”旨在也包括复数表达形式,除非其上下文中明确地有相反指示。还应当理解,本申请中使用的术语“和/或”是指并包含一个或多个所列出项目的任何或所有可能组合。The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations of the present application. As used in the specification of this application and the appended claims, the singular expressions "a," "an," "the," "above," "the," and "the" are intended to also Plural expressions are included unless the context clearly dictates otherwise. It will also be understood that, as used in this application, the term "and/or" refers to and includes any and all possible combinations of one or more of the listed items.
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为暗示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征,在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。Hereinafter, the terms "first" and "second" are only used for descriptive purposes, and should not be understood as implying or implying relative importance or implying the number of indicated technical features. Therefore, the features defined with "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, the "multiple" The meaning is two or more.
为了使应用程序之间能够共享数据,在一些实施例中,开发人员在开发应用程序A时,可以将该应用程序A中的文件info.Plist中添加UIFileSharingEnabled(Application supports iTunes file sharing)键,并将该键值设置为第一标识,第一标识可以是“yes”。然后,开发人员将应用程序A中可以被共享的文件A放到电子设备中的documents目录下。这样,其他应用程序可以访问应用程序A的文件A中的数据。In order to enable data sharing between applications, in some embodiments, when developing application A, a developer can add a UIFileSharingEnabled(Application supports iTunes file sharing) key to the file info.Plist in application A, and The key value is set as the first identifier, and the first identifier may be "yes". Then, the developer puts the file A that can be shared in the application A into the documents directory in the electronic device. In this way, other applications can access the data in file A of application A.
在上述实施例中,应用程序A的文件A可以被共享。但是,电子设备中开启文件共享功能的应用程序均可以共享文件A。这样,可以共享文件A的应用程序不够单一。In the above embodiment, the file A of the application A can be shared. However, any application program that enables the file sharing function in the electronic device can share the file A. In this way, the applications that can share file A are not single enough.
在又一些实施例中,为了实现应用程序A和应用程序B之间的数据共享。开发人员可以将应用程序A的安装包中的manifest.xml文件中的shareduserID设置成相同的。电子设备在安装应用程序时,会给具有相同的shareduserID的应用程序分配相同的用户ID,即UID。这样,应用程序A和应用程序B之间就可以互访数据。应用程序B可以访问到应用程序A的所有数据。这样,应用程序B可以访问应用程序A的所有数据,若与应用程序B接收到不当操作,可能会影响应用程序A的正常运行。In yet other embodiments, in order to implement data sharing between application A and application B. The developer can set the shareduserID in the manifest.xml file in the application A's installation package to be the same. When the electronic device installs the application, the application with the same shareduserID will be assigned the same user ID, that is, the UID. In this way, application A and application B can mutually access data. Application B can access all data of application A. In this way, application B can access all data of application A. If improper operation is received with application B, the normal operation of application A may be affected.
本申请提供一种文件共享方法及电子设备,该方法可以使得指定应用程序(例如应用程序B)共享应用程序A中指定的文件。这样,既可以实现应用程序之间的数据共享,又可以避免一个应用程序的可共享文件被所有应用程序共享,以及一个应用程序的所有数据被其他应用程序共享。下面将结合附图详细介绍本申请实施例提供的文件共享方法及电子设备。The present application provides a file sharing method and electronic device, which can enable a specified application (eg, application B) to share a file specified in application A. In this way, data sharing between applications can be realized, and sharable files of one application can be avoided to be shared by all applications, and all data of one application can be avoided to be shared by other applications. The file sharing method and electronic device provided by the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
首先介绍本申请实施例提供的示例性电子设备100。First, the exemplary electronic device 100 provided by the embodiment of the present application is introduced.
图1是本申请实施例提供的电子设备100的结构示意图。FIG. 1 is a schematic structural diagram of an electronic device 100 provided by an embodiment of the present application.
下面以电子设备100为例对实施例进行具体说明。应该理解的是,电子设备100可以具有比图中所示的更多的或者更少的部件,可以组合两个或多个的部件,或者可以具有不同的部件配置。图中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。The embodiment will be described in detail below by taking the electronic device 100 as an example. It should be understood that the electronic device 100 may have more or fewer components than those shown in the figures, may combine two or more components, or may have different component configurations. The various components shown in the figures 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.
电子设备100可以包括:处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。The electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2. Mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, camera 193, display screen 194 and Subscriber identification module (subscriber identification module, SIM) card interface 195 and so on. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
可以理解的是,本发明实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that, the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100 . In other embodiments of the present application, the electronic device 100 may include more or less components than shown, or combine some components, or separate some components, or arrange different components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多 个处理器中。The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait. Among them, different processing units can be independent devices, and can also be integrated in one or more processors.
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller may be the nerve center and command center of the electronic device 100 . The controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, the processor 110 may include one or more interfaces. The interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or universal serial bus (universal serial bus, USB) interface, etc.
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。The I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may contain multiple sets of I2C buses. The processor 110 can be respectively coupled to the touch sensor 180K, the charger, the flash, the camera 193 and the like through different I2C bus interfaces. For example, the processor 110 may couple the touch sensor 180K through the I2C interface, so that the processor 110 and the touch sensor 180K communicate with each other through the I2C bus interface, so as to realize the touch function of the electronic device 100 .
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。The I2S interface can be used for audio communication. In some embodiments, the processor 110 may contain multiple sets of I2S buses. The processor 110 may be coupled with the audio module 170 through an I2S bus to implement communication between the processor 110 and the audio module 170 . In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface, so as to realize the function of answering calls through a Bluetooth headset.
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。The PCM interface can also be used for audio communications, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to realize the function of answering calls through the Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。The UART interface is a universal serial data bus used for asynchronous communication. The bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is typically used to connect the processor 110 with the wireless communication module 160 . For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface, so as to realize the function of playing music through the Bluetooth headset.
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 . MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc. In some embodiments, the processor 110 communicates with the camera 193 through a CSI interface, so as to realize the photographing function of the electronic device 100 . The processor 110 communicates with the display screen 194 through the DSI interface to implement the display function of the electronic device 100 .
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface may be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like. The GPIO interface can also be configured as I2C interface, I2S interface, UART interface, MIPI interface, etc.
SIM接口可以被用于与SIM卡接口195通信,实现传送数据到SIM卡或读取SIM卡中数据的功能。The SIM interface can be used to communicate with the SIM card interface 195 to realize the function of transferring data to the SIM card or reading data in the SIM card.
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。The USB interface 130 is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices.
可以理解的是,本发明实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration, and does not constitute a structural limitation of the electronic device 100 . In other embodiments of the present application, the electronic device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。The charging management module 140 is used to receive charging input from the charger. The charger may be a wireless charger or a wired charger.
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。The power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 . The power management module 141 receives input from the battery 142 and/or the charging management module 140 and supplies power to the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 .
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。 Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 may provide wireless communication solutions including 2G/3G/4G/5G etc. applied on the electronic device 100 . The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 . In some embodiments, at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 . In some embodiments, at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. Wherein, the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and passed to the application processor. The application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 . In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(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)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellites Wireless communication solutions such as global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared technology (IR). The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 . The wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无 线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。In some embodiments, the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc. The GNSS may include a global positioning system (global positioning system, GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(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)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。Display screen 194 is used to display images, videos, and the like. Display screen 194 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 (active-matrix organic light). emitting diode, AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on. In some embodiments, the electronic device 100 may include one or N display screens 194 , where N is a positive integer greater than one.
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 may implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。The ISP is used to process the data fed back by the camera 193 . For example, when taking a photo, the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise, brightness, and skin tone. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in the camera 193 .
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。Camera 193 is used to capture still images or video. The object is projected through the lens to generate an optical image onto the photosensitive element. The photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. DSP converts digital image signals into standard RGB, YUV and other formats of image signals. In some embodiments, the electronic device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。A digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy and so on.
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos of various encoding formats, such as: Moving Picture Experts Group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。The NPU is a neural-network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transfer mode between neurons in the human brain, it can quickly process the input information, and can continuously learn by itself. Applications such as intelligent cognition of the electronic device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
内部存储器121可以包括一个或多个随机存取存储器(random access memory,RAM)和一个或多个非易失性存储器(non-volatile memory,NVM)。The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
随机存取存储器可以包括静态随机存储器(static random-access memory,SRAM)、动态随机存储器(dynamic random access memory,DRAM)、同步动态随机存储器(synchronous dynamic random access memory,SDRAM)、双倍资料率同步动态随机存取存储器(double data rate synchronous dynamic random access memory,DDR SDRAM,例如第五代DDR SDRAM一般称为DDR5SDRAM)等;Random access memory can include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronization Dynamic random access memory (double data rate synchronous dynamic random access memory, DDR SDRAM, such as the fifth generation DDR SDRAM is generally called DDR5 SDRAM), etc.;
非易失性存储器可以包括磁盘存储器件、快闪存储器(flash memory)。Non-volatile memory may include magnetic disk storage devices, flash memory.
快闪存储器按照运作原理划分可以包括NOR FLASH、NAND FLASH、3D NAND FLASH等,按照存储单元电位阶数划分可以包括单阶存储单元(single-level cell,SLC)、多阶存储单元(multi-level cell,MLC)、三阶储存单元(triple-level cell,TLC)、四阶储存单元(quad-level cell,QLC)等,按照存储规范划分可以包括通用闪存存储(universal flash storage,UFS)、嵌入式多媒体存储卡(embedded multi media Card,eMMC)等。Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle, and can include single-level memory cells (single-level cells, SLC), multi-level memory cells (multi-level memory cells) according to the level of storage cell potential cell, MLC), triple-level cell (TLC), quad-level cell (QLC), etc., according to storage specifications, it can include universal flash storage (UFS), embedded type multimedia memory card (embedded multi media Card, eMMC) and so on.
随机存取存储器可以由处理器110直接进行读写,可以用于存储操作系统或其他正在运行中的程序的可执行程序(例如机器指令),还可以用于存储用户及应用程序的数据等。The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (eg, machine instructions) of an operating system or other running programs, and can also be used to store data of users and application programs.
非易失性存储器也可以存储可执行程序和存储用户及应用程序的数据等,可以提前加载到随机存取存储器中,用于处理器110直接进行读写。The non-volatile memory can also store executable programs and store data of user and application programs, etc., and can be loaded into the random access memory in advance for the processor 110 to directly read and write.
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playback, recording, etc.
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。The audio module 170 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。Speaker 170A, also referred to as a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music through the speaker 170A, or listen to a hands-free call.
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。The receiver 170B, also referred to as "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 answers a call or a voice message, the voice can be answered by placing the receiver 170B close to the human ear.
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。The microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can make a sound by approaching the microphone 170C through a human mouth, and input the sound signal into the microphone 170C. The electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which can implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。The earphone jack 170D is used to connect wired earphones. The earphone interface 170D can be the USB interface 130, or can be a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作, 可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。The pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals. In some embodiments, the pressure sensor 180A may be provided on the display screen 194 . There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, and the like. The capacitive pressure sensor may be comprised of at least two parallel plates of conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example, when a touch operation whose intensity is less than the first pressure threshold acts on the short message application icon, the instruction for viewing the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。The gyro sensor 180B may be used to determine the motion attitude of the electronic device 100 . In some embodiments, the angular velocity of electronic device 100 about three axes (ie, x, y, and z axes) may be determined by gyro sensor 180B. The gyro sensor 180B can be used for image stabilization. Exemplarily, when the shutter is pressed, the gyro sensor 180B detects the shaking angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse motion to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenarios.
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.
磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can detect the opening and closing of the flip holster using the magnetic sensor 180D. In some embodiments, when the electronic device 100 is a flip machine, the electronic device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D. Further, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, characteristics such as automatic unlocking of the flip cover are set.
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). The magnitude and direction of gravity can be detected when the electronic device 100 is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。Distance sensor 180F for measuring distance. The electronic device 100 can measure the distance through infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes. The light emitting diodes may be infrared light emitting diodes. The electronic device 100 emits infrared light to the outside through the light emitting diode. Electronic device 100 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100 . When insufficient reflected light is detected, the electronic device 100 may determine that there is no object near the electronic device 100 . The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in holster mode, pocket mode automatically unlocks and locks the screen.
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。The ambient light sensor 180L is used to sense ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket, so as to prevent accidental touch.
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, accessing application locks, taking pictures with fingerprints, answering incoming calls with fingerprints, and the like.
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。The temperature sensor 180J is used to detect the temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 caused by the low temperature. In some other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸 传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。Touch sensor 180K, also called "touch panel". The touch sensor 180K may be disposed on the display screen 194 , and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”. The touch sensor 180K is used to detect a touch operation 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 touch operations may be provided through display screen 194 . In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a different location than the display screen 194.
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。The keys 190 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。Motor 191 can generate vibrating cues. The motor 191 can be used for vibrating alerts for incoming calls, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, playing audio, etc.) can correspond to different vibration feedback effects. The motor 191 can also correspond to different vibration feedback effects for touch operations on different areas of the display screen 194 . Different application scenarios (for example: time reminder, receiving information, alarm clock, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。The indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like.
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。The SIM card interface 195 is used to connect a SIM card. The SIM card can be contacted and separated from the electronic device 100 by inserting into the SIM card interface 195 or pulling out from the SIM card interface 195 . The electronic device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card and so on. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as call and data communication.
图2是本申请实施例的电子设备100的软件结构框图。FIG. 2 is a block diagram of the software structure of the electronic device 100 according to the embodiment of the present application.
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将系统分为四层,从上至下分别为应用程序层,应用程序框架层,运行时(Runtime)和系统库,以及内核层。The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the system is divided into four layers, which are, from top to bottom, an application layer, an application framework layer, a runtime (Runtime) and a system library, and a kernel layer.
应用程序层可以包括一系列应用程序包。The application layer can include a series of application packages.
如图2所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序(也可以称为应用)。As shown in FIG. 2 , the application package may include applications (also referred to as applications) such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and short message.
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。The application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
如图2所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器,包管理器,元能力管理器等。As shown in Figure 2, the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, a package manager, a meta-capability manager, and the like.
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。A window manager is used to manage window programs. The window manager can get the size of the display screen, determine whether there is a status bar, lock the screen, take screenshots, etc.
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。Content providers are used to store and retrieve data and make these data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone book, etc.
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on. View systems can be used to build applications. A display interface can consist of one or more views. For example, the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。The phone manager is used to provide the communication function of the electronic device 100 . For example, the management of call status (including connecting, hanging up, etc.).
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。The resource manager provides various resources for the application, such as localization strings, icons, pictures, layout files, video files and so on.
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息, 可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话界面形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。The notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages, and can disappear automatically after a brief pause without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also display notifications in the status bar at the top of the system in the form of graphs or scroll bar text, such as notifications from applications running in the background, and can also display notifications on the screen in the form of a dialog interface. For example, text information is prompted in the status bar, a prompt sound is issued, the electronic device vibrates, and the indicator light flashes.
包管理器(Bundle Manager)可以为应用程序提供包管理服务(Bundle Manager Service,BMS)。BMS可以用于实现应用安装卸载,组件查询匹配,权限管理等功能。在安装应用程序时,BMS可以通过预设在设备内部的云端公钥验证应用程序的安装包的完整性。BMS还可以用于解压应用程序的安装包获取应用程序的公钥publickey。BMS可以根据应用程序的公钥查询该应用程序是否可以共享其他应用程序的文件。若可以,则BMS可以将应用程序的UID加入到可以共享该文件的用户组中。A package manager (Bundle Manager) can provide a package management service (Bundle Manager Service, BMS) for an application. BMS can be used to implement functions such as application installation and uninstallation, component query matching, and permission management. When installing an application, the BMS can verify the integrity of the installation package of the application through the cloud public key preset inside the device. BMS can also be used to decompress the installation package of the application to obtain the public key of the application. The BMS can query whether the application can share files of other applications based on the application's public key. If possible, the BMS can add the UID of the application to the user group that can share the file.
元能力管理器(Ability Manager)可以为应用提供元能力管理服务(Ability Manager Service,AMS)。AMS可以用于应用程序生命周期管理。例如AMS可以主要负责应用程序进程的拉起、管理、销毁等。A meta-capability manager (Ability Manager) can provide a meta-capability management service (Ability Manager Service, AMS) for applications. AMS can be used for application lifecycle management. For example, the AMS can be mainly responsible for pulling, managing, and destroying the application process.
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),二维图形引擎(例如:SGL)等。A system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了二维(2-Dimensional,2D)和三维(3-Dimensional,3D)图层的融合。The Surface Manager is used to manage the display subsystem and provides a fusion of two-dimensional (2-Dimensional, 2D) and three-dimensional (3-Dimensional, 3D) layers for multiple applications.
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。The media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
三维图形处理库用于实现3D图形绘图,图像渲染,合成,和图层处理等。The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
2D图形引擎是2D绘图的绘图引擎。2D graphics engine is a drawing engine for 2D drawing.
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动,虚拟卡驱动。The kernel layer is the layer between hardware and software. The kernel layer contains at least display drivers, camera drivers, audio drivers, sensor drivers, and virtual card drivers.
下面结合捕获拍照场景,示例性说明电子设备100软件以及硬件的工作流程。In the following, the workflow of the software and hardware of the electronic device 100 is exemplarily described in conjunction with the capturing and photographing scene.
当触摸传感器180K接收到触摸操作,相应的硬件中断被发给内核层。内核层将触摸操作加工成原始输入事件(包括触摸坐标,触摸操作的时间戳等信息)。原始输入事件被存储在内核层。应用程序框架层从内核层获取原始输入事件,识别该输入事件所对应的控件。以该触摸操作是触摸单击操作,该单击操作所对应的控件为相机应用图标的控件为例,相机应用调用应用框架层的接口,启动相机应用,进而通过调用内核层启动摄像头驱动,通过摄像头193捕获静态图像或视频。When the touch sensor 180K receives a touch operation, a corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes touch operations into raw input events (including touch coordinates, timestamps of touch operations, etc.). Raw input events are stored at the kernel layer. The application framework layer obtains the original input event from the kernel layer, and identifies the control corresponding to the input event. Taking the touch operation as a touch click operation, and the control corresponding to the click operation is the control of the camera application icon, as an example, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer, and then starts the camera driver by calling the kernel layer. The camera 193 captures still images or video.
在本申请实施例,应用程序A可以称为第一应用程序,应用程序B可以称为第二应用程序。文件A可以称为第一文件。In this embodiment of the present application, application A may be referred to as a first application, and application B may be referred to as a second application. File A may be referred to as the first file.
下面结合上述示例性电子设备100的软硬件机构,对本申请实施例中方法进行具体描述。本申请实施例提供了一种文件共享方法。在该方法中,应用程序A的安装包中写入了将文件A共享给应用程序B的标识。当手机中安装了应用程序A和应用程序B时,手机可以将应用程序B的标识加入到可共享文件A的共享组中。这样,应用程序B在运行时可以访问文件A。在本申请实施例中,应用程序也可以简称为应用。The method in the embodiment of the present application will be described in detail below with reference to the software and hardware mechanisms of the above-mentioned exemplary electronic device 100 . The embodiments of the present application provide a file sharing method. In this method, an identifier for sharing file A with application B is written in the installation package of application A. When application A and application B are installed in the mobile phone, the mobile phone can add the identifier of application B to the sharing group that can share file A. This way, application B can access file A at runtime. In this embodiment of the present application, an application program may also be referred to as an application for short.
这里文件A可共享给应用程序B是指,应用程序B可以访问文件A,读取文件A的数据和可以执行文件A。文件A的共享组中的应用程序均可以访问文件A。Here, file A can be shared with application B, which means that application B can access file A, read the data of file A, and execute file A. All applications in the shared group of file A can access file A.
首先,结合附图简要介绍应用程序开发和上传到应用市场,到手机从应用市场下载应用 程序的过程。如图3所示。以应用程序B为例,应用程序开发和上传到应用市场,到手机从应用市场下载应用程序可以包括如下步骤:First of all, the process of application development and uploading to the application market, and the mobile phone downloading the application from the application market will be briefly introduced with reference to the attached drawings. As shown in Figure 3. Taking application B as an example, developing and uploading the application to the application market, and downloading the application from the application market to the mobile phone may include the following steps:
A、应用程序开发和上传到应用市场A. Application development and uploading to the application market
1、开发人员生成应用程序B的公私钥对,公钥publickeyB和私钥privatekeyB。1. The developer generates the public-private key pair of application B, the public key publickeyB and the private key privatekeyB.
应用程序的开发者可以开发应用程序B的设备中生成一对应用程序B的公私钥对。例如图3中示出的应用程序B公私钥对301。公私钥对301可以包括公钥publickeyB和私钥privatekeyB。可以理解的是,公钥和私钥是成对出现的,它们可以互相解密。公钥加密的内容,只有私钥可以解密。私钥加密的内容,只有公钥可以解密。公钥加密,私钥解密;私钥签名,公钥验证。公钥是对外公开的,私钥是保密的。终端可以从应用程序的安装包中获取到应用程序的公钥。The developer of the application can generate a pair of public and private keys of the application B in the device that develops the application B. For example, the public-private key pair 301 of application B shown in FIG. 3 . The public-private key pair 301 may include a public key publickeyB and a private key privatekeyB. Understandably, the public and private keys come in pairs, and they can decrypt each other. Content encrypted by the public key can only be decrypted by the private key. Content encrypted by the private key can only be decrypted by the public key. Public key encryption, private key decryption; private key signature, public key verification. The public key is public and the private key is kept secret. The terminal can obtain the public key of the application from the installation package of the application.
2、开发人员向应用市场申请应用程序B的签名证书。2. The developer applies to the application market for the signing certificate of application B.
开发人员可以将应用程序B的公钥上传到应用市场申请对应的应用签名证书。例如图3示出的应用程序B签名证书302。应用程序B签名证书中可以包含应用程序B的公钥publickeyB。应用程序B的签名证书可以用于标识开发者身份,其中,还可以包含开发者基本信息。The developer can upload the public key of application B to the application market to apply for the corresponding application signing certificate. For example, the application B signing certificate 302 shown in FIG. 3 . Application B's signature certificate can contain application B's public key publickeyB. The signing certificate of application B can be used to identify the identity of the developer, and it can also contain basic information of the developer.
应用市场又可以称为应用商店,即APP STORE,是为移动设备手机、平板电脑等电子设备提供收费或者免费的游戏、应用下载服务的电子应用商店。The application market can also be called the application store, that is, APP STORE, which is an electronic application store that provides paid or free games and application download services for electronic devices such as mobile phones and tablet computers.
3、开发人员开发应用B,得到应用B的源程序包。3. The developer develops application B, and obtains the source program package of application B.
开发人员开发应用程序B,得到用程序B的源程序包,例如图3示出的应用程序B的源程序包303。源程序包中可以包含多个文件,每个文件中可包含按照特定格式编写的源代码。The developer develops the application program B, and obtains the source program package of the application program B, for example, the source program package 303 of the application program B shown in FIG. 3 . A source package can contain multiple files, each of which can contain source code written in a specific format.
4、开发人员对应用程序B进行自签名,得到应用程序B的上架安装包。4. The developer self-signs the application B, and obtains the shelf installation package of the application B.
开发人员利用应用程序B的私钥privatekeyB对应用程序B进行自签名,得到自签名信息signatureB。开发人员将自签名信息signatureB和公钥publickeyB放入应用程序B的程序包中,得到应用程序B的上架安装包。如图3中示出的应用程序B的上架安装包304。The developer uses the private key privatekeyB of application B to self-sign application B to obtain the self-signed information signatureB. The developer puts the self-signed information signatureB and the public key publickeyB into the package of application B, and obtains the shelf installation package of application B. An on-shelf installation package 304 of application B as shown in FIG. 3 .
5、开发人员利用应用市场的私钥对应用程序B的上架安装包进行签名,得到应用程序B的下载安装包。5. The developer uses the private key of the application market to sign the on-the-shelf installation package of application B to obtain the downloaded installation package of application B.
开发人员将应用程序B的上架安装包上传到应用市场。应用市场使用应用市场私钥对应用程序B的上架安装包进行签名,得到签名信息signature。应用市场并将该签名信息signature放入到应用程序B的上架安装包中,形成应用程序B的下载安装包。例如,图3中示出的应用程序B的下载安装包306。The developer uploads the shelf installation package of application B to the application market. The application market uses the application market private key to sign the on-air installation package of application B to obtain the signature information signature. The application market puts the signature information signature into the shelf installation package of application B to form a download installation package of application B. For example, the download installation package 306 of application B shown in FIG. 3 .
应用市场持有一对统一的公私钥对。例如图3中示出的应用市场公私钥对305。应用市场公私钥对305中可以包括应用市场公钥和应用市场私钥。所有的应用程序上架到该应用市场时,应用市场均可以用私钥对应用程序的上架安装包进行签名,得到签名信息。应用市场的公钥可以对该签名信息进行验签。The application market holds a unified public and private key pair. For example, the application market public-private key pair 305 shown in FIG. 3 . The application market public-private key pair 305 may include the application market public key and the application market private key. When all applications are listed on the application market, the application market can use the private key to sign the application's installation package on the shelf to obtain the signature information. The public key of the application market can verify the signature information.
B、手机从应用市场下载应用程序并安装应用程序B. The mobile phone downloads the application from the application market and installs the application
6、手机从应用市场下载应用程序B的下载安装包,取出应用程序B的下载安装包中的signature,使用手机中保存的应用市场公钥对signature进行验签,验签通过后,手机取出下载安装包中的publickeyB对signatureB进行验签,验签成功,则可安装应用程序B。6. The mobile phone downloads the download and installation package of application B from the application market, takes out the signature in the download and installation package of application B, and verifies the signature with the public key of the application market saved in the mobile phone. After the verification is passed, the mobile phone takes out the download The publickeyB in the installation package verifies the signature of signatureB. If the signature is successful, application B can be installed.
手机从应用市场下载该应用程序B的下载安装包后,手机中BMS可以取出该应用程序B的下载安装包中的签名信息signature,并使用手机中预置的应用市场公钥对签名信息signature进行验签。当应用程序B的下载安装包被篡改时,可能会导致应用程序B的下载安装包中的 签名信息signature验签失败。若验签失败,手机安装该下载安装包失败,退出安装。若验签通过,则表示应用程序的下载安装包的来源合法。After the mobile phone downloads the download and installation package of the application B from the application market, the BMS in the mobile phone can take out the signature information signature in the download and installation package of the application B, and use the application market public key preset in the mobile phone to perform the signature information signature. Check the signature. When the download and installation package of application B is tampered with, the signature information signature in the download and installation package of application B may fail to be verified. If the signature verification fails, the mobile phone fails to install the downloaded installation package and exits the installation. If the verification is passed, it means that the source of the downloaded installation package of the application is legal.
签名信息signature验签通过后,手机中BMS取出应用程序B的下载安装包中的自签名信息signatureB和公钥publickeyB。BMS通过公钥publickeyB对自签名信息signatureB进行验签。若验签通过,则手机可以成功安装应用程序B。应用程序B的源程序包和自签名信息signatureB以及公钥publickeyB均未被篡改,且publickeyB是自签名signatureB匹配的公钥时,应用程序B才可以成功安装。After the signature information signature is verified, the BMS in the mobile phone takes out the self-signed information signatureB and the public key publickeyB in the download and installation package of application B. The BMS verifies the signature of the self-signed information signatureB through the public key publickeyB. If the verification is passed, the mobile phone can successfully install application B. Application B can be successfully installed only when the source package of application B, the self-signed information signatureB, and the public key publickeyB have not been tampered with, and publickeyB is the public key that matches the self-signed signatureB.
图4示出了本申请实施例示意出本申请实施例提供的一种文件分享方法的实现框图。如图4所示,在本申请实施例提供的文件分享方法实现框图中,可以包括应用程序A的下载安装包401,包管理服务BMS402、应用程序B的下载安装包403;其中:FIG. 4 shows a block diagram illustrating an implementation of a file sharing method provided by an embodiment of the present application. As shown in FIG. 4 , in the implementation block diagram of the file sharing method provided by the embodiment of the present application, a download and installation package 401 of application A, a package management service BMS402, and a download and installation package 403 of application B may be included; wherein:
应用程序A的安装包401中可以包括文件4011和文件4012。文件4011写入了将文件名getHilink.so的文件共享给publickey为“abcdfgh”的应用程序的代码。文件4012为文件名称为getHilink.so的文件。文件4012可以从应用程序A的安装包401中解压得到。The installation package 401 of the application A may include a file 4011 and a file 4012 . File 4011 writes the code to share the file named getHilink.so with the application whose publickey is "abcdfgh". The file 4012 is a file whose file name is getHilink.so. The file 4012 can be obtained by decompressing the installation package 401 of the application A.
包管理服务BMS402由图2中包管理器提供。包管理服务BMS402可以保存文件4011中的文件名为getHilink.so的文件与publickey为“abcdfgh”的应用程序的对应关系4021。BMS402根据该对应关系建立文件名为getHilink.so的文件的共享组4022。对应关系4021和共享组4022可以保存于数据库中。应用程序B的publickeyB为“abcdfgh”当应用程序B安装后,BMS可以将应用程序B的UID(例如UIDB)加入到共享组4022中。The package management service BMS 402 is provided by the package manager in FIG. 2 . The package management service BMS402 can save the corresponding relationship 4021 between the file named getHilink.so in the file 4011 and the application program whose public key is "abcdfgh". The BMS 402 establishes a sharing group 4022 of a file named getHilink.so according to the corresponding relationship. Correspondence 4021 and sharing group 4022 can be stored in a database. The publickeyB of application B is "abcdfgh". After application B is installed, the BMS can add the UID (eg UIDB) of application B to the sharing group 4022 .
应用程序B的下载安装包402中可以包含应用程序B的公钥publickeyB。publickeyB可以为“abcdfgh”。The download and installation package 402 of the application B may contain the public key publickeyB of the application B. publickeyB can be "abcdfgh".
这样,通过BMS402建立文件名为getHilink.so的文件的共享组,并将应用程序B的UID加入到文件名为getHilink.so的文件的共享组。应用程序B就具有可读可执行文件名为getHilink.so的文件的权限。In this way, a sharing group of the file with the file name getHilink.so is established through the BMS 402, and the UID of the application B is added to the sharing group of the file with the file name getHilink.so. Application B has the right to read the executable file named getHilink.so.
下面结合附图详细介绍本申请实施例提供的一种文件分享方法。图5示出了本申请实施例提供的一种文件分享方法的流程示意图。如图5所示,本申请实施例提供的一种文件分享方法可以包括:A file sharing method provided by an embodiment of the present application is described in detail below with reference to the accompanying drawings. FIG. 5 shows a schematic flowchart of a file sharing method provided by an embodiment of the present application. As shown in FIG. 5 , a file sharing method provided by an embodiment of the present application may include:
S100、电子设备响应于操作A,获取应用程序A的安装包。S100. The electronic device, in response to operation A, acquires an installation package of application A.
用户可以在电子设备的应用市场中获取应用程序A的安装包。操作A可以是用户获取应用程序A的安装包的操作,例如,操作A可以是用户从应用市场中下载应用程序A的安装包。参考图3中的描述,可以理解的是,用户从应用市场中下载应用程序A的安装包可以包括应用程序A的源程序包,应用程序A的公钥以及应用程序A的自签名信息。这里应用程序A的安装包可以称为应用程序A的下载安装包。应用程序A的生成以及上架到应用市场形成应用程序A上的下载安装包的过程可以参考图3中的描述,此处不再赘述。The user may obtain the installation package of the application A in the application market of the electronic device. Operation A may be an operation for the user to obtain the installation package of the application program A, for example, the operation A may be that the user downloads the installation package of the application program A from the application market. Referring to the description in FIG. 3 , it can be understood that the installation package of the application A downloaded by the user from the application market may include the source package of the application A, the public key of the application A and the self-signed information of the application A. Here, the installation package of application A may be referred to as the downloaded installation package of application A. For the process of generating the application A and listing it on the application market to form the download and installation package of the application A, reference may be made to the description in FIG. 3 , which will not be repeated here.
S101、电子设备确定应用程序A的安装包中携带有第一标识,第一标识用于指示应用程序A的安装包中的文件A共享给共享对象,共享对象为可以访问文件A的应用程序。S101. The electronic device determines that the installation package of application A carries a first identifier, and the first identifier is used to indicate that file A in the installation package of application A is shared with a shared object, and the shared object is an application that can access file A.
电子设备可以从应用程序A的安装包中读取到第一标识。该第一标识可以是应用程序A的源程序包中的源代码。该第一标识用于指示应用程序A的安装包中的文件A共享给共享对象。共享对象为可以访问文件A的应用程序。可以理解的是,应用程序A的开发人员可以和 其他应用程序的开发人员约定将应用程序A的某个文件共享给其他应用程序。这样,其他应用程序可以调用读取文件A的数据,实现文件A中源代码所提供的功能。The electronic device can read the first identifier from the installation package of the application A. The first identifier may be the source code in the source package of the application A. The first identifier is used to indicate that the file A in the installation package of the application A is shared with the shared object. Shared objects are applications that can access file A. It is understandable that the developer of application A may agree with developers of other applications to share a certain file of application A with other applications. In this way, other applications can call to read the data of file A to realize the functions provided by the source code in file A.
第一标识可以如下所示:The first identification can be as follows:
Profile.json:Profile.json:
<share name=“getHilink.so”>//指明可共享的文件名为“getHilink.so”<share name="getHilink.so">//Indicates the shareable file name is "getHilink.so"
<publickey>abcdfgh</publickey></share>//文件“getHilink.so”的共享对象为public key为“abcdfgh”的应用程序<publickey>abcdfgh</publickey></share>//The shared object of the file "getHilink.so" is the application whose public key is "abcdfgh"
第一标识中可以指定应用程序A中可以共享的文件,以及该文件可以共享的对象。本申请实施例中文件A可以是上述第一标识文件“getHilink.so”。文件A的共享对象可以是public key为“abcdfgh”的应用程序。电子设备在安装应用程序A时,可以将文件“getHilink.so”解压到应用安装,例如/data/appA/lib。电子设备可以根据第一标识,例如上述profile信息中的内容,将文件A(例如文件“getHilink.so”)和共享对象(例如public key为“abcdfgh”的应用程序)的对应关系同步到BMS中。BMS可以将文件A(例如文件“getHilink.so”)和共享对象(例如public key为“abcdfgh”的应用程序)的对应关系存储到数据库中。The first identifier may specify a file that can be shared in application A and an object to which the file can be shared. In this embodiment of the present application, the file A may be the above-mentioned first identification file "getHilink.so". The shared object of file A can be an application whose public key is "abcdfgh". When the electronic device installs the application A, the file "getHilink.so" may be decompressed to the application installation, for example, /data/appA/lib. The electronic device can synchronize the correspondence between the file A (for example, the file "getHilink.so") and the shared object (for example, the application whose public key is "abcdfgh") to the BMS according to the first identifier, for example, the content in the above profile information . The BMS may store the correspondence between the file A (for example, the file "getHilink.so") and the shared object (for example, the application whose public key is "abcdfgh") in the database.
可以理解的是,开发者可以将应用程序A中的文件A共享给多个共享对象。开发者还可以将应用程序A中的多个文件共享给一个或多个共享对象。It can be understood that the developer can share the file A in the application A to multiple shared objects. Developers can also share multiple files in Application A to one or more shared objects.
可以理解的是,应用程序中共享的文件不同,该共享文件的共享对象不同,第一标识中的内容也会不同,本申请实施例对第一标识的具体内容不作限定。It can be understood that, different files are shared in the application programs, the shared objects of the shared files are different, and the content of the first identifier will also be different, and the specific content of the first identifier is not limited in this embodiment of the present application.
S102、电子设备基于第一标识建立文件A的共享组。S102, the electronic device establishes a sharing group of the file A based on the first identifier.
电子设备可以通过BMS来建立文件A的共享组。BMS可以生成文件A的共享组ID(group ID,GID)。文件A的共享组内可以包括所有可以共享文件A的应用程序的用户ID(user ID,UID)以及应用程序A的UID。若电子设备还未安装第一标识中指定文件A可共享的应用程序,那么共享组中只有应用程序A的UID。这里UID可以用于标识一个应用程序。The electronic device may establish a sharing group of file A through the BMS. The BMS can generate the shared group ID (group ID, GID) of file A. The sharing group of file A may include the user IDs (user ID, UID) of all applications that can share file A and the UID of application A. If the electronic device has not installed the application program that can be shared by the file A specified in the first identifier, only the UID of the application program A is in the sharing group. This UID can be used to identify an application.
电子设备在安装应用程序时,电子设备中的BMS可以给应用程序分配UID。在应用程序存在于电子设备的期间,应用程序的UID不会改变。且一个应用程序只能有一个UID。When an electronic device installs an application, the BMS in the electronic device can assign a UID to the application. The UID of the application does not change while the application exists on the electronic device. And an application can only have one UID.
在本申请实施例中,基于共享文件,可以将电子设备中的应用程序分成三种类型:文件所有者用户、群组用户、其他用户。提供共享文件的应用程序可以称为文件所有者用户。在共享文件的共享组内的,除了提供文件的应用程序的其他应用程序可以称为群组用户。电子设备中不可以共享该共享文件的应用程序可以称为其他用户。对于可共享文件,不同类型的应用程序的权限不同。文件所有者用户具有可读,可写,且可执行该文件的权限,群组用户具有可读可执行但不可写该文件的权限,其他用户则不可读不可写也不可执行该共享文件。In this embodiment of the present application, based on shared files, applications in the electronic device can be divided into three types: file owner users, group users, and other users. An application that provides shared files can be referred to as the file owner user. Within a sharing group that shares files, other applications other than the application providing the files may be referred to as group users. Applications in the electronic device that cannot share the shared file may be referred to as other users. Different types of applications have different permissions for shareable files. The file owner user has the permission to read, write, and execute the file, the group user has the permission to read, execute, but not write the file, and other users can neither read, write nor execute the shared file.
S103、电子设备响应于操作B,获取应用程序B的安装包。S103 , the electronic device, in response to operation B, acquires the installation package of application B.
用户可以在电子设备的应用市场中获取应用程序B的安装包。操作B可以是用户获取应用程序B的安装包的操作,例如,操作B可以是用户从应用市场中下载应用程序B的安装包。参考图3中的描述,可以理解的是,用户从应用市场中下载应用程序B的安装包可以包括应用程序B的源程序包,应用程序B的公钥以及应用程序B的自签名信息。这里应用程序B的安装包可以称为应用程序B的下载安装包。应用程序B的生成以及上架到应用市场形成应用程序B上的下载安装包的过程可以参考图3中的描述,此处不再赘述。The user can obtain the installation package of the application B in the application market of the electronic device. Operation B may be an operation for the user to obtain the installation package of application B. For example, operation B may be that the user downloads the installation package of application B from the application market. Referring to the description in FIG. 3 , it can be understood that the installation package of application B downloaded by the user from the application market may include the source package of application B, the public key of application B, and the self-signed information of application B. Here, the installation package of application B may be referred to as the downloaded installation package of application B. For the process of generating the application B and listing it on the application market to form the download and installation package of the application B, reference may be made to the description in FIG. 3 , which will not be repeated here.
S104、电子设备根据应用程序B的标识以及第一标识,确定应用程序B为文件A的共享对象。S104 , the electronic device determines that the application B is the shared object of the file A according to the identifier of the application B and the first identifier.
电子设备可以在应用程序B的下载安装包中获取到应用程序B的标识。具体地,应用程序B的标识可以是应用程序B的公钥publickeyB。例如,应用程序B的publickeyB为“abcdfgh”。第一标识中指示将应用程序A的文件A共享给publickeyB为“abcdfgh”的应用程序。这样,电子设备可以根据应用程序B的标识以及第一标识,确定应用程序B为文件A的共享对象。The electronic device can obtain the identifier of the application B in the download and installation package of the application B. Specifically, the identity of the application B may be the public key publickeyB of the application B. For example, application B's publickeyB is "abcdfgh". The first identifier indicates that the file A of the application A is shared with the application whose publickeyB is "abcdfgh". In this way, the electronic device can determine that the application B is the shared object of the file A according to the identification of the application B and the first identification.
S105、电子设备将应用程序B加入文件A的共享组。S105 , the electronic device adds the application B to the sharing group of the file A.
电子设备可以将应用B的UID加入到共享文件A(例如文件“getHilink.so”)的用户组中。若文件的用户组的GID为1001,应用程序A的UID为1001,应用程序B的UID为1002。那么,此时文件A的GID为1001的共享组中包含两个用户:UID 1001(应用程序A)和UID1002(应用程序B)。这里,共享文件(例如文件A)的所有者(例如应用程序A)的UID可以和共享文件的用户组的GID相同。但是,不同的应用程序的UID是不相同的。The electronic device may add the UID of application B to the user group sharing the file A (eg, the file "getHilink.so"). If the GID of the user group of the file is 1001, the UID of application A is 1001, and the UID of application B is 1002. Then, at this time, the shared group whose GID of file A is 1001 contains two users: UID 1001 (application A) and UID 1002 (application B). Here, the UID of the owner (eg, application A) of the shared file (eg, file A) may be the same as the GID of the user group sharing the file. However, the UIDs of different applications are not the same.
电子设备将应用程序B加入文件A的共享后,当应用程序B调用文件A时,应用程序B可以读取文件A中的数据以及可执行文件A。应用程序B运行时,由AMS负责应用程序B的生命周期管理。After the electronic device adds the application B to the sharing of the file A, when the application B calls the file A, the application B can read the data in the file A and the executable file A. When application B is running, the AMS is responsible for the life cycle management of application B.
可以理解的是,电子设备在执行步骤S102时,电子设备中BMS可以获取应用程序A的公钥publickeyA。BMS根据publickeyA确定电子设备中是否存在共享给应用程序A的文件,若有,电子设备可以将应用程序A加入到该文件的共享组中。进一步地,可以将应用程序A的UID加入到该文件的共享组中。It can be understood that, when the electronic device performs step S102, the BMS in the electronic device can obtain the public key publickeyA of the application A. The BMS determines whether there is a file shared with application A in the electronic device according to publickeyA, and if so, the electronic device can add application A to the sharing group of the file. Further, the UID of application A can be added to the sharing group of the file.
通过本申请实施例提供的文件共享方法,电子设备可以将应用程序A中的指定文件,即文件A共享给指定应用程序,例如应用程序B。这样,应用程序B就可以访问文件并可执行文件A。但是电子设备中的其他程序不可访问文件A也不可执行文件A。这样,应用程序A既能共享文件A给应用程序B,也避免了应用程序A的文件A被电子设备中的其他应用程序恶意访问。With the file sharing method provided by the embodiments of the present application, the electronic device can share the specified file in application A, that is, file A, to a specified application, such as application B. This way, application B can access the file and execute file A. But other programs in the electronic device cannot access file A nor execute file A. In this way, application A can not only share file A with application B, but also prevent file A of application A from being maliciously accessed by other applications in the electronic device.
在本申请中,应用程序A的开发人员在应用程序A的源程序包中写入第一标识。该第一标识指示将应用程序A的文件A共享给应用程序B。例如,应用程序A的开发人员可以在应用程序A源程序包的profile文件中写入第一标识。电子设备中可以先安装应用程序A,也可以先安装应用程序B。当电子设备中先安装应用程序B时,本申请实施例提供的一种文件共享方法可以按照图6示出的步骤执行。In this application, the developer of the application A writes the first identifier in the source package of the application A. The first identifier indicates that file A of application A is shared with application B. For example, the developer of application A may write the first identifier in the profile file of the source package of application A. Application A may be installed in the electronic device first, or application B may be installed first. When the application B is first installed in the electronic device, the file sharing method provided by the embodiment of the present application may be performed according to the steps shown in FIG. 6 .
图6示出了本申请实施例提供的一种文件共享方法的流程示意图,如图6所示,本申请实施例提供的文件共享方法可以包括:FIG. 6 shows a schematic flowchart of a file sharing method provided by an embodiment of the present application. As shown in FIG. 6 , the file sharing method provided by the embodiment of the present application may include:
S200、电子设备响应于操作B,获取应用程序B的安装包。S200. The electronic device, in response to operation B, acquires an installation package of application B.
用户可以在电子设备的应用市场中获取应用程序B的安装包。操作B可以是用户获取应用程序B的安装包的操作,例如,操作B可以是用户从应用市场中下载应用程序B的安装包。参考图3中的描述,可以理解的是,用户从应用市场中下载应用程序B的安装包可以包括应用程序B的源程序包,应用程序B的公钥以及应用程序B的自签名信息。这里应用程序B的安装包可以称为应用程序B的下载安装包。应用程序B的生成以及上架到应用市场形成应用程序B上的下载安装包的过程可以参考图3中的描述,此处不再赘述。The user can obtain the installation package of the application B in the application market of the electronic device. Operation B may be an operation for the user to obtain the installation package of application B. For example, operation B may be that the user downloads the installation package of application B from the application market. Referring to the description in FIG. 3 , it can be understood that the installation package of application B downloaded by the user from the application market may include the source package of application B, the public key of application B, and the self-signed information of application B. Here, the installation package of application B may be referred to as the downloaded installation package of application B. For the process of generating the application B and listing it on the application market to form the download and installation package of the application B, reference may be made to the description in FIG. 3 , which will not be repeated here.
S201、电子设备确定电子设备中是否存在应用程序B可以共享的文件A;若存在,则执 行步骤S202,若不存在,则执行步骤S203。S201. The electronic device determines whether there is a file A that can be shared by the application B in the electronic device; if it exists, execute step S202, and if not, execute step S203.
电子设备可以从应用程序B的安装包中获取到应用程序B的标识,例如应用程序B的公钥publickeyB。电子设备可以根据publickeyB确定电子设备中是否有共享给应用程序B的文件。若BMS中有publickeyB和共享文件的对应关系,则电子设备确定电子设备中有共享给应用程序B的文件。电子设备可以执行步骤S202。若BMS中不存在publickeyB和共享文件的对应关系,则电子设备确定电子设备中没有共享给应用程序B的文件。电子设备可以执行步骤S203。The electronic device can obtain the identity of the application B from the installation package of the application B, for example, the public key publickeyB of the application B. The electronic device can determine whether there is a file shared to application B in the electronic device according to publickeyB. If there is a correspondence between publickeyB and the shared file in the BMS, the electronic device determines that there is a file shared to application B in the electronic device. The electronic device may perform step S202. If there is no corresponding relationship between the publickeyB and the shared file in the BMS, the electronic device determines that there is no file shared to the application B in the electronic device. The electronic device may perform step S203.
S202、电子设备将应用程序B加入文件A的共享组。S202, the electronic device adds the application B to the sharing group of the file A.
电子设备可以将应用B的UID加入到共享文件A(例如文件“getHilink.so”)的用户组中。例如,文件的用户组的GID为1001。文件A的所有者为应用程序A,应用程序A的UID为1001。应用程序B的UID为1002。那么,此时文件A的GID为1001的共享组中包含两个用户:UID 1001(应用程序A)和UID 1002(应用程序B)。这里,共享文件(例如文件A)的所有者(例如应用程序A)的UID可以和共享文件的用户组的GID相同。但是,不同的应用程序的UID是不相同的。The electronic device may add the UID of application B to the user group sharing the file A (eg, the file "getHilink.so"). For example, a file's user group has a GID of 1001. The owner of file A is application A, and the UID of application A is 1001. Application B has a UID of 1002. Then, at this time, the shared group whose GID of file A is 1001 contains two users: UID 1001 (application A) and UID 1002 (application B). Here, the UID of the owner (eg, application A) of the shared file (eg, file A) may be the same as the GID of the user group sharing the file. However, the UIDs of different applications are not the same.
电子设备在安装应用程序时,电子设备中的BMS可以给应用程序分配UID。在应用程序存在于电子设备的期间,应用程序的UID不会改变。且一个应用程序只能有一个UID。When an electronic device installs an application, the BMS in the electronic device can assign a UID to the application. The UID of the application does not change while the application exists on the electronic device. And an application can only have one UID.
电子设备将应用程序B加入文件A的共享后,当应用程序B调用文件A时,应用程序B可以读取文件A中的数据以及可执行文件A。应用程序B运行时,由AMS负责应用程序B的生命周期管理。After the electronic device adds the application B to the sharing of the file A, when the application B calls the file A, the application B can read the data in the file A and the executable file A. When application B is running, the AMS is responsible for the life cycle management of application B.
步骤S202可以参考步骤S105中的描述。Step S202 can refer to the description in step S105.
S203、电子设备响应于操作A,获取应用程序A的安装包。S203 , the electronic device acquires the installation package of the application A in response to the operation A.
用户可以在电子设备的应用市场中获取应用程序A的安装包。操作A可以是用户获取应用程序A的安装包的操作,例如,操作A可以是用户从应用市场中下载应用程序A的安装包。参考图3中的描述,可以理解的是,用户从应用市场中下载应用程序A的安装包可以包括应用程序A的源程序包,应用程序A的公钥以及应用程序A的自签名信息。这里应用程序A的安装包可以称为应用程序A的下载安装包。应用程序A的生成以及上架到应用市场形成应用程序A上的下载安装包的过程可以参考图3中的描述,此处不再赘述。The user may obtain the installation package of the application A in the application market of the electronic device. Operation A may be an operation for the user to obtain the installation package of the application program A, for example, the operation A may be that the user downloads the installation package of the application program A from the application market. Referring to the description in FIG. 3 , it can be understood that the installation package of the application A downloaded by the user from the application market may include the source package of the application A, the public key of the application A and the self-signed information of the application A. Here, the installation package of application A may be referred to as the downloaded installation package of application A. For the process of generating the application A and listing it on the application market to form the download and installation package of the application A, reference may be made to the description in FIG. 3 , which will not be repeated here.
可以理解的是,用户的操作A和操作B可以是不连续的操作。即,用户可以在执行操作B之后的第一时间段后再执行操作A。例如,用户可以执行安装应用程序B的操作的三天后再执行安装应用程序A的操作。第一时间段可以是30分钟,也可以是1天,也可以是1个月,本申请实施例对此不作限定。It can be understood that the user's operation A and operation B may be discontinuous operations. That is, the user may perform the operation A after the first time period after the operation B is performed. For example, the user may perform the operation of installing application A three days after performing the operation of installing application B. The first time period may be 30 minutes, or may be one day, or may be one month, which is not limited in this embodiment of the present application.
S204、电子设备确定应用程序A的安装包中携带有第一标识,第一标识指示应用程序A的安装包中的文件A共享给应用程序B。S204 , the electronic device determines that the installation package of the application A carries a first identifier, and the first identifier indicates that the file A in the installation package of the application A is shared with the application B.
电子设备可以从应用程序A的安装包中读取到第一标识。该第一标识可以是应用程序A的源程序包中的源代码。该第一标识用于指示应用程序A的安装包中的文件A共享给应用程序B。可以理解的是,应用程序A的开发人员可以和应用程序B的开发人员约定将应用程序A的文件A共享给应用程序B。这样,应用程序B可以调用读取文件A的数据,实现文件A中源代码所提供的功能。The electronic device can read the first identifier from the installation package of the application A. The first identifier may be the source code in the source package of the application A. The first identifier is used to indicate that file A in the installation package of application A is shared with application B. It is understandable that the developer of application A may agree with the developer of application B to share the file A of application A with application B. In this way, application B can call to read the data of file A, and realize the function provided by the source code in file A.
第一标识可以如下所示:The first identification can be as follows:
Profile.json:Profile.json:
<share name=“getHilink.so”>//指明可共享的文件名为“getHilink.so”<share name="getHilink.so">//Indicates the shareable file name is "getHilink.so"
<publickey>abcdfgh</publickey></share>//文件“getHilink.so”的共享对象为public key为“abcdfgh”的应用程序<publickey>abcdfgh</publickey></share>//The shared object of the file "getHilink.so" is the application whose public key is "abcdfgh"
第一标识中可以指定应用程序A中可以共享的文件,以及该文件可以共享的对象。本申请实施例中文件A可以是上述第一标识文件“getHilink.so”。文件A的共享对象可以是public key为“abcdfgh”的应用程序。应用程序B的public key为“abcdfgh”。因此,第一标识指示将文件A共享给应用程序B。The first identifier may specify a file that can be shared in application A and an object to which the file can be shared. In this embodiment of the present application, the file A may be the above-mentioned first identification file "getHilink.so". The shared object of file A can be an application whose public key is "abcdfgh". The public key of application B is "abcdfgh". Therefore, the first identification indicates that file A is to be shared with application B.
电子设备在安装应用程序A时,可以将文件“getHilink.so”解压到应用安装,例如/data/appA/lib。电子设备可以根据第一标识,例如上述profile信息中的内容,将文件A(例如文件“getHilink.so”)和共享对象(例如public key为“abcdfgh”的应用程序)的对应关系同步到BMS中。BMS可以将文件A(例如文件“getHilink.so”)和共享对象(例如public key为“abcdfgh”的应用程序)的对应关系存储到数据库中。When the electronic device installs the application A, the file "getHilink.so" may be decompressed to the application installation, for example, /data/appA/lib. The electronic device can synchronize the correspondence between the file A (for example, the file "getHilink.so") and the shared object (for example, the application whose public key is "abcdfgh") to the BMS according to the first identifier, for example, the content in the above profile information . The BMS may store the correspondence between the file A (for example, the file "getHilink.so") and the shared object (for example, the application whose public key is "abcdfgh") in the database.
S205、电子设备将应用程序B加入文件A的共享组。S205 , the electronic device adds the application B to the sharing group of the file A.
电子设备可以将应用B的UID加入到共享文件A(例如文件“getHilink.so”)的用户组中。例如,文件的用户组的GID为1001。文件A的所有者为应用程序A,应用程序A的UID为1001。应用程序B的UID为1002。那么,此时文件A的GID为1001的共享组中包含两个用户:UID 1001(应用程序A)和UID 1002(应用程序B)。这里,共享文件(例如文件A)的所有者(例如应用程序A)的UID可以和共享文件的用户组的GID相同。但是,不同的应用程序的UID是不相同的。The electronic device may add the UID of application B to the user group sharing the file A (eg, the file "getHilink.so"). For example, a file's user group has a GID of 1001. The owner of file A is application A, and the UID of application A is 1001. Application B has a UID of 1002. Then, at this time, the shared group whose GID of file A is 1001 contains two users: UID 1001 (application A) and UID 1002 (application B). Here, the UID of the owner (eg, application A) of the shared file (eg, file A) may be the same as the GID of the user group sharing the file. However, the UIDs of different applications are not the same.
电子设备将应用程序B加入文件A的共享后,当应用程序B调用文件A时,应用程序B可以读取文件A中的数据以及可执行文件A。应用程序B运行时,由AMS负责应用程序B的生命周期管理。After the electronic device adds the application B to the sharing of the file A, when the application B calls the file A, the application B can read the data in the file A and the executable file A. When application B is running, the AMS is responsible for the life cycle management of application B.
步骤S205可以参考步骤S105或步骤S202中的描述。Step S205 may refer to the description in step S105 or step S202.
通过本申请实施例提供的文件共享方法,电子设备可以将应用程序A中的指定文件,即文件A共享给指定应用程序,例如应用程序B。这样,应用程序B就可以访问文件并可执行文件A。但是电子设备中的其他程序不可访问文件A也不可执行文件A。这样,应用程序A既能共享文件A给应用程序B,也避免了应用程序A的文件A被电子设备中的其他应用程序恶意访问。With the file sharing method provided by the embodiments of the present application, the electronic device can share the specified file in application A, that is, file A, to a specified application, such as application B. This way, application B can access the file and execute file A. But other programs in the electronic device cannot access file A nor execute file A. In this way, application A can not only share file A with application B, but also prevent file A of application A from being maliciously accessed by other applications in the electronic device.
当电子设备的应用程序B要访问应用程序A的文件A时,电子设备需要确定应用程序B是否有访问应用程序A的权限。若应用程序B在文件A的共享组,则电子设备确定应用程序B有访问应用程序A的权限,否则,电子设备确定应用程序B确定应用程序B没有访问应用程序A的权限。这里,具体可以参考图7示出的文件共享方法的流程示意图。When the application B of the electronic device wants to access the file A of the application A, the electronic device needs to determine whether the application B has the permission to access the application A. If application B is in the sharing group of file A, the electronic device determines that application B has access to application A; otherwise, the electronic device determines that application B does not have access to application A. Here, specific reference may be made to the schematic flowchart of the file sharing method shown in FIG. 7 .
图7示出了本申请实施例提供的一种文件共享方法,如图7所示,本申请实施例提供的文件共享方法可以包括:FIG. 7 shows a file sharing method provided by an embodiment of the present application. As shown in FIG. 7 , the file sharing method provided by the embodiment of the present application may include:
S300、响应于用户操作,电子设备中的应用程序B调用文件A,文件A为应用程序A的安装包中的一个文件。S300. In response to the user operation, the application B in the electronic device calls the file A, where the file A is a file in the installation package of the application A.
用户操作可以是用户可以在电子设备的主界面中点击应用程序B的图标的操作。响应于该用户操作,电子设备启动应用程序B。应用程序在启动时可以去调用文件A。用户操作也可以是用户在应用程序B的用户界面中点击控件的操作。响应于该用户操作,应用程序B调用文件A。文件A为应用程序A的安装包中的一个文件。文件A可以是可执行文件,即文件A为电子设备可以加载执行的文件。The user operation may be an operation in which the user may click the icon of the application program B in the main interface of the electronic device. In response to the user operation, the electronic device starts the application B. The application can call file A at startup. The user operation may also be an operation in which the user clicks a control in the user interface of application B. In response to this user operation, application B calls file A. File A is a file in the installation package of application A. The file A may be an executable file, that is, the file A is a file that can be loaded and executed by the electronic device.
S301、电子设备确定应用程序B是否在文件A的共享组中,文件A的共享组用于指示在文件A的共享组中的应用程序具有访问文件A的权限,文件A的共享组由电子设备根据应用程序A的安装包中的第一标识建立,第一标识用于指示文件A的共享对象。若是,则执行步骤S302a;若否,则执行步骤S302b。S301. The electronic device determines whether application B is in the shared group of file A, where the shared group of file A is used to indicate that the application in the shared group of file A has permission to access file A, and the shared group of file A is controlled by the electronic device The first identifier is established according to the first identifier in the installation package of the application program A, and the first identifier is used to indicate the shared object of the file A. If yes, go to step S302a; if not, go to step S302b.
电子设备可以根据应用程序B的UID来确定应用程序是否在文件A的共享组中。具体地,电子设备可以查看应用程序B的UID是否存在BMS中文件A的共享组中。文件A的共享组用于指示在文件A的共享组中的应用程序具有访问文件A的权限,文件A的共享组由电子设备根据应用程序A的安装包中的第一标识建立,第一标识用于指示文件A的共享对象。The electronic device may determine whether the application is in the sharing group of file A according to the UID of application B. Specifically, the electronic device can check whether the UID of application B exists in the shared group of file A in the BMS. The shared group of file A is used to indicate that the application in the shared group of file A has the right to access file A, and the shared group of file A is established by the electronic device according to the first identification in the installation package of application A. The first identification Used to indicate the shared object of file A.
进一步地,电子设备可以先查看应用程序B是否为提供文件A的应用程序。若是,电子设备可以执行步骤S302a。若不是,电子设备查看应用程序是否在文件A的共享组中。若在,电子设备可以确定系统设置的文件A的共享组中应用程序的权限。若系统设置文件A的共享组中的应用程序可以读取文件A,也可以执行文件A,那么电子设备可以执行步骤S302a。Further, the electronic device may first check whether application B is the application that provides file A. If so, the electronic device may execute step S302a. If not, the electronic device checks whether the application is in the file A's share group. If so, the electronic device can determine the permission of the application in the shared group of file A set by the system. If the application in the shared group of the system setting file A can read the file A, and can also execute the file A, the electronic device can execute step S302a.
这里,可以理解的是,电子设备在安装应用程序A时,电子设备中BMS可以为应用程序A分配应用程序A在电子设备唯一的UID,例如UIDA。BMS可以将应用程序A的下载安装包中资源文件解压在系统的某个路径。这时,电子设备可以将该路径下文件和文件夹的用户所有者设置为应用程序A的UID,例如,文件A的用户所有者设置为UIDA。同时,电子设备将文件A的共享组的GID可以设置为应用程序A的UID。当电子设备安装应用程序B时,BMS解析到应用程序B可以共享应用程序A的文件A。BMS可以触发电子设备的系统将应用程序B的UID加入到文件A的共享组。例如,BMS可以触发系统执行gpasswd命令将应用程序B的UID加入到文件A的共享组。电子设备的系统将应用程序B的UID加入文件A的共享组的方式有多种,本申请实施例对此不作限定。Here, it can be understood that when the electronic device installs the application A, the BMS in the electronic device can assign the application A a unique UID of the electronic device, such as UIDA. The BMS can decompress the resource files in the downloaded installation package of application A to a certain path in the system. At this time, the electronic device may set the user owner of the files and folders in the path as the UID of the application A, for example, the user owner of the file A may be set as UIDA. At the same time, the electronic device may set the GID of the sharing group of the file A as the UID of the application A. When the electronic device installs the application B, the BMS resolves that the application B can share the file A of the application A. The BMS can trigger the system of the electronic device to add the UID of the application B to the sharing group of the file A. For example, the BMS can trigger the system to execute the gpasswd command to add the UID of application B to the share group of file A. There are various ways for the system of the electronic device to add the UID of the application B to the sharing group of the file A, which is not limited in this embodiment of the present application.
这里,电子设备如何构建文件A的共享组可以参考上述步骤S100-步骤S105、或步骤S200-步骤S205中的描述,此处不再赘述。Here, for how the electronic device constructs the sharing group of the file A, reference may be made to the descriptions in the above steps S100-S105, or steps S200-S205, which will not be repeated here.
S302a、电子设备将文件A的数据提供给应用程序B。S302a, the electronic device provides the data of the file A to the application B.
如果应用程序B在文件的共享组中,电子设备允许应用程序B访问文件。电子设备可以将文件A的数据提供给应用程序B。即,应用程序B可以读取文件A的数据,应用程序B也可以执行文件A。If application B is in the sharing group of the file, the electronic device allows application B to access the file. The electronic device can provide the data of file A to application B. That is, application B can read the data of file A, and application B can also execute file A.
S302b、电子设备确定应用程序B调用文件A失败。S302b, the electronic device determines that the application program B fails to call the file A.
如果电子设备确定应用程序B不在文件A的共享组中,则应用程序B没有调用文件A的权限。电子设备确定应用程序B调用文件A失败。应用程序B的用户界面可以显示调用文件A失败的提示,例如“没有访问权限”、“访问失败”等等。此处对电子设备具体如何提示应用程序B调用文件A失败不作限定。If the electronic device determines that the application B is not in the sharing group of the file A, the application B does not have the right to call the file A. The electronic device determines that application B fails to call file A. The user interface of application B may display a prompt of failure to call file A, such as "no access permission", "access failed", and so on. Here, there is no limitation on how the electronic device specifically prompts the application B to fail to call the file A.
通过本申请实施例提供的方法,电子设备在确定应用程序B为文件A的共享组中的成员时,应用程序B才可以访问文件A。这样,文件A不仅可以共享给指定的应用程序。避免电子设备中的其他应用程序恶意访问文件A。应用程序B只能访问应用程序A中的文件A,而不是应用程序A的所有文件。这样,可以避免影响应用程序A的正常运行。With the method provided by the embodiment of the present application, the application B can access the file A only when the electronic device determines that the application B is a member of the sharing group of the file A. In this way, file A can not only be shared with the specified application. Avoid malicious access to file A by other applications in the electronic device. App B can only access file A in app A, not all of app A's files. In this way, the normal operation of application A can be avoided.
图8是本申请实施例提供的文件共享装置示意图。如图8所示,该文件共享装置800可以包括获取模块801和权限设置模块802;其中:FIG. 8 is a schematic diagram of a file sharing apparatus provided by an embodiment of the present application. As shown in FIG. 8 , the file sharing apparatus 800 may include an obtaining module 801 and a permission setting module 802; wherein:
获取模块801,用于:获取第一应用程序的安装包,其中,第一应用程序的安装包中包括第一文件和第一标识,第一标识指示第一文件的共享对象包括第二应用程序。An obtaining module 801, configured to: obtain an installation package of a first application, wherein the installation package of the first application includes a first file and a first identifier, and the first identifier indicates that the shared object of the first file includes the second application .
权限设置模块802,用于:根据第一标识,向第二应用程序提供第一文件的访问权限。The permission setting module 802 is configured to: provide the second application with the access permission of the first file according to the first identifier.
在一种可能的实现方式中,权限设置模块802可以用于:In a possible implementation, the permission setting module 802 can be used to:
根据第一标识,将第二应用程序加入第一文件的共享组,其中,共享组用于指示具有访问第一文件的权限的应用程序。According to the first identification, the second application is added to the sharing group of the first file, wherein the sharing group is used to indicate the application having the permission to access the first file.
在一种可能的实现方式中,权限设置模块802可以用于:In a possible implementation, the permission setting module 802 can be used to:
当确定第一标识中包含第二应用程序的标识时,将第二应用程序加入第一文件的共享组;第二应用程序的标识包括第二应用程序的安装包中携带的标识。例如,第二应用程序的公钥。When it is determined that the first identification contains the identification of the second application, the second application is added to the sharing group of the first file; the identification of the second application includes the identification carried in the installation package of the second application. For example, the public key of the second application.
在一种可能的实现方式中,权限设置模块802可以用于:In a possible implementation, the permission setting module 802 can be used to:
根据第一标识,将第二应用程序的标识加入第一文件的共享组,第二应用程序的标识包括在安装第二应用程序时分配给第二应用程序的标识,例如第二应用程序的UID。According to the first identification, the identification of the second application is added to the sharing group of the first file, where the identification of the second application includes the identification assigned to the second application when the second application is installed, such as the UID of the second application .
在一种可能的实现方式中,权限设置模块802可以用于:In a possible implementation, the permission setting module 802 can be used to:
在安装第二应用程序时,给第二应用程序分配第二应用程序的标识;When installing the second application, assigning the second application an identifier of the second application;
根据第一标识,将第二应用程序的标识加入第一文件的共享组。According to the first identification, the identification of the second application is added to the sharing group of the first file.
在一种可能的实现方式中,权限设置模块802可以用于:In a possible implementation, the permission setting module 802 can be used to:
在安装第一应用程序时,建立第一标识中指示出的共享关系;共享关系描述出第一文件的共享对象包括第二应用程序。例如图4中对应关系4021中示出的文件名为getHilink.so的文件与publickey为“abcdfgh”的应用程序的共享关系。When the first application is installed, the sharing relationship indicated in the first identifier is established; the sharing relationship describes that the shared object of the first file includes the second application. For example, the corresponding relationship 4021 in FIG. 4 shows the sharing relationship between a file whose file name is getHilink.so and an application whose public key is "abcdfgh".
在一种可能的实现方式中,获取模块801可以用于接收第二应用程序对第一文件的访问请求。In a possible implementation manner, the obtaining module 801 may be configured to receive an access request for the first file by the second application.
在一种可能的实现方式中,权限设置模块802可以用于确认第二应用程序具有第一文件具有访问权限。In a possible implementation manner, the permission setting module 802 may be configured to confirm that the second application program has access permission to the first file.
在一种可能的实现方式中,该文件共享装置800还可以包括提供模块803;其中:In a possible implementation manner, the file sharing apparatus 800 may further include a providing module 803; wherein:
提供模块803可以用于将第一文件的数据提供给第二应用程序。The providing module 803 may be used to provide the data of the first file to the second application.
可以理解的是,文件共享装置800可以实现图5中的示出的步骤S100-步骤S105中描述的文件共享方法,以及图6中示出的步骤S200-步骤S205中描述的文件共享方法,以及图7中示出的步骤S300-步骤S302a、步骤S302b中描述的文件共享方法。具体地:It can be understood that the file sharing apparatus 800 can implement the file sharing method described in steps S100-S105 shown in FIG. 5, and the file sharing method described in steps S200-step S205 shown in FIG. 6, and The file sharing method described in step S300-step S302a and step S302b shown in FIG. 7 . specifically:
获取模块801可以用于执行步骤S100、步骤S103、步骤200、步骤203。The obtaining module 801 can be used to perform step S100 , step S103 , step 200 and step 203 .
权限设置模块802可以用于执行步骤S101、步骤102、步骤S104、步骤S105、步骤S201、步骤202、步骤S204、步骤S205、以及步骤S300、步骤S301。The authority setting module 802 can be used to execute steps S101, 102, S104, S105, S201, 202, S204, S205, and S300 and S301.
提供模块803可以用于执行步骤S302a、步骤S302b。The providing module 803 can be used to perform steps S302a and S302b.
本申请实施例提供的文件共享装置,可以根据第一应用程序的安装包中的第一标识,将第二应用程序加入第一应用程序的安装包中的第一文件的共享组。第二应用程序具有访问第一文件的权限。这样,第一文件不仅可以共享给指定的应用程序。避免文件共享装置中的其他应用程序恶意访问文件。第二应用程序只能访问第一应用程序中的第一文件,而不是第一应用程序的所有文件。这样,可以避免影响第一应用程序的正常运行。The file sharing apparatus provided by the embodiment of the present application can add the second application program to the sharing group of the first file in the installation package of the first application program according to the first identifier in the installation package of the first application program. The second application has permission to access the first file. In this way, the first file can not only be shared with the designated application. Prevent malicious access to files by other applications in the file sharing device. The second application can only access the first file in the first application, not all files of the first application. In this way, the normal operation of the first application program can be avoided.
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand: The technical solutions described in the embodiments are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
上述实施例中所用,根据上下文,术语“当…时”可以被解释为意思是“如果…”或“在…后”或“响应于确定…”或“响应于检测到…”。类似地,根据上下文,短语“在确定…时”或“如果检 测到(所陈述的条件或事件)”可以被解释为意思是“如果确定…”或“响应于确定…”或“在检测到(所陈述的条件或事件)时”或“响应于检测到(所陈述的条件或事件)”。As used in the above embodiments, the term "when" may be interpreted to mean "if" or "after" or "in response to determining..." or "in response to detecting..." depending on the context. Similarly, depending on the context, the phrases "in determining..." or "if detecting (the stated condition or event)" can be interpreted to mean "if determining..." or "in response to determining..." or "on detecting (the stated condition or event)" or "in response to the detection of (the stated condition or event)".
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如DVD)、或者半导体介质(例如固态硬盘)等。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented in software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general purpose computer, special purpose computer, computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server, or data center Transmission to another website site, computer, server, or data center by wire (eg, coaxial cable, optical fiber, digital subscriber line) or wireless (eg, infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, or the like that includes an integration of one or more available media. The usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, solid state drives), and the like.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,该流程可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented. The process can be completed by instructing the relevant hardware by a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed , which may include the processes of the foregoing method embodiments. The aforementioned storage medium includes: ROM or random storage memory RAM, magnetic disk or optical disk and other mediums that can store program codes.

Claims (17)

  1. 一种文件共享方法,所述方法应用于电子设备,其特征在于,包括:A file sharing method, the method being applied to an electronic device, characterized in that it includes:
    获取第一应用程序的安装包,其中,所述第一应用程序的安装包中包括第一文件和第一标识,所述第一标识指示所述第一文件的共享对象包括第二应用程序;obtaining an installation package of a first application, wherein the installation package of the first application includes a first file and a first identifier, and the first identifier indicates that the shared object of the first file includes the second application;
    根据所述第一标识,向所述第二应用程序提供所述第一文件的访问权限。According to the first identification, the access right of the first file is provided to the second application.
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述第一标识,向所述第二应用程序提供所述第一文件的访问权限,包括:The method according to claim 1, wherein the providing the second application with the access authority of the first file according to the first identifier comprises:
    在所述电子设备根据所述第一应用程序的安装包安装所述第一应用程序时,读取所述第一标识;Reading the first identifier when the electronic device installs the first application according to the installation package of the first application;
    根据所述第一标识,向所述第二应用程序提供所述第一文件的访问权限。According to the first identification, the access right of the first file is provided to the second application.
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述第一标识,向所述第二应用程序提供所述第一文件的访问权限,包括:The method according to claim 2, wherein the providing the second application with the access authority of the first file according to the first identifier comprises:
    根据所述第一标识,将所述第二应用程序加入所述第一文件的共享组,其中,所述共享组用于指示具有访问所述第一文件的权限的应用程序。According to the first identification, the second application is added to a sharing group of the first file, wherein the sharing group is used to indicate an application having the permission to access the first file.
  4. 根据权利要求3所述的方法,其特征在于,所述根据所述第一标识,将所述第二应用程序的标识加入所述第一文件的共享组,包括:The method according to claim 3, wherein adding the identifier of the second application program to the sharing group of the first file according to the first identifier comprises:
    当确定所述第一标识中包含所述第二应用程序的标识时,将所述第二应用程序加入所述第一文件的共享组;所述第二应用程序的标识包括所述第二应用程序的安装包中携带的标识。When it is determined that the first identifier contains the identifier of the second application, the second application is added to the sharing group of the first file; the identifier of the second application includes the second application The identifier carried in the installation package of the program.
  5. 根据权利要求3所述的方法,其特征在于,所述根据所述第一标识,将所述第二应用程序加入所述第一文件的共享组,包括:The method according to claim 3, wherein the adding the second application to the sharing group of the first file according to the first identifier comprises:
    根据所述第一标识,将所述第二应用程序的标识加入所述第一文件的共享组,所述第二应用程序的标识包括所述电子设备在安装所述第二应用程序时分配给所述第二应用程序的标识。adding the identifier of the second application to the sharing group of the first file according to the first identifier, where the identifier of the second application includes the identifier assigned to the electronic device when the second application is installed The identifier of the second application.
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述第一标识,将所述第二应用程序的标识加入所述第一文件的共享组,包括:The method according to claim 5, wherein adding the identifier of the second application program to the sharing group of the first file according to the first identifier comprises:
    在安装所述第二应用程序时,给所述第一应用程序分配所述第二应用程序的标识;When installing the second application, assigning the first application an identifier of the second application;
    根据所述第一标识,将所述第二应用程序的标识加入所述第一文件的共享组。According to the first identification, the identification of the second application is added to the sharing group of the first file.
  7. 根据权利要求1-6任一项所述的方法,其特征在于,所述根据所述第一标识,向所述第二应用程序提供所述第一文件的访问权限之后,所述方法还包括:The method according to any one of claims 1-6, wherein after providing the second application with the access right of the first file according to the first identifier, the method further comprises: :
    接收所述第二应用程序对所述第一文件的访问请求;receiving an access request from the second application to the first file;
    确认所述第二应用程序具有所述第一文件的访问权限;confirming that the second application has access rights to the first file;
    将所述第一文件的数据提供给所述第二应用程序。The data of the first file is provided to the second application.
  8. 一种文件共享装置,其特征在于,所述文件共享装置包括:A file sharing device, characterized in that the file sharing device comprises:
    获取模块,用于:获取第一应用程序的安装包,其中,所述第一应用程序的安装包中包 括第一文件和第一标识,所述第一标识指示所述第一文件的共享对象包括第二应用程序;an obtaining module, configured to: obtain an installation package of a first application, wherein the installation package of the first application includes a first file and a first identifier, and the first identifier indicates a shared object of the first file including a second application;
    权限设置模块,用于:根据所述第一标识,向所述第二应用程序提供所述第一文件的访问权限。A permission setting module, configured to: provide the second application with the access permission of the first file according to the first identifier.
  9. 根据权利要求8所述的装置,其特征在于,所述权限设置模块用于:The device according to claim 8, wherein the authority setting module is used for:
    在根据所述第一应用程序的安装包安装所述第一应用程序时,读取所述第一标识;When the first application is installed according to the installation package of the first application, the first identifier is read;
    根据所述第一标识,向所述第二应用程序提供所述第一文件的访问权限。According to the first identification, the access right of the first file is provided to the second application.
  10. 根据权利要求9所述的装置,其特征在于,所述权限设置模块用于:The device according to claim 9, wherein the authority setting module is used for:
    根据所述第一标识,将所述第二应用程序加入所述第一文件的共享组,其中,所述共享组用于指示具有访问所述第一文件的权限的应用程序。According to the first identification, the second application is added to a sharing group of the first file, wherein the sharing group is used to indicate an application having the permission to access the first file.
  11. 根据权利要求10所述的装置,其特征在于,所述权限设置模块用于:The device according to claim 10, wherein the authority setting module is used for:
    当确定所述第一标识中包含所述第二应用程序的标识时,将所述第二应用程序加入所述第一文件的共享组;所述第二应用程序的标识包括所述第二应用程序的安装包中携带的标识。When it is determined that the first identifier contains the identifier of the second application, the second application is added to the sharing group of the first file; the identifier of the second application includes the second application The identifier carried in the installation package of the program.
  12. 根据权利要求9所述的装置,其特征在于,所述权限设置模块用于:The device according to claim 9, wherein the authority setting module is used for:
    根据所述第一标识,将所述第二应用程序的标识加入所述第一文件的共享组,所述第二应用程序的标识包括在安装所述第二应用程序时分配给所述第二应用程序的标识。adding the identifier of the second application to the sharing group of the first file according to the first identifier, where the identifier of the second application includes the identifier assigned to the second application when the second application is installed The identity of the application.
  13. 根据权利要求12所述的装置,其特征在于,所述权限设置模块用于:The device according to claim 12, wherein the authority setting module is used for:
    在安装所述第二应用程序时,给所述第一应用程序分配所述第二应用程序的标识;When installing the second application, assigning the first application an identifier of the second application;
    根据所述第一标识,将所述第二应用程序的标识加入所述第一文件的共享组。According to the first identification, the identification of the second application is added to the sharing group of the first file.
  14. 根据权利要求8-13任一项所述的装置,其特征在于,所述获取模块用于:The device according to any one of claims 8-13, wherein the acquisition module is configured to:
    接收所述第二应用程序对所述第一文件的访问请求;receiving an access request from the second application to the first file;
    所述权限设置模块用于:确认所述第二应用程序具有所述第一文件的访问权限;The permission setting module is used for: confirming that the second application has the access permission of the first file;
    所述装置还包括:The device also includes:
    提供模块,用于:将所述第一文件的数据提供给所述第二应用程序。A providing module is used for: providing the data of the first file to the second application.
  15. 一种电子设备,其特征在于,所述电子设备包括处理器和存储器;所述存储器用于存储程序代码,所述处理器用于调用所述程序代码以使得所述电子设备执行如权利要求1-7中任一项所述的方法。An electronic device, characterized in that the electronic device comprises a processor and a memory; the memory is used to store program codes, and the processor is used to call the program codes to cause the electronic device to execute the method according to claim 1- The method of any one of 7.
  16. 一种包含指令的计算机程序产品,其特征在于,当所述指令在电子设备上运行时,使得所述电子设备执行如权利要求1-7中任一项所述的方法。A computer program product comprising instructions, wherein the instructions, when executed on an electronic device, cause the electronic device to perform the method of any one of claims 1-7.
  17. 一种计算机可读存储介质,包括指令,其特征在于,当所述指令在电子设备上运行时,使得所述电子设备执行如权利要求1-7中任一项所述的方法。A computer-readable storage medium comprising instructions, characterized in that, when the instructions are executed on an electronic device, the electronic device is caused to perform the method according to any one of claims 1-7.
PCT/CN2021/132422 2020-11-24 2021-11-23 File sharing method and apparatus, and electronic device WO2022111469A1 (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN202011332002 2020-11-24
CN202011332002.2 2020-11-24
CN202110051249.5 2021-01-14
CN202110051249.5A CN114546969A (en) 2020-11-24 2021-01-14 File sharing method and device and electronic equipment

Publications (1)

Publication Number Publication Date
WO2022111469A1 true WO2022111469A1 (en) 2022-06-02

Family

ID=81668737

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/132422 WO2022111469A1 (en) 2020-11-24 2021-11-23 File sharing method and apparatus, and electronic device

Country Status (2)

Country Link
CN (1) CN114546969A (en)
WO (1) WO2022111469A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117743445A (en) * 2024-02-18 2024-03-22 荣耀终端有限公司 Data access method and electronic equipment
WO2024067053A1 (en) * 2022-09-28 2024-04-04 华为技术有限公司 Application program installation method and electronic device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106020885A (en) * 2016-05-23 2016-10-12 北京金山安全软件有限公司 Application providing method and device and electronic equipment
CN106855816A (en) * 2016-12-13 2017-06-16 青岛海信电器股份有限公司 The resource file loading method and device of application program in terminal
US20190102339A1 (en) * 2016-11-25 2019-04-04 Huawei Technologies Co., Ltd. Multimedia File Sharing Method and Terminal Device
CN109684278A (en) * 2018-12-21 2019-04-26 广州酷狗计算机科技有限公司 File acquisition method, device, terminal and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106020885A (en) * 2016-05-23 2016-10-12 北京金山安全软件有限公司 Application providing method and device and electronic equipment
US20190102339A1 (en) * 2016-11-25 2019-04-04 Huawei Technologies Co., Ltd. Multimedia File Sharing Method and Terminal Device
CN106855816A (en) * 2016-12-13 2017-06-16 青岛海信电器股份有限公司 The resource file loading method and device of application program in terminal
CN109684278A (en) * 2018-12-21 2019-04-26 广州酷狗计算机科技有限公司 File acquisition method, device, terminal and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024067053A1 (en) * 2022-09-28 2024-04-04 华为技术有限公司 Application program installation method and electronic device
CN117743445A (en) * 2024-02-18 2024-03-22 荣耀终端有限公司 Data access method and electronic equipment

Also Published As

Publication number Publication date
CN114546969A (en) 2022-05-27

Similar Documents

Publication Publication Date Title
KR102503341B1 (en) Security service deletion method and electronic device
WO2021159746A1 (en) File sharing method and system, and related device
WO2020150917A1 (en) Application permission management method and electronic device
WO2021253975A1 (en) Permission management method and apparatus for application, and electronic device
WO2021052204A1 (en) Address book-based device discovery method, audio and video communication method, and electronic device
WO2022160991A1 (en) Permission control method and electronic device
WO2022111469A1 (en) File sharing method and apparatus, and electronic device
EP4270230A1 (en) Access control method, electronic device and system
WO2022089121A1 (en) Method and apparatus for processing push message
WO2022022422A1 (en) Permission management method and terminal device
WO2021057982A1 (en) Application processing method and related product
WO2021073337A1 (en) Method and apparatus for installing plug-in, and storage medium
EP4280090A1 (en) Access control method, electronic device, and system
WO2022111664A1 (en) Patching method, related apparatus, and system
CN114006698B (en) token refreshing method and device, electronic equipment and readable storage medium
WO2022166502A1 (en) Data protection method and system, and medium and electronic device
CN113590346B (en) Method and electronic equipment for processing service request
WO2022111529A1 (en) Application program debugging method and electronic device
CN115203716A (en) Permission synchronization method, related device and system
CN116982042A (en) Flexible authorized access control method, related device and system
CN115017495A (en) Timing verification method, electronic device and readable storage medium
CN115017498A (en) Method for operating applet and electronic device
CN115701018A (en) Method for safely calling service, method and device for safely registering service
CN114692119A (en) Method for verifying application and electronic equipment
WO2022068578A1 (en) File sharing method and electronic device

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: 21896970

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21896970

Country of ref document: EP

Kind code of ref document: A1