Discussion:
Tutorial: Working example of removing & re-installing Android system apps from a PC
Add Reply
Marion
2025-03-21 05:55:59 UTC
Reply
Permalink
This tutorial below shows how you can do tricks with a PC to manage the
apps 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.
============================================================================
Kenny McCormack
2025-03-24 19:15:20 UTC
Reply
Permalink
In article <vriv1f$on5$***@nnrp.usenet.blueworldhosting.com>,
Marion <***@facts.com> wrote:
...
Post by Marion
In summary, this shows how Android works, where no other OS that I know of
works this way.
Are you saying that is a Good Thing or a Bad Thing?
--
Donald Drumpf claims to be "the least racist person you'll ever meet".

This would be true if the only other person you've ever met was David Duke.
Marion
2025-03-24 21:09:10 UTC
Reply
Permalink
Post by Kenny McCormack
Post by Marion
In summary, this shows how Android works, where no other OS that I know of
works this way.
Are you saying that is a Good Thing or a Bad Thing?
Android has advantages that no other common consumer operating system has.
So it's good.

For example, unlike every other common consumer operating system, Android
*ALWAYS* automagically saves the original APK which was used to install the
app, no matter who or what entity had originally installed that app.
a. If Samsung installed that app, then Samsung's APK is always saved;
b. If T-Mobile installed that app, then T-Mobile's APK is always saved;
c. If the user installed that app, the user's APK is always saved.

That fact that the original APK is *ALWAYS* on the system can be useful.

To my knowledge, that's just one of the many things that Android does which
is unique to the Android operating system. No other OS does that, AFAIK.

There's more that Android does which is unique, but saving every single APK
on the system, no matter who installed it, is unique (AFAIK) to Android.

Is it not?
Lawrence D'Oliveiro
2025-03-24 22:55:07 UTC
Reply
Permalink
Post by Marion
To my knowledge, that's just one of the many things that Android does
which is unique to the Android operating system. No other OS does that,
AFAIK.
On Debian derivatives, while the original .deb package file is not saved
per se, it is possible to recreate it from the installed items with the
dpkg-repack command.
Marion
2025-03-25 08:33:21 UTC
Reply
Permalink
Post by Lawrence D'Oliveiro
Post by Marion
To my knowledge, that's just one of the many things that Android does
which is unique to the Android operating system. No other OS does that,
AFAIK.
On Debian derivatives, while the original .deb package file is not saved
per se, it is possible to recreate it from the installed items with the
dpkg-repack command.
Well then, that's kind of the same thing. Thanks for adding that value.
If you can re-create/extract a working installer, I'll count that as a win.

One might ask why it is a great idea to always have the original installer.

A *huge* advantage of the APK always being there is it helps to populate
another phone (or a billion other phones), since you can COPY that APK.

If it's a free app (i.e., not restricted) and if the obligatory hardware
versions and API levels are compatible, it's easy to populate any other
phone with the same apps that you have on one phone.

How cool is that?

Remember, there's no special software required. No backup necessary.
The APK is always waiting for you. It's there if you ever need it.
Tango Romeo
2025-03-26 02:09:49 UTC
Reply
Permalink
Post by Marion
A *huge* advantage of the APK always being there is it helps to populate
another phone (or a billion other phones), since you can COPY that APK.
Why aren't the installer programs restricted only to the user's ID account?
Loading...