安卓系统应用比data分区应用版本号新怎么办

148 阅读1分钟

安卓9代码:

PackageManagerService

/**
     * Adds a new package to the internal data structures during platform initialization.
     * <p>After adding, the package is known to the system and available for querying.
     * <p>For packages located on the device ROM [eg. packages located in /system, /vendor,
     * etc...], additional checks are performed. Basic verification [such as ensuring
     * matching signatures, checking version codes, etc...] occurs if the package is
     * identical to a previously known package. If the package fails a signature check,
     * the version installed on /data will be removed. If the version of the new package
     * is less than or equal than the version on /data, it will be ignored.
     * <p>Regardless of the package location, the results are applied to the internal
     * structures and the package is made available to the rest of the system.
     * <p>NOTE: The return value should be removed. It's the passed in package object.
     */

If the package fails a signature check,the version installed on /data will be removed. If the version of the new package is less than or equal than the version on /data, it will be ignored.

意味着系统分区应用版本号小于或者等于data分区的应用,则data应用会被保留。(这里是指那些系统应用通过更新方式安装到data分区的)