Android 11.0 pms filters out some app functions when obtaining the application list

1 Introduction

  In the system rom customization development of 11.0, there are many functions for system customization. In product development, when the third-party app obtains the application list, some apps need to be filtered out, that is, they are not displayed in the app application list. , which requires filtering out these apps when pms queries the app list, and then implements these functions

2. When pms obtains the application list, filter out the core classes implemented by some app functions

    frameworks\base\core\java\android\content\pm\PackageManager.java
    frameworks\base\services\core\java\com\android\server\pm\PackageManagerService.java

3. When pms obtains the application list, filter out the core function analysis and implementation of some app functions
 

The first choice is to see how to obtain the relevant source code of the app list through pms in the app. Next, analyze the relevant source code of pms.
         final PackageManager packageManager = getPackageManager();
        final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
        mainIntent.addCategory( Intent.CATEGORY_LAUNCHER);
        List<ResolveInfo> apps = packageManager.queryIntentActivities(mainIntent, 0);
        for(ResolveInfo info : apps){             String pkgname = info.activityInfo.packageName;             Lo

おすすめ

転載: blog.csdn.net/baidu_41666295/article/details/131337816