Access control method, related apparatus and system
By creating multiple instances of the callee for each caller in a distributed system and synchronously updating the instance state when the caller's state changes, the data security problem caused by inconsistent application states is solved, achieving both data security and resource optimization.
Patent Information
- Application Number
- CN202210202855.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2021-03-03
- Filing Date
- 2022-03-02
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2042-03-02
AI Technical Summary
In a distributed environment, how can we manage the running state of each application during inter-application calls to ensure consistency and prevent data leakage and misuse?
By creating multiple instances of the callee in the electronic device and synchronously changing the state of the corresponding instance when the caller's running state changes, the state of the caller and the callee instances are kept consistent. Instances are isolated by processes or threads in random access memory, thus optimizing resource utilization.
It achieves data security during the call process in a distributed system, prevents data abuse and leakage, and saves resources while improving user experience.
Smart Images

Figure CN115017536B_ABST
Abstract
Description
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on March 3, 2021, with application number 202110233519.4 and application name “Access Control Method, Related Devices and Systems”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computer and communication technology, and in particular to access control methods, related devices and systems. Background Art
[0003] In a standalone scenario involving a single device, applications (apps) on that device can call each other and access various resources on that device. With the development of smart devices, the variety and number of devices in users' lives are increasing, and distributed scenarios where devices communicate and interconnect with each other are gradually becoming a reality. In distributed scenarios, applications on devices can call each other and share resources, which will become a future trend.
[0004] When one application calls another, how to manage the running status of each application, ensure the consistency of the running status of the application during the call, and prevent data leakage and abuse are issues that need to be urgently addressed now and in the future. Summary of the Invention
[0005] This application provides an access control method, related devices and systems, which can ensure the consistency of the status of the caller and the callee instances, avoid the risk of expanded permissions during the call process, thereby ensuring data security during the call process and preventing data abuse and leakage.
[0006] In the first aspect, an embodiment of the present application provides an access control method, which is applied to a communication system comprising a first device, a second device and a third device, wherein a first caller is installed in the first device, a second caller is installed in the second device, and a callee is installed in the third device; the first caller, the second caller and the callee are application programs APP or functional components; APP is a program entity that implements multiple functions, and a functional component is a program entity that implements a single function. The method includes: a first device sends a first access request to a third device, the first access request carrying the identifier of the first caller, the identifier of the callee and the identifier of the first resource; a second device sends a second access request to the third device, the second access request carrying the identifier of the second caller, the identifier of the callee and the identifier of the second resource; the third device creates a first instance of the callee in response to the first access request, and runs the first instance to access the first resource in the third device; the third device creates a second instance of the callee in response to the second access request, and runs the second instance to access the second resource in the third device; the second instance is different from the first instance, the first instance and the second instance are processes or threads running in a random access memory (RAM), and the first instance and the second instance are isolated from each other; the first caller in the first device changes from a first running state to a second running state; the first device sends the second running state of the first caller to the third device; the third device changes the running state of the first instance to the second running state.
[0007] By implementing the method provided in the first aspect, in a distributed system, when an electronic device receives multiple access requests for the same callee, it can run multiple instances of the callee. Furthermore, when the running state of the caller changes, the electronic device synchronously changes the running state of the callee instance corresponding to the caller. This method of providing services to multiple callers through multiple instances ensures that the states of the caller and callee instances are consistent, avoiding the risk of expanded permissions during the call process. This ensures data security during the call process and prevents data misuse and leakage. Furthermore, it can conserve resources in the electronic device and optimize resource usage within the electronic device.
[0008] In a second aspect, an embodiment of the present application provides an access control method, which is applied to a communication system comprising a first device and a third device, wherein a first caller is installed in the first device and a callee is installed in the third device; the first caller and the callee are an application APP or a functional component; an APP is a program entity that implements multiple functions, and a functional component is a program entity that implements a single function. The method comprises: the first device sends a first access request to the third device, the first access request carrying an identifier of the first caller, an identifier of the callee, and an identifier of a first resource; the third device creates a first instance of the callee in response to the first access request, and runs the first instance to access a first resource in the third device; the first instance is a process or thread running in a random access memory RAM; the first caller in the first device changes from a first running state to a second running state; the first device sends the second running state of the first caller to the third device; the third device changes the running state of the first instance to the second running state.
[0009] When implementing the method provided in the second aspect, when the caller's operating state changes, the electronic device synchronously changes the operating state of the callee instance corresponding to the caller. This ensures consistency between the caller and callee instances, thereby protecting data security during the call process, avoiding the risk of privilege escalation, and preventing data misuse and leakage. Furthermore, it conserves resources in the object device and optimizes resource usage within the object device.
[0010] On the third aspect, an embodiment of the present application provides an access control method, which is applied to a communication system comprising a first device, a second device and a third device, wherein a first caller is installed in the first device, a second caller is installed in the second device, and a callee is installed in the third device; the first caller, the second caller and the callee are application programs APP or functional components; APP is a program entity that implements multiple functions, and a functional component is a program entity that implements a single function. The method includes: a first device sends a first access request to a third device, the first access request carrying the identifier of the first caller, the identifier of the callee and the identifier of the first resource; a second device sends a second access request to the third device, the second access request carrying the identifier of the second caller, the identifier of the callee and the identifier of the second resource; the third device creates a first instance of the callee in response to the first access request, and runs the first instance to access the first resource in the third device; the third device creates a second instance of the callee in response to the second access request, and runs the second instance to access the second resource in the third device; the second instance is different from the first instance, the first instance and the second instance are processes or threads running in a random access memory (RAM), and the first instance and the second instance are isolated from each other; the first caller in the first device changes from a first running state to a second running state; the first device sends the second running state of the first caller to the third device; the third device maintains the running state of the first instance as the first running state.
[0011] By implementing the method provided in the third aspect, when an electronic device obtains multiple access requests to call the same callee, it can run multiple instances of the callee, and when the running status of the caller changes, the electronic device maintains the running status of the instance of the callee corresponding to the caller unchanged.
[0012] In combination with the method provided in the third aspect, in some embodiments, when the third device recognizes the first scenario, it maintains the operating state of the first instance in the first operating state. The first scenario can be pre-set. The first scenario can be, for example, a scenario in which the first device is a car computer, and the first device calls a PA that provides a positioning function in the third device. This can meet the needs of users in specific scenarios. For example, in a scenario in which the car computer calls a PA that provides a positioning function in a mobile phone, if the car computer stops running or is on standby, the PA that provides a positioning function in the mobile phone can continue to run and does not stop running or on standby with the car computer. This can ensure that the mobile phone continues to obtain positioning and provide users with continuous positioning functions.
[0013] In combination with the method provided in the first aspect, the second aspect, or the third aspect, in some embodiments, the first operating state or the second operating state includes: foreground running, background running, and stopped running.
[0014] In conjunction with the methods provided in the first, second, or third aspects, in some implementations, a third device may assign a first user identifier (UID) to the first instance and a second UID to the second instance. In this way, the third device can distinguish the first instance from the second instance by using the UID. In other implementations, the third device may assign a first process identifier (PID) to the first instance and a second process identifier (PID) to the second instance. In this way, the third device can distinguish the first instance from the second instance by using the UID.
[0015] In conjunction with the methods provided in the first, second, or third aspects, in some implementations, after the third device creates the first instance and the second instance, it may further store the call relationship between the first caller and the first instance, as well as the call relationship between the second caller and the second instance. After the first device sends a first access request to the third device, it may further store the call relationship between the first caller and the first instance. After the second device sends a second access request to the third device, it may further store the call relationship between the second caller and the second instance.
[0016] The calling relationship between the first caller and the first instance includes: a calling relationship ID, information about the first instance, and information about the first caller.
[0017] The call relationship ID may be assigned by the first device.
[0018] The information of the first instance may include one or more of the following: a device identifier (device ID) of the third device, an APP ID of the callee, and a UID and PID of the first instance.
[0019] The caller information includes the APP ID of the first caller, and may also include one or more of the following: the device identifier (device ID) of the first device, the developer signature, UID, and account ID of the first caller.
[0020] The calling relationship between the second caller and the second instance is similar to the calling relationship between the first caller and the first instance, and will not be repeated here.
[0021] The first device, the second device, and the third device all store the calling relationship, which can be used to trace the cause when a problem occurs later, ensure that the running status of the caller and the callee instances in the calling relationship are consistent, and restore the calling task, etc.
[0022] In combination with the method provided in the first aspect, the second aspect, or the third aspect, in some embodiments, if the third device fails to create the first instance, or the first instance fails to access the first resource, the first device may send a third access request to the fourth device, where the third access request carries the identifier of the first caller, the identifier of the callee, and the identifier of the first resource; the fourth device may create a third instance of the callee in response to the third access request, and run the third instance to access the first resource in the fourth device.
[0023] Specifically, the third device may fail to create the first instance, or the first instance may fail to access the first resource due to a variety of reasons, not limited herein, including, for example, a shutdown or malfunction of the third device. Upon receiving exception information from the third device or failing to receive an access result from the guest device within a preset time, the first device may determine that an exception has occurred in the calling task and send a third access request to the fourth device.
[0024] The fourth device can have the following situations:
[0025] 1. The fourth device is the third device. In this way, the original object device can be used to resume the calling task, and the calling task will not be affected, which can improve the user experience.
[0026] 2. The fourth device is an electronic device selected by the first device according to the selection policy, which is installed with the callee or can be installed with the callee, for example, the device with the most available resources, the device closest to the main device, etc.
[0027] 3. The fourth device is an electronic device selected by the user.
[0028] Specifically, before the first device sends the third access request to the fourth device, it can display a first user interface, in which multiple device options are displayed, and the multiple device options include options for the fourth device; the first device can receive user operations that act on options for the fourth device.
[0029] The fourth device in the second or third case mentioned above can resume the call task across devices. Although the device where the callee is located has changed, it does not affect resource calls. Moreover, from the user's perspective, the call task is not affected, which can improve the user experience.
[0030] In some implementations, the third access request also carries the first UID and / or first PID of the first instance, and the fourth device can assign the first UID and / or first PID to the third instance. This allows the UID or PID previously assigned to the first instance to be used, reducing device operations and conserving resources.
[0031] In a fourth aspect, an embodiment of the present application provides an access control method, which is applied to a first device, and the method includes: the first device sends a first access request to a third device, and the first access request carries the identifier of the first caller, the identifier of the callee and the identifier of the first resource; the first caller is installed in the first device, and the callee is installed in the third device, the first caller and the callee are application programs APP or functional components, APP is a program entity that implements multiple functions, and the functional component is a program entity that implements a single function; the first access request is used to create a first instance of the callee on the third device, and run the first instance to access the first resource in the third device; the first caller in the first device changes from a first running state to a second running state; the first device sends the second running state of the first caller to the third device.
[0032] By implementing the method provided in the fourth aspect, the first caller in the first device can call the callee in the third device, and can transfer the running status of the first caller to the third device.
[0033] In combination with the method of the fourth aspect, in some implementations, the first running state or the second running state includes: foreground running, background running, and stopped running.
[0034] In conjunction with the method of the fourth aspect, in some embodiments, after the first device sends the first access request to the third device, it may also store the call relationship between the first caller and the first instance. For detailed information about this call relationship, please refer to the relevant description above. This call relationship can be used to trace the cause of subsequent problems, ensure the consistency of the running status of the caller and callee instances in the call relationship, and restore the calling task.
[0035] In conjunction with the method of the fourth aspect, in some embodiments, if the third device fails to create the first instance, or if the first instance fails to access the first resource, the first device sends a third access request to the fourth device. The third access request carries the identifier of the first caller, the identifier of the callee, and the identifier of the first resource. The third access request is used by the fourth device to create a third instance of the callee and run the third instance to access the first resource on the fourth device. This allows the calling task to be restored without affecting the resource call. Furthermore, from the user's perspective, the calling task is unaffected, which can improve the user experience.
[0036] For several implementations of the fourth device, please refer to the relevant description above.
[0037] In combination with the method of the fourth aspect, in some embodiments, the third access request also carries the first UID and / or first PID assigned by the third device to the first instance, and the first UID and / or first PID are used by the fourth device to assign to the third instance.
[0038] In combination with the method of the fourth aspect, in some embodiments, the fourth device and the third device are the same device.
[0039] In a fifth aspect, an embodiment of the present application provides an access control method, which is applied to a third device, and the method includes: the third device receives a first access request sent by the first device, the first access request carries the identifier of the first caller, the identifier of the callee and the identifier of the first resource; the first caller is installed in the first device, and the callee is installed in the third device; the third device receives a second access request sent by the second device, the second access request carries the identifier of the second caller, the identifier of the callee and the identifier of the second resource; the second caller is installed in the second device, the first caller, the second caller and the callee are application programs APP or functional components, APP is a program entity that implements multiple functions, and functional components The component is a program entity that implements a single function; the third device creates a first instance of the callee in response to the first access request, and runs the first instance to access the first resource in the third device; the third device creates a second instance of the callee in response to the second access request, and runs the second instance to access the second resource in the third device; the second instance is different from the first instance, the first instance and the second instance are processes or threads running in the random access memory RAM, and the first instance and the second instance are isolated from each other; the third device receives the second running state of the first caller after the change sent by the first device; the third device changes the running state of the first instance to the second running state, or keeps the running state of the first instance as the first running state.
[0040] When implementing the method provided in the fifth aspect, when an electronic device receives multiple access requests for the same callee, it can run multiple instances of the callee. When the caller's operating state changes, the electronic device synchronously changes the operating state of the callee instance corresponding to the caller. This method of providing services to multiple callers through multiple instances ensures consistency in the states of the caller and callee instances, avoiding the risk of expanded permissions during the call process. This ensures data security during the call process and prevents data misuse and leakage. Furthermore, it can conserve resources in the object device and optimize resource usage within the object device.
[0041] In combination with the method provided in the fifth aspect, in some embodiments, the third device can maintain the operating state of the first instance in the first operating state when the first scenario is identified. The first scenario can be pre-set. The first scenario can be, for example, a scenario in which the first device is a car computer, and the first device calls the PA that provides a positioning function in the third device. This can meet the user needs in specific scenarios. For example, in a scenario in which the car computer calls the PA that provides a positioning function in a mobile phone, if the car computer stops running or is on standby, the PA that provides a positioning function in the mobile phone can continue to run and does not stop running or on standby with the car computer. This can ensure that the mobile phone continues to obtain positioning and provide users with continuous positioning functions.
[0042] In combination with the method of the fifth aspect, in some implementations, the first running state and the second running state include: foreground running, background running, and stopped running.
[0043] In conjunction with the method of the fifth aspect, in some embodiments, the third device may assign a first user identifier (UID) to the first instance and a second UID to the second instance. In this way, the third device can distinguish the first instance from the second instance by using the UID. In other embodiments, the third device may assign a first process identifier (PID) to the first instance and a second process identifier (PID) to the second instance. In this way, the third device can distinguish the first instance from the second instance by using the UID.
[0044] In conjunction with the method of the fifth aspect, in some embodiments, after the third device creates the first instance and the second instance, it may also store the calling relationship between the first caller and the first instance, as well as the calling relationship between the second caller and the second instance. The specific content of these two calling relationships can be found in the relevant description above and will not be repeated here.
[0045] The first device stores the calling relationship, which can be used to trace the cause when a problem occurs later, ensure that the running status of the caller and the callee instances in the calling relationship are consistent, and restore the calling task, etc.
[0046] In combination with the method of the fifth aspect, in some embodiments, if the third device fails to create the first instance, or the first instance fails to access the first resource, the third device can receive a third access request sent by the first device, which carries the identifier of the first caller, the identifier of the callee, and the identifier of the first resource; and in response to the third access request, create a third instance of the callee, and run the third instance to access the first resource in the third device.
[0047] Specifically, the failure of the third device to create the first instance, or the failure of the first instance to access the first resource, can occur for a variety of reasons, not limited here. Examples include a shutdown or malfunction of the third device. Upon receiving exception information from the third device or failing to receive access results from the object device within a preset time, the first device can determine that an exception has occurred in the invocation task and send a third access request to the fourth device. This allows the invocation task to be restored using the original object device, without being affected, thereby improving the user experience.
[0048] For several situations of the fourth device, please refer to the relevant description above.
[0049] In some implementations, the third access request also carries the first UID and / or first PID of the first instance, and the fourth device can assign the first UID and / or first PID to the third instance. This allows the UID or PID previously assigned to the first instance to be used, reducing device operations and conserving resources.
[0050] In a sixth aspect, an embodiment of the present application provides an access control method, which is applied to an electronic device, wherein a first caller, a second caller, and a callee are installed in the electronic device; the first caller, the second caller, and the callee are application programs (APPs) or functional components; an APP is a program entity that implements multiple functions, and a functional component is a program entity that implements a single function. The method includes: the electronic device generates a first access request, the first access request including an identifier of the first caller, an identifier of the callee, and an identifier of a first resource; the electronic device generates a second access request, the second access request including an identifier of the second caller, an identifier of the callee, and an identifier of the second resource; the electronic device creates a first instance of the callee in response to the first access request, and runs the first instance to access the first resource; the electronic device creates a second instance of the callee in response to the second access request, and runs the second instance to access the second resource; the second instance is different from the first instance, the first instance and the second instance are processes or threads running in a random access memory (RAM), and the first instance and the second instance are isolated from each other; the first caller in the electronic device changes from a first running state to a second running state; and the electronic device changes the running state of the first instance to the second running state.
[0051] By implementing the method provided in the sixth aspect, in a stand-alone scenario, when multiple callers of an electronic device call the same callee, the electronic device can run multiple instances of the callee, and when the running state of the caller changes, the electronic device synchronously changes the running state of the instance of the callee corresponding to the caller. In this way, by providing services to multiple callers with multiple instances, the states of the caller and the callee instances can be guaranteed to be consistent, avoiding the risk of expanded permissions during the calling process, thereby ensuring data security during the calling process and preventing data abuse and leakage. In addition, it can also save resources in the electronic device and optimize the way resources are used in the electronic device.
[0052] In the first aspect, the second aspect, the third aspect, or any one of the above embodiments, the operations performed by the first device, the second device, or the third device are all performed by the same electronic device in the method provided in the sixth aspect. For details, please refer to the relevant description above and will not be repeated here.
[0053] In the seventh aspect, an embodiment of the present application provides an electronic device, comprising: a memory, and one or more processors; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute a method as in the fourth aspect or any one of the embodiments of the fourth aspect.
[0054] In the eighth aspect, an embodiment of the present application provides an electronic device, comprising: a memory, and one or more processors; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute a method as in the fifth aspect or any one of the embodiments of the fifth aspect.
[0055] In the ninth aspect, an embodiment of the present application provides a communication system, comprising a first device, a second device, and a third device, wherein the first device is used to execute a method as in the fourth aspect or any one of the embodiments of the fourth aspect, and the third device is used to execute a method as in the fifth aspect or any one of the embodiments of the fifth aspect.
[0056] In the tenth aspect, an embodiment of the present application provides an electronic device comprising: a memory and one or more processors; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute a method as in the sixth aspect or any one of the embodiments of the sixth aspect.
[0057] In an eleventh aspect, an embodiment of the present application provides a computer-readable storage medium, including instructions, which, when executed on an electronic device, causes the electronic device to execute a method as in the fourth aspect or any one of the embodiments of the fourth aspect.
[0058] In the twelfth aspect, an embodiment of the present application provides a computer program product, which, when running on a computer, enables the computer to execute the method of the fourth aspect or any one of the implementation methods of the fourth aspect.
[0059] In the thirteenth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising instructions, which, when the instructions are executed on an electronic device, enable the electronic device to execute a method as in the fifth aspect or any one of the implementation methods of the fifth aspect.
[0060] In the fourteenth aspect, an embodiment of the present application provides a computer program product, which, when running on a computer, enables the computer to execute the method of the fifth aspect or any one of the implementation methods of the fifth aspect.
[0061] By implementing the technical solution provided by this application, when an electronic device receives multiple access requests to the same callee, it can run multiple instances of the callee. Furthermore, when the running state of the caller changes, the electronic device will synchronously change the running state of the callee instance corresponding to the caller. This approach of providing services to multiple callers through multiple instances ensures consistency in the states of the caller and callee instances, avoiding the risk of expanded permissions during the call process. This ensures data security during the call process and prevents data abuse and leakage. Furthermore, it can conserve resources within the electronic device and optimize resource usage within the electronic device. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 This shows a way for apps to call each other in a stand-alone scenario.
[0063] Figure 2 A schematic diagram of the structure of a communication system 10 provided in an embodiment of the present application;
[0064] Figure 3 Distributed scenarios provided in the embodiments of this application;
[0065] Figure 4A A hardware structure diagram of an electronic device provided in an embodiment of the present application;
[0066] Figure 4B A software structure diagram of an electronic device provided in an embodiment of the present application;
[0067] Figure 4C A software structure diagram of the main device provided in the embodiment of the present application;
[0068] Figure 4D A software structure diagram of the object device provided in the embodiment of the present application;
[0069] Figure 5 A flowchart of the access control method provided in an embodiment of the present application;
[0070] Figure 6A 、 Figure 6B A user interface provided in an embodiment of the present application. DETAILED DESCRIPTION
[0071] The following is a clear and detailed description of the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in the text is only a description of the association relationship between related objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0072] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood to imply or suggest relative importance or implicitly indicate the number of the technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of this application, unless otherwise specified, "plurality" means two or more.
[0073] The term "user interface (UI)" in the following embodiments of this application refers to a medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface is a source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on an electronic device and finally presented as content that the user can recognize. The commonly used form of user interface is graphical user interface (GUI), which refers to a user interface related to computer operations that is displayed in a graphical manner. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. displayed on the display screen of an electronic device.
[0074] refer to Figure 1 , Figure 1 This example illustrates a way for apps to call each other in a stand-alone scenario.
[0075] like Figure 1 As shown, APP1, APP2, and APP3 are installed in a stand-alone device. A stand-alone device can run three instances: an instance of APP1, an instance of APP2, and an instance of APP3. When APP1 and APP2 call APP3 respectively, APP3 provides services to APP1 and APP2 in the form of a single instance. Due to the form of providing services in a single instance, the running state of the APP3 instance cannot be changed synchronously with the running state of the caller. For example, if APP1 and APP2 call APP3 respectively, APP1 changes from foreground running to background running, but APP2 remains in the foreground running. When the running states of the two callers are inconsistent, the instance of APP3 cannot change its own state to be consistent with the caller.
[0076] However, maintaining consistency between the caller and the callee is essential to ensuring data security during the call process and preventing data misuse and leakage. For example, when APP1 calls APP3, it can pass its acquired resource access permissions to APP3, which then accesses device resources within that permission range. When APP1's operating state changes, the scope of APP1's permissions also changes. If APP3's operating state doesn't change synchronously, the permissions APP3 possesses when providing services to APP1 will differ from APP1's actual permissions, potentially leading to data misuse and leakage.
[0077] Not only Figure 1 In the single-machine scenario shown, distributed scenarios consisting of multiple devices also have data security issues caused by inconsistent states between the caller and the callee.
[0078] In order to solve the above problems, the following embodiments of the present application provide an access control method, which can be applied to a single device or a communication system including multiple electronic devices.
[0079] In this method, when an electronic device receives multiple access requests to the same callee, it can run multiple instances of the callee, with one instance of the callee being used to respond to access requests initiated by one caller. The callers that initiate the multiple access requests can be from one electronic device or multiple electronic devices. When the running state of the caller changes, the electronic device synchronously changes the running state of the instance of the callee corresponding to the caller. In this way, by providing services to multiple callers through multiple instances, the states of the caller and callee instances can be guaranteed to be consistent, thereby ensuring data security during the call process and preventing data abuse and leakage.
[0080] Furthermore, in this access control method, if a callee instance fails, it can be restored. For details on how to restore the callee instance, refer to the detailed description of the subsequent method embodiments. This ensures that access requests initiated by the caller are successfully responded to, improving the user experience.
[0081] In the embodiments of this application, an instance is a running app or functional component. An instance can refer to either a process or a thread. A process is an execution activity of an application on a computer. A thread is a single sequential control flow within the execution of an application. A process can include multiple threads.
[0082] Instances are isolated from each other. Electronic devices will allocate physical addresses in random access memory (RAM) to different instances on a process basis. When an electronic device needs to run an instance, it will find the space in RAM corresponding to the instance based on the virtual address and run the instance in that space. The virtual address is mapped to the physical address assigned to the instance by the electronic device, and the mapping relationship is stored in the controller of the electronic device. In other words, the instance uses the virtual address to find the actual storage location of the memory data. Under such a mechanism, different instances can only access the physical address corresponding to their own virtual address through their own virtual address, that is, they cannot access each other's physical space in RAM, so the instances are isolated from each other.
[0083] The definitions of caller, callee, and functional components can be found in the relevant description of the embodiments below.
[0084] The running status of an application may include: foreground running, background running, and stopped running. Among them, the provider of the user interface currently displayed by the electronic device is the foreground running application. The application that the electronic device is currently running but does not provide a user interface is the background running application. The application that the electronic device has previously run but is not currently running is a stopped application. In an electronic device, the number of applications running in the foreground, background, or stopped can be one or more, and there is no limit here.
[0085] In the following embodiments of this application, the caller and callee instances corresponding to an access request form a logical task domain. The event of the caller calling the callee can be called a task or event. A caller can have multiple task domains.
[0086] Below, the communication system provided by the embodiment of the present application is first introduced.
[0087] like Figure 2As shown, an embodiment of the present application provides a communication system 10. The communication system 10 includes: a plurality of electronic devices. The communication system 10 can also be called a distributed system 10.
[0088] The multiple electronic devices included in the distributed system 10 are all smart terminal devices, which can be of various types. The embodiments of the present application do not limit the specific types of the multiple electronic devices. For example, the multiple electronic devices include mobile phones, and can also include tablet computers, desktop computers, laptop computers, handheld computers, notebook computers, smart screens, wearable devices, augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, car computers, smart headphones, game consoles, and can also include Internet of Things (IOT) devices or smart home devices such as smart water heaters, smart lamps, smart air conditioners, etc. Without limitation, the multiple devices in the distributed system 10 can also include non-portable terminal devices such as laptop computers with touch-sensitive surfaces or touch panels, desktop computers with touch-sensitive surfaces or touch panels, etc.
[0089] When the multiple electronic devices in the distributed system 10 are all devices deployed in a home, the distributed system 10 can also be called a home distributed system.
[0090] Multiple electronic devices in the distributed system 10 can be connected by logging into the same account. For example, multiple electronic devices can log into the same Huawei account and remotely connect and communicate through the server.
[0091] Multiple electronic devices in the distributed system 10 can also log in to different accounts, but are connected by binding. For example, after the electronic device 100 logs in to the account, it can bind the electronic device 200 that is logged in to a different account or not logged in in the device management application, and then the electronic device 100 and the electronic device 200 can communicate through the device management application. In the following embodiments of the present application, the electronic device 100 can be any electronic device in the distributed system 10, and the electronic device 200 can also be any electronic device in the distributed system 10. For example, the electronic device 100 is a smart phone, and the electronic device 200 is a smart screen.
[0092] Multiple electronic devices in the distributed system 10 can also establish connections by scanning QR codes, NFC tapping, etc., which are not limited here.
[0093] The communication connections established between multiple electronic devices in the distributed system 10 may include but are not limited to: wired connections, wireless connections such as Bluetooth (BT) connections, wireless local area networks (WLAN) such as wireless fidelity point to point (Wi-Fi P2P) connections, near field communication technology (NFC) connections, infrared technology (IR) connections, and remote connections, etc.
[0094] In addition, multiple electronic devices in a distributed system can also be connected and communicated in combination with any of the above methods, and the embodiments of the present application do not limit this.
[0095] The plurality of electronic devices may be configured with different software operating systems (OS), including but not limited to Etc. Among them, It is Huawei's Hongmeng system.
[0096] The plurality of electronic devices may also be configured with the same software operating system, for example, they may all be configured with The software systems of multiple electronic devices are When the distributed system 10 is connected to the server, it can be regarded as a hyper terminal.
[0097] In the embodiment of the present application, each device in the distributed system 10 can install an application (APP), such as a traditional camera application, a gallery application, a settings application, etc. In subsequent embodiments, the traditional APP may be referred to as APP for short.
[0098] In addition, the distributed system 10 provided in the embodiment of the present application can install a distributed application. The distributed application can be a system application or a third-party application, which is not limited here.
[0099] Unlike apps that contain multiple capabilities, distributed applications support deployment as a single capability. A distributed application consists of one or more functional components.
[0100] A functional component is the smallest unit of independently functioning capability within an electronic device. It abstractly encapsulates a single capability. While an app bundles multiple functions together, a functional component treats each function as a separate, service-oriented capability. In other words, a functional component is a program entity that implements a single function.
[0101] Each functional component can be downloaded, installed and run independently. Multiple functional components that make up the same distributed application can be deployed in the same electronic device in the distributed system 10 or in different electronic devices.
[0102] The term "functional component" is merely a term used in this embodiment. Its meaning has been described in this embodiment, and its name does not constitute any limitation to this embodiment. In addition, in other embodiments of this application, the functional component may also be referred to as a system component, system service, business function, or other term. Subsequent embodiments of this application will be uniformly described as "functional component."
[0103] by For example, The functional components in can include the following two categories:
[0104] (1)feature ability, FA.
[0105] FA is a functional component that includes one or more UIs and provides the ability to interact with users. For example, the navigation interface in a map application and the video call interface in an instant messaging application can be implemented as a FA.
[0106] In some embodiments, FA is developed based on the MVVM (model-view-view-model) pattern, separating the view UI from the business logic. Business logic code and view UI code are deployed separately, allowing the view UI code to be integrated into other apps. During runtime, the view UI code can communicate with the business logic code to obtain the data required for UI presentation.
[0107] FA supports page template capabilities, such as Empty Ability, Login Ability, and Setting Ability. FA uses a scripting language (javascript, JS) to provide a declarative development model, using a declarative programming language similar to HTML and Cascading Style Sheets (CSS) as the development language for page layout and page styles, and supports the ECMAScript-compliant JS language to provide page business logic.
[0108] FA has the capabilities of free installation, independent operation, cross-device UI migration, cross-device binary migration, etc. FA also has the characteristics of multi-terminal deployment and distributed execution.
[0109] FA can call AA or APP to achieve more and more complex functions.
[0110] (2)particle ability, PA.
[0111] PA is a UI-less functional component that provides support for FA. For example, PA can provide computing power as a backend service or provide data access capabilities as a data warehouse. For example, beauty features, positioning features, audio and video encoding and decoding functions, etc. can be encapsulated as PA.
[0112] PA also has features such as multi-terminal deployment and distributed execution. PA is only dependent on system services and has no dependencies on other PAs.
[0113] PA effectively encapsulates remote virtualization, remote invocation, PA management, cross-platform compatibility, and security. It opens up cross-device service enablement and invocation to developers, allowing other devices to leverage the computing power of their own device and collaborate with them to complete computing tasks. PA supports both Service Ability and Data Ability. Service Ability provides the ability to run background tasks. Data Ability provides a unified data access abstraction.
[0114] PA can call FA or APP to achieve more and more complex functions.
[0115] It is understood that "FA" and "PA" are only terms used in this embodiment, and in other embodiments of this application, they can also be referred to as other terms. For example, "PA" and "FA" can also be referred to as atomic capability (AA), atomic application, meta-capability, atomic service, feature capability, and other terms.
[0116] The multiple functional components that make up a distributed application can be developed or provided by the same developer or by multiple developers separately, without any restrictions. Collaborative development of functional components by different developers can improve the development efficiency of distributed applications.
[0117] In the embodiments of the present application, functional components provide standardized interfaces for external invocation. Apps can call functional components. In some cases, functional components can also call other functional components or apps. In addition, the called functional components can also continue to call other functional components or apps. This multi-level invocation method can be called chain invocation.
[0118] After each device in the distributed system 10 establishes a communication connection, each device will synchronize the functional component information and APP information of other devices in the distributed system. Specifically, each device can synchronize the names of its installed functional components and APPs to other devices, so that the FA, PA and other functional components of other devices can be called in the distributed system 10. Which callers can call the FA, PA and other functional components, as well as which other functional components can be called, can be pre-set and recorded in each electronic device. In some other embodiments, each device can also synchronize its own device identification, device type, etc. to other devices in the distributed system.
[0119] refer to Figure 3 , Figure 3 A possible distributed distance learning service scenario is exemplified.
[0120] like Figure 3 As shown in the figure, the distributed system includes electronic devices such as smartphones, tablets, and smart screens. Each device in the distributed system is connected to each other. Smartphones, tablets, and smart screens can be configured with different software operating systems (OS). For example, smartphones and tablets can be configured with System, smart screen can be configured system.
[0121] An "online classroom" is installed in a smartphone. The "online classroom" is an application installed in an electronic device that provides teachers and students with various functions required for remote classes. The embodiment of this application does not limit its name. The "online classroom" may include the following functional components: a blackboard functional component, a whiteboard functional component, an audio and video codec functional component, and a network connection functional component. Among them, the blackboard functional component and the whiteboard functional component belong to FA, and the audio and video codec functional component and the network connection functional component belong to PA. The blackboard functional component provides the function of remotely explaining courses. The whiteboard functional component provides the function of remotely answering questions. The audio and video codec functional component provides video and audio codec functions.
[0122] On the teacher's side, when using the "Online Classroom" on a smartphone, the teacher can migrate or switch the blackboard function components to the smart screen, so as to explain the course on the smart screen.
[0123] On the student side, when students use the "Online Classroom" on their smartphones, they can migrate or switch the whiteboard function components to the tablet computer and answer questions on the tablet computer.
[0124] Migrating or switching a functional component from one device A to another device B can be done in two ways: 1. UI migration. When the FA's view UI and business logic are separated, device A can run the business logic code, which can trigger device B to run the view UI code. To the user, it appears as if the functional component has been migrated from device A to device B. 2. Whole-system migration. Whole-system migration means that device B downloads and installs the functional component from device A or the Internet, then runs it and provides the corresponding functionality.
[0125] In this remote teaching business scenario, the "online classroom" is the caller, and the whiteboard function component in the tablet computer and the blackboard function component in the smart screen are the callees.
[0126] Figure 3 Another possible distributed video call service scenario is also shown.
[0127] like Figure 3 As shown, smartphones can also be installed with other distributed applications, such as instant messaging applications. Instant messaging applications can provide video calls, voice calls, and other communication functions. Instant messaging applications can include the following functional components: video call function component, audio and video codec function component, and network connection function component.
[0128] When users use instant messaging apps on their smartphones, they can migrate or switch the app's video call function components to the smart screen, thereby using the smart screen's camera and display to make video calls.
[0129] The blackboard function component in the aforementioned "online classroom" and the video call function component in the instant messaging application can be the same function component. In other words, the function component in the smart screen can be called by the "online classroom" and instant messaging applications installed on the smartphone respectively.
[0130] In this video call business scenario, the instant messaging application is the caller, and the video call function component in the smart screen (i.e., the video call function component) is the callee.
[0131] It should be noted that if Figure 3 The business scenarios shown are only used to assist in describing the technical solutions of the embodiments of this application. In actual business scenarios, Figure 3 The distributed system shown may include more terminal devices, more or fewer functional components may be deployed in each device, and each distributed application may include more or fewer functional components.
[0132] pass Figure 2 The distributed system 10 shown, and Figure 3The distributed scenario shown can integrate the software and hardware capabilities of different devices to achieve an intelligent full-scene experience.
[0133] In the subsequent embodiments of this application: the party that initiates the call to the functional component or APP can be called the caller. The caller can be, for example, an APP, a service, a FA, or a PA. The initial initiator of the entire call chain can be called the first caller. The first caller can be, for example, an APP or a FA. For example, the call chain is: APP1 calls PA1, PA1 calls PA2, PA2 calls FA1, then APP1 is the first caller. For another example, the call chain is: FA1 calls PA1, PA1 calls PA2, then FA1 is the first caller.
[0134] In the entire call chain, the party called in the middle and the party called last can be called the callee. The callee can be, for example, APP, FA or PA.
[0135] In some embodiments of the present application, the caller may also be referred to as a subject application, and the callee may also be referred to as an object application.
[0136] In the call chain, the caller and the callee can be deployed in the same electronic device or in different electronic devices.
[0137] The device where the caller is located is called the subject device, and the device where the callee is located is the object device.
[0138] The application referred to in the following embodiments of this application may include APP or functional components.
[0139] In an embodiment of the present application, when an electronic device in the distributed system 10 receives multiple access requests for the same callee from other devices, it can run multiple instances of the callee, with one instance of the callee being used to respond to an access request initiated by a caller. When the running state of a caller changes, the electronic device synchronously changes the running state of the instance of the callee corresponding to the caller. In this way, by providing services to multiple callers with multiple instances, the states of the caller and callee instances can be guaranteed to be consistent, thereby ensuring data security during the call process and preventing data abuse and leakage.
[0140] In addition, if the instance of the callee in the electronic device fails to run, the device that initiated the access request corresponding to the instance can also restore the instance of the callee. The method of restoring the instance of the callee can refer to the detailed description of the subsequent method embodiments.
[0141] refer to Figure 4A , Figure 4AThis is a hardware structure diagram of the electronic device provided in the embodiment of the present application. The electronic device can be Figure 1 Any electronic device in the distributed system 10 shown. The electronic device can be a main device or a guest device.
[0142] like Figure 4A As shown, the electronic device 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, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. 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, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0143] It is understood that the structures illustrated in the embodiments of the present invention do not constitute specific limitations on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0144] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0145] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0146] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0147] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.
[0148] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in an electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.
[0149] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied in electronic devices. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process 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 convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0150] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0151] The wireless communication module 160 can provide wireless communication solutions for electronic devices, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. The wireless communication module 160 can be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, demodulates 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, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0152] In some embodiments, the antenna 1 of the electronic device is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include 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, and / or IR technology. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS) and / or satellite based augmentation system (SBAS).
[0153] The electronic device implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects 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 modify display information.
[0154] 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 (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, the electronic device can include one or N display screens 194, where N is a positive integer greater than one.
[0155] The electronic device can realize the shooting function through the ISP, camera 193, video codec, GPU, display 194 and application processor.
[0156] The ISP processes data fed back by camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then passed to the ISP for processing and converted into a visible image. The ISP can also perform algorithmic optimization on image noise, brightness, and skin tone. It can also optimize parameters such as exposure and color temperature of the captured scene. In some embodiments, the ISP can be located within camera 193.
[0157] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0158] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when an electronic device selects a frequency, the DSP performs a Fourier transform on the frequency energy.
[0159] Video codecs are used to compress or decompress digital video. Electronic devices may support one or more video codecs. This allows them to play or record videos in a variety of encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.
[0160] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU enables intelligent cognitive applications in electronic devices, such as image recognition, face recognition, speech recognition, and text comprehension.
[0161] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
[0162] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.; non-volatile memory may include disk storage devices and flash memory.
[0163] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage cell potential level; universal flash storage (UFS) and embedded multi media card (eMMC) can be divided into UFS and embedded multi media card according to the storage specification.
[0164] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.
[0165] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .
[0166] The external memory interface 120 can be used to connect to an external non-volatile memory device to expand the storage capacity of the electronic device. The external non-volatile memory device communicates with the processor 110 via the external memory interface 120 to implement data storage. For example, files such as music and videos can be stored in the external non-volatile memory device.
[0167] The electronic device can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0168] The pressure sensor 180A is used to sense the pressure signal and convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194 .
[0169] The touch sensor 180K is also referred to as a "touch-sensitive device." The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also referred to as a "touch screen." The touch sensor 180K is used to detect touch operations applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operations can be provided via the display screen 194. In other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device, at a location different from that of the display screen 194.
[0170] when Figure 4A When the electronic device shown is the main device:
[0171] The mobile communication module 150 or the wireless communication module 160 can be used to communicate with Figure 2 The other electronic devices in the distributed system 10 shown in FIG. 1 establish communication connections. The specific method of establishing communication connections can be referred to in the following example. Figure 2 Related description. After establishing a communication connection, the mobile communication module 150 or wireless communication module 160 can also be used to receive functional component information and app information synchronized from other electronic devices, such as the names of functional components and apps installed in other electronic devices. The mobile communication module 150 or wireless communication module 160 can also be used to send access requests to the target device.
[0172] The processor 110 may be used to monitor the running status of the caller in the subject device. The mobile communication module 150 or the wireless communication module 160 may also be used to send the running status of the caller in the subject device to the object device.
[0173] In some embodiments, when the processor 110 monitors that the instance of the callee corresponding to the access request initiated by the main device fails to run, it can also restore the instance of the callee. The specific method of restoration can be referred to the relevant description of the subsequent method embodiments.
[0174] The display screen 194 is used to display the user interface provided in subsequent embodiments.
[0175] The internal memory 121 can be used to store functional component information and APP information synchronized from other electronic devices in the distributed system 10.
[0176] The internal memory 121 can also be used to store the call relationship between the caller in the subject device and the callee in the object device. This call relationship includes: a call relationship ID, the instance information of the callee, and the information of each caller that calls the instance. For the specific content of this call relationship, please refer to the relevant description of the subsequent embodiments.
[0177] The internal memory 121 can also be used to store task information of each caller in the main device, including task domain ID, call relationship ID, task status, etc.
[0178] when Figure 4A When the electronic device shown is the object device:
[0179] The mobile communication module 150 or the wireless communication module 160 can be used to communicate with Figure 2 The other electronic devices in the distributed system 10 shown in FIG. 1 establish communication connections. The specific method of establishing communication connections can be referred to in the following example. Figure 2 Related description. After establishing a communication connection, the mobile communication module 150 or wireless communication module 160 can also be used to receive functional component information and app information synchronized from other electronic devices, such as the names of functional components and apps installed in other electronic devices. The mobile communication module 150 or wireless communication module 160 can also be used to receive access requests sent by the main device.
[0180] The mobile communication module 150 or the wireless communication module 160 may also be configured to receive the running status of the caller in the main device sent by the main device.
[0181] When the object device receives multiple access requests from the subject device for the same callee, the processor 110 is configured to run multiple instances of the callee, with one instance of the callee responding to a single access request from the caller. When the running state of a caller changes, the processor 110 is configured to synchronously change the running state of the callee instance corresponding to the caller.
[0182] The internal memory 121 can be used to store functional component information and APP information synchronized from other electronic devices in the distributed system 10.
[0183] The internal memory 121 can also be used to store the call relationship between the caller in the subject device and the callee in the object device. This call relationship includes: a call relationship ID, the instance information of the callee, and the information of each caller that calls the instance. For the specific content of this call relationship, please refer to the relevant description of the subsequent embodiments.
[0184] The internal memory 121 can also be used to store task information of each caller in the main device, including task domain ID, call relationship ID, task status, etc.
[0185] refer to Figure 4B , Figure 4B This is a schematic diagram of the software structure of an electronic device provided in an embodiment of the present application. The electronic device can be a main device or an object device.
[0186] The software system of the electronic device can adopt a layered architecture, event-driven architecture, micro-core architecture, micro-service architecture, or cloud architecture. For example, the software system of the electronic device includes but is not limited to Linux or other operating systems.
[0187] A layered architecture divides software into several layers, each with distinct roles and responsibilities. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.
[0188] The application layer can include a series of application packages.
[0189] like Figure 4B As shown, the application package may include APPs, such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc. The application layer may also include functional components, such as FA, PA, etc.
[0190] The application framework layer provides an application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0191] like Figure 4B As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
[0192] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, take screenshots, etc.
[0193] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0194] The view system includes visual controls, such as those for displaying text and images. The view system is used to build applications. A display interface can consist of one or more views. For example, a display interface containing a text notification icon might include a view for displaying text and a view for displaying images.
[0195] The phone manager is used to provide communication functions for electronic devices, such as call status management (including answering, hanging up, etc.).
[0196] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0197] The Notification Manager allows applications to display notifications in the status bar. These messages can be displayed briefly and then disappear automatically without user interaction. For example, the Notification Manager is used to notify users of completed downloads and message reminders. The Notification Manager can also display notifications in the top status bar of the system as icons or scrolling text, such as notifications from background applications, or as dialog windows on the screen. Examples include text messages in the status bar, beeps, vibrations on electronic devices, and flashing indicator lights.
[0198] Android Runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.
[0199] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.
[0200] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.
[0201] The system library can include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0202] The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.
[0203] The media library supports playback and recording of a variety of common audio and video formats, as well as static 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.
[0204] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0205] A 2D graphics engine is a drawing engine for 2D drawings.
[0206] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.
[0207] refer to Figure 4C , Figure 4C A schematic diagram of the software structure of the main device provided in an embodiment of the present application.
[0208] like Figure 4C As shown, the main device may include the following modules:
[0209] Application information management module, application startup management module, call relationship management module, call relationship library, application status management module, task management module, task information library.
[0210] The application information management module is used to manage the information of each app and functional component installed on the main device. For example, it manages the names of each app and functional component. The application information management module is also used to synchronize the information of the local app and functional component with other devices, and receive the information of the app and functional component synchronized from other devices.
[0211] The application startup management module is used to manage the startup of various apps and functional components.
[0212] The call relationship management module is responsible for maintaining the call relationship consisting of the caller and the callee instance that provides services to the caller, and storing it in the call relationship library.
[0213] In some embodiments, the call relationship management module includes a call relationship mapping module. This module acts as a virtual proxy, internally masking the actual information of the callee, such as the device it is located on, and externally locating the correct device to call the callee based on demand. The caller in the main device does not know the actual information of the callee, and only through the call relationship mapping module can it obtain the actual information of the callee and initiate the call.
[0214] The call relationship library is used to store the call relationship consisting of caller and callee instances. The call relationship includes: call relationship ID, callee instance information, and information of each caller that calls the instance.
[0215] The call relationship ID can be allocated by the subject device. For the same call relationship, the object device and the subject device can share the same call relationship ID, which can be carried in the access request sent to the object device and allocated by the subject device and sent to the object device.
[0216] The callee's instance information may include one or more of the following: the object device's device ID, the callee's app ID, the instance's user ID (UID), and the process identifier (PID). The PID is the instance's identifier; when an electronic device runs an instance, it assigns a unique PID to the instance. The PID and UID can be synchronized from the object device to the subject device.
[0217] The caller information includes the caller's application ID (APP ID), and may also include one or more of the following: the device ID of the subject device, the developer signature of the caller, the user ID (UID) of the caller, and the account ID of the subject device.
[0218] APP ID, used to identify an APP or functional component.
[0219] Device ID is used to identify the device. The device ID can be, for example, the device name, serial number, media access control (MAC) address, etc.
[0220] Developer signature, used to identify the developer.
[0221] UID is used to identify the user to whom an APP or functional component belongs. Typically, electronic devices assign different UIDs to different installed APPs or functional components to distinguish them. In some embodiments, electronic devices may assign the same UID to various APPs or functional components developed by the same developer. The same APP or functional component may have different UIDs in different electronic devices.
[0222] Account ID, used to identify the user currently logged in to the electronic device, for example, it can be a Huawei account.
[0223] Refer to Table 1 below, which exemplarily shows the calling relationships stored in the calling relationship library of the electronic device 100 .
[0224]
[0225] Table 1
[0226] As can be seen from Table 1, the APP or functional component identified as "ID1" in electronic device 100 acts as a caller and calls the APP or functional component identified as "ID2" in electronic device 200. Electronic device 200 creates one instance to provide services to the caller in electronic device 100.
[0227] The application state management module is used to manage the running state of each application in the electronic device 100. Specifically, the running state management module is used to transfer the running state of the caller in the subject device to the object device.
[0228] The task management module is responsible for managing the tasks in the caller's task domain and providing the task status corresponding to the caller. The task management module is also used to recover tasks in the task domain if an exception occurs. The specific implementation of task recovery can be found in the description of the method embodiment below.
[0229] The task information library stores caller-related task information, including task domain ID, call relationship ID, task status, caller's app ID, callee's app ID, and other information. Task status can range from normal to abnormal. Abnormal task status can be further categorized into various types, such as the target device being powered off or the callee failing to start up, though these are not limited here.
[0230] Referring to Table 2 below, it exemplarily shows task domain information of the electronic device 100 stored in the task information.
[0231] Task Field ID Call relationship ID Task Status Caller's APP ID APP ID of the callee 1 1 normal ID1 ID2
[0232] Table 2
[0233] It can be seen from Table 2 and Table 1 that the APP or functional component identified as “ID1” in the electronic device 100 as the caller and the APP or functional component identified as “ID2” in the electronic device 200 constitute a task domain.
[0234] The task domain ID is used to identify the task domain. The task domain ID can be assigned by the subject device. For the same task domain, both the guest device and the subject device can share the same task domain ID. This task domain ID can be included in access requests sent to the guest device and assigned by the subject device before being sent to the guest device.
[0235] Figure 4C This is only an illustrative example. The main device provided in the embodiment of the present application may also include more or fewer modules, which is not limited here.
[0236] Figure 4C The module of the main device shown in FIG can be located Figure 4B The application framework layer, system service layer, kernel layer, etc. of the electronic device are not restricted here.
[0237] refer to Figure 4D , Figure 4D A schematic diagram of the software structure of the object device provided in an embodiment of the present application.
[0238] like Figure 4D As shown, the object device may include the following modules:
[0239] Application information management module, application startup management module, instance management module, call relationship management module, call relationship library, application status management module, task management module, task information library.
[0240] The application information management module, application startup management module, call relationship management module, call relationship library, task management module, and task information library are similar to those in the main device, and can be referred to the relevant description.
[0241] The instance management module is responsible for dynamically enabling the callee's instance based on the caller's information and providing services to the caller. Specifically, the instance management module can enable different callee instances for different callers.
[0242] The application state management module is used to manage the running state information of the callee instance. Specifically, the running state management module synchronously changes the running state of the callee instance corresponding to the caller according to the running state of the caller in the main device.
[0243] Figure 4D This is only an illustrative example. The object device provided in the embodiment of the present application may also include more or fewer modules, which is not limited here.
[0244] Figure 4D The module of the object device shown in FIG. Figure 4B The application framework layer, system service layer, kernel layer, etc. of the electronic device are not restricted here.
[0245] based on Figure 2 The distributed system 10 shown, Figure 4A The hardware structure of the electronic device shown, Figure 4B The software structure of the electronic device shown, and Figure 4C The software structure of the main device shown in the figure is as follows: Figure 4D The software structure of the object device shown in the figure, and the access control method provided by the embodiment of the present application are described in detail below.
[0246] refer to Figure 5 , Figure 5 Schematic diagram of the access control method provided in this application embodiment. Figure 5 As shown, the method may include the following steps:
[0247] S101: A main device and a guest device establish a communication connection, and the number of the main device is one or more.
[0248] The number of the object device is one, and the object device can be any electronic device in the distributed system 10 .
[0249] The number of the main device can be one or more. The main device can be any electronic device in the distributed system 10.
[0250] The embodiment of the present application does not limit the way in which the main device and the object device establish a communication connection. For example, a communication connection can be established by logging into the same account, binding devices, scanning a QR code, etc. The embodiment of the present application does not limit the type of communication connection established between the main device and the object device. For example, it can include wired connection, wireless connection such as Bluetooth connection, Wi-Fi P2P connection, NFC connection, IR connection, and remote connection, etc. For details, please refer to Figure 2 Related description in .
[0251] In some embodiments, after establishing a communication connection between the object device and the subject device, the object device and the subject device can synchronize their own application (including APP and functional components), such as the application's identifier or name, with the other device based on the communication connection. This facilitates subsequent resource calls between the devices and enables resource sharing.
[0252] S102, the main device sends an access request to the object device, which carries: the caller's identifier, the callee's identifier, and indication information of the resource to be accessed by the access request; the access request is used by the caller in the main device to call the callee in the object device to access the corresponding resource.
[0253] The caller is installed in the main device, and the callee is installed in the object device. Both the caller and the callee can be apps or functional components.
[0254] In the embodiment of the present application, the same main device can send one or more access requests to the object device, which is not limited here.
[0255] In the embodiment of the present application, each access request corresponds to an initiating device of the access request (ie, a subject device), a caller, a callee, and a resource to be accessed.
[0256] The callees in different access requests are all the same callee in the object device.
[0257] The caller in different access requests can be different and there is no restriction here. For example, a host device can call the camera of a guest device when running a video call application, and another host device can call the camera of a guest device when running a photo taking application.
[0258] Different access requests may also request different resources. For example, a subject device may request access to the memory resources of a guest device, while another subject device may request access to the camera of a guest device.
[0259] In some embodiments, the subject device can send an access request to the guest device in response to a received user operation. For example, when a user uses a video call application on the subject device (e.g., a mobile phone), the user can input a user operation to trigger the subject device to send an access request to the guest device (e.g., a smart screen) to access the guest device's camera and display to conduct a video call.
[0260] In other embodiments, the subject device may also autonomously initiate the access request to the object device in some cases. For example, when the subject device is running a food delivery application, it may autonomously call the positioning function in the object device to obtain positioning data.
[0261] In some embodiments, the subject device may first determine whether the caller corresponding to the access request generated by itself has the authority to access the corresponding resource, and then send the access request to the object device.
[0262] S103 , the object device creates and runs multiple callee instances in response to the received access request, where one callee instance is used to respond to an access request initiated by a caller.
[0263] Specifically, after receiving multiple access requests to invoke a callee, the object device can create different instances of the callee for different callers. The object device can then run the callee instance to access the resources requested, thereby providing services to the corresponding callers. Different callers, or callers on different devices, are considered different callers.
[0264] For example, after caller 1 in one subject device and caller 1 in another subject device both send access requests to the object device for calling the callee, the object device can create two instances of the callee to provide services to caller 1 in the subject device and caller 1 in another subject device respectively.
[0265] For another example, after caller 1 in one subject device and caller 2 in another subject device both send access requests to the object device for calling the callee, the object device can create two instances of the callee to provide services to caller 1 in the subject device and caller 2 in the other subject device respectively.
[0266] For another example, after caller 1 and caller 2 in a subject device both send access requests to the object device for calling the callee, the object device can create two instances of the callee to provide services to caller 1 and caller 2 in the subject device respectively.
[0267] In some embodiments, the object device may first determine whether the caller corresponding to the access request has the authority to access the corresponding resource, and then respond to the access request.
[0268] In some embodiments, the object device may be installed in advance. In other embodiments, the object device may download and install the callee from the network after receiving the access request sent by the object device, or directly download and install the callee from the subject device.
[0269] When the object device creates an instance of the callee, it can assign a UID and PID to the instance.
[0270] In some embodiments, the object device may continue to use the caller's UID, that is, assign the caller's UID to the callee instance created for the caller. Since different callers have different UIDs, the callee instances created for different callers are different.
[0271] In other embodiments, the object device may allocate UIDs to callee instances individually according to its own allocation rules. For example, the object device may allocate UIDs to each app within a data range (e.g., 10000-30000), and allocate UIDs to each functional component instance (including the callee instance) within another data range (e.g., 30001-50000). Different UIDs may be allocated to different instances of the same functional component.
[0272] It can be seen that in the above two embodiments, the object device can distinguish different instances of the callee through the UID.
[0273] In addition, the guest device allocates different PIDs to different instances of the callee, and the PIDs can be used to distinguish different instances of the callee.
[0274] In some embodiments, after the guest device runs the created instance and accesses the corresponding resources, it can perform a series of operations based on the access results, such as displaying a video call interface on a display screen, capturing images through a camera, etc. In some embodiments, after the guest device runs the instance and accesses the corresponding resources, it can send the access results back to the device that initiated the access request, such as sending positioning results or calculation results to the host device.
[0275] After the object device creates an instance of the callee, it can save the calling relationship between the caller and the callee instance. The specific content of this calling relationship can be found in the relevant description above. The object device can also synchronize some content of this calling relationship (such as the UID and PID of the callee instance created for the caller in the subject device) to the subject device to facilitate the subject device to store this calling relationship.
[0276] After executing S102 or S103, both the subject device and the object device can store the corresponding task domain information. For the description of the task domain information, please refer to the above text.
[0277] S104: The subject device monitors the running status of the caller and transmits the running status of the caller to the object device.
[0278] The caller's running status may include: foreground running, background running, stopped running, etc.
[0279] In some embodiments, the main device may continuously or periodically monitor the running status of the caller.
[0280] In some embodiments, the subject device may periodically send the monitored running status of the caller to the object device, or may send the running status of the caller to the object device when it detects that the running status of the caller changes.
[0281] In other embodiments, the main device may also send the caller's running status to the object device in response to the object device's request. For example, after the object device creates an instance of the callee for the caller, the caller does not call the callee's instance for a long time, such as a video call APP in the main device does not call the camera in the object device for a long time, or the access result of the callee's instance remains unchanged for a long time, such as the positioning result obtained by the PA that provides positioning function in the object device remains unchanged for a long time, etc. In this case, the running status of the caller in the main device may have changed or is about to change. At this time, the main device sends the caller's running status to the object device, which can timely adjust the running status of the callee instance in the object device, thereby optimizing the resource usage in the object device.
[0282] The change in the caller's running state in the main device may be caused by a user operation or other reasons, which are not specifically limited here.
[0283] S105 , the object device synchronously changes the running state of the callee instance corresponding to the caller according to the received running state of the caller.
[0284] Specifically, the object device can change the running state of the callee instance that provides services to the caller to match that of the caller. This ensures that the permissions of the callee instance in the object device are consistent with those of the caller, ensuring that the callee instance can provide the corresponding services to the caller while also avoiding the risk of privilege escalation.
[0285] For example, when the caller in the subject device is running in the foreground, the instance of the callee corresponding to the caller in the object device is also running in the foreground. When the caller in the subject device is running in the background, the instance of the callee corresponding to the caller in the object device is also running in the background. When the caller in the subject device stops running, the instance of the callee corresponding to the caller in the object device also stops running.
[0286] When the caller's operating status changes on the main device, the main device's permissions will also change accordingly, and the operating status of the callee instance corresponding to the caller will be changed synchronously. This ensures that the permissions of the callee instance providing services to the caller are consistent with the caller. This prevents the callee's permissions from being expanded and prevents data misuse and leakage.
[0287] For example, a video call application on a subject device acts as a caller to access the camera on a target device. When the video call application is in the foreground, it has camera access permissions, and the instance enabled for the caller on the target device also has camera access permissions. However, when the video call application on the subject device moves to the background, it no longer has camera access permissions. At this point, the instance enabled for the caller on the target device also changes to the background and, likewise, no longer has camera access permissions.
[0288] For example, a video calling app on a host device acts as a caller to access the camera on a guest device. When the video calling app is in the foreground, the instance enabled for the caller on the guest device also runs in the foreground. If the video calling app on the host device stops running, the instance enabled for the caller on the guest device also stops running, thus preventing the risk of escalated permissions due to changes in the caller's status.
[0289] In addition, through S105, when the running status of the caller in the main device changes to background running or stopped running, the object device synchronously changes the running status of the instance of the callee corresponding to the caller to background running or stopped running, which can save resources in the object device and optimize the resource usage in the object device.
[0290] In the embodiment of the present application, since different callers correspond to different callee instances in the object device, the running state of the callee instance can be consistent with the running state of the corresponding caller.
[0291] In some embodiments, after the running status of the callee instance in the object device changes with the caller, the object device may further output prompt information to prompt the user of the current running status of the callee instance.
[0292] refer to Figure 6A , Figure 6A The user interface 61 displayed by the object device is shown as an example. Figure 6A As shown, a prompt message 601 is displayed in the user interface 61, and the prompt message 601 is used to prompt the user that the instance of the callee (eg, a PA for implementing a positioning function) currently providing services to the caller (eg, a map APP) has stopped running.
[0293] The object device shown in S105 is not limited to synchronously changing the running status of the instance of the callee corresponding to the caller according to the running status of the caller in the main device. In some other embodiments of the present application, S105 can also be replaced by the following operation: after the object device receives the running status of the caller in the main device, if the current object device is in a special scenario, the object device keeps the running status of the instance of the callee corresponding to the caller unchanged.
[0294] That is to say, in some specific scenarios, the object device can maintain the running state of the callee instance created for the caller, thereby meeting the user needs in specific scenarios. These specific scenarios can be scenarios preset by the object device or set by the user. For example, the specific scenario can be a scenario in which the car computer calls the PA that provides the positioning function in the mobile phone. If the car computer stops running or is on standby, the PA that provides the positioning function in the mobile phone can continue to run and will not stop running or on standby with the car computer. This can ensure that the mobile phone continues to obtain positioning and provide the user with continuous positioning function. In the embodiment of the present application, this specific scenario can also be referred to as the first scenario.
[0295] S106: The subject device monitors the task status of the caller calling the callee in the object device.
[0296] The main device may execute S106 at any time point after the above S102.
[0297] Task status can be either normal or abnormal. An abnormal task status means the task cannot be executed normally. This can be caused by any of the following: the object device is shut down or malfunctions, the object device abnormally exits or fails to start the callee instance created for the caller in the subject device, or the object device fails to create the callee instance for the caller in the subject device.
[0298] Specifically, the subject device can learn, through the exception information fed back by the object device, that an exception has occurred in the task of the callee in the object device invoked by the caller. In other embodiments, if the subject device does not receive the access result fed back by the object device within a preset time, it can be determined that an exception has occurred in the task of the callee in the object device invoked by the caller.
[0299] S107: When the task status of the callee in the object device called by the caller becomes abnormal, the subject device resumes the task.
[0300] Specifically, when an exception occurs in the task status of the callee in the object device called by the caller, the main device can obtain information about the instance of the callee currently called by the caller, such as the APP ID, UID, PID, etc. of the callee based on the stored task domain and calling relationship.
[0301] The method for the subject device to restore the task state in the caller's task domain may include any of the following:
[0302] 1. The subject device instructs the original object device in the task domain to recreate the instance of the callee that provides services to the caller in the subject device.
[0303] In some embodiments, the subject device may also transmit the identifier (including UID and / or PID) of the instance of the callee that provides services to the caller in the subject device in S103 to the object device. The object device may recreate the instance of the callee that provides services to the caller in the subject device and continue to use the identifier.
[0304] This allows tasks in the task domain to be fully restored, unchanged from before, without affecting resource calls within the task domain. Furthermore, from the user's perspective, task calls remain unaffected, improving the user experience.
[0305] 2. The subject device instructs the appropriate electronic device in the distributed system 10 to create an instance of the callee that provides services to the caller in the subject device.
[0306] In some embodiments, suitable electronic devices may include: electronic devices selected by the subject device from the distributed system according to a selection policy, which are installed with the callee or are capable of installing the callee. The present application does not limit the selection policy, and for example, the device with the most available resources, the device closest to the subject device, etc. may be selected.
[0307] In other embodiments, the appropriate electronic device may be selected by the user. Figure 6B , Figure 6B The user interface 62 is shown as an example when the subject device learns that the task status of the callee in the object device called by the caller is abnormal. Figure 6B As shown, user interface 62 displays a prompt message 602, which informs the user that an abnormality has occurred in the task status of the current caller invoking the callee in the object device. User interface 62 also displays one or more device options 603, each of which corresponds to an electronic device in the distributed system that has a callee installed or is capable of installing a callee. The subject device can receive a user operation on a device option 603 and, using the electronic device corresponding to the device option 603 as an appropriate electronic device, trigger the creation of a callee instance that provides services to the caller in the subject device.
[0308] In some embodiments, the main device may also transmit the identifier (including UID and / or PID) of the instance of the callee that provides services to the caller in the main device in S103 to the appropriate electronic device. The appropriate electronic device may use the identifier when creating an instance of the callee that provides services to the caller in the main device.
[0309] This allows tasks in the task domain to be restored across devices from the perspective of the primary device. While the device of the called callee changes, it does not affect resource calls within the task domain. Furthermore, from the user's perspective, task calls remain unaffected, improving the user experience.
[0310] In the first or second manner above, the main device may specifically trigger another electronic device to create an instance of the callee that provides services to the caller in the main device by sending an access request to the other electronic device.
[0311] In the embodiment of the present application, S104-S105 and S106-S107 can be implemented selectively. When both are implemented together, the present application does not limit the order between the two.
[0312] exist Figure 5 In the access control method shown:
[0313] The object device may be referred to as a third device, one subject device may be referred to as a first device, and another subject device may be referred to as a second device.
[0314] The caller in the first device may be referred to as a first caller, and the caller in the second device may be referred to as a second caller.
[0315] An access request sent by a first device to a guest device may be referred to as a first access request. The resource requested in the first access request may be referred to as a first resource. Information indicating the first resource may also be referred to as an identifier of the first resource. An access request sent by a second device to a guest device may be referred to as a second access request. The resource requested in the second access request may be referred to as a second resource. Information indicating the second resource may also be referred to as an identifier of the second resource.
[0316] The instance of the callee established by the object device in response to the first access request may be referred to as a first instance. The instance of the callee established by the object device in response to the second access request may be referred to as a second instance.
[0317] The UID and PID allocated by the guest device to the first instance may be referred to as a first UID and a first PID, respectively. The UID and PID allocated by the guest device to the second instance may be referred to as a second UID and a second PID, respectively.
[0318] In S104 , the running state monitored by the main device before the caller changes may be referred to as a first running state, and the running state after the caller changes may be referred to as a second running state.
[0319] In S107, the original object device or a suitable electronic device involved in the task recovery by the subject device may be referred to as a fourth device. The access request sent by the subject device to the fourth device may be referred to as a third access request. The instance of the callee created by the fourth device for the caller in the subject device in response to the third access request may be referred to as a third instance.
[0320] In S107, the main device provides a user interface for the user to independently select a fourth device (ie, a suitable electronic device), for example Figure 6B The user interface 62 shown may be referred to as a first user interface.
[0321] Implementation Figure 5In the access control method shown, when an electronic device receives multiple access requests for the same callee, it can run multiple instances of the callee, with one instance of the callee responding to access requests initiated by a single caller. When the caller's operating state changes, the electronic device synchronously changes the operating state of the callee instance corresponding to the caller. This way, by providing services to multiple callers through multiple instances, the states of the caller and callee instances remain consistent, thereby ensuring data security during the call process and preventing data misuse and leakage.
[0322] Not limited to distributed systems, the access control method provided by the embodiments of the present application can also be applied to stand-alone devices. Specifically, when an electronic device generates multiple access requests to call the same callee, multiple instances of the callee can be run, and one instance of the callee is used to respond to an access request initiated by a caller. When the running state of the caller changes, the electronic device synchronously changes the running state of the instance of the callee corresponding to the caller. In this way, by providing services to multiple callers in multiple instances, the states of the caller and the callee instances can be guaranteed to be consistent, thereby ensuring the data security during the calling process of the stand-alone device and preventing data abuse and leakage.
[0323] The various implementation modes of this application can be combined arbitrarily to achieve different technical effects.
[0324] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented 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 herein are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0325] Those skilled in the art will appreciate that all or part of the process steps in the above-described method embodiments can be implemented by a computer program instructing the relevant hardware. The program can be stored in a computer-readable storage medium, and when executed, the program can include the process steps in the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
[0326] In short, the above description is only an embodiment of the technical solution of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made based on the disclosure of the present invention should be included in the scope of protection of the present invention.
Claims
1. An access control method, characterized in that: The method is applied to a communication system comprising a first device, a second device and a third device, wherein a first caller is installed in the first device, a second caller is installed in the second device, and a callee is installed in the third device; The first caller, the second caller, and the callee are an application program APP or a functional component; the APP is a program entity that implements multiple functions, and the functional component is a program entity that implements a single function; The method comprises: The first device sends a first access request to the third device, where the first access request carries an identifier of the first caller, an identifier of the callee, and an identifier of the first resource; The second device sends a second access request to the third device, where the second access request carries an identifier of the second caller, an identifier of the callee, and an identifier of the second resource; The third device creates a first instance of the callee in response to the first access request, and runs the first instance to access the first resource in the third device; The third device creates a second instance of the callee in response to the second access request, and runs the second instance to access the second resource in the third device; the second instance is different from the first instance, the first instance and the second instance are processes or threads running in a random access memory (RAM), and the first instance and the second instance are isolated from each other; The first caller in the first device changes from a first running state to a second running state; The first device sends the second running status of the first caller to the third device; The third device changes the running state of the first instance to the second running state.
2. An access control method, characterized in that: The method is applied to a communication system comprising a first device, a second device and a third device, wherein a first caller is installed in the first device, a second caller is installed in the second device, and a callee is installed in the third device; The first caller, the second caller, and the callee are an application program APP or a functional component; the APP is a program entity that implements multiple functions, and the functional component is a program entity that implements a single function; The method comprises: The first device sends a first access request to the third device, where the first access request carries an identifier of the first caller, an identifier of the callee, and an identifier of the first resource; The second device sends a second access request to the third device, where the second access request carries an identifier of the second caller, an identifier of the callee, and an identifier of the second resource; The third device creates a first instance of the callee in response to the first access request, and runs the first instance to access the first resource in the third device; The third device creates a second instance of the callee in response to the second access request, and runs the second instance to access the second resource in the third device; the second instance is different from the first instance, the first instance and the second instance are processes or threads running in a random access memory (RAM), and the first instance and the second instance are isolated from each other; The first caller in the first device changes from a first running state to a second running state; The first device sends the second running status of the first caller to the third device; The third device maintains the running state of the first instance in the first running state.
3. The method according to claim 1 or 2, characterized in that The first running state or the second running state includes: foreground running, background running, and stopped running.
4. The method according to claim 1 or 2, characterized in that The method further comprises: The third device allocates a first user identifier UID to the first instance and allocates a second UID to the second instance; and / or, The third device allocates a first process identifier PID to the first instance and allocates a second PID to the second instance.
5. The method according to claim 1 or 2, characterized in that After the third device creates the first instance and the second instance, the method further includes: storing, by the third device, a calling relationship between the first caller and the first instance, and a calling relationship between the second caller and the second instance; After the first device sends the first access request to the third device, the method further includes: the first device storing a call relationship between the first caller and the first instance; After the second device sends the second access request to the third device, the method further includes: the second device storing a calling relationship between the second caller and the second instance.
6. The method according to claim 1 or 2, characterized in that The communication system further includes a fourth device, and the method further includes: If the third device fails to create the first instance, or the first instance fails to access the first resource, the first device sends a third access request to the fourth device, where the third access request carries the identifier of the first caller, the identifier of the callee, and the identifier of the first resource; In response to the third access request, the fourth device creates a third instance of the callee and runs the third instance to access the first resource in the fourth device.
7. The method according to claim 6, characterized in that The fourth device is determined by the first device from the devices included in the communication system; or, Before the first device sends the third access request to the fourth device, the method further includes: The first device displays a first user interface, wherein a plurality of device options are displayed in the first user interface, and the plurality of device options include an option for the fourth device; The first device receives a user operation acting on an option of the fourth device.
8. The method according to claim 6, characterized in that The third access request further carries the first user identifier UID and / or the first process identifier PID of the first instance. After the fourth device creates the third instance of the callee, the method further includes: The fourth device allocates the first user identifier UID and / or the first process identifier PID to the third instance.
9. The method according to claim 6, characterized in that The fourth device and the third device are the same device.
10. The method according to claim 2, characterized in that Maintaining, by the third device, the running state of the first instance in the first running state specifically includes: When the third device recognizes the first scenario, it maintains the running state of the first instance in the first running state.
11. An access control method, characterized in that: The method is applied to a first device, and includes: The first device sends a first access request to the third device, where the first access request carries an identifier of the first caller, an identifier of the callee, and an identifier of the first resource; the first caller is installed in the first device, and the callee is installed in the third device, where the first caller and the callee are an application program APP or a functional component, where the APP is a program entity that implements multiple functions, and the functional component is a program entity that implements a single function; the first access request is used by the third device to create a first instance of the callee and run the first instance to access the first resource in the third device; The first caller in the first device changes from a first running state to a second running state; The first device sends the second running status of the first caller to the third device; If the third device fails to create the first instance, or the first instance fails to access the first resource, the first device sends a third access request to the fourth device, where the third access request carries the identifier of the first caller, the identifier of the callee, and the identifier of the first resource; the third access request is used by the fourth device to create a third instance of the callee and run the third instance to access the first resource in the fourth device; In which, the third access request also carries the first user identifier UID and / or first process identifier PID assigned by the third device to the first instance, and the first user identifier UID and / or the first process identifier PID are used by the fourth device to assign to the third instance.
12. The method according to claim 11, characterized in that The first running state or the second running state includes: foreground running, background running, and stopped running.
13. The method according to claim 11, characterized in that After the first device sends the first access request to the third device, the method further includes: The first device stores a calling relationship between the first caller and the first instance.
14. The method according to claim 11, characterized in that The fourth device is determined by the first device; or, Before the first device sends the third access request to the fourth device, the method further includes: The first device displays a first user interface, wherein a plurality of device options are displayed in the first user interface, and the plurality of device options include an option for the fourth device; The first device receives a user operation acting on an option of the fourth device.
15. The method according to any one of claims 11 to 14, characterized in that: The fourth device and the third device are the same device.
16. An access control method, characterized in that: The method is applied to a third device, and includes: The third device receives a first access request sent by the first device, where the first access request carries an identifier of the first caller, an identifier of the callee, and an identifier of the first resource; the first caller is installed in the first device, and the callee is installed in the third device; The third device receives a second access request sent by the second device, where the second access request carries an identifier of the second caller, an identifier of the callee, and an identifier of the second resource; the second caller is installed in the second device, and the first caller, the second caller, and the callee are an application program APP or a functional component, where the APP is a program entity that implements multiple functions, and the functional component is a program entity that implements a single function; The third device creates a first instance of the callee in response to the first access request, and runs the first instance to access the first resource in the third device; The third device creates a second instance of the callee in response to the second access request, and runs the second instance to access the second resource in the third device; the second instance is different from the first instance, the first instance and the second instance are processes or threads running in a random access memory (RAM), and the first instance and the second instance are isolated from each other; The third device receives a second running state after the first caller changes and sent by the first device; The third device changes the running state of the first instance to the second running state.
17. An access control method, characterized in that: The method is applied to a third device, and includes: The third device receives a first access request sent by the first device, where the first access request carries an identifier of the first caller, an identifier of the callee, and an identifier of the first resource; the first caller is installed in the first device, and the callee is installed in the third device; The third device receives a second access request sent by the second device, where the second access request carries an identifier of the second caller, an identifier of the callee, and an identifier of the second resource; the second caller is installed in the second device, and the first caller, the second caller, and the callee are an application program APP or a functional component, where the APP is a program entity that implements multiple functions, and the functional component is a program entity that implements a single function; The third device creates a first instance of the callee in response to the first access request, and runs the first instance to access the first resource in the third device; The third device creates a second instance of the callee in response to the second access request, and runs the second instance to access the second resource in the third device; the second instance is different from the first instance, the first instance and the second instance are processes or threads running in a random access memory (RAM), and the first instance and the second instance are isolated from each other; The third device receives a second running state after the first caller changes and sent by the first device; The third device maintains the running state of the first instance in a first running state.
18. The method according to claim 16 or 17, characterized in that The second running state includes: foreground running, background running, and stopped running.
19. The method according to claim 16 or 17, characterized in that The method further comprises: The third device allocates a first user identifier UID to the first instance and allocates a second UID to the second instance; and / or, The third device allocates a first process identifier PID to the first instance and allocates a second PID to the second instance.
20. The method according to claim 16 or 17, characterized in that After the third device creates the first instance and the second instance, the method further includes: The third device stores the calling relationship between the first caller and the first instance, and the calling relationship between the second caller and the second instance.
21. The method according to claim 16 or 17, characterized in that The method further comprises: If the third device fails to create the first instance, or the first instance fails to access the first resource, the third device receives a third access request sent by the first device, where the third access request carries the identifier of the first caller, the identifier of the callee, and the identifier of the first resource; In response to the third access request, the third device creates a third instance of the callee and runs the third instance to access the first resource in the third device.
22. The method according to claim 17, wherein Maintaining, by the third device, the running state of the first instance in the first running state specifically includes: When the third device recognizes the first scenario, it maintains the running state of the first instance in the first running state.
23. An electronic device, characterized in that: include: A memory, one or more processors; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method as described in any one of claims 11-22.
24. 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 execute the method according to any one of claims 11 to 22.
25. A computer program product, characterized in that When the computer program product is run on a computer, the computer is caused to perform the method according to any one of claims 11 to 22.
26. A communication system, characterized in that: The communication system includes a first device, a second device, and a third device. The first device is configured to execute the method according to any one of claims 11 to 15, and the third device is configured to execute the method according to any one of claims 16 to 22.
Citation Information
Patent Citations
Cross-device access control method, related device and system
CN114996667A