Why can't I remove bloatware apps on secondary users in Android? - General Questions and Answers

For context, I'm using stock Android 13 (rooted) on my Pixel 5, and I, for the life of me, cannot figure out how to remove preinstalled bloatware apps from the secondary users. To clarify, I'm not talking about apps from the primary admin user (i.e. --user 0 in ADB) or work profiles; I'm talking about secondary users in which only one can be used at a time. I have no issues with removing apps from the primary profile, but I actually want to use a secondary user profile without the bloatware. In ADB, the error I get is "Failure [DELETE_FAILED_USER_RESTRICTED]," which leads me to believe that it may be possible to change some parameters using ADB and pm, but I can't seem to find what I'm looking for. I also tried it on the device, since I have root, and that failed, too. As far as I'm aware, I'm one of the first people to inquire about this, so if anyone has any information that can help me with my issue, I would greatly appreciate it. Thanks for reading my post!

My theory. The secondary user is using a separate memory space and perhaps links to actual files (e.g. hard links) rather than real copies.
The purpose of creating a sub-user account is to limit its ability to make changes to the main system, which, as you can see from your analysis, has been achieved.
p.s.
Perhaps also the user id are different and have different permissions in the system.

An Android device can have multiple users, which are the equivalent of users on a computer, if device supports that feature: Note that user 0 isn't always identical with the device administator, it's the default system user - primary user - who exists on all Android installations, he is called root . Secondary users are Android users with separate apps and data saved between sessions will say it’s an entirely different profile with its own apps, settings, wallpaper, and the like.
Each user gets a workspace for installing and placing apps. No user has access to another user's app data. Each user can influence the installed apps for all users. An admin user can remove apps or even the entire workspace set up by secondary users.
Exception: OBB Folder (/sdcard/Android/obb) is used to share files and folder between the multi users, but OBB folder may not be shown in second user.
You manage these users with their specific user id like e..g. user 1027:
Example:
Code:
adb shell "su"
pm uninstall -user <USER-ID> <PACKAGE-NAME>

xXx yYy said:
Code:
adb shell "su"
pm uninstall -user <USER-ID> <PACKAGE-NAME>
Click to expand...
Click to collapse
This didn't work for me. I get the same error: "Failure [DELETE_FAILED_USER_RESTRICTED]." I was running as superuser from ADB. Do you know of any way to work around this?

I've figured out a solution. What I ended up doing was disabling and hiding the bloatware apps using ADB. Unfortunately, this requires root, but I was able to do this since I already had it. Here are the commands I used for each of the packages:
Code:
adb shell
su
pm disable --user USER_ID PACKAGE
pm hide --user USER_ID PACKAGE
If you don't have root, you can still do this for a similar effect:
Code:
adb shell
pm disable-user --user USER_ID PACKAGE
I hope this helps someone out in debloating Android apps from secondary user profiles.

Related

[GUIDE] [EMUI] Improve multitasking experience

I stumbled across com.huawei.iaware thing when I was reading logcat on my Huawei device. As we all know, Huawei implemented their own very aggressive memory management on top of Android,and thus messing up multitasking experience. Even disabling Automatic Launch doesn't help, as background tasks are almost always killed. On my 2GB ram device, multitasking between only 2 apps has been a nightmare.
As seen on logcat, Iaware seems to mimic Android's Low Memory Killer but in the most aggressive way imaginable. This guide can also improve performance and battery (a little bit) as killing apps repeatedly is expensive
To disable com.huawei.iaware without root, assuming you have installed and setup adb, just run
Code:
adb shell pm uninstall -k --user 0 com.huawei.iaware
Note that doing the above command will not actually delete the app in any way and you can still receive Ota updates, but the only way to restore that app is by factory reseting your device
To disable com.huawei.iaware with root, just install Link2sd or any similar app you could think of that can disable system apps. Find com.huawei.iaware and disable it.
Mods, can you move this thread to Hacking and Development - > Android General? Thanks

