简体   繁体   中英

How to handle uninstall intent on Android 6 and above?

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?

根据此提交,这是首次在marshmallow-release 分支中看到的有意更改,以禁止拦截包卸载 UI。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM