Commit 3949c89f authored by Nate Fischer's avatar Nate Fischer Committed by Commit Bot

AW docs: add manual steps for removing system apps

This adds a collapsible section with manual steps for removing system
apps. This is helpful in case the script is broken (I've heard this is
still the case for some devices) or someone wants to remove a different
system app (ex. WebView shell).

Fixed: 1006037
Test: tools/md_browser/md_browser.py
Test: Upload to gerrit > open file > click "gitiles"
Change-Id: Id7a1bce22df6246bba34b6926a818c24c0e2d37c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2419812
Auto-Submit: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: default avatarLaís Minchillo <laisminchillo@chromium.org>
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808908}
parent 354b86b8
......@@ -165,6 +165,14 @@ Otherwise, you can remove the preinstalled WebView like so:
android_webview/tools/remove_preinstalled_webview.py
```
*** note
If you're using an emulator, make sure to [start it with
`-writable-system`](/docs/android_emulator.md#writable-system-partition)
**before** removing the preinstalled WebView.
***
If the script doesn't work, see the [manual steps](removing-system-apps.md).
### Important notes for N-P
_This functionality was added in N and removed in Q, so you should skip this if
......
# Removing system apps
<!--
Ideally this would just be a "details" element on build-instructions.md, but
gitiles markdown does not support this tag.
-->
Removing a system app isn't WebView-specific, but it's occasionally necessary
for WebView development.
We have an [automated script to remove the preinstalled
WebView](build-instructions.md#Removing-preinstalled-WebView) from the device,
but if this script does not work or you need to remove a different system app,
you can manually run the following adb commands. This uses
"com.google.android.webview" as an example, but change the package name as
necessary for your case.
```sh
# Uninstall updates. Repeat "adb uninstall" until it fails with the
# "DELETE_FAILED_INTERNAL_ERROR" error message to make sure you've removed all
# the updates.
$ adb uninstall com.google.android.webview
Success
$ adb uninstall com.google.android.webview
Failure [DELETE_FAILED_INTERNAL_ERROR]
# Figure out the path of the system app. This varies depending on OS level.
$ adb shell pm path com.google.android.webview
package:/system/app/WebViewGoogle/WebViewGoogle.apk
$ adb root
# This is necessary for M and up:
$ adb disable-verity
$ adb reboot
# wait for device to reboot...
$ adb root
# For all OS versions:
# Mount the system partition as read-write and 'rm' the path we found before.
$ adb remount
$ adb shell stop
$ adb shell rm -rf /system/app/WebViewGoogle/WebViewGoogle.apk
$ adb shell start
```
......@@ -74,29 +74,11 @@ following [commandline-flags.md](./commandline-flags.md).
### INSTALL\_FAILED\_UPDATE\_INCOMPATIBLE: Package ... signatures do not match previously installed version
The easiest way to workaround this is to [change the shell's package name in a
local build](#building-for-the-emulator).
If you **need** to use the same package name (ex. you're installing an official
build of WebView shell), then you can modify the system image.
*** note
**Note:** If using the emulator ensure it is being started with the
`-writable-system` option as per the
[Writable system partition](/docs/android_emulator.md#writable-system-partition)
instructions.
***
```sh
# Remount the /system partition read-write
$ adb root
$ adb remount
# Get the APK path to the WebView shell
$ adb shell pm path org.chromium.webview_shell
package:/system/app/Browser2/Browser2.apk
# Use the APK path above to delete the APK
$ adb shell rm /system/app/Browser2/Browser2.apk
# Restart the Android shell to "forget" about the WebView shell
$ adb shell stop
$ adb shell start
```
This may be happening because the shell is preinstalled on your device (ex. this
is the case on all emulators). **The easiest way** to workaround this is to
[change the shell's package name in a local build](#building-for-the-emulator).
If you don't want to (or can't) change the package name, then you may be able to
modify your device's system image. See the [manual steps for removing system
apps](removing-system-apps.md) and replace **com.google.android.webview** with
**org.chromium.webview_shell**.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment