美文网首页
PMS 保存 Package 信息

PMS 保存 Package 信息

作者: 行走中的3卡 | 来源:发表于2023-07-23 16:08 被阅读0次

PMS 里的 mPackages 保存了所有 应用包的信息

frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java

public class PackageManagerService implements PackageSender, TestUtilityService {
    // Keys are String (package name), values are Package.
    @Watched
    @GuardedBy("mLock")
    final WatchedArrayMap<String, AndroidPackage> mPackages = new WatchedArrayMap<>();
    

AndroidPackage 封装了应用包的信息

frameworks/base/services/core/java/com/android/server/pm/parsing/pkg/AndroidPackage.java

/**
 * The last state of a package during parsing/install before it is available in {@link
 * com.android.server.pm.PackageManagerService#mPackages}.
 * <p>
 * It is the responsibility of the caller to understand what data is available at what step of the
 * parsing or install process.
 * <p>
 *
 * @hide
 */
public interface AndroidPackage extends ParsingPackageRead, AndroidPackageApi,
        OverlayConfig.PackageProvider.Package {

    /**
     * The package name as declared in the manifest, since the package can be renamed. For example,
     * static shared libs use synthetic package names.
     */
    @NonNull
    String getManifestPackageName();
}

它取代了旧OS 的 PackageParser.Package, 参考:
frameworks/base/core/java/android/content/pm/PackageParser.java

 * @deprecated This class is mostly unused and no new changes should be added to it. Use
 * ParsingPackageUtils and related parsing v2 infrastructure in
 * the core/services parsing subpackages. Or for a quick parse of a provided APK, use
 * {@link PackageManager#getPackageArchiveInfo(String, int)}.
 *
 * @hide
 */
@Deprecated
public class PackageParser {
    /**
     * Representation of a full package parsed from APK files on disk. A package
     * consists of a single base APK, and zero or more split APKs.
     *
     * Deprecated internally. Use AndroidPackage instead.
     */
    public final static class Package implements Parcelable {

AndroidPackageApi 里定义了获取四大组件等的方法

frameworks/base/services/core/java/com/android/server/pm/pkg/AndroidPackageApi.java

/**
 * Explicit interface used for consumers like mainline who need a {@link SystemApi @SystemApi} form
 * of {@link AndroidPackage}. *
 * @hide
 */
//@SystemApi(client = SystemApi.Client.SYSTEM_SERVER)
public interface AndroidPackageApi {
    @NonNull
    List<ParsedActivity> getActivities();
    
    @NonNull
    List<ParsedProvider> getProviders();

    @NonNull
    List<ParsedActivity> getReceivers();

    @NonNull
    List<ParsedService> getServices();
}

而 AndroidPackage 的又被接口 ParsedPackage 继承 (具体实现类在哪里??)
frameworks/base/services/core/java/com/android/server/pm/parsing/pkg/ParsedPackage.java

/**
 * Methods used for mutation after direct package parsing, mostly done inside
 * {@link com.android.server.pm.PackageManagerService}.
 *
 * Java disallows defining this as an inner interface, so this must be a separate file.
 *
 * @hide
 */
public interface ParsedPackage extends AndroidPackage {

    AndroidPackage hideAsFinal();

    ParsedPackage addUsesLibrary(int index, String libraryName);

后续, PMS 是在什么时机保存 各个 apk 的 信息的?

相关文章

  • mybatis联合多表查询

    数据库表 pms_user_tea表保存教师用户信息 pms_exp表保存实验室信息查询信息:所有教师下的所有实验...

  • --save-dev

    --save:将保存配置信息至package.json -dev:保存至package.json的devDepen...

  • JDK1.7的BASE64Decoder与BASE64Encod

    package com.fpi.epoch.pms.util; import sun.misc.BASE64Dec...

  • jQuery纯前端TODO

    1.0 创建 初始化 --save 会把信息保存到package.json里面INIT 如果有package.js...

  • 第9章 安装软件程序

    本章介绍Linux上各种包管理系统(package management system, PMS),以及用来进行软...

  • 写给Android App开发人员看的Android底层知识(8

     (十)PMS及App安装过程  PMS,全称PackageManagerService,是用来获取Apk包的信息...

  • --save 与--save-dev

    --save-dev:将保存配置信息到 package.json 的 devDependencies节点中。 --...

  • Android widget 管理架构

    Widget 1.AndroidManifast中注册的广播类型,通过pm查询保存在pms集合中, 2.launc...

  • node入门app1

    app 1、使用npm init创建一个package.json文件,这个文件保存着这个项目相关信息2、npm i...

  • 保存信息

    一,分类 二,可检索,可修正 三,不易丢失 四,保存工具存量大 五,重要信息不泄密 六,字体可辩认 即简书,印象笔...

网友评论

      本文标题:PMS 保存 Package 信息

      本文链接:https://www.haomeiwen.com/subject/rwnfpdtx.html