How to handle uninstall intent on Android 6 and above?

痴心易碎 提交于 2019-12-02 11:04:36

问题


Background

On my "app manager" app, I handled uninstall intent so that users could uninstall apps in the background, using root.

The problem

Up to Android 5.x , all went well and worked fine, but it seems that starting from Android 6, things have changed and the same intent, even though the logs say is being used, cannot be used by the app.

What I've tried

The manifest includes this intent-filter for the activity, as it always had:

  <intent-filter>
    <action android:name="android.intent.action.DELETE"/>
    <action android:name="android.intent.action.UNINSTALL_PACKAGE"/>

    <category android:name="android.intent.category.DEFAULT"/>
    <data android:scheme="package"/>
  </intent-filter>

This is because of the docs, here and here, it says that those are what the framework uses.

I tried to separate the actions, and I tried to look at the logs, but it's exactly the same logs as before. Example:

system_process I/ActivityManager: START u0 {act=android.intent.action.DELETE dat=package:me.scan.android.client flg=0x10800000 cmp=com.google.android.packageinstaller/com.android.packageinstaller.UninstallerActivity (has extras)} from uid 10078 on display 0

It seems as if the framework already decided which app would handle the intent.

The question

Is it possible to still handle uninstall-intent? Even with root?


回答1:


Per this commit, this was an intentional change first seen in the marshmallow-release branch to disallow intercepting the package uninstall UI.



来源:https://stackoverflow.com/questions/36947015/how-to-handle-uninstall-intent-on-android-6-and-above

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!