Android PackageInstaller API silent update test app

Overview

PackageInstaller 静默升级 演示应用

用于检测 PackageInstaller API 是否正常的测试应用。 该 API 自 API 级别 21(Android 5.0)起可用。 从 API 级别 31(Android 12)起,PackageInstaller 支持静默升级。

MIUI 破坏了此 API

在MIUI 12.5 之前,开启 MIUI 优化时无法正常使用。具体表现为com.miui.packageinstaller未实现android.content.pm.action.CONFIRM_INSTALL

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.content.pm.action.CONFIRM_INSTALL flg=0x10000000 pkg=com.miui.packageinstaller (has extras) }

关闭 MIUI 优化时使用 Google 安装器,恢复正常。

在 MIUI 12.5 及以后,部分版本恢复正常,随即又被破坏。问题来源于系统,无法通过升级软件包安装器修复,但依然可通过关闭 MIUI 优化绕过问题逻辑。

E/PKMSImpl: MIUILOG- assertCallerAndPackage: uid=10018, installerPkg=io.github.vvb2060.packageinstaller.test, msg=Permission denied

API 注意事项

在 Android 12 之前,此 API 常见用途为安装拆分包,非拆分 apk 大多使用 intent 传递给系统安装器安装。

在 Android 12 及以后,由于支持静默升级,可能会全面开始使用此 API,这是本应用诞生的直接原因:提供示例代码以供测试。

静默升级的要求有:

  1. 已经允许安装未知应用操作。可主动要求用户开启,也可发起一次安装,系统自会要求用户开启。
  2. 升级自身或由自己安装的应用。升级其它应用时,需要该应用的安装者为自己,即以前通过 PackageInstaller API 安装的应用,系统安装器无效。
  3. apk 已经适配 Android 10 或更高。即 Target API >= 29,此条件以后会增加。
  4. 30 秒以内没有静默升级过同一款应用。参考 SilentUpdatePolicy
  5. 永远做好接收STATUS_PENDING_USER_ACTION的准备。

用户非常容易把静默升级当成应用崩溃,因此需要合理的引导。 应用打开时触发的升级可接收android.intent.action.MY_PACKAGE_REPLACED广播弹出更新完成通知。 但更建议在后台进行升级,如果需要用户确认可发送通知。

由于安装会话除非显式放弃,否则一直可用,包括在重启设备后,因此也可等待下次打开应用时让用户确认(此功能本演示应用未实现,一律直接丢弃)。

You might also like...

In the application, users should be able to register, login and create/update/delete their own to-do lists.

Mini TO-DO app About the project Todoist In the application, users should be able to register, login and create/update/delete their own to-do lists. Y

Nov 22, 2022

Share food-Android- - Food donation coded in native android with firebase, google maps api and php server xampp

Share food-Android- - Food donation coded in native android with firebase, google maps api and php server xampp

share_food-Android- Instructions: 1. Create a firebase account and link it with the project via google-services.json. 2. This project also uses a XAMP

Dec 28, 2021

A password strength test app with strength, estimated crack times, warnings and suggestions to help make better passwords.

A password strength test app with strength, estimated crack times, warnings and suggestions to help make better passwords.

Is Your Password Secure? A password strength test app which displays strength, estimated crack time and provides warnings and suggestions to help make

Dec 15, 2022

Spring Boot microservices app with Spring Cloud, Robust and resilient backend managing e-Commerce app

Spring Boot microservices app with Spring Cloud, Robust and resilient backend managing e-Commerce app

e-Commerce-boot μServices Important Note: This project's new milestone is to move The whole system to work on Kubernetes, so stay tuned. Introduction

Dec 23, 2022

This app corrects your sitting posture and provides feedback in real time in conjunction with the app. A sensor of 31 cells detects your posture to get better life-wellness

This app corrects your sitting posture and provides feedback in real time in conjunction with the app. A sensor of 31 cells detects your posture to get better life-wellness

Notichair 실시간 자세분석 및 교정 스마트체어 🏆 상명대학교 PRIME 경진대회 수상 🏆 요구사항 31-cell sensor (mdxs-16-5610) 목차 1. 소개 프로젝트 내용 소개 2. 개발 환경 사전 설정 및 환경 구축 3. 기능 Sensors Ap

Jan 15, 2022

An implementation of a sample E-Commerce app in k8s. This online retail marketplace app uses Spring Boot, React, and YugabyteDB.

An implementation of a sample E-Commerce app in k8s. This online retail marketplace app uses Spring Boot, React, and YugabyteDB.

An implementation of a sample E-Commerce app in k8s. This online retail marketplace app uses Spring Boot, React, and YugabyteDB.

Oct 27, 2022

Spring Boot Rest API unit test with Junit 5, Mockito, Maven

Spring Boot Rest API unit testing with Junit 5, Mockito, Maven Apply Spring Boot @WebMvcTest for Rest Controller Unit Test with JUnit 5 and Mockito. F

Dec 22, 2022

Aliucord - Discord Android app mod inspired by desktop Discord client mods.

Aliucord Aliucord is a modification for the Android Discord app inspired by desktop client modifications. Unlike other Android Discord app modificatio

Dec 31, 2022

PortalController - A rudimentary TeamViewer-like remote control app for Android, using ws.

PortalController A TeamViewer-like app for Android-to-Android remote control, using node.js and websockets (ws). Some insight The reason I call it rud

Dec 15, 2022
Comments
  • 给APP自启动权限就能正常出现APP Updated

    给APP自启动权限就能正常出现APP Updated

    机型:Redmi K40 Gaming 系统版本:Android 12 MIUI版本:21.1.13 操作:授权PackageInstallersTest这个APP自启权限,然后打开bginstall,安装APP 结果:安装完成后出现APP Updated通知,符合预期 所以是小米他们修复了? 编辑:未关闭MIUI优化

    opened by hamjin 2
Owner
南宫雪珊
南宫雪珊
Android Auto Apps Downloader (AAAD) is an app for Android Phones that downloads popular Android Auto 3rd party apps and installs them in the correct way to have them in Android Auto.

Android Auto Apps Downloader (AAAD) is an app for Android Phones that downloads popular Android Auto 3rd party apps and installs them in the correct way to have them in Android Auto.

Gabriele Rizzo 865 Jan 2, 2023
Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstall apk.

Tinker Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstalling apk. Getting started Add t

Tencent 16.6k Dec 30, 2022
Very briefly capturing some of new/ update in API that were introduced after Java 8 that may come handy for dev folks while programming

Very briefly capturing some of new/ update in API that were introduced after Java 8 that may come handy for dev folks while programming. Also have created tests demonstrating those APIs and playaround with it.

Jayaramanan Kumar 3 Jan 24, 2022
This app brings Privacy dashboard features from Android 12 to older android devices.

PrivacyDashboard This app brings Privacy dashboard features from Android 12 to older android devices. Have you ever thought which apps are accessing y

Rushikesh Kamewar 234 Jan 7, 2023
Simple Android app during a coding night. Just Learning Firebase and Android

KUI-App Simple Android app during a coding night. Just Learning Firebase and Android What we learned: Some basics of Android Basic setup of Firebase:

Kibabii University Informatics Club (KUI) 7 Aug 28, 2022
Auto-Unit-Test-Case-Generator automatically generates high-level code-coverage JUnit test suites for Java, widely used within the ANT Group.

中文README传送门 What is Auto-Unit-Test-Case-Generator Auto-Unit-Test-Case-Generator generates JUnit test suites for Java class just as its name. During te

TRaaS 108 Dec 22, 2022
this repo is probs gonna die cuz idk very much java but i will update it when i learn how to actually DO SHIT

pastegod.cc shitty rename of zihasz client base rn but as i learn java i will paste-i mean add modules ;) (23/9/2021) why is everyone starring and wat

null 9 Dec 9, 2022
Assistant to create, update and validate Modget manifests

Modget Create This tool helps to create Modget Manifests, which is used by the mod Modget. Modget Create (or MGC for short) is NOT perfect, but will a

null 5 Aug 13, 2022
CRUD about create, update and delete items like fish and fishbowl

CreacionPecesYPeceras Este repositorio contiene el código fuente y la base de datos (fichero .sql) que conforman una aplicación CRUD (Create, Read, Up

Ale Cueto Jiménez 9 Mar 2, 2022
We have created a techblog website where a user can post technical posts and edit and update the post accordingly.

TechBlog Introduction - In this project we have created a technical blog website where we have provided functionalities such as 1) SignUp 2) Login 3)

Riya Vijay Vishwakarma 2 Jan 23, 2022