How do you copy a user?

I can't believe there isn't anything on search for this issue. Does anyone know how to duplicate the current user? I have ADB, root, all the things. I can create a new user, but it seems to be completely blank when I do so and there is no option to copy everything over. I really don't feel like setting everything up again just to uninstall a few apps from the second user I'm trying to create. I'm using Android 11.
A user's data since ever is stored in partition /data/media/<USER_ID> - hence a user's privacy is protected by default.
By means of ADB you can pull these data from user 0 ( primary user ) and push them to user 1 ( secondary user ), and so forth, if user's privacy isn't a concern.
Installed user apps (APKs) always are stored in partition /data/app/<PKG_NAME>-<NUM> what's true for all users - will say there is not a separate department for each existing user -> all users created, unless they are guest users, share these APKs.

pm uninstall -k

There are dozens of various device specific debloat guides scattered about here and most of them use the -k option to keep the packages data and cache directories although I have seen at least one guide that didn't recommend -k.
I'm guessing that the general reason for using the -k option is so that if someone later finds out they really do need the package it can be restored to the same state that it was in prior to being uninstalled.
My question is if I don't use the -k option can that cause the potential use of install-existing to fail?
Or is it simply a matter of losing any package settings that have been changed from the default state and as long as I can remember how I want the package configured it's no big deal to get back to where I was.
So are my assumptions correct or is there a looming disaster awaiting me because I neglected to use the -k option when uninstalling?
guess it's the only way to keep entry in /data/system/packages.xml to force app disabled permanently
Thanks for the response but I don't quite understand. I assumed that the -k option saved the current state of the apps current User Data and Cache as shown in settings > app info > storage.
My understanding of packages.xml is gleaned from context but my best guess is that it's something that controls the overall android build in some way or other.
Any insight you can provide that improves my obviously muddy understanding is appreciated.
right. just guesswork because the documentation doesn't say anything about /data/system/packages.xml. I tought package won't purged when data is kept, so it can remember it when trying to reinstall. Thats the difference, without -k it is simply purged and gone, and treated as new package on reinstall. But it seems I have mixed up with /data/system/users/0/package-restrictions.xml for disabled packages (nowadays uninstalling is done with --user 0 flag which means it's not actually uninstalled but disabled for the user)
https://developer.android.com/studio/command-line/adb#pm

All "Assistive Touch" apps failed on Android 11 Go

I was iPhone user but years ago I switched to Android. Since then I've been using "Assistive Touch" apps on all my android devices. Unfortunately now on latest android devices especially with Go editions all those "Assistive Touch" apps stopped working due to the missing overlay "Draw over other apps" permission
For example I've Sunshine T1 Cloud tablet (with 8" display 2GB RAM 16GB storage, and Android 11) in my hand and I've tried almost every Assistive Touch, Easy Touch, Floating Menu app available in Play Store without success.
There is though an Accessibility Shortcut Menu in stock Settings that is when enabled shows a little doll icon in lower right corner of display. It is a static icon that can't be moved anywhere on screen and thus so unconvenient. It also interferes with the Keyboard Switch Icon that appears at the same placement
I am immensely in need of Assistive Touch app. Is there any solution or alternate available ?
Any solution....
Adb command for the app requesting it like
pm grant com.android.phone android.permission.SYSTEM_ALERT_WINDOW
Did this help you. Android Go disables Displaying Over Other App. The command I posted is the only way to grant any app this permission. So to grant YouTube this permission is
adb shell pm grant com.google.android.youtube android.permission.SYSTEM_ALERT_WINDOW
From a local shell
sh -c pm grant com.google.android.youtube android.permission.SYSTEM_ALERT_WINDOW
Or
pm grant com.google.android.youtube android.permission.SYSTEM_ALERT_WINDOW
If those fail you may need to use another device to set the permissions. You don't need root however some terminal emulators don't have sufficient permission
You can always download Bugjaeger app and in dev settings enable wireless adb and pair your app. This requires split screen. As soon as you move away from the pop up with the pairing code. The code becomes invalid and a new code and ip is required.
Obviously if you have root this not be a issue. I hope this helps.
Here if you need the help
The output will be nothing on most devices when the command is successful. Check the permissions screen to verify it has been marked as yes.
** I have the - Sunshine T1 Cloud tablet **
Ithe bootloader is unlockable and this device is Treble - enabled ** I have not been able to get a GSI installed on it without go Gapps. So unfortunately the tablet will remain a go device. So the command is still the only real way to approve the permissions. So I can verify it works without room but you need to be connected with a different device through adb either. Wired or wifi-adb as non of the terminals I tried worked. It does work in terminal if you have an active device connected to adb from the emulator. So I believe you just need adb active with a device accessing it..
JovialQuestion said:
Did this help you. Android Go disables Displaying Over Other App. The command I posted is the only way to grant any app this permission. So to grant YouTube this permission is
adb shell pm grant com.google.android.youtube android.permission.SYSTEM_ALERT_WINDOW
From a local shell
sh -c pm grant com.google.android.youtube android.permission.SYSTEM_ALERT_WINDOW
Or
pm grant com.google.android.youtube android.permission.SYSTEM_ALERT_WINDOW
If those fail you may need to use another device to set the permissions. You don't need root however some terminal emulators don't have sufficient permission
You can always download Bugjaeger app and in dev settings enable wireless adb and pair your app. This requires split screen. As soon as you move away from the pop up with the pairing code. The code becomes invalid and a new code and ip is required.
Obviously if you have root this not be a issue. I hope this helps.
Here if you need the help
The output will be nothing on most devices when the command is successful. Check the permissions screen to verify it has been marked as yes.
** I have the - Sunshine T1 Cloud tablet **
Ithe bootloader is unlockable and this device is Treble - enabled ** I have not been able to get a GSI installed on it without go Gapps. So unfortunately the tablet will remain a go device. So the command is still the only real way to approve the permissions. So I can verify it works without room but you need to be connected with a different device through adb either. Wired or wifi-adb as non of the terminals I tried worked. It does work in terminal if you have an active device connected to adb from the emulator. So I believe you just need adb active with a device accessing it..
Click to expand...
Click to collapse
Thank you very much...!!!
What you suggested worked like a charm
I'm sorry I couldn't reply in a timely manner
In fact I would've thrown away this device if I had not your precious suggestion
Although its touch is not that smooth but after installation of Assistive Touch, it is now easy on hands.
Thanks once again.
Glad to hear it. Any app that requires that permission on Android 11-12 (Go). You can use the same command just changing the apps name in the command. It will lag a little bit on applications that use a lot of the devices resources. So I wouldn't grant the permission to data consuming apps or ones that run large processes in the background. I'm glad this worked for you.
Great...!!!
Thank you very much

ADB App Management APK

This was built using Tasker but I'll share the extracted APK from App Factory below so it can be used without Tasker.
This is similar to ADB App Control for PC in its functioning. It has several executable commands that can be performed on applications in batches. Current commands are: Install, Enable, Disable, Uninstall, Uninstall Updates, and Reinstall. Requires ADB WiFi access to use. ROOT NOT REQUIRED. Can perform all commands on system applications.
In a nutshell, it makes debloating and re-bloating automated and quick. Can filter applications to show: System, User, Enable, Disabled, and Uninstalled. Also can combine filters and color code applications by their current state. Recently added the ability to save custom lists for quick recall of certain applications.
No experience with ADB necessary.
If you're not sure what uninstalling or disabling system applications can do to your device, you should probably not use this. I take no responsibility for any software issues that occur as a result from using this tool.
TaskerNet Task Import: CLICK HERE
Direct APK for use without Tasker below

Categories

Resources