Android 12.0 grants app runtime permissions by default when booting for the first time (remove the runtime authorization pop-up window) The second method

1 Overview

  In the 12.0 system product development, the application for permissions after 6.0 needs to be dynamically applied, so after the system is started for the first time, when the app runs for the first time, an authorization window will pop up, allowing the user to manually grant the app runtime permissions , because the system product development needs to grant the app runtime permission by default, and the user does not need to grant the runtime pop-up window by default, so it is necessary to grant all the app runtime permissions by default at the first boot

2. The core class of the solution of the second method is to grant the app runtime permission by default at the first startup (remove the runtime authorization pop-up window)

    frameworks/base/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
    frameworks/base/services/core/java/com/android/server/pm/permission/Permission.java

3. The core function analysis and implementation of the second method grants app runtime permission by default when booting for the first time (remove the runtime authorization pop-up window)

The first startup grants the app runtime permission by default (remove the runtime authorization pop-up window). In the function realization of the second method,

After Android 6.0, due to the consideration of running security, when the app needs to apply for some permissions during the running of the app, all
permissions will not be authorized by default as before. It is necessary to apply for permissions in AndroidManifest.xml, and at the same time for some Special permissions need to
apply for permissions when the app is running, and an authorization box without authorization will pop up every time the app runs to allow user authorization,
and the management of permissions in the system is in PermissionManagerService.java, which is responsible for The service of system authority management
The following analyzes the source code of PermissionManagerService.java to see how the system is specifically authorized, and then
in the ap

Guess you like

Origin blog.csdn.net/baidu_41666295/article/details/132706475