Android 9.0 Apps without source code increase the granting of relevant permissions

1 Overview

In the 9.0 system rom product development, for some apps without source code, some permissions need to be added, such as the floating window permission. Since the app does not apply for this permission, the system needs to be adapted to grant this permission by default, and it needs to be parsed and installed in the PMS
. It’s time to grant the floating window permission

2. No source code app adds core classes that grant relevant permissions

     frameworks/base/core/java/android/content/pm/PackageParser.java
     frameworks/base/core/java/android/content/pm/PackageManager.java

3. The core function analysis and implementation of granting relevant permissions to the app without source code
3.1 PackageManager.java calls related methods on parsing the app

In the pms management, parsing and installation app, it is realized through PackageManage's getPackageArchiveInfo()

       public PackageInfo getPackageArchiveInfo(@NonNull String archiveFilePath,
                @PackageInfoFlags int flags) {
            final PackageParser parser = new PackageParser();
            parser.setCallback(new PackageParser.CallbackImpl(this));
            final File apkFile = new File(archiveFilePath);
            try {
                if ((flags & (MATCH_DIRECT_BOOT_UNAWARE | MATCH_DIRECT_BOOT_AWA

Guess you like

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