0

Can someone help me with an problem please?

I have an A20e (SM-A202F) phone and I try to clear all apps data and cache with adb with this command:

cmd package list packages | cut -d":" -f2 | while read package; do pm clear $package && echo $package; done

All working fine but at some point for whatever reason its stuck at one random app... I try again and the same thing, at another app is stuck and is not finishing to clear all apps. I also want to specify that I'm trying to do this on stock firmware, the latest one.

Someone have an ideea please? Thanks a lot and please excuse my English, I'm not native.

UPDATE: I found that when pm clear command stops working on the phone screen appears an message: Security policy restrics clearing of application data....

  • Try using the `pm clear-app-data` command, instead of `pm clear` – Gandhi Dec 08 '22 at 07:59
  • @Gandhi Thanks, I will try and come back with results. Thanks a lot! Samsung's Stock Firmware have 379 apps installed in total, a lot of bloatware, at least I want to clear all data from time to time. –  Dec 08 '22 at 08:04
  • @Gandhi I have this error when I run `pm clear-app-data`: `Unknown command: clear-app-data` ... –  Dec 08 '22 at 08:44
  • you can also try the `-k` (forces pm clear to kill the app before clearing data) or the `user 0` flag (id 0 is typically primary user). But that probably won't change anything about the privacy settings. You have to change them in your Settings (Privacy, Security, etc.). Note that you maybe have to restart your device for the changes to take effect. – Gandhi Dec 08 '22 at 09:20
  • If you got that error, try to update your `pm` tool on your device to the latest version, by either installing the latest android version or with `adb`, because your `pm` is to old for `clear-app-data` or not available on the android version of your device. If you still get the error, after updating `pm` try the `user` flag with `pm clear`. **Update**: Please note that `pm clear-app-data` only clears the app data and not the cache. – Gandhi Dec 08 '22 at 09:25
  • In Settings (Privacy, Security) I found nothing about that. Also the `-k` or `--user 0` flags do nothing, same problem. I think is an "issue" or some restriction from stock firmware, some apps don't have "Clear Data" or "Clear Cache". –  Dec 08 '22 at 09:28
  • well the last try could be using `adb shell` and manually removing the data, but you have to know what to remove and what not, because you can delete anything there, including any saved settings, preferences, and progress. – Gandhi Dec 08 '22 at 09:33

0 Answers0