"uninstall" / "reinstall" apps without factory resetting
Method you describe might be best, looked it up, updated my post.
Thanks for posting,
This XDA tutorial below might be the safest method described in following link
https://www.xda-developers.com/disable-system-app-bloatware-android/
That tutorial only disables a package, my tutorial uninstalls a package and I am not entirely sure that without factory reset my tutorial works.
EDIT 1: I included your comparison and updated my post since the method you point out is much safer in case one wants a package back to be enabled again.
EDIT 2: The difference is now explained and my post says how to DISABLE ONLY or UNINSTALL PERMANENTLY until factory reset.
I've been using the "adb pm uninstall -k --user 0 <package_name>" method for years, and discovered through trial and error that there's no need to do a factory reset the in order to re-enable the "uninstalled" apps. Contrary to popular belief, the "pm uninstall" command doesn't actually erase the app's apk, rather just hides it from the app manager. Therefore "uninstalled" apps can be "reinstalled" individually using the following method, without the need for a factory reset.
First, make a make a backup list of all your currently installed apps via ADB:
adb shell pm list packages -f >C:\AppList.txt
For example, let's "uninstall" the Samsung Smart Switch app which can be found in the above AppList.txt file as
/system/preload/SmartSwitch/SmartSwitch.apk=com.sec.android.easyMover
Sometimes the app's name matches the package/file name perfectly, sometimes they are a little different and takes a bit of guessing.
The package name of the Samsung Smart Switch app is "com.sec.android.easyMover", with its path and file name "/system/preload/SmartSwitch/SmartSwitch.apk", as you can see at least the path and file name contains the name of the app.
To disable it via the "uninstall" command, enter:
adb shell pm uninstall -k --user 0 <package/component>
Example:
adb shell pm uninstall -k --user 0 com.sec.android.easyMover
OR
adb shell cmd package uninstall -k --user 0 com.sec.android.easyMover
Now, to re-enable the above "uninstalled" app or any other specific one without a factory reset, simply copy and paste the app's package name from the AppList.txt into this command:
adb shell cmd package install-existing <package/component>
Example:
adb shell cmd package install-existing com.sec.android.easyMover
OR
Copy and paste the app's path and file name from the AppList.txt into the "install" command, like this:
adb shell pm install -d -r --user 0 <app's_path/file_name)>
Example:
adb shell pm install -d -r --user 0 /system/preload/SmartSwitch/SmartSwitch.apk
OR
adb shell cmd package install -d -r --user 0 /system/preload/SmartSwitch/SmartSwitch.apk
We are using the "pm" package manager to simply reinstall the app from its current location which can be easily found in the previously prepared AppList.txt file.
The reason for including two slightly different versions of the commands, is to have a backup method in case one of them fails.
The "-d -r" options is to allow replacement of existing applications and version code downgrading.
The advantage of using the "uninstall"/"install" method is that there's no need to purchase any package disabler apps, and it works even on non-rooted devices, plus you may even learn something.
Hope this might come in handy for some.
