summaryrefslogtreecommitdiffstats
path: root/minadbd/minadbd_services.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2020-12-14Do not call exit() immediately after serving sideloadKelvin Zhang1-1/+40
Wait for socket to close before exit(), so that last "DONEDONE" message is correctly sent. Test: enter recovery, sideload an OTA, verify that no read error occured on client side. Repeat 5 times. Bug: 155158483 Change-Id: Ibb02548d8c03fb77f8f60cb69cff84c33903adc0
2020-04-01minadbd: statically link libadbd.Josh Gao1-0/+4
Reduce the amount of wasted space on the recovery image by statically linking all of the adb libraries into minadbd. Bug: http://b/150317254 Test: booted aosp_walleye-eng into recovery Change-Id: I5233b1a23c14f9d478bb77c25ebdbb0ce45bcc5a Merged-In: I5233b1a23c14f9d478bb77c25ebdbb0ce45bcc5a (cherry picked from commit 5ee3eba34f0ddf478f53ac4d0774c1ee423a5182)
2020-03-31minadbd: statically link libadbd.Josh Gao1-0/+4
Reduce the amount of wasted space on the recovery image by statically linking all of the adb libraries into minadbd. Bug: http://b/150317254 Test: booted aosp_walleye-eng into recovery Change-Id: I5233b1a23c14f9d478bb77c25ebdbb0ce45bcc5a
2019-10-05minadbd: Return battery level via getprop.Tao Bao1-2/+16
`adb rescue getprop rescue.battery_level` returns the current battery level. Bug: 134560109 Test: Build and boot into rescue mode. Test: `adb rescue getprop ro.build.fingerprint` Test: `adb rescue getprop rescue.battery_level` Test: `adb rescue getprop` to dump all the properties. Test: Run recovery_unit_test. Change-Id: I78a9e8ab9783ffc8532cb93e6a64fb2157c19bd5
2019-09-26minadbd: Export minadbd/types.h to libinstall.Tao Bao1-1/+1
Test: mmma bootable/recovery Change-Id: I503e942b23cc51024aa752c1eb3db5455a44a9d1
2019-07-17minadbd sends heartbeat to rescue service for getprop command.Tao Bao1-0/+8
We start minadbd and rescue services in two processes. In particular, minadbd handles the requests from host, then communicates with rescue service to do install/wipe works. When resuce service doesn't see any request in a pre-defined timeout (currently 300s), rescue service will exit to avoid endless waiting. This CL changes minadbd to additionally send a no-op command to rescue service as a heartbeat signal, so that host side can finish time-consuming operations (e.g. downloading over network) while keeping rescue service alive. Bug: 136457446 Test: Enter resuce mode on blueline. Send `adb rescue getprop ro.build.fingerprint` and check that rescue service doesn't exit. Test: Stop sending the getprop command. Check that rescue service exits after 300s. Change-Id: Ib9d5ed710cfa94ecfe6cf393a71a0b67b2539531 Merged-In: Ib9d5ed710cfa94ecfe6cf393a71a0b67b2539531 (cherry picked from commit 2223e6a9f8bf24b023e8ae3103b50c37def3147e) (cherry picked from commit 0bbb2ed53eb4dc4ae8d447062482f9eda5ef9a91) (cherry picked from commit dd0158ac6016f2853d1af336e345980e06144abd)
2019-07-16minadbd sends heartbeat to rescue service for getprop command.Tao Bao1-0/+8
We start minadbd and rescue services in two processes. In particular, minadbd handles the requests from host, then communicates with rescue service to do install/wipe works. When resuce service doesn't see any request in a pre-defined timeout (currently 300s), rescue service will exit to avoid endless waiting. This CL changes minadbd to additionally send a no-op command to rescue service as a heartbeat signal, so that host side can finish time-consuming operations (e.g. downloading over network) while keeping rescue service alive. Bug: 136457446 Test: Enter resuce mode on blueline. Send `adb rescue getprop ro.build.fingerprint` and check that rescue service doesn't exit. Test: Stop sending the getprop command. Check that rescue service exits after 300s. Change-Id: Ib9d5ed710cfa94ecfe6cf393a71a0b67b2539531 Merged-In: Ib9d5ed710cfa94ecfe6cf393a71a0b67b2539531 (cherry picked from commit 2223e6a9f8bf24b023e8ae3103b50c37def3147e) (cherry picked from commit 0bbb2ed53eb4dc4ae8d447062482f9eda5ef9a91)
2019-07-11minadbd sends heartbeat to rescue service for getprop command.Tao Bao1-0/+8
We start minadbd and rescue services in two processes. In particular, minadbd handles the requests from host, then communicates with rescue service to do install/wipe works. When resuce service doesn't see any request in a pre-defined timeout (currently 300s), rescue service will exit to avoid endless waiting. This CL changes minadbd to additionally send a no-op command to rescue service as a heartbeat signal, so that host side can finish time-consuming operations (e.g. downloading over network) while keeping rescue service alive. Bug: 136457446 Test: Enter resuce mode on blueline. Send `adb rescue getprop ro.build.fingerprint` and check that rescue service doesn't exit. Test: Stop sending the getprop command. Check that rescue service exits after 300s. Change-Id: Ib9d5ed710cfa94ecfe6cf393a71a0b67b2539531 Merged-In: Ib9d5ed710cfa94ecfe6cf393a71a0b67b2539531 (cherry picked from commit 2223e6a9f8bf24b023e8ae3103b50c37def3147e)
2019-07-09minadbd sends heartbeat to rescue service for getprop command.Tao Bao1-0/+8
We start minadbd and rescue services in two processes. In particular, minadbd handles the requests from host, then communicates with rescue service to do install/wipe works. When resuce service doesn't see any request in a pre-defined timeout (currently 300s), rescue service will exit to avoid endless waiting. This CL changes minadbd to additionally send a no-op command to rescue service as a heartbeat signal, so that host side can finish time-consuming operations (e.g. downloading over network) while keeping rescue service alive. Bug: 136457446 Test: Enter resuce mode on blueline. Send `adb rescue getprop ro.build.fingerprint` and check that rescue service doesn't exit. Test: Stop sending the getprop command. Check that rescue service exits after 300s. Change-Id: Ib9d5ed710cfa94ecfe6cf393a71a0b67b2539531
2019-07-09minadbd: delete unnecessary fdevent.h include.Josh Gao1-1/+0
Test: treehugger Change-Id: I09e9850dabbd71bffbe568f240f9fde8b3743e5e
2019-06-11minadbd: `adb rescue getprop` returns newline-terminated result.Tao Bao1-10/+7
This change addresses the comment in [1], which makes the results of `adb shell getprop foo` and `adb rescue getprop foo` more consistent. That is, both will return newline-terminated results now. [1] https://r.android.com/c/platform/bootable/recovery/+/976340/3/minadbd/minadbd_services.cpp#188 Fixes: 134027350 Test: Run the following commands on taimen (under rescue mode): `adb rescue getprop ro.build.fingerprint` `adb rescue getprop ro.nonexistent` `adb rescue getprop` Change-Id: I5af47f8ea4d569b8507e259daef87749c0945f47 Merged-In: I5af47f8ea4d569b8507e259daef87749c0945f47 (cherry picked from commit 57a27890cec050d36a0d2d6e7db008cd22eb0560)
2019-06-10minadbd: `adb rescue getprop` returns newline-terminated result.Tao Bao1-10/+7
This change addresses the comment in [1], which makes the results of `adb shell getprop foo` and `adb rescue getprop foo` more consistent. That is, both will return newline-terminated results now. [1] https://r.android.com/c/platform/bootable/recovery/+/976340/3/minadbd/minadbd_services.cpp#188 Test: Run the following commands on taimen (under rescue mode): `adb rescue getprop ro.build.fingerprint` `adb rescue getprop ro.nonexistent` `adb rescue getprop` Change-Id: I5af47f8ea4d569b8507e259daef87749c0945f47
2019-06-06minadbd: Support `adb rescue getprop`.Tao Bao1-5/+18
It dumps all the allowed properties, similar to `adb shell getprop`. Bug: 134027350 Test: Run the command under rescue mode. Change-Id: Ic0864ca0fb51505ec1e4f38af2464591aa576201 Merged-In: Ic0864ca0fb51505ec1e4f38af2464591aa576201 (cherry picked from commit d8db81a01464c53c9bd6dbff32194faed85b6ccc)
2019-06-06minadbd: More allowed properties.Tao Bao1-1/+8
Most of these properties are already part of the fingerprint. This CL allows querying them directly, instead of encouraging users to decode from fingerprints. Bug: 134027350 Test: Boot into rescue mode on taimen. Run `adb rescue getprop` with new props. Change-Id: Id4667fcaf0e908c391085b22e22c957acd01d9c4 Merged-In: Id4667fcaf0e908c391085b22e22c957acd01d9c4 (cherry picked from commit 3b9ef341be618885407bc302ffc235585bc01c5d)
2019-06-05minadbd: Support `adb rescue getprop`.Tao Bao1-5/+18
It dumps all the allowed properties, similar to `adb shell getprop`. Bug: 134027350 Test: Run the command under rescue mode. Change-Id: Ic0864ca0fb51505ec1e4f38af2464591aa576201
2019-06-03minadbd: More allowed properties.Tao Bao1-1/+8
Most of these properties are already part of the fingerprint. This CL allows querying them directly, instead of encouraging users to decode from fingerprints. Bug: 134027350 Test: Boot into rescue mode on taimen. Run `adb rescue getprop` with new props. Change-Id: Id4667fcaf0e908c391085b22e22c957acd01d9c4
2019-05-03ConsumePrefix is now in libbase.Elliott Hughes1-5/+5
Test: treehugger Change-Id: I2feecabb77986d3e007de1009b123c2d98454631
2019-04-30Support wipe command in rescue modexunchang1-6/+40
Bug: 131037235 Test: unit tests pass, run `adb rescue wipe` Change-Id: I22668f2c98fe2d9195d2561f961c28a7c08e712c (cherry picked from commit fedeef6f6d1f7b8f1e5a8b9e77f8dc21ef6b3c95)
2019-04-26minadbd: Support `adb reboot` under sideload/rescue modes.Tao Bao1-2/+41
Bug: 128415917 Test: Run the following commands under sideload and rescue modes respectively. $ adb reboot $ adb reboot bootloader $ adb reboot recovery $ adb reboot rescue $ adb reboot invalid Change-Id: I84daf63e3360b7b4a0af5e055149a4f54e10ba90 Merged-In: I84daf63e3360b7b4a0af5e055149a4f54e10ba90 (cherry picked from commit 10f441a9dbb91be3124f455439631abcf8e96cde)
2019-04-26Add test for minadbdxunchang1-1/+7
Ass some unit tests to check if the minadbd service exit correctly in the failure case. Also start the fuse and verify the socket communication between minadbd with adb host, and minadbd with recovery. Bug: 131037235 Test: run unit tests repeatedly, injects some errors and test fails without dangling process. Change-Id: I2f073b701b25d7f1aafc59868a7a91a8cbefaf49 Merged-In: I2f073b701b25d7f1aafc59868a7a91a8cbefaf49 (cherry picked from commit 9c04eb46b7492033e4675bd303a8bb20548081b5)
2019-04-26minadbd: Support rescue install and getprop commands.Tao Bao1-14/+81
Bug: 128415917 Test: Enter rescue mode on taimen. Send the following commands: `adb rescue getprop ro.build.fingerprint` `adb rescue getprop ro.build.date.utc` `adb rescue install /path/to/package.zip` Test: Sideload on taimen w/ `adb sideload /path/to/package.zip`. Change-Id: Ibc25daf9fd13f7002e54789f67aaf85d06976bb8 Merged-In: Ibc25daf9fd13f7002e54789f67aaf85d06976bb8 (cherry picked from commit ed717ca17d0b1a35f2d2e57802e2381a6004fdd1)
2019-04-26Remove the FD parameter from FuseDataProvider ctor.Tao Bao1-2/+1
This leaves the FD implementation details to subclasses. In particular, it allows minadbd to do additional works with the FD after sideloading. Bug: 128415917 Test: atest recovery_component_test Test: atest minadbd_test Test: Sideload package on taimen. Change-Id: I106bbaad05201227bbc5fe28890bbbb06fdcb67e Merged-In: I106bbaad05201227bbc5fe28890bbbb06fdcb67e (cherry picked from commit 2be9737cf449dd0650c85ee5168d09b12d386077)
2019-04-26Allow entering rescue mode via recovery UI.Tao Bao1-0/+6
Only enabled on debuggable builds. Bug: 128415917 Test: Sideload package on taimen. Test: Choose "Enter rescue" from recovery UI. Change-Id: I913dbdbcffd3179e6fa72ca862f74ca8f1364b02 Merged-In: I913dbdbcffd3179e6fa72ca862f74ca8f1364b02 (cherry picked from commit c6dc325e88a25201aa3856e6532c3ed14203a376)
2019-04-26Support wipe command in rescue modexunchang1-6/+40
Bug: 131037235 Test: unit tests pass, run `adb rescue wipe` Change-Id: I22668f2c98fe2d9195d2561f961c28a7c08e712c
2019-04-24minadbd: Support `adb reboot` under sideload/rescue modes.Tao Bao1-2/+41
Bug: 128415917 Test: Run the following commands under sideload and rescue modes respectively. $ adb reboot $ adb reboot bootloader $ adb reboot recovery $ adb reboot rescue $ adb reboot invalid Change-Id: I84daf63e3360b7b4a0af5e055149a4f54e10ba90
2019-04-23Add test for minadbdxunchang1-1/+7
Ass some unit tests to check if the minadbd service exit correctly in the failure case. Also start the fuse and verify the socket communication between minadbd with adb host, and minadbd with recovery. Bug: 131037235 Test: run unit tests repeatedly, injects some errors and test fails without dangling process. Change-Id: I2f073b701b25d7f1aafc59868a7a91a8cbefaf49
2019-04-19minadbd: Support rescue install and getprop commands.Tao Bao1-14/+81
Bug: 128415917 Test: Enter rescue mode on taimen. Send the following commands: `adb rescue getprop ro.build.fingerprint` `adb rescue getprop ro.build.date.utc` `adb rescue install /path/to/package.zip` Test: Sideload on taimen w/ `adb sideload /path/to/package.zip`. Change-Id: Ibc25daf9fd13f7002e54789f67aaf85d06976bb8
2019-04-17Allow entering rescue mode via recovery UI.Tao Bao1-0/+6
Only enabled on debuggable builds. Bug: 128415917 Test: Sideload package on taimen. Test: Choose "Enter rescue" from recovery UI. Change-Id: I913dbdbcffd3179e6fa72ca862f74ca8f1364b02
2019-04-16DO NOT MERGE: Add socket communication between recovery and minadbdxunchang1-7/+66
This cl adds a socket pair to support the communication between recovery and minadbd. Therefore, minadbd will be able to issue multiple commands to recovery and get back the status of each command. This cl also switches the adb sideload from the recovery menu to use this protocol; and moves minadbd to a separate binary. Bug: 130166585 Test: sideload a package Change-Id: I80d36d5c4e6fe1ae3ea23640907bc50c0dc0d482 (cherry picked from commit 34690ced91e22f5d9b5dd19c33b11c8e0b4bafa0)
2019-04-16Remove the FD parameter from FuseDataProvider ctor.Tao Bao1-2/+1
This leaves the FD implementation details to subclasses. In particular, it allows minadbd to do additional works with the FD after sideloading. Bug: 128415917 Test: atest recovery_component_test Test: atest minadbd_test Test: Sideload package on taimen. Change-Id: I106bbaad05201227bbc5fe28890bbbb06fdcb67e
2019-04-11Add socket communication between recovery and minadbdxunchang1-7/+66
This cl adds a socket pair to support the communication between recovery and minadbd. Therefore, minadbd will be able to issue multiple commands to recovery and get back the status of each command. This cl also switches the adb sideload from the recovery menu to use this protocol; and moves minadbd to a separate binary. Bug: 130166585 Test: sideload a package Change-Id: I80d36d5c4e6fe1ae3ea23640907bc50c0dc0d482
2019-03-19Remove the provider_vtabxunchang1-1/+5
It's no longer needed with the newly added FuseDataProvider class. Also cleans up the parameters for run_fuse_sideload. Bug: 127071893 Test: unit tests pass, run a sideload Change-Id: I1ccd6798d187cfc6ac9f559ffb3f3edf08dad55c
2019-03-19Create a FuseDataProvider base classxunchang1-1/+1
The fuse data provider for adb/sdcard shares common code and structures. This cl creates a FuseDataProvider base class and provides implementations for adb and sdcard. In the follow cls, we can kill the provider_vtab struct; and also add another implementation to parse a block map file and provides data. Test: unit tests pass, sideload a package, apply a package from sdcard Change-Id: If8311666a52a2e3c0fbae0ee9688fa6d01e4ad09
2019-01-02minadbd: daemon_service_to_fd takes std::string_view.Tao Bao1-7/+7
The caller of daemon_service_to_fd() in core adb has switched to std::string_view in [1]. The mismatch breaks the sideload service, as it picks up the wrong daemon_service_to_fd() when serving sideload. [1] https://android-review.googlesource.com/c/platform/system/core/+/850392 Bug: 122171762 Test: `adb sideload` on taimen. Change-Id: Ie828400768523c35c5576e2c029e38fc0ad0aff9
2018-09-27Allow OTA package size larger than 2GiB(2147483647 bytes) on sideload.katao1-10/+11
At present, multiple partitions such as vendor have been added, which reduces the coupling between mobile phone manufacturers and Android systems. However, it may increase the generated package size substantially (e.g. from ~200MB to ~800MB). Causes the package size to exceed the int limit (2147483647 bytes). Change the int length parameters to long. Bug: http://b/112003354 Test: adb sideload ota.zip (ota.zip bigger than 2147483647 bytes) Change-Id: Ifb656431f7b961ac0e91754107578dc8b89ff14e Signed-off-by: katao <katao@xiaomi.com>
2018-07-27minadbd: avoid overrriding services_to_fd.Josh Gao1-22/+8
Previously, we were relying on linker ordering pulling in minadbd's copy of services_to_fd instead of libadbd's, which breaks when we switch to dynamically linking. Separate out libadbd's services into a separate function that's in a file that isn't built into libadbd, so that we can provide our own here. Bug: http://b/111831478 Test: mma Change-Id: I2479947b2d81db5e750020fffc2c2c770cb31a78
2018-04-14minadbd: track signature change of service_to_fd.Josh Gao1-1/+1
Bug: http://b/37066218 Bug: http://b/71898863 Test: treehugger Change-Id: I5f2b14c65cff8d41dd3230d78b87e3e27e489bf6 (cherry picked from commit 570b08b7904901162ae2d4c847b19c1aa9738aaf)
2018-04-14minadbd: track signature change of service_to_fd.Josh Gao1-1/+1
Bug: http://b/37066218 Bug: http://b/71898863 Test: treehugger Change-Id: I5f2b14c65cff8d41dd3230d78b87e3e27e489bf6
2017-10-12Drop -Wno-unused-parameter.Tao Bao1-15/+15
The only one left is libedify. Will handle that in a separate CL. Test: mmma bootable/recovery Change-Id: I732a5f85229da90fd767bee2e46c5c95f529c396
2017-04-19Minor clean up to minadbd_services.cppTianjie Xu1-9/+7
Switch some function signatures to std::string to avoid memory leak. Bug: 30039381 Test: sideload a package on angler Change-Id: Iae1e75871a782d6e5d6dde5dcf3f18469eb63f7d
2017-04-13minadbd: switch adb_thread_create to std::thread.Josh Gao1-27/+3
Test: treehugger Change-Id: I7edcb13eb1fc6d4f36f5a764a1b647fbf9cd063e
2016-11-16Use static_cast to cast pointers returned by malloc/calloc/realloc/mmap.Rahul Chaudhry1-1/+1
static_cast is preferable to reinterpret_cast when casting from void* pointers returned by malloc/calloc/realloc/mmap calls. Discovered while looking at compiler warnings (b/26936282). Test: WITH_TIDY=1 WITH_STATIC_ANALYZER=1 mma Change-Id: Iaffd537784aa857108f6981fdfd82d0496eb5592 Merged-In: I151642d5a60c94f312d0611576ad0143c249ba3d
2016-11-09Use static_cast to cast pointers returned by malloc/calloc/realloc/mmap.Rahul Chaudhry1-1/+1
static_cast is preferable to reinterpret_cast when casting from void* pointers returned by malloc/calloc/realloc/mmap calls. Discovered while looking at compiler warnings (b/26936282). Test: WITH_TIDY=1 WITH_STATIC_ANALYZER=1 mma Change-Id: I151642d5a60c94f312d0611576ad0143c249ba3d
2016-06-17Minor minadbd cleanup.Elliott Hughes1-3/+2
Distinguish our "services.cpp" more clearly from the regular adbd "services.cpp", and remove a few useless includes of "sysdeps.h". Change-Id: Ided4945a3ac5916133322ca7e95fa51add9abaa4
2016-02-23minadbd: update for adb_thread_create signature change.Josh Gao1-2/+1
Change-Id: Ifa0b4d8c1cf0bb39abac61984ff165e82e41222c (cherry picked from commit cc07b3556510d03e389a8994a8e5dbed3f3bbbb4)
2016-02-13minadbd: update for adb_thread_create signature change.Josh Gao1-2/+1
Change-Id: Ifa0b4d8c1cf0bb39abac61984ff165e82e41222c
2015-09-30minadbd: use strdup() to create argument for sideload thread.Yabin Cui1-2/+4
So sideload thread will not use argument which is to be freed in the main thread. Bug: 23968770 Change-Id: I9d6dadc6c33cfbe4b5759382a80fe14cd0d54355
2015-09-24minadbd: move from D() to VLOG().Yabin Cui1-2/+1
Change-Id: I542e2ae8f5ef18b2d6b3dbc1888b3ce1e02a7404
2015-09-04minadbd: update service_to_fd() signature.David Pursell1-1/+1
No functional change, just matching the signature to an adb change. See https://android-review.googlesource.com/#/c/169601/. Change-Id: Ic826864e126054849b3a4d193ded8acc5ee5269c
2015-05-05Track adb_thread_create API change.Elliott Hughes1-4/+2
Change-Id: Ia3f30f3ba85c0246d4b667fb7723cfcdce299d4a
2015-04-28Stop using adb_strtok, and check argument validity.Elliott Hughes1-9/+10
(cherry picked from commit ba45ddf37cf4543143af6b2e27fc1214f3dbe892) Change-Id: Iba4f77f7db54ca0184437bd8ea96abfadabc72a3
2015-04-28Stop using adb_strtok, and check argument validity.Elliott Hughes1-9/+10
Change-Id: I323ffda71b82cc939aed446f9c9fb86ca78df153
2015-04-10Switch minadb over to C++.Elliott Hughes1-14/+8
Change-Id: I5afaf70caa590525627c676c88b445d3162de33e
2015-02-25Fix LP64 build for minadbd.Narayan Kamath1-2/+2
services.c:57:12: error: format '%llu' expects argument of type 'long long unsigned int', but argument 2 has type 'uint64_t' [-Werror=format=] Change-Id: Ieba691bf9e7a30c8bb38f4e1f36e86b6ea3f8c80
2015-02-25Fix build from implicit declaration.Dan Albert1-6/+8
Turn the warning on by default and turn on -Werror so this doesn't happen next time. Change-Id: Id65bf0cb63bbf0ff224655b425463ae2f55435df
2015-02-19Remove dead code.Dan Albert1-38/+0
This code doesn't exist in the normal adb, so it just makes it harder to diff the two. Change-Id: Ibb21b49bb9944c4245199536cbe88e8a107cf00d
2015-02-19Use headers from adb.Dan Albert1-2/+2
adb.h has diverged a bit, so that one will be more involved, but these three are all trivial, unimportant changes. Change-Id: Ief8474c1c2927d7e955adf04f887c76ab37077a6
2014-07-10refactor fuse sideloading codeDoug Zongker1-2/+2
Split the adb-specific portions (fetching a block from the adb host and closing the connections) out from the rest of the FUSE filesystem code, so that we can reuse the fuse stuff for installing off sdcards as well. Change-Id: I0ba385fd35999c5f5cad27842bc82024a264dd14
2014-07-02sideload without holding the whole package in RAMDoug Zongker1-33/+18
Implement a new method of sideloading over ADB that does not require the entire package to be held in RAM (useful for low-RAM devices and devices using block OTA where we'd rather have more RAM available for binary patching). We communicate with the host using a new adb service called "sideload-host", which makes the host act as a server, sending us different parts of the package file on request. We create a FUSE filesystem that creates a virtual file "/sideload/package.zip" that is backed by the ADB connection -- users see a normal file, but when they read from the file we're actually fetching the data from the adb host. This file is then passed to the verification and installation systems like any other. To prevent a malicious adb host implementation from serving different data to the verification and installation phases of sideloading, the FUSE filesystem verifies that the contents of the file don't change between reads -- every time we fetch a block from the host we compare its hash to the previous hash for that block (if it was read before) and cause the read to fail if it changes. One necessary change is that the minadbd started by recovery in sideload mode no longer drops its root privileges (they're needed to mount the FUSE filesystem). We rely on SELinux enforcement to restrict the set of things that can be accessed. Change-Id: Ida7dbd3b04c1d4e27a2779d88c1da0c7c81fb114
2014-02-06recovery: fix building with pointer-to-int errors turned onColin Cross1-2/+2
Use intptr_t/uintptr_t to cast between pointer and int to allow building with -Werror=pointer-to-int-cast and Werror=int-to-pointer-cast turned on. Cast to char* instead of unsigned int for pointer arithmetic. Change-Id: Ia862306fdcca53866b330e8cf726f3d62f2248a0
2013-01-09exit instead of return if sideload file creation failsEthan Yonker1-1/+1
A return here leaves adb sideload in a permanent loop. An exit is more appropriate for this error. Change-Id: I80fb8abae4f6378833aa75f9eaf7ec1acd44b274 Signed-off-by: Ethan Yonker <ethanayonker@gmail.com>
2012-03-20run minadbd as shell user, remove unused codeDoug Zongker1-0/+1
Make minadbd drop its root privileges after initializing. We need to make the /tmp directory writable by the shell group so that it can drop the sideloaded file there.
2012-03-20run minadbd as shell userDoug Zongker1-0/+1
Make minadbd drop its root privileges after initializing. We need to make the /tmp directory writable by the shell group so that it can drop the sideloaded file there. Change-Id: I67b292cf769383f0f67fb934e5a80d408a4c131d
2012-01-18support "sideload over ADB" modeDoug Zongker1-0/+161
Rather than depending on the existence of some place to store a file that is accessible to users on an an unbootable device (eg, a physical sdcard, external USB drive, etc.), add support for sideloading packages sent to the device with adb. This change adds a "minimal adbd" which supports nothing but receiving a package over adb (with the "adb sideload" command) and storing it to a fixed filename in the /tmp ramdisk, from where it can be verified and sideloaded in the usual way. This should be leave available even on locked user-build devices. The user can select "apply package from ADB" from the recovery menu, which starts minimal-adb mode (shutting down any real adbd that may be running). Once minimal-adb has received a package it exits (restarting real adbd if appropriate) and then verification and installation of the received package proceeds. always initialize usb product, vendor, etc. for adb in recovery Set these values even on non-debuggable builds, so that the mini-adb now in recovery can work.
2012-01-10support "sideload over ADB" modeDoug Zongker1-0/+161
Rather than depending on the existence of some place to store a file that is accessible to users on an an unbootable device (eg, a physical sdcard, external USB drive, etc.), add support for sideloading packages sent to the device with adb. This change adds a "minimal adbd" which supports nothing but receiving a package over adb (with the "adb sideload" command) and storing it to a fixed filename in the /tmp ramdisk, from where it can be verified and sideloaded in the usual way. This should be leave available even on locked user-build devices. The user can select "apply package from ADB" from the recovery menu, which starts minimal-adb mode (shutting down any real adbd that may be running). Once minimal-adb has received a package it exits (restarting real adbd if appropriate) and then verification and installation of the received package proceeds. Change-Id: I6fe13161ca064a98d06fa32104e1f432826582f5