Marion
2025-03-21 05:55:59 UTC
Reply
Permalinkapps on Android, even system apps, on non-rooted Android over adb.
This tutorial is just one of thousands of examples where it's actually
easier to manage Android from a PC than from the Android device itself.
But what else this tutorial shows, is that no other operating system is
anything like Android in the way that this tutorial shows it works.
I'll add the Linux/Mac folks as the test below will work the same,
only the syntax will be easier (e.g., "grep" instead of "findstr").
=============================================================================
*How to delete Google Discover from both your Android work & user profiles*
<https://www.novabbs.com/computers/article-flat.php?id=57864&group=comp.mobile.android#57864>
Basics:
a. My Samsung Galaxy A32-5G baseband sub-version (H) is not rootable.
b. I have no accounts on the phone (not Google, not Samsung, none).
c. Long ago I wiped out all the bloatware using adb from Windows.
d. I'm on Windows (but the adb commands work the same on any PC).
It's important to note that 'Google Discover' is inside this package.
<com.google.android.googlequicksearchbox>
Looking it up... apparently "Discover" is a personalized feed of content
provided by Google based on your past Google activity, including your
searches, browsing history, and app usage. Yikes! I wouldn't want that.
<https://www.samsung.com/us/support/answer/ANS10001618/#:~:text=Google%20Discover%20is%20just%20a,your%20search%20and%20browsing%20history.>
I have that package on my Android 13 Galaxy so why don't I see "Discover"?
C:\> adb shell pm list packages com.google.android.googlequicksearchbox
(this lists it)
Luckily for me, it's been long ago "disabled" by me (probably en masse):
C:\> adb shell pm list packages -d com.google.android.googlequicksearchbox
(this lists it)
I looked to see if it was "stopped" also (in addition to disabled).
C:\> adb shell "dumpsys package com.google.android.googlequicksearchbox | grep stopped="
The output indicated that the package wasn't installed for "user 0" but it
was installed (& working) for "user 11", so I needed to figure who is who.
C:\> adb shell am get-current-user
This reported that I'm user 0 when running adb
I have a work profile (set up when testing "Island").
Clearly the work profile is this mysterious "user 11".
So for the work profile, the Discover functionality exists, but not for the
main profile of mine (since I don't have any "accounts" set up on my phone).
The first thing I have to do is figure out how many "users" exist.
C:\> adb shell pm list users
Users:
UserInfo{0:Owner:c13} running
UserInfo{11: Island :10b0}
OK. That makes sense that user 0 is me, and user 11 is my work profile.
List if the package is installed for each of those userids, 0 & 11.
C:\> adb shell pm list packages --user 0 com.google.android.googlequicksearchbox
(the package does NOT show up, which means it's not installe)
C:\> adb shell pm list packages --user 11 com.google.android.googlequicksearchbox
(the package does show up, which means it is installed)
To remove it for user 11.
C:\> adb shell pm uninstall --user 11 com.google.android.googlequicksearchbox
Success
To check that it's gone for user 11.
C:\> adb shell pm list packages --user 11 com.google.android.googlequicksearchbox
(the package does NOT show up, which means it's not installed)
As a test, I tried re-installing it (from the system partition).
C:\> adb shell cmd package install-existing com.google.android.googlequicksearchbox
Package com.google.android.googlequicksearchbox installed for user: 0
Notice it worked to re-install the app for user 0 but not for user 11!
To install it back for user 11 is not simple, it turns out.
First, check that it's not there:
C:\> adb shell pm list packages --user 11 | findstr googlequicksearchbox
(nothing was reported)
The re-install for user 11 fails as the system package isn't debuggable.
C:\> adb shell "run-as com.google.android.googlequicksearchbox cmd package install-existing com.google.android.googlequicksearchbox"
run-as: package not debuggable: com.google.android.googlequicksearchbox
Isn't that interesting!
This system package isn't set to debuggable in its manifest.
That's a security measure.
This is a core basic feature of Android I'm hitting that no other OS does!
a. The system partition (always!) contains the base APK!
b. So that's why I could re-install it into the user 0 data partition.
c. But Android won't let me re-install it into the user 11 data partition.
Android's security model enforces strict isolation between user profiles.
This prevents apps in one profile from accessing or modifying data in
another profile.
But there's a trick!
Given you can uninstall and re-install system packages on any non-rooted
Android, but you can only do so for user 0 and not for the work profile
user 11, there's a trick to re-install this non-debuggable system package
for the work profile user 11 which takes advantage of how Android works.
For most (all?) system packages, Android never actually deleted them!
C:\> adb shell pm path com.google.android.googlequicksearchbox
package:/product/priv-app/Velvet/Velvet.apk
Huh? Velvet? It turns out "Velvet" is a Google internal codename.
Now copy that Velvet system APK to the computer:
C:\> adb pull /product/priv-app/Velvet/Velvet.apk .\velvet.apk
/product/priv-app/Velvet/Vel... (276644880 bytes in 8.645s)
Note that I can grab things in the private system area!
(It's read only, but wait, I can install it once I have it!)
Now install that APK from the system partition to the work profile.
C:\> adb install --user 11 .\velvet.apk
Performing Streamed Install
Success
Now check if it's really installed for the work profile user 11.
C:\> adb shell pm list packages --user 11 | findstr googlequicksearchbox
(it's there!)
In summary, this shows empirically how Android handles system packages.
1. Any non-root user can still remove (most) system packages
2. But, they are not deleted. They're just removed for the user
3. They stay in the system partition (since they're system packages)
So...
A. You can easily re-install these deleted system packages for the user
B. But, you have to extract them first, to re-install for the work profile
Who knew?
Not me.
Now I do!
Of course, I removed it since I don't ever want to see Google Discover!
C:> adb shell pm uninstall --user 0 com.google.android.googlequicksearchbox
Success
C:\> adb shell pm uninstall --user 11 com.google.android.googlequicksearchbox
Success
Double checking, they're gone.
C:\> adb shell pm list packages --user 0 com.google.android.googlequicksearchbox
(nothing is reported)
C:\> adb shell pm list packages --user 11 com.google.android.googlequicksearchbox
(nothing is reported)
In summary, this shows how Android works, where no other OS that I know of
works this way.
============================================================================