0x192 / universal-android-debloater

Cross-platform GUI written in Rust using ADB to debloat non-rooted android devices. Improve your privacy, the security and battery life of your device.
GNU General Public License v3.0
15.59k stars 825 forks source link

Unable to disable or uninstall packages on older android versions #78

Closed eauchat closed 2 years ago

eauchat commented 2 years ago

First, thanks a lot for the amazing software, it works very well and I very much appreciate it!! :)

Lately I've been trying to debloat an old huawei device with android 4.2.2 on it. The UAD interface somehow seems to display the "Disable"/"Uninstall" buttons dimmer, and clicking them does nothing.

I searched but didn't find documentation on that kind of issue. What could be the reason why it's not working? Thanks a lot for the attention :)

eauchat commented 2 years ago

Actually, I'm also encountering the same issue with a Xiaomi device running android 7.1. I wonder if there's anything I'm doing wrong, but I don't think so.

0x192 commented 2 years ago

First, thanks a lot for the amazing software, it works very well and I very much appreciate it!! :)

Thanks! :)

The UAD interface somehow seems to display the "Disable"/"Uninstall" buttons dimmer, and clicking them does nothing.

Can you upload the logfile here please?

eauchat commented 2 years ago

Can you upload the logfile here please?

Yep, sure.

I just reproduced the bug right now, this is what I did:

  1. plugged the phone,
  2. opened the app,
  3. tried disabling a few apps (= clicked on the red "disable" button right from their names).
  4. went to settings and changed to "uninstalling" mode
  5. back to the apps list, tried uninstalling a few apps (= clicked on the red "uninstall" button right from their names).
  6. switched back to "disabling" mode

The uad.log file isn't so talkative, that's the full content of it after the mentioned operations:

2021-12-04 20:16:16 INFO  [src/gui/mod.rs:80] ANDROID_SDK: 17 | PHONE: Huawei HUAWEI Y330-U01
2021-12-04 20:16:19 WARN  [src/gui/views/list.rs:121] No custom selection imported: No such file or directory (os error 2)
2021-12-04 20:21:40 INFO  [src/gui/views/settings.rs:46] Disable mode disabled
2021-12-04 20:21:55 INFO  [src/gui/views/settings.rs:46] Disable mode enabled
matchatealeaf commented 2 years ago

I have the same issue on my Samsung Galaxy Note 8.0 (LTE) running Android 4.4.2. I'm not sure if this is relevant since my Android version is slightly different from OP's 4.2.2.

Running pm disable-user com.android.chrome in adb shell returns sh: resetreason: can't execute: Permission denied.

I believe on 4.0+ pm disable-user requires root access. A quick search online shows that pm block is the common substitute for pm disable-user in 4.0+ without root access. Running

am force-stop com.android.chrome
pm block com.android.chrome
pm clear com.android.chrome

seems to work, and com.android.chrome is listed in UAD under the "Uninstalled" filter.

Perhaps the pm block option can be provided in the settings?

sbechet commented 2 years ago

see #63

0x192 commented 2 years ago

Mhm... on Android 8.0 pm disable-user works without root. I'm pretty sure it works without root since Android 5.0.

@eauchat Can you confirm you also need root on your Android 4.4.2 phone?

adb shell pm disable-user <package>

pm disable doesn't work without root on Android 5+ so I don't think it will work but let's try just in case.

adb shell pm disable <package>


Perhaps the pm block option can be provided in the settings?

Yes but pm block only works on Android 4.4.2. I don't know what to use on older versions...


Can you both confirm pm uninstall still works on your phone ? (be careful, you can't restore the package with a command)

pm uninstall <package>

One thing I noticed is that even if the multi-user system was implemented in Android 4.2, pm uninstall can't be used with a specific user.

matchatealeaf commented 2 years ago

Mhm... on Android 8.0 pm disable-user works without root. I'm pretty sure it works without root since Android 5.0.

I think you misread my post, I'm talking about Android 4.4.2 on an old Galaxy Note 8.0 from 2013, not the Galaxy Note 8 from 2017.

Can you both confirm pm uninstall still works on your phone ? (be careful, you can't restore the package with a command)

On Android 4.4.2, pm uninstall works for me on an app that I installed myself, e.g.

pm uninstall com.aurora.store

However, it returns Failure on a built-in app, e.g.

pm uninstall com.android.chrome
eauchat commented 2 years ago

@0x192, to answer your request

On that android 4.2.2 device, I ran the following commands and got the results you can see:

shell@android:/ $ pm disable-user com.google.android.apps.maps
pm disable-user com.google.android.apps.maps
Killed 
137

shell@android:/ $ pm disable com.google.android.apps.maps
pm disable com.google.android.apps.maps
Killed 
137

shell@android:/ $ pm uninstall com.google.android.apps.maps
pm uninstall com.google.android.apps.maps
Failure

It doesn't seem that anything changed on the device, app is still present.

I also tried what @matchatealeaf uses (pm block ...) but block command probably didn't exist in android 4.2 (Error: unknown command 'block').

I'm not able to root that device (thanks to huawei), so I can't test if any of those command would work with root.

0x192 commented 2 years ago

Ok. This is the last issue before the release of the v0.4. Sorry for the late reply.

I didn't manage to find my old Android 4.4 phone so I couldn't do some tests.

I think you misread my post, I'm talking about Android 4.4.2 on an old Galaxy Note 8.0 from 2013, not the Galaxy Note 8 from 2017.

No, I understood that. I probably did not express myself very well. I wanted to point out that since disable-user doesn't require root since Android 5.0, it seems odd that this is not the case for Android 4.4.2.

According to @matchatealeaf, pm disable-user needs root on Android 4.4.2 but @eauchat succeed without it on Android 4.2.2

At the same time, pm disable was possible without root on Android 4.2.2 which is no longer the case since Android 5.0.

Did you both perform the commands on a already uninstalled package? Because Failure it's the typical return value of pm uninstall <already_uninstalled_package>


It doesn't seem that anything changed on the device, app is still present.

Are you sure about that? Can you list it with this command?

adb shell pm list packages -s | grep com.google.android.apps.maps

In the end, it seems that we weirdly can use pm disable-user on Android 4+ but not on Android 4.4.2

I'll make an exception to for Android 4.4.x and use pm block instead of pm disable-user

eauchat commented 2 years ago

According to @matchatealeaf, pm disable-user needs root on Android 4.4.2 but @eauchat succeed without it on Android 4.2.2

Ah, well maybe I wasn't clear or something, but there seems to be a misunderstanding there. Maybe the

Killed 
137

in the logs I sent are supposed to mean the command worked, but the result isn't there. The app is still listed, and is still on the home screen, clickable, even after running all of the commands I mentioned.

Maybe there's something I didn't really get in your message @0x192, but to me the commands are failing to achieve my goal, which is to remove or at least disable the apps. Not sure I can bring more useful information on the table on why it's failing though.

Thanks for your efforts still :)

0x192 commented 2 years ago

I finally got my old Android 4.4 phone back.

1) I'm dumb. There was a nasty bug in my code preventing any action on older phones (< Android 8.0). c188479 fixed this.

2) I can confirm we can only use pm block/pm unblock on Android 4.4.4 . All other commands need root. Old ADB version are really bad and have barely no error handling. ADB commands can return the 0 exit code even if there is an error. ADB doesn't check if the package exists. It does not return any error if you try to pm block a non-existent package. Some commands are even killed by ADB before finishing and UAD can't catch the output. It seems to be the (questionable) behavior when the privileges are not high enough. I also noticed that pm block doesn't set the package to the disabled state but to the uninstalled state.

3) @eauchat Unfortunately I think we're screwed without root on even older (< Android 4.4.4). There is no other commands besidespm disable <package>, pm disable-user --user <user> <package> and pm uninstall <package>.

eauchat commented 2 years ago

Well, the situation you describe with ADB showing bad error messages and no error handling, reflects quite well what I've observed. Thanks a lot for investigating the situation and trying to find solutions @0x192 :) Great that this ticket helped solve that bug in the code :)

Gaming-pandatje commented 1 year ago

I want to delete some apps from my old phone (sm-a500fu android 6.0.1) but when I click on the uninstall button nothing happens is there any way to fix this?

Pietzcker commented 1 year ago

I have the same issue here (Android 6.0.1 on a Samsung Galaxy J5 (SM-J500FN)) - the device is detected, but it doesn't list anything under "Recommended/Enabled/All Lists", and when I manually search for things like facebook, Microsoft etc. and select them, clicking on Uninstall (individually or on "Uninstall Selected") doesn't do anything...

Pietzcker commented 1 year ago

To update this: The logfile shows that all the attempts to pm uninstall --user 0 com.xxx.yyy end in Failure - not installed for 0, but when I execute them manually in the adb shell, they work perfectly. So it seems to be a GUI issue?

Gaming-pandatje commented 1 year ago

Yeah I found this also out yesterday but still thanks all the bloatware is now gone on my device.