WO2023035754A1 - 权限同步方法、装置、电子设备与存储介质 - Google Patents

权限同步方法、装置、电子设备与存储介质 Download PDF

Info

Publication number
WO2023035754A1
WO2023035754A1 PCT/CN2022/104353 CN2022104353W WO2023035754A1 WO 2023035754 A1 WO2023035754 A1 WO 2023035754A1 CN 2022104353 W CN2022104353 W CN 2022104353W WO 2023035754 A1 WO2023035754 A1 WO 2023035754A1
Authority
WO
WIPO (PCT)
Prior art keywords
operating system
permission information
permission
shared memory
memory area
Prior art date
Application number
PCT/CN2022/104353
Other languages
English (en)
French (fr)
Inventor
蒋世德
李京
Original Assignee
北京字节跳动网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京字节跳动网络技术有限公司 filed Critical 北京字节跳动网络技术有限公司
Publication of WO2023035754A1 publication Critical patent/WO2023035754A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes

Definitions

  • the present disclosure relates to the technical field of computer operating systems, for example, to a permission synchronization method, device, electronic equipment, and storage medium.
  • Android is an operating system (Operating System, OS) based on the Linux kernel.
  • OS Operating System
  • Android applications can be run in Linux OS through virtual machines, containers, etc.
  • the present disclosure provides a permission synchronization method, device, electronic equipment and storage medium.
  • the present disclosure provides a permission synchronization method, including:
  • the first operating system reads permission information from the shared memory area.
  • the present disclosure also provides a permission synchronization device, including:
  • the authority information acquisition module is configured to acquire the first authority information set to be synchronized from the second operating system running in the first operating system environment;
  • the permission information transmission and storage module is configured to transmit and save the first permission information set to be synchronized in the shared memory area of the first operating system
  • the authority information reading module is configured to read the authority information from the shared memory area by the first operating system.
  • the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and operable on the processor.
  • the processor executes the program, the permission synchronization method steps.
  • the present disclosure also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the rights synchronization method are implemented.
  • FIG. 1 is a flow chart of the permission synchronization method of the present disclosure
  • FIG. 2 is a schematic diagram of an implementation of the permission synchronization method provided by the present disclosure in an embodiment
  • FIG. 3 is a schematic diagram of an authority synchronization device provided by the present disclosure
  • Fig. 4 is a schematic structural diagram of an electronic device provided by the present disclosure.
  • a virtual Android system in the host Android system, such as virtual machine operating system (Virtual Memory Operating System, VMOS), light speed virtual machine and other solutions, all of which realize the running of Android OS in Android OS.
  • VMOS Virtual Memory Operating System
  • the host operating system also faces the problem that the host operating system cannot obtain and manage the permissions in the virtual Android system.
  • one way is to develop a special cross-system permission attribute management function in the host operating system, and set permissions for each application and system function of the mobile terminal on the host terminal and the mobile terminal respectively.
  • this method not only puts a lot of pressure on development, but also brings a lot of burden to users, which is too cumbersome and prone to conflicts in permission settings due to negligence.
  • the second operating system includes various mobile operating systems with rights management for applications and functions, such as Android, iOS, etc., where Android includes Google's Android OS and Android Open Source Project (Android Open) Various derivative versions of Source Project, AOSP), such as MIUI, EMUI, etc.
  • Android includes Google's Android OS and Android Open Source Project (Android Open)
  • AOSP Various derivative versions of Source Project, AOSP), such as MIUI, EMUI, etc.
  • the first operating system includes various desktop operating systems, such as Windows, Linux, Mac OS, etc., and may also be a mobile operating system, such as Android.
  • the second operating system runs in the environment of the first operating system, which may be in the form of a virtual machine, for example, the first operating system supports the second operating system through a virtual machine monitor (Hypervisor); it may be through a container
  • the container method supports the second operating system.
  • the second operating system and the first operating system share the operating system kernel.
  • the second operating system is Android
  • the first operating system is Linux OS
  • Android shares the Linux kernel (Linux kernel) of Linux OS in a containerized manner as an example to illustrate the embodiments of the present disclosure. Implementation process.
  • FIG. 1 is a flow chart of the permission synchronization method of the present disclosure. As shown in FIG. 1 , the permission synchronization method provided in the present disclosure includes:
  • Step 101 Obtain a first permission information set to be synchronized from a second operating system running in the environment of the first operating system.
  • Permissions are used to describe whether a subject has access to resources in the system. For example, if an Android application A has the permission to access the interface or use a certain hardware a, it means that the Android application A is allowed to access the interface or use a certain hardware a; if the Android application B does not have the permission to access the interface or use a certain hardware b, it means Android application B is prohibited from accessing the interface or using certain hardware b.
  • the authority information is information for describing authority.
  • the authority information includes authority name information, authority attribute information and authority value.
  • the permission name information of the permission "INTERNET" used to determine whether a subject can connect to the Internet (Internet) may be expressed as "android.permission.INTERNET".
  • the authority attribute information is used to describe the group to which the authority belongs.
  • the authority attribute information of the authority "INTERNET” is "inet" (network), indicating that the authority is related to the network.
  • the permission value is used to describe the permission level.
  • the most common permission levels include “allow” and “forbidden”, which can be represented by logical values "1" and "0"; more permission levels can also be set to diversify permissions. differentiated.
  • composition of the permission information is not limited to the above description, and those skilled in the art can determine the composition of the permission information according to actual needs.
  • the permission information is set under the Android OS or is automatically set by the system when the application is installed, and is stored in a specified location in the second operating system, so it can be accessed from the second operating system. Specify the location to obtain the permission information to be synchronized.
  • the following permission information of the aforementioned permission "INTERNET" is set under the Android system framework layer (framework/base/data/etc/platform.xml):
  • the permission name information "android.permission.INTERNET” is stored in the "permission name” field, and the group to which the permission "INTERNET” belongs (ie permission attribute information) is stored in the "group gid” field.
  • the above permission information will be synchronized to the first operating system in subsequent steps, since the permission information to be synchronized can be one or more, including at least one application and system functions in the second operating system At least one of the permission information, in this embodiment, these permission information to be synchronized are recorded as the first permission information set to be synchronized.
  • the type of permission information contained in the first permission information set to be synchronized is not limited to the above example, and permission information that has been set in the second operating system and required in the first operating system can be used as the permission to be synchronized Information.
  • the type of authority information included in the first authority information set to be synchronized is not limited.
  • the permission synchronization method of the present disclosure is executed during system initialization, so as to uniformly synchronize related permissions in the second operating system to the first operating system.
  • Step 102 Transmit and save the first permission information set to be synchronized in the shared memory area of the first operating system.
  • a shared memory area means that the data stored in the memory area can be accessed by two or more processes.
  • the shared memory area of Linux OS means that the data stored in the memory area can be accessed by two or more Linux processes.
  • the acquisition and transmission manner of the synchronization information to be synchronized is not limited.
  • mmap is a method of memory mapping files, which can map a file or other objects into memory.
  • Step 103 the first operating system reads permission information from the shared memory area.
  • a preset process, application, etc. in the Linux OS can freely access the shared memory area of the first operating system.
  • a Linux process or application needs to obtain permission information, it first searches in the shared memory area of the first operating system. If the shared memory area stores the permission information required by the Linux process or application, it can be read from the shared memory area.
  • the permission information of the aforementioned permission "INTERNET" is transmitted and stored in a shared memory area of the Linux system, and it is referenced and managed through a linked list in the shared memory area; when a Linux process or application needs the permission When information is obtained, its reference is obtained by looking up the linked list, and the memory address where the real data is located is obtained, thereby obtaining the final real data.
  • the permission synchronization method provided by the present disclosure transmits the first permission information set in the second operating system to the shared memory area of the first operating system, so that the first operating system can read the permission information from the shared memory area when needed, thereby The rapid synchronization of the authority information is realized, and the problem of inefficiency caused by resetting the authority information in the first operating system is avoided.
  • the transmitting and storing the first permission information set to be synchronized in the shared memory area of the first operating system includes:
  • the first permission information set to be synchronized is transmitted and stored in the shared memory area of the first operating system by means of mmap mapping.
  • mmap enables processes to share memory by mapping the same file. After the file is mapped to the process address space, the process can access the file like accessing ordinary memory.
  • the first permission information set is read from the framework layer of the Android system, and then synchronized to the Linux kernel space of the first operating system by way of process space access (mmap). Due to the characteristics of mmap itself, only one copy operation is required when the permission information is synchronized, which helps to improve the efficiency of synchronizing permission information from the Android system to the Linux system.
  • mmap process space access
  • the permission synchronization method provided in the present disclosure transmits and saves the first permission information set to be synchronized in the shared memory area of the first operating system through mmap mapping. Based on the characteristics of mmap mapping itself, this method can improve the The efficiency of synchronizing permission information from the second operating system into the first operating system.
  • the transmitting and storing the first permission information set to be synchronized in the shared memory area of the first operating system includes:
  • the first permission information set to be synchronized is transmitted and stored in the shared memory area of the first operating system through the socket connection.
  • Socket is also a socket, which is used for two-way communication between application processes on different hosts in the network.
  • the socket can also be applied to the communication between the second operating system and the first operating system.
  • a socket connection can be initiated by the first operating system, and the second operating system acts as a client link to the socket connection initiated by the first operating system, thereby establishing two-way communication between the first operating system and the second operating system, and then using the The socket connection transmits and saves the first permission information set to be synchronized in the shared memory area of the first operating system.
  • the socket connection can be used to directly send instructions on the Linux side, and it is no longer mandatory to send instructions on the Android side.
  • the permission synchronization method provided in the present disclosure transmits and saves the first permission information set to be synchronized in the shared memory area of the first operating system through a socket connection, so that the permission information synchronization process is more flexible.
  • the method further includes:
  • the second permission information set to be synchronized is obtained from the second operating system, and the second permission information set to be synchronized is transmitted and stored in the first In the shared memory area of the operating system.
  • the synchronization of permission information is generally implemented when the system is initialized. However, during the operation of the system, there are cases where permission information is changed. In this example, such cases are discussed.
  • the first monitoring process can be customized in the Android system, and the first monitoring process can be implemented by using a watchdog (WatchDog) process.
  • WatchDog watchdog
  • the first monitoring process can be started by itself to realize the monitoring of the shared memory area.
  • the monitoring of the shared memory area by the first monitoring process is mainly to monitor the identification information in the shared memory area, and the identification information can reflect whether the permission information stored in the shared memory area changes. For example, if a certain permission information has not changed after being stored in the shared memory area, the value of the identification information corresponding to the permission information is "0"; later, if the permission information changes, the identification information corresponding to the permission information The value of the information changes from "0" to "1". There is a corresponding relationship between the identification information and the authority information, for example, there is unique identification information corresponding to each authority information. Since the type of permission information to be synchronized is not limited to one type, the type of identification information set in the shared memory area is also not limited to one type.
  • the first monitoring process finds that the permission information has changed through monitoring the identification information, it can re-acquire the permission information to be synchronized from the second operating system, and transmit and save it in the shared memory area of the first operating system.
  • the information to be synchronized here may be changed permission information determined according to the changed identification information, or may be all permission information previously stored in the shared memory area of the first operating system.
  • the permission information to be synchronized here is recorded as the second permission information set to be synchronized.
  • the second permission information set may include one or more permission information to be synchronized.
  • the change of permission information described in this embodiment may be that the user changes the permission information in the second operating system, for example, a certain function of the second operating system applies for network permission; it may also be that the user changes the permission information in the first operating system
  • the operating system sends an instruction to change the permission information in the second operating system. No matter what causes the permission information to change, the changed permission information can be synchronized to the shared memory area of the first operating system, so that the processes in the first operating system can obtain the updated permission information in time.
  • the permission synchronization method provided by the present disclosure can monitor the shared memory area of the first operating system by starting the first monitoring process in the second operating system, so that when the permission information changes, it can be found in time to avoid the permission information not being synchronized in time data risk.
  • the method further includes:
  • the second permission information set to be synchronized is obtained from the second operating system, and the second permission information set to be synchronized is transmitted and stored in the first In the shared memory area of the operating system.
  • the synchronization of permission information is generally implemented when the system is initialized. However, in the actual application process, there are cases where permission information is changed.
  • the second process can be started by the init process in the Linux system, and the second monitoring process can be realized by using the WatchDog process.
  • the init process is the starting point of all processes in the system.
  • the monitoring of the shared memory area by the second monitoring process is mainly to monitor the identification information in the shared memory area, and the identification information can reflect whether the permission information stored in the shared memory area changes. For example, if a certain permission information has not changed after being stored in the shared memory area, the value of the identification information corresponding to the permission information is "0"; later, if the permission information changes, the identification information corresponding to the permission information The value of the information changes from "0" to "1". There is a corresponding relationship between the identification information and the authority information, for example, there is unique identification information corresponding to each authority information. Since the type of permission information to be synchronized is not limited to one type, the type of identification information set in the shared memory area is also not limited to one type.
  • the second monitoring process finds that the permission information has changed through monitoring the identification information, it can re-acquire the permission information to be synchronized from the second operating system, and transmit and save it in the shared memory area of the first operating system.
  • the information to be synchronized here may be changed permission information determined according to the changed identification information, or may be all permission information previously stored in the shared memory area of the first operating system.
  • the permission information to be synchronized here is recorded as the second permission information set to be synchronized.
  • the second permission information set may include one or more permission information to be synchronized.
  • the permission synchronization method provided by the present disclosure can monitor the shared memory area of the first operating system by starting the second monitoring process in the first operating system, so that when the permission information changes, it can be found in time, and the permission information is not synchronized in time. data risk.
  • the method further includes:
  • the first permission information set is saved in the shared memory area, the first permission information set is also written into the storage device.
  • the first permission information set is written into the storage device.
  • the first set of permission information is preferentially read from the local storage device, without waiting for permission synchronization before setting the permission information, which improves work efficiency.
  • writing the first permission information set into the storage device includes:
  • the first flag information corresponds to the first permission information in the first permission information set, and the first permission information is the first permission information in the first permission information set Any permission information;
  • the flag information is the second state value
  • the first permission information is written into the storage device after a selected time delay.
  • the timing for writing any permission information in the first permission information set to the disk is specified.
  • corresponding flag information may be set in advance for each permission information in the first permission information set, where the flag information can reflect the urgency of writing the corresponding permission information to the disk.
  • the first flag information may be set as the first status value.
  • the first flag information is the first state value
  • the first permission information needs to be synchronized to the storage device in real time. This ensures the timely preservation of important permission information, and can effectively avoid possible risks caused by sudden failures.
  • the first flag information may be set as the second status value.
  • a certain time delay is allowed, for example, it is set to 30 seconds (s), 1 minute ( min) and so on, then synchronize the first permission information to the storage device.
  • the storage of the first permission information in the storage device can be implemented when the first operating system is relatively idle, thereby reducing the number of frequent interruptions of the first operating system due to operations related to storing permission information.
  • the time delay described in this embodiment can be determined according to actual needs, and there is no limit to the value of the time delay in this embodiment.
  • the first state value and the second state value can be set as required, such as setting the first state value to 0, setting the second state value to 1, or other candidate values, which are not correct in this embodiment
  • the values of the first state value and the second state value are limited.
  • the authority synchronization method provided by the present disclosure determines the timing of synchronizing the authority information from the shared memory area to the storage device by checking the preset flag information, so that the timing of synchronization can be determined according to the importance of the authority information, between data security and work efficiency strike a balance.
  • the method further includes :
  • the second permission information set is also transmitted and stored in the shared memory area of the first operating system.
  • the second permission information set needs to be written into a storage device, so as to achieve local permanent storage of the permission information in the second permission information set.
  • the process of writing the second permission information set to the storage device is not substantially different from the above-mentioned process of writing the first permission information set to the disk, so the description will not be repeated here.
  • the permission synchronization method provided by the present disclosure can preferentially read the second permission information set from the local disk after the computing device restarts, without waiting for Android permission synchronization before setting the permission information, which improves work efficiency.
  • the above-mentioned storage device may be a local disk, such as a hard disk drive (Hard Disk Drive, HDD), a solid state drive (Solid State Drives, SSD), etc., or an external storage device,
  • a U disk, an SD card, etc. may also be a network storage device, such as a network attached storage (Network Attached Storage, NAS) of a local area network, cloud storage, etc.
  • NAS Network Attached Storage
  • FIG. 2 is a schematic diagram of an implementation of the permission synchronization method provided by the present disclosure in an embodiment.
  • the permissions and attributes related to the Android platform can be synchronized to the shared memory area of Linux by mmap mapping, so that the Linux process can be quickly accessed in the way of common memory.
  • mmap mapping can include:
  • the Linux process can go to the shared memory area to read the relevant permission data for synchronous processing through ordinary reading of the memory. If it is necessary to start a separate WatchDog process to adjust the event scheduling when the shared memory changes, so as to achieve real-time monitoring of the Linux system.
  • this disclosure can use a flag to judge whether it is necessary to synchronize the disk in real time, or synchronize the data to the disk according to a certain timing, such as before the process is closed, etc., which is convenient for the next system startup. Permissions can be directly read locally.
  • the permission synchronization method provided by the present disclosure can also be implemented through a socket.
  • a socket can include:
  • the Linux side starts a socket service, and the Android side acts as a client to connect to the socket service started by the Linux side, and then synchronizes the relevant permissions and attributes to the Linux side through the socket and writes them into the shared memory, so that the relevant processes on the Linux side can be acquired by supply and demand ;
  • the rights synchronization device provided by the present disclosure is described below, and the rights synchronization device described below and the rights synchronization method described above can be referred to in correspondence.
  • FIG. 3 is a schematic diagram of a permission synchronization device provided in the present disclosure. As shown in FIG. 3 , the permission synchronization device provided in the present disclosure includes:
  • the permission information obtaining module 301 is configured to obtain the first permission information set to be synchronized from the second operating system running in the first operating system environment;
  • the permission information transmission and storage module 302 is configured to transmit and save the first permission information set to be synchronized in the shared memory area of the first operating system;
  • the authority information reading module 303 is configured to read the authority information from the shared memory area by the first operating system.
  • the permission synchronization device transmits the first permission information set in the second operating system to the shared memory area of the first operating system, and can read the permission information from the shared memory area when necessary, thereby realizing the synchronization of the permission information. Fast synchronization avoids the inefficiency caused by resetting permission information in the first operating system.
  • the authority information transmission and storage module 302 is set to:
  • the first permission information set to be synchronized is transmitted and stored in the shared memory area of the first operating system by means of mmap mapping.
  • the permission synchronization device transmits and stores the first permission information set to be synchronized in the shared memory area of the first operating system through mmap mapping. Based on the characteristics of mmap mapping itself, this method can improve the The efficiency of synchronizing permission information from the second operating system into the first operating system.
  • the authority information transmission and storage module 302 is set to:
  • the first permission information set to be synchronized is transmitted and stored in the shared memory area of the first operating system through the socket connection.
  • the permission synchronization device transmits and stores the first permission information set to be synchronized in the shared memory area of the first operating system through a socket, so that the permission information synchronization process is more flexible.
  • the device further includes:
  • a first monitoring module configured to start a first monitoring process in a second operating system; wherein, the first monitoring process is set to monitor the shared memory area;
  • the secondary transmission and storage module is configured to obtain the second set of permission information to be synchronized from the second operating system when the permission information stored in the shared memory area changes, and transmit and save it in the first In the shared memory area of the operating system.
  • the permission synchronization device provided by the present disclosure can monitor the shared memory area of the first operating system by starting the first monitoring process in the second operating system, so that when the permission information changes, it can be found in time to avoid the permission information not being synchronized in time data risk.
  • the device further includes:
  • the second monitoring module is configured to start a second monitoring process in the first operating system; wherein, the second monitoring process is configured to monitor the shared memory area;
  • the secondary transmission and storage module is configured to obtain the second set of permission information to be synchronized from the second operating system when the permission information stored in the shared memory area changes, and transmit and save it in the first In the shared memory area of the operating system.
  • the authority synchronization device can monitor the shared memory area of the first operating system by starting the second monitoring process in the first operating system, so that when the authority information changes, it can be found in time to avoid the authority information not being synchronized in time data risk.
  • the device further includes:
  • the first writing module is configured to write the first permission information set into a storage device.
  • the permission synchronization device reads the first permission information set from the local disk preferentially after the computing device restarts, without waiting for Android permission synchronization before setting the permission information, which improves work efficiency.
  • the first writing module includes:
  • the flag information checking unit is configured to check the preset first flag information; wherein, the first flag information corresponds to the first permission information in the first permission information set, and the first permission information is all Any piece of permission information in the first permission information set;
  • the real-time writing unit is configured to write the first permission information into the storage device in real time when the first flag information is the first state value;
  • the delay writing unit is configured to write the first permission information into the storage device after a certain time delay when the flag information is the second state value.
  • the authority synchronization device determines the timing of synchronizing the authority information from the shared memory area to the storage device by checking the preset flag information, so that the timing of synchronization can be determined according to the importance of the authority information, and the balance between data security and work efficiency strike a balance.
  • the device further includes:
  • the second writing module is configured to write the second permission information set into the storage device.
  • the permission synchronization device provided by the present disclosure can preferentially read the second permission information set from the local disk after the computing device is restarted, without waiting for Android permission synchronization before setting the permission information, which improves work efficiency.
  • FIG. 4 illustrates a schematic diagram of the physical structure of an electronic device.
  • the electronic device may include: a processor (processor) 410, a communication interface (Communications Interface) 420, a memory (memory) 430 and a communication bus 440, Wherein, the processor 410 , the communication interface 420 , and the memory 430 communicate with each other through the communication bus 440 .
  • the processor 410 can invoke logic instructions in the memory 430 to execute the rights synchronization method, which includes:
  • the first operating system reads permission information from the shared memory area.
  • the above logic instructions in the memory 430 may be implemented in the form of software functional units, and when sold or used as an independent product, may be stored in a computer-readable storage medium.
  • the essence of the technical solution of the present disclosure or the part that contributes to the related technology or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including at least An instruction is used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present disclosure.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc., which can store program codes. .
  • the present disclosure also provides a computer program product
  • the computer program product includes a computer program stored on a non-transitory computer-readable storage medium
  • the computer program includes program instructions, and when the program instructions are executed by a computer When executing, the computer can execute the permission synchronization method provided by the above methods, which method includes:
  • the first operating system reads permission information from the shared memory area.
  • the present disclosure also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it is implemented to perform the permission synchronization methods provided above, the method comprising:
  • the first operating system reads permission information from the shared memory area.
  • the device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to implement the solution of this embodiment. It can be understood and implemented by those skilled in the art without any creative effort.
  • each implementation can be implemented by means of software plus a necessary general hardware platform, and of course also by hardware.
  • the essence of the above technical solutions or the part that contributes to related technologies can be embodied in the form of software products, and the computer software products can be stored in computer-readable storage media, such as ROM, RAM, disk , optical disc, etc., including at least one instruction to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)
  • Hardware Redundancy (AREA)

Abstract

本公开提供一种权限同步方法、装置、电子设备与存储介质,该方法包括:从运行在第一操作系统环境的第二操作系统中获取待同步的第一权限信息集合;将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中;第一操作系统从所述共享内存区域中读取权限信息。

Description

权限同步方法、装置、电子设备与存储介质
本公开要求在2021年9月8日提交中国专利局、申请号为202111046737.3的中国专利申请的优先权,该申请的全部内容通过引用结合在本公开中。
技术领域
本公开涉及计算机操作系统技术领域,例如涉及一种权限同步方法、装置、电子设备与存储介质。
背景技术
安卓(Android)是基于Linux内核的操作系统(Operating System,OS)。为了扩展Linux OS发行版的应用生态,可以通过虚拟机、容器等方式实现在Linux OS中运行安卓应用。
发明内容
本公开提供一种权限同步方法、装置、电子设备与存储介质。
本公开提供一种权限同步方法,包括:
从运行在第一操作系统环境的第二操作系统中获取待同步的第一权限信息集合;
将所述待同步的第一权限信息集合传输并保存在所述第一操作系统的共享内存区域中;
所述第一操作系统从所述共享内存区域中读取权限信息。
本公开还提供了一种权限同步装置,包括:
权限信息获取模块,被设置为从运行在第一操作系统环境的第二操作系统中获取待同步的第一权限信息集合;
权限信息传输及存储模块,被设置为将所述待同步的第一权限信息集合传输并保存在所述第一操作系统的共享内存区域中;
权限信息读取模块,被设置为所述第一操作系统从所述共享内存区域中读取权限信息。
本公开还提供了一种电子设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述程序时实现如所述权限同步方法的步骤。
本公开还提供了一种非暂态计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如所述权限同步方法的步骤。
附图说明
下面将对实施例或相关技术描述中所需要使用的附图作一简单地介绍,下面描述中的附图是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本公开的权限同步方法的流程图;
图2是本公开提供的权限同步方法在一个实施例中的实现示意图;
图3为本公开提供的权限同步装置的示意图;
图4是本公开提供的电子设备的结构示意图。
具体实施方式
下面将结合本公开中的附图,对本公开中的技术方案进行描述,所描述的实施例是本公开一部分实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。
通过虚拟机、容器等方式实现Linux OS、Windows等支持Android OS中的应用是可行的。移动端操作系统,例如Android、iOS等,实现了对应用和系统功能的权限管理,这是传统桌面端操作系统中所不存在的,如果要较好的实现对移动端应用的支持,防止其对宿主操作系统的功能造成干扰或恶意使用权限,需要在桌面端兼容移动端应用的权限和属性。
同时,在宿主Android系统中运行虚拟Android系统也是可行的,例如虚拟机操作系统(Virtual Memory Operating System,VMOS)、光速虚拟机等方案,均实现了在Android OS中运行Android OS。在该类技术方案中,同样面临宿主操作系统无法获得、管理虚拟Android系统中的权限的问题。
在可选技术方案中,一种方式是在宿主操作系统开发专门的跨系统权限属性管理功能,在宿主端和移动端分别对移动端的每个应用和系统功能进行权限设定。但这种方式不仅开发压力大,而且给用户带来了很大的使用负担,过于繁琐,且容易出现由于疏忽导致的权限设定冲突的情况。
在下述实施例中,第二操作系统包括各种具有对应用和功能具有权限管理的移动操作系统,例如Android、iOS等,此处所称的Android包括Google的Android OS和基于安卓开源项目(Android Open Source Project,AOSP)的各种 衍生版,如MIUI、EMUI等。
在下述实施例中,第一操作系统包括各种桌面版操作系统,例如Windows、Linux、Mac OS等,也可以是移动操作系统,例如Android等。
在下述实施例中,第二操作系统运行在第一操作系统环境中,可以是以虚拟机的方式,例如第一操作系统通过虚拟机监视器(Hypervisor)支持第二操作系统;可以是通过容器Container的方式支持第二操作系统,在容器环境下,第二操作系统与第一操作系统是共享操作系统内核的。
为了便于说明,在下述实施例中,以第二操作系统为Android、第一操作系统为Linux OS,Android以容器化的方式共享Linux OS的Linux内核(Linux kernel)为例说明本公开实施例的实现过程。
下面结合图1-图4描述本公开的权限同步方法、装置、电子设备与存储介质。
图1为本公开的权限同步方法的流程图,如图1所示,本公开提供的权限同步方法包括:
步骤101、从运行在第一操作系统环境的第二操作系统中获取待同步的第一权限信息集合。
权限用于描述某一主体对系统中的资源是否具有访问能力。例如,一安卓应用A具有访问接口或使用某硬件a的权限,则意味着允许安卓应用A访问接口或使用某硬件a;安卓应用B不具有访问接口或使用某硬件b的权限,则意味着禁止安卓应用B访问接口或使用某硬件b。
权限信息是用于描述权限的信息。在本实施例中,所述权限信息包括权限名称信息、权限属性信息与权限值。例如,用于确定某一主体是否能够连接因特网(Internet)的权限“INTERNET”,其权限名称信息可表示为“android.permission.INTERNET”。权限属性信息用于描述权限所属分组,如权限“INTERNET”的权限属性信息为“inet”(网络),说明该权限是与网络有关的。权限值用于描述权限的等级,最为常见的权限等级包括“允许”、“禁止”,可以用逻辑值“1”、“0”表示;也可以设置更多的权限等级,以对权限进行多样化的区分。
可以理解的是,权限信息的组成并不局限于上述描述,本领域技术人员可根据实际需要确定权限信息的组成。
在本实施例中,所述权限信息是在Android OS下设置的或应用在安装时系统自动为其设置的,并保存在第二操作系统中的指定位置,因此可从第二操作系统中的指定位置获取待同步的权限信息。
例如,以第二操作系统为安卓系统为例,在安卓系统框架层(framework/base/data/etc/platform.xml)下设置了前述权限“INTERNET”的如下权限信息:
<permission name=”android.permission.INTERNET”>
<group gid=”inet”>
</permission>
其中,在“permission name”字段中存储了权限名称信息“android.permission.INTERNET”,在“group gid”字段中存储了权限“INTERNET”的所属分组(即权限属性信息)。
上述权限信息会在之后的步骤中被同步到第一操作系统中,由于待同步的权限信息可以是一个,也可以是多个,其包括第二操作系统中的至少一个应用和系统功能两者中的至少之一的权限信息,在本实施例中,将这些待同步的权限信息记为待同步的第一权限信息集合。
待同步的第一权限信息集合中所包含的权限信息的类型并不局限于上述示例,事先已经在第二操作系统中设置且第一操作系统中所需要的权限信息均可作为待同步的权限信息,在本实施例中不对待同步的第一权限信息集合中所包含的权限信息的类型进行限定。
需要说明的是,在本实施例中,在系统初始化时运行本公开的权限同步方法,以将第二操作系统中的相关权限统一同步到第一操作系统。
步骤102、将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中。
共享内存区域是指内存区域内所存储的数据能够被两个或多个进程访问。例如,Linux OS的共享内存区域是指该内存区域内所存储的数据能够被两个或多个Linux进程访问。
在前一步骤中获取待同步的第一权限信息集合后,在本步骤中可将这些信息传输并保存在第一操作系统的共享内存区域中。
由于第一操作系统环境与第二操作系统环境存在隔离,因此需要采用特定的方式将第一权限信息集合从安卓环境传输至Linux环境。如文件内存映射(map files or device into memory,mmap)的方式、套接字(socket)服务的方式、管道(pipe)的方式、命名管道(FIFO)的方式、消息队列(Message Queue)的方式、信号量(Semaphore)的方式、信号(sinal)的方式等,在本实施例中,不对待同步信息的获取传输方式进行限定。
需要说明的是,mmap是一种内存映射文件的方法,可以将一个文件或者其它对象映射进内存。
步骤103、第一操作系统从所述共享内存区域中读取权限信息。
例如,Linux OS中的某个预设进程、应用等可自由访问第一操作系统的共享内存区域,当Linux进程或应用需要获取权限信息时,首先在第一操作系统的共享内存区域中查找,若所述共享内存区域存储了Linux进程或应用所需要的权限信息,则可从共享内存区域读取。
例如,前述权限“INTERNET”的权限信息被传输并存储到Linux系统的一块共享内存区域中,在所述共享内存区域内通过链表的方式对其引用并管理;当有Linux进程或应用需要该权限信息时,通过查找链表获取其引用,得到真实数据所在的内存地址,从而获取最终的真实数据。
本公开提供的权限同步方法通过将第二操作系统中的第一权限信息集合传输到第一操作系统的共享内存区域,使得第一操作系统可在需要时从共享内存区域读取权限信息,从而实现了权限信息的快速同步,避免了在第一操作系统中重新设置权限信息所带来的效率低下的问题。基于上述任一实施例,在本实施例中,所述将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中,包括:
通过mmap映射的方式将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中。
mmap使得进程之间通过映射同一个文件实现共享内存,文件被映射到进程地址空间后,进程可以像访问普通内存一样对文件进行访问。
例如,从安卓系统框架层中读取第一权限信息集合,然后以进程空间访问的方式(mmap)同步到第一操作系统的Linux内核空间。由于mmap本身的特性,因此在权限信息同步时只需要做一次拷贝操作,这有助于提升将权限信息从安卓系统同步到Linux系统中的效率。
本公开提供的权限同步方法通过mmap映射的方式将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中,基于mmap映射自身的特性,这一方式能够提升将权限信息从第二操作系统同步到第一操作系统中的效率。
基于上述任一实施例,在本实施例中,所述将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中,包括:
在第一操作系统与第二操作系统之间建立socket连接;
通过所述socket连接将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中。
socket也就是套接字,它用于对网络中不同主机上的应用进程之间进行双向通信。在本实施例中,也可将socket应用于第二操作系统与第一操作系统之间的通信。例如,可由第一操作系统启动一个socket连接,第二操作系统作为客户端链接第一操作系统启动的socket连接,从而在第一操作系统与第二操作系统之间建立双向通信,然后可利用该socket连接将待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中。
在后续的操作中,若第一操作系统需要对第二操作系统中的权限信息进行控制操作,利用所述socket连接可直接在Linux端发送指令,而不再强制要求必须在安卓端发送指令。
本公开提供的权限同步方法通过socket连接的方式将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中,使得权限信息的同步过程更为灵活。
基于上述任一实施例,在本实施例中,在所述将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中之后,方法还包括:
在第二操作系统中设置第一监控进程;其中,所述第一监控进程用于监控所述共享内存区域;
在所述共享内存区域中所存储的权限信息发生变化的情况下,从第二操作系统获取待同步的第二权限信息集合,将所述待同步的第二权限信息集合传输并保存在第一操作系统的共享内存区域中。
在之前的实施例中,对权限信息的同步一般是在系统初始化时实现的。但在系统运行过程中,存在对权限信息进行变更的情况。在本实施例中,对此类情况进行讨论。
以安卓为例,可在安卓系统中定制第一监控进程,所述第一监控进程可采用看门狗(WatchDog)进程实现。在安卓系统启动时,所述第一监控进程可以自行启动,实现对共享内存区域的监控。
第一监控进程对共享内存区域的监控主要是对共享内存区域中的标识信息的监控,所述标识信息能够反映共享内存区域中所存储的权限信息是否发生变化。例如,某一权限信息在存储到共享内存区域后未发生变化,则该权限信息所对应的标识信息的值为“0”;之后,若该权限信息发生变化,则该权限信息所对应的标识信息的值从“0”变为“1”。标识信息与权限信息之间存在对应关系,如每个权限信息存在唯一对应的标识信息。由于待同步的权限信息的类 型不限于一种,因此共享内存区域中所设置的标识信息的类型也不限于一种。
当第一监控进程通过对标识信息的监控,发现有权限信息发生变化时,可重新从第二操作系统获取待同步的权限信息,并传输、保存在第一操作系统的共享内存区域中。需要说明的是,此处所述的待同步信息可以是根据发生变化的标识信息所确定的发生变化的权限信息,也可以是第一操作系统的共享内存区域之前已存储的所有权限信息。为了将此处待同步的权限信息与系统初始化时所同步的权限信息加以区分,在本实施例中,将此处待同步的权限信息记为待同步的第二权限信息集合。第二权限信息集合可包含一个或多个待同步的权限信息。
需要说明的是,本实施例所描述的权限信息发生变化可以是用户在第二操作系统中对权限信息进行改变,如第二操作系统某个功能申请了网络权限;也可以是用户在第一操作系统中发送指令,进而对第二操作系统中的权限信息进行改变。无论是何种原因造成的权限信息发生变化,都可将改变后的权限信息同步到第一操作系统的共享内存区域中,以使得第一操作系统中的进程能够及时获得更新后的权限信息。
本公开提供的权限同步方法通过在第二操作系统中启动第一监控进程,可以对第一操作系统的共享内存区域进行监控,从而在权限信息发生变化时能够及时发现,避免权限信息未及时同步所带来的数据风险。
基于上述任一实施例,在本实施例中,在所述将所述待同步的权限信息传输并保存在第一操作系统的共享内存区域中之后,方法还包括:
在第一操作系统中设置第二监控进程;其中,所述第二监控进程用于监控所述共享内存区域;
在所述共享内存区域中所存储的权限信息发生变化的情况下,从第二操作系统获取待同步的第二权限信息集合,将所述待同步的第二权限信息集合传输并保存在第一操作系统的共享内存区域中。
在之前的实施例中,对权限信息的同步一般是在系统初始化时实现的。但在实际应用过程中,存在对权限信息进行变更的情况。
以Linux OS为例,可由Linux系统中的init进程启动第二进程,所述第二监控进程可采用WatchDog进程实现。其中,init进程是系统所有进程的起点。
第二监控进程对共享内存区域的监控主要是对共享内存区域中的标识信息的监控,所述标识信息能够反映共享内存区域中所存储的权限信息是否发生变化。例如,某一权限信息在存储到共享内存区域后未发生变化,则该权限信息所对应的标识信息的值为“0”;之后,若该权限信息发生变化,则该权限信息 所对应的标识信息的值从“0”变为“1”。标识信息与权限信息之间存在对应关系,如每个权限信息存在唯一对应的标识信息。由于待同步的权限信息的类型不限于一种,因此共享内存区域中所设置的标识信息的类型也不限于一种。
当第二监控进程通过对标识信息的监控,发现有权限信息发生变化时,可重新从第二操作系统获取待同步的权限信息,并传输、保存在第一操作系统的共享内存区域中。需要说明的是,此处所述的待同步信息可以是根据发生变化的标识信息所确定的发生变化的权限信息,也可以是第一操作系统的共享内存区域之前已存储的所有权限信息。为了将此处待同步的权限信息与系统初始化时所同步的权限信息加以区分,在本实施例中,将此处待同步的权限信息记为待同步的第二权限信息集合。第二权限信息集合可包含一个或多个待同步的权限信息。
本公开提供的权限同步方法通过在第一操作系统中启动第二监控进程,可以对第一操作系统的共享内存区域进行监控,从而在权限信息发生变化时能够及时发现,避免权限信息未及时同步所带来的数据风险。
基于上述任一实施例,在本实施例中,在所述将所述待同步的权限信息传输并保存在第一操作系统的共享内存区域中之后,方法还包括:
将所述第一权限信息集合写入存储装置。
在本实施例中,在将所述第一权限信息集合保存到共享内存区域之后,还要将所述第一权限信息集合写入存储装置。
内存中保存的信息在计算设备断电后会消失。为了实现已同步权限信息的本地永久化保存,在本实施例中,将第一权限信息集合写入存储装置。
当计算设备再次启动后,优先从本地存储装置读取第一权限信息集合,而不需要等待权限同步后再做权限信息的设置,提高了工作效率。
基于上述任一实施例,在本实施例中,所述将所述第一权限信息集合写入存储装置,包括:
检查预设的第一标志信息;其中,所述第一标志信息与所述第一权限信息集合中的第一权限信息相对应,所述第一权限信息为所述第一权限信息集合中的任意一个权限信息;
在所述的第一标志信息为第一状态值的情况下,将所述第一权限信息实时写入存储装置;
在所述的标志信息为第二状态值的情况下,在所选择的时延之后,再将所述第一权限信息写入存储装置。
在本实施例中,对第一权限信息集合中的任意一个权限信息写入磁盘的时机加以规定。为此,可预先为第一权限信息集合中的各个权限信息设置对应的标志信息,该标志信息能够反映所对应的权限信息写入磁盘的紧要程度。
若第一权限信息集合中的第一权限信息十分重要且急迫,可以将第一标志信息设置为第一状态值。当检查到第一标志信息为第一状态值时,一旦第一权限信息写入第一操作系统的共享内存区域,就需要将第一权限信息实时同步到存储装置中。这样做保证了重要权限信息的及时保存,能有效避免突发故障可能带来的风险。
若第一权限信息相对不太重要或相对不太急迫,可以将所述第一标志信息设置为第二状态值。当检查到第一标志信息为第二状态值时,在第一权限信息写入第一操作系统的共享内存区域之后,允许经历一定的时延,例如设置为30秒(s)、1分钟(min)等之后,再将第一权限信息同步到存储装置中。一般来说,可在第一操作系统相对空闲的情况下,实现第一权限信息在存储装置中的存储,从而降低了第一操作系统因为存储权限信息的相关操作而被频繁打断的次数。
本实施例所描述的时延可根据实际需要确定,在本实施例中不对时延值的大小进行限制。
所述第一状态值与第二状态值可以根据需要设定,如将第一状态值设为0,将第二状态值设为1,也可以是其他的候选值,在本实施例中不对第一状态值和第二状态值的取值进行限制。
本公开提供的权限同步方法通过检查预设的标志信息,确定权限信息从共享内存区域同步到存储装置的时机,从而可以根据权限信息的重要程度决定同步的时机,在数据安全与工作效率之间取得平衡。
基于上述任一实施例,在本实施例中,在所述从第二操作系统获取待同步的第二权限信息集合,并传输、保存在第一操作系统的共享内存区域中之后,方法还包括:
将所述第二权限信息集合写入存储装置。
在系统运行过程中,权限信息实时发生变化后,第二权限信息集合也被传输并保存到第一操作系统的共享内存区域中。在本实施例中,需要将所述第二权限信息集合写入存储装置,以实现第二权限信息集合中的权限信息的本地永久化保存。
第二权限信息集合写入存储装置的过程与前述第一权限信息集合写入磁盘的过程并无本质区别,因此不在此处做重复说明。
本公开提供的权限同步方法,在计算设备再次启动后,可优先从本地磁盘读取第二权限信息集合,而不需要等待安卓权限同步后再做权限信息的设置,提高了工作效率。
在本公开的实施例中,上述所称的存储装置,可以是本地磁盘,例如硬盘驱动器(Hard Disk Drive,HDD)、固态硬盘(Solid State Drives,SSD)等,也可以是外置存储装置,例如U盘、SD卡等,还可以是网络存储装置,例如局域网的网络附属存储(Network Attached Storage,NAS)、云存储等。
以第一操作系统为Linux OS、第二操作系统为Android为例,图2是本公开提供的权限同步方法在一个实施例中的实现示意图。参考图2,在该实施例中,可采用mmap映射的方式把Android平台相关的权限及属性同步到Linux的共享内存区域,使Linux进程可以以普通内存的方式快速进行访问。例如,可以包括:
S1、首先把Android相关权限及属性通过mmap的方映射到一块共享内存的区域;在必要时同步到磁盘,便于系统拉起时针对状态做相关处理。同时Android端启动一个WatchDog进程,用于关注共享内存的变化,当有变化时会针对相关变化的权限做相关的事件调度调整,以达到Linux系统对Android系统控制与改变的同步能力。
S2、Linux进程可以通过普通读取内存的方式去共享内存区域读取相关的权限数据做同步处理,如果有必要启动一个单独WatchDog进程针对共享内存变化时做事件调度调整,以达到Linux系统实时监控Android权限变更的能力。
S3、当数据写入共享内存时,本公开可以通过一个标志来判断是需要实时同步磁盘,或者根据某个时机来把数据同步到磁盘,如进程关闭前等,便于下次系统启动时的一些权限可以直接通过本地读取。
在另一个实施例中,本公开提供的权限同步方法还可以通过socket的方式实现。例如,可以包括:
S11、通过socket的方式把Android平台相关的权限及属性同步到Linux共享内存区域;
S12、Linux端启动一个socket服务,Android端作为客户端链接Linux端启动的socket服务,然后把相关权限及属性通过socket的方式同步到linux端并写入共享内存,便于Linux端相关进程可以供需获取;
S13、当Linux同步了Android端的权限后,如需要相关权限控制的操作可通过socket的方式向Android端发送相关控制请求。
下面对本公开提供的权限同步装置进行描述,下文描述的权限同步装置与上文描述的权限同步方法可相互对应参照。
图3为本公开提供的权限同步装置的示意图,如图3所示,本公开提供的权限同步装置包括:
权限信息获取模块301,被设置为从运行在第一操作系统环境的第二操作系统中获取待同步的第一权限信息集合;
权限信息传输及存储模块302,被设置为将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中;
权限信息读取模块303,被设置为第一操作系统从所述共享内存区域中读取权限信息。
本公开提供的权限同步装置通过将第二操作系统中的第一权限信息集合传输到第一操作系统的共享内存区域,可在需要时从共享内存区域读取权限信息,从而实现了权限信息的快速同步,避免了在第一操作系统中重新设置权限信息所带来的效率低下的问题。
基于上述任一实施例,在本实施例中,所述权限信息传输及存储模块302,被设置为:
通过mmap映射的方式将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中。
本公开提供的权限同步装置通过mmap映射的方式将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中,基于mmap映射自身的特性,这一方式能够提升将权限信息从第二操作系统同步到第一操作系统中的效率。
基于上述任一实施例,在本实施例中,所述权限信息传输及存储模块302,被设置为:
在第一操作系统与第二操作系统之间建立socket连接;
通过所述socket连接将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中。
本公开提供的权限同步装置通过socket的方式将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中,使得权限信息的同步过程更为灵活。
基于上述任一实施例,在本实施例中,装置还包括:
第一监控模块,用于在第二操作系统中启动第一监控进程;其中,所述第一监控进程被设置为监控所述共享内存区域;
二次传输及存储模块,被设置为在所述共享内存区域中所存储的权限信息 发生变化的情况下,从第二操作系统获取待同步的第二权限信息集合,并传输、保存在第一操作系统的共享内存区域中。
本公开提供的权限同步装置通过在第二操作系统中启动第一监控进程,可以对第一操作系统的共享内存区域进行监控,从而在权限信息发生变化时能够及时发现,避免权限信息未及时同步所带来的数据风险。
基于上述任一实施例,在本实施例中,装置还包括:
第二监控模块,被设置为在第一操作系统中启动第二监控进程;其中,所述第二监控进程被设置为监控所述共享内存区域;
二次传输及存储模块,被设置为在所述共享内存区域中所存储的权限信息发生变化的情况下,从第二操作系统获取待同步的第二权限信息集合,并传输、保存在第一操作系统的共享内存区域中。
本公开提供的权限同步装置通过在第一操作系统中启动第二监控进程,可以对第一操作系统的共享内存区域进行监控,从而在权限信息发生变化时能够及时发现,避免权限信息未及时同步所带来的数据风险。
基于上述任一实施例,在本实施例中,装置还包括:
第一写入模块,被设置为将所述第一权限信息集合写入存储装置。
本公开提供的权限同步装置在计算设备再次启动后,优先从本地磁盘读取第一权限信息集合,而不需要等待安卓权限同步后再做权限信息的设置,提高了工作效率。
基于上述任一实施例,在本实施例中,所述第一写入模块,包括:
标志信息检查单元,被设置为检查预设的第一标志信息;其中,所述第一标志信息与所述第一权限信息集合中的第一权限信息相对应,所述第一权限信息为所述第一权限信息集合中的任意一个权限信息;
实时写入单元,被设置为在所述的第一标志信息为第一状态值的情况下,将所述第一权限信息实时写入存储装置;
延时写入单元,被设置为在所述的标志信息为第二状态值的情况下,在一定的时延之后,再将所述第一权限信息写入存储装置。
本公开提供的权限同步装置通过检查预设的标志信息,确定权限信息从共享内存区域同步到存储装置的时机,从而可以根据权限信息的重要程度决定同步的时机,在数据安全与工作效率之间取得平衡。
基于上述任一实施例,在本实施例中,装置还包括:
第二写入模块,被设置为将所述第二权限信息集合写入存储装置。
本公开提供的权限同步装置,在计算设备再次启动后,可优先从本地磁盘读取第二权限信息集合,而不需要等待安卓权限同步后再做权限信息的设置,提高了工作效率。
图4示例了一种电子设备的实体结构示意图,如图4所示,该电子设备可以包括:处理器(processor)410、通信接口(Communications Interface)420、存储器(memory)430和通信总线440,其中,处理器410,通信接口420,存储器430通过通信总线440完成相互间的通信。处理器410可以调用存储器430中的逻辑指令,以执行权限同步方法,该方法包括:
从第二操作系统中获取待同步的第一权限信息集合;
将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中;
第一操作系统从所述共享内存区域中读取权限信息。
此外,上述的存储器430中的逻辑指令可以通过软件功能单元的形式实现,并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本公开的技术方案本质上或者说对相关技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括至少一个指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本公开各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
另一方面,本公开还提供一种计算机程序产品,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,计算机能够执行上述各方法所提供的权限同步方法,该方法包括:
从运行在第一操作系统环境的第二操作系统中获取待同步的第一权限信息集合;
将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中;
第一操作系统从所述共享内存区域中读取权限信息。
又一方面,本公开还提供一种非暂态计算机可读存储介质,其上存储有计 算机程序,该计算机程序被处理器执行时实现以执行上述各提供的权限同步方法,该方法包括:
从运行在第一操作系统环境的第二操作系统中获取待同步的第一权限信息集合;
将所述待同步的第一权限信息集合传输并保存在第一操作系统的共享内存区域中;
第一操作系统从所述共享内存区域中读取权限信息。
本公开实施例的电子设备、程序和存储介质的有益效果,可以参考上述各方法的有益效果分析,此次不再赘述。
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM、RAM、磁碟、光盘等,包括至少一个指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。

Claims (11)

  1. 一种权限同步方法,包括:
    从运行在第一操作系统环境的第二操作系统中获取待同步的第一权限信息集合;
    将所述待同步的第一权限信息集合传输并保存在所述第一操作系统的共享内存区域中;
    所述第一操作系统从所述共享内存区域中读取权限信息。
  2. 根据权利要求1所述的权限同步方法,其中,所述将所述待同步的第一权限信息集合传输并保存在所述第一操作系统的共享内存区域中,包括:
    通过文件内存映射的方式将所述待同步的第一权限信息集合传输并保存在所述第一操作系统的共享内存区域中。
  3. 根据权利要求1所述的权限同步方法,其中,所述将所述待同步的第一权限信息集合传输并保存在所述第一操作系统的共享内存区域中,包括:
    在所述第一操作系统与所述第二操作系统之间建立套接字连接;
    通过所述套接字连接将所述待同步的第一权限信息集合传输并保存在所述第一操作系统的共享内存区域中。
  4. 根据权利要求1所述的权限同步方法,在所述将所述待同步的第一权限信息集合传输并保存在所述第一操作系统的共享内存区域中之后,所述方法还包括:
    在所述第二操作系统中设置第一监控进程;其中,所述第一监控进程用于监控所述共享内存区域;
    在所述共享内存区域中所存储的权限信息发生变化的情况下,从所述第二操作系统获取待同步的第二权限信息集合,将所述待同步的第二权限信息集合传输并保存在所述第一操作系统的共享内存区域中。
  5. 根据权利要求1所述的权限同步方法,在所述将所述待同步的第一权限信息集合传输并保存在所述第一操作系统的共享内存区域中之后,所述方法还包括:
    在所述第一操作系统中设置第二监控进程;其中,所述第二监控进程用于监控所述共享内存区域;
    在所述共享内存区域中所存储的权限信息发生变化的情况下,从所述第二操作系统获取待同步的第二权限信息集合,将所述待同步的第二权限信息集合传输并保存在所述第一操作系统的共享内存区域中。
  6. 根据权利要求1所述的权限同步方法,在所述将所述待同步的第一权限信息集合传输并保存在所述第一操作系统的共享内存区域中之后,所述方法还包括:
    将所述第一权限信息集合写入存储装置。
  7. 根据权利要求6所述的权限同步方法,其中,所述将所述第一权限信息集合写入存储装置,包括:
    检查预设的第一标志信息;其中,所述第一标志信息与所述第一权限信息集合中的第一权限信息相对应,所述第一权限信息为所述第一权限信息集合中的任意一个权限信息;
    在所述的第一标志信息为第一状态值的情况下,将所述第一权限信息实时写入存储装置;
    在所述的标志信息为第二状态值的情况下,在所选择的时延之后,再将所述第一权限信息写入存储装置。
  8. 根据权利要求4或5所述的权限同步方法,在所述从第二操作系统获取待同步的第二权限信息集合,将所述待同步的第二权限信息集合传输并保存在所述第一操作系统的共享内存区域中之后,所述方法还包括:
    将所述第二权限信息集合写入存储装置。
  9. 一种权限同步装置,包括:
    权限信息获取模块,被设置为从运行在第一操作系统环境的第二操作系统中获取待同步的第一权限信息集合;
    权限信息传输及存储模块,被设置为将所述待同步的第一权限信息集合传输并保存在所述第一操作系统的共享内存区域中;
    权限信息读取模块,被设置为所述第一操作系统从所述共享内存区域中读取权限信息。
  10. 一种电子设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述程序时实现如权利要求1至8任一项所述权限同步方法的步骤。
  11. 一种非暂态计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至8任一项所述权限同步方法的步骤。
PCT/CN2022/104353 2021-09-08 2022-07-07 权限同步方法、装置、电子设备与存储介质 WO2023035754A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111046737.3 2021-09-08
CN202111046737.3A CN113505011B (zh) 2021-09-08 2021-09-08 权限同步方法、装置、电子设备与存储介质

Publications (1)

Publication Number Publication Date
WO2023035754A1 true WO2023035754A1 (zh) 2023-03-16

Family

ID=78016458

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/104353 WO2023035754A1 (zh) 2021-09-08 2022-07-07 权限同步方法、装置、电子设备与存储介质

Country Status (2)

Country Link
CN (1) CN113505011B (zh)
WO (1) WO2023035754A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113505011B (zh) * 2021-09-08 2021-12-07 北京鲸鲮信息系统技术有限公司 权限同步方法、装置、电子设备与存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108369604A (zh) * 2017-12-28 2018-08-03 深圳前海达闼云端智能科技有限公司 一种多操作系统共享文件系统的方法、装置和电子设备
US20190163626A1 (en) * 2017-11-30 2019-05-30 Webroot Inc. Multi-Ring Shared, Traversable, and Dynamic Advanced Database
CN109976925A (zh) * 2019-03-27 2019-07-05 北京翼辉信息技术有限公司 一种基于混合多系统核间实时通信的方法和系统
CN111259408A (zh) * 2018-12-03 2020-06-09 阿里巴巴集团控股有限公司 应用权限管理及检查方法、装置、设备及存储介质
CN113505011A (zh) * 2021-09-08 2021-10-15 北京鲸鲮信息系统技术有限公司 权限同步方法、装置、电子设备与存储介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103942178A (zh) * 2014-03-03 2014-07-23 浙江大学 多核处理器上实时操作系统与非实时操作系统之间的通信方法
CN105138398B (zh) * 2015-09-30 2019-09-27 山东乾云启创信息科技股份有限公司 同步通信模式下socket通信与进程管理通用平台及方法
CN108183871B (zh) * 2017-11-23 2019-03-12 北京三快在线科技有限公司 一种虚拟交换机、虚拟交换机启动方法,电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190163626A1 (en) * 2017-11-30 2019-05-30 Webroot Inc. Multi-Ring Shared, Traversable, and Dynamic Advanced Database
CN108369604A (zh) * 2017-12-28 2018-08-03 深圳前海达闼云端智能科技有限公司 一种多操作系统共享文件系统的方法、装置和电子设备
CN111259408A (zh) * 2018-12-03 2020-06-09 阿里巴巴集团控股有限公司 应用权限管理及检查方法、装置、设备及存储介质
CN109976925A (zh) * 2019-03-27 2019-07-05 北京翼辉信息技术有限公司 一种基于混合多系统核间实时通信的方法和系统
CN113505011A (zh) * 2021-09-08 2021-10-15 北京鲸鲮信息系统技术有限公司 权限同步方法、装置、电子设备与存储介质

Also Published As

Publication number Publication date
CN113505011A (zh) 2021-10-15
CN113505011B (zh) 2021-12-07

Similar Documents

Publication Publication Date Title
US10282192B1 (en) Updating device code through a bus
US10360054B2 (en) File mapping and converting for dynamic disk personalization for multiple platforms
US9710186B2 (en) Performing online data migration with concurrent active user access to the data
US11748006B1 (en) Mount path management for virtual storage volumes in a containerized storage environment
JP6397113B2 (ja) リモーティングセッションを通じた非サポートファイル形式の開封
WO2017066944A1 (zh) 一种存储设备访问方法、装置和系统
US9092426B1 (en) Zero-copy direct memory access (DMA) network-attached storage (NAS) file system block writing
WO2018090290A1 (zh) 镜像文件转换方法及装置
WO2013135105A1 (zh) 数据存储方法和数据存储装置
WO2019061352A1 (zh) 数据加载方法及装置
WO2020103904A1 (zh) 云桌面升级方法、装置、云端服务器及存储介质
US10001933B1 (en) Offload pipeline for data copying
WO2014190806A1 (en) Application backup and restore
JP6663478B2 (ja) データ移行方法及び計算機システム
WO2013097619A1 (zh) 文件在线迁移方法、装置和系统
CN102541984A (zh) 一种分布式文件系统客户端的文件系统
CN111782318A (zh) 远程挂载本地磁盘到云桌面虚拟机中共享访问系统及方法
WO2017177892A1 (zh) 操作系统的安装
WO2023035754A1 (zh) 权限同步方法、装置、电子设备与存储介质
US20140082275A1 (en) Server, host and method for reading base image through storage area network
CN105653342B (zh) 一种Windows池桌面自动入域的方法及系统
EP2845110A1 (en) Reflective memory bridge for external computing nodes
US9032484B2 (en) Access control in a hybrid environment
US10452482B2 (en) Systems and methods for continuously available network file system (NFS) state data
US8510736B2 (en) Computer system, information processing apparatus, and security protection method

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE