android-in-china / Compatibility

用于反馈和跟踪国内 Android 设备/ROM 兼容性问题的公益项目
836 stars 30 forks source link

MIUI 破坏了全部 PackageInstaller API 的功能 #28

Open vvb2060 opened 2 years ago

vvb2060 commented 2 years ago

在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

表现为安装请求一律返回错误代码,无法安装应用。另外,有部分设备由于安装失败,在放弃此安装会话 时,会接到权限异常。

java.lang.RuntimeException: Error receiving broadcast Intent { act=APKInstall flg=0x10 pkg=io.github.vvb2060.packageinstaller.test (has extras) } in a.s$i@3b656f3
  at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1708)
  at android.app.LoadedApk$ReceiverDispatcher$Args$$ExternalSyntheticLambda0.run(Unknown Source:2)
  at android.os.Handler.handleCallback(Handler.java:938)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loopOnce(Looper.java:210)
  at android.os.Looper.loop(Looper.java:299)
  at android.app.ActivityThread.main(ActivityThread.java:8087)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
Caused by: java.lang.SecurityException: Caller has no access to session 1099467425
  at android.os.Parcel.createExceptionOrNull(Parcel.java:2425)
  at android.os.Parcel.createException(Parcel.java:2409)
  at android.os.Parcel.readException(Parcel.java:2392)
  at android.os.Parcel.readException(Parcel.java:2334)
  at android.content.pm.IPackageInstaller$Stub$Proxy.abandonSession(IPackageInstaller.java:648)
  at android.content.pm.PackageInstaller.abandonSession(PackageInstaller.java:530)
  at a.s$i.onReceive(APKInstall.java:13)
  at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1694)
  ... 9 more