Processing method for dynamically detecting operation information of android system

By triggering script running in the Android system and using SELinux permissions to collect system resource information, the security restrictions of applications to obtain and upload system information are solved, and safe and controllable data collection and upload are achieved, ensuring device performance monitoring and security.

CN119150279APending Publication Date: 2024-12-17SHANDONG ARTAPLAY INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411211706.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

In Android systems, it is difficult for applications to obtain and upload system resource information without violating security policies, especially due to the limitations of security and privacy protection, which makes it impossible to effectively monitor device performance and collect necessary data.

Method used

By triggering the script to run, leverage rules and SELinux tags and permissions in the init.rc file, collect system resource information and write it to a permission-controlled file, ensuring security, and then notify the application through broadcast messages and upload to the remote server.

Benefits of technology

It realizes the safe and controllable collection and upload system resource information while complying with Android system security policies, provides data support for device performance monitoring and fault diagnosis, and ensures operational security and compliance, avoids data leakage. risk.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119150279A_ABST
    Figure CN119150279A_ABST
Patent Text Reader

Abstract

The invention discloses a processing method for dynamically detecting operation information of an android system, and relates to the technical field of android systems. The method comprises the steps that a program calls a system interface to set specific system attributes, a script with a proper SELinux label is executed through an init process, and the script collects system information by using a top command or reading proc. The collected information will be written into a predefined, privilege-controlled file that opens a read privilege to the application. The application program receives the broadcast, reads the information, carries out necessary analysis and formatting, and then uploads the information to a specified remote server for analysis and storage. According to the method, the security limitation that the application program directly accesses the system information is solved, and data support is provided for equipment performance optimization, fault diagnosis and user experience improvement. And through strict authority management and SELinux strategy configuration, the operation safety is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of Android systems and relates to a processing method for dynamically detecting running information of an Android system. Background Art

[0002] With the widespread use of mobile devices, especially the global popularity of the Android operating system, the demand for device performance monitoring is growing. In the Android system, due to security and privacy considerations, applications are strictly restricted from directly accessing the underlying system information. For example, obtaining CPU usage, memory status, and other system resource information usually requires root permissions or special system-level permissions, which is contrary to the security policy in modern Android versions.

[0003] In addition, to ensure the security of user data, the Android system introduced the SELinux (Security-Enhanced Linux) mandatory access control mechanism, which further restricts the application's access to sensitive system information. Therefore, developing a method that allows applications to read and report system information without violating the Android system security policy has become an urgent problem to be solved. Summary of the invention

[0004] In order to make up for the deficiencies of the prior art, in order to strictly comply with the enhanced security policy and effectively collect system resource information, the present invention provides a processing method for dynamically detecting the operation information of the Android system to ensure that while complying with the Android system security policy, the application is allowed to collect and upload the system resource information to the remote server in a safe and controllable manner. The present invention is implemented by the following technical solution: The present invention provides a processing method for dynamically detecting the operation information of the Android system, comprising the following steps: Step 1: The application triggers the script to run; The application sets the value of the system property to running by calling it, sending a signal to the system to indicate that it is ready to start the process of collecting system resource information; Step 2: Script trigger execution; When the system init process detects that the attribute value changes to running, the script running with root privileges is triggered through the rules preset in the init.rc file; this script is given SELinux labels and permissions to ensure that it is executed within a safe range; Step 3: Collect relevant information; The triggered script executes the top command or reads proc-related file information to collect system resource information including but not limited to CPU usage, memory usage, and process status; the collected information will be written to a pre-defined, permission-controlled file, which is open to applications for reading permissions; the collected information is sorted and written to a file in the / data directory, and the file's permission settings ensure that only authorized applications can read it; Step 4: Send broadcast; After the script is executed, it sends a specific broadcast message to the application through root privileges; the broadcast message carries a relevant identifier to notify the application that the data collection process has ended; After receiving the completion signal, the application listening to the above broadcast parses the broadcast information and confirms that data collection has been completed; the application reads the system information file stored in the / data directory, parses and formats the data, and uploads the sorted system resource information to the remote server through the network connection for further analysis and storage; Step 5: Process the selinux permissions of the top command.

[0005] The beneficial effects of the present invention are: In Android R (API 30) and above, in order to strictly comply with the enhanced security policy and effectively collect system resource information, the present invention provides a method that allows applications to collect and upload system resource information to a remote server in a secure and controllable manner while complying with the Android system security policy.

[0006] The present invention solves the security restrictions of applications directly accessing system information, and also provides an effective way to monitor system resources, providing data support for device performance optimization, fault diagnosis and user experience improvement. At the same time, through strict permission management and SELinux policy configuration, the security and compliance of operations are ensured, avoiding potential data leakage risks and authentication risks. BRIEF DESCRIPTION OF THE DRAWINGS

[0007] The present invention will be further described below in conjunction with the accompanying drawings; Figure 1 It is the work flow chart of the present invention. DETAILED DESCRIPTION

[0008] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention, so the present invention is not limited by the specific embodiments disclosed below.

[0009] The accompanying drawing is a specific embodiment of a processing method for dynamically detecting Android system operation information of the present invention. The embodiment comprises the following steps: Step 1: The application triggers the script to run; On Android versions above R, the application cannot obtain detailed system information, so it is necessary to trigger a script to collect it; set system properties. The application sets the value of the system property to running by calling the SystemProperties method; send a signal to the system to indicate that it is ready to start the collection process of system resource information; this step requires setting the SELinux permissions of the system application, allowing access and setting of property values ​​in the te file.

[0010] Step 2: The script is triggered to execute; the init process triggers the script according to the property changes.

[0011] init.rc is one of the initialization scripts loaded when Android starts. It contains a series of rules for monitoring and responding to changes in system properties. When the system property is detected to be running, the corresponding rules in the init.rc file trigger the script execution. The script is usually run by / system / bin / sh or other shell interpreters, requires root permissions, and should follow the SELinux security policy. The te file allows the init process to create related folders, set and access related property values.

[0012] Step 3: Collect relevant information; The triggered script executes the top command or reads information from / proc / meminfo and other / proc file systems to collect system resource usage information, including but not limited to CPU usage, memory usage, and process status; the collected information is organized and written to a secure file, usually a file in the / data directory, with permissions set to ensure that only authorized applications can read it. te file settings allow system applications to read and obtain the relevant attributes and content of the file.

[0013] Step 4: Send broadcast; After the script is executed, it sends a specific broadcast message to the application through root privileges; the broadcast message carries the relevant identifier to inform the application that the data collection process has ended. Use the am broadcast command to send a broadcast message with a specific Action. This requires the script to have the permission to send broadcasts. The system_server, AcivitiyManager, and binder call permissions of the script need to be configured in the te file.

[0014] After receiving the completion signal, the application listening to the above broadcast parses the broadcast information and confirms that data collection has been completed. The application reads the system information file stored in the / data directory, parses and formats the data, and uploads the organized system resource information to the remote server through the network connection for further analysis and storage.

[0015] Step 5: Process the selinux permissions of the top command; The SELinux permissions of general scripts are not enough to use the top command to obtain the process running information of all different users and groups. It is necessary to write corresponding SELinux permissions according to shell processes such as dumpstate. Since the top command needs to access the information of other processes, its SELinux permissions need to be configured correctly. Usually, the script must be marked with the same context as dumpstate or other system tools with similar permissions. Assign the script's executable file domain to an existing shell script.

[0016] As attached Figure 1 , the application calls the system interface and sets the value of the system property to running as a signal to start resource information collection. The system detects the above property changes and triggers the execution of the script with root privileges according to the preset rules in the init.rc file. The script executes system monitoring tools, such as the top command, to collect system resource information such as CPU usage, memory usage, and process status. The collected data is organized and saved to a secure file in the / data directory, and the file permissions are only authorized to specific applications. After the script completes data collection, it sends a broadcast message with a specific identifier to notify the application that data collection has ended. The application listens to and receives the broadcast to confirm that data collection is complete. Read the system information file in the / data directory, parse and format the data. Upload the organized system resource information to the remote server via the network for analysis and storage.

Claims

1. A processing method for dynamically detecting the operation information of an Android system, characterized in that: The steps include: Step 1: The application triggers the script to run; The application sets the value of the system property to running by calling it, sending a signal to the system to indicate that it is ready to start the process of collecting system resource information; Step 2: Script trigger execution; When the system init process detects that the attribute value changes to running, the script running with root privileges is triggered through the rules preset in the init.rc file; This script is given SELinux labels and permissions to ensure it executes within a safe scope; Step 3: Collect relevant information; The triggered script executes the top command or reads proc-related file information to collect system resource information including but not limited to CPU usage, memory usage, and process status; The collected information will be written to a predefined, permission-controlled file that is readable by applications. The collected information is collated and written to a file in the / data directory, which is set with permissions that only authorized applications can read it. Step 4: Send broadcast; After the script is executed, it sends a specific broadcast message to the application through root privileges; The broadcast message carries a relevant identifier to inform the application that the data collection process has ended; After receiving the completion signal, the application listening to the above broadcast parses the broadcast information and confirms that data collection has been completed; the application reads the system information file stored in the / data directory, parses and formats the data, and uploads the sorted system resource information to the remote server through the network connection for further analysis and storage; Step 5: Process the selinux permissions of the top command.

2. The method for dynamically detecting the operation information of the Android system according to claim 1, characterized in that: After configuring the relevant selinux permissions, the system application sets the attribute value.

3. The method for dynamically detecting the operation information of the Android system according to claim 1, characterized in that: Configure SELinux permissions related to shell scripts, execute top, and read related file information under / proc / .

4. The method for dynamically detecting the operation information of the Android system according to claim 1, characterized in that: In step 1, set the SELinux permissions for system applications, and allow access and setting of attribute values ​​in the te file; in step 2, the te file allows the init process to create related folders, set and access related attribute values; in step 3, the te file settings allow system applications to read and obtain related attributes and contents of files; in step 4, the te file needs to configure the system_server, AcivitiyManager, and binder call permissions of the script.