History log of /system/core/adb/services.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
f366b3698b409405e1ee88476d1186f29fe14b06 16-Mar-2012 Benoit Goby <benoit@android.com> adb: Don't synchronize with transport using sleep

Services that cause adbd to reboot are currently implemented this way:
write(fd, response)
close(fd)
sleep(1)
exit(1)
sleep(1) is necessary to leave time for the transport to transmit
the response before the daemon exits. This is slow and unreliable.
Instead, add a flag to the asocket to make it exit the daemon only
after the socket is closed.

Change-Id: I9df45ea6221f0d9b828703b9b2316a5d4fe59352
/system/core/adb/services.c
7941cf87f624e7747b5bb868a27904c7a3be0ca4 16-Mar-2012 Benoit Goby <benoit@android.com> Revert "Reimplement the "adb root" command to more closely match its previous behavior"

This reverts commit 535164e9d9649a83d4d63829f3389f2bea339fe1.
/system/core/adb/services.c
535164e9d9649a83d4d63829f3389f2bea339fe1 22-Jun-2011 Mike Lockwood <lockwood@android.com> Reimplement the "adb root" command to more closely match its previous behavior

The adb gadget driver used to reset the USB bus when the adbd daemon exited,
and the host side adb relied on this behavior to force it to reconnect
with the new adbd instance after init relaunches it. The new gadget
drivers no longer automatically reset the USB bus when adbd is restarted
which caused adb to hang since it was no longer forced to reconnect with the
device. We attempted to work around this on the host side adb, but that
work around has not been reliable.

This change adds a property trigger on the service.adb.root system property
which will reset the USB bus and restart the adbd daemon when adbd sets
the property to 1. This should be much closer to the previous behavior
and will hopefully fix some problems with automated testing.

Change-Id: I177c37400009a3d83f21a5f9431f94fd1cc19b9b
Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/services.c
702967afb1bebc97c0b8a23c075d4932820ef7a3 18-May-2011 Christopher Tate <ctate@google.com> Add 'adb restore' to parallel 'adb backup'

It won't actually do anything until the 'bu' tool and framework are
updated to respond properly, but this is the adb side of the
necessary infrastructure: we copy the tarfile into the socket pointed
at the device, using the existing mechanisms.

Change-Id: Ic3b5779ade256bd1ad989a94b0685f7b1a7d59d2
/system/core/adb/services.c
d2f5415c603f7d9961f7a0b05579a0768e071410 21-Apr-2011 Christopher Tate <ctate@google.com> Add 'adb backup' for pulling a full backup tarfile to the host

The direct command interfaces with the 'bu' binary in /system/bin
on the device.

Change-Id: I4cd69eedfe5144c47277573c5626c6ad8755d70b
/system/core/adb/services.c
408fa57864c01113deaa213e5c1848a9c594ae92 16-Mar-2011 JP Abgrall <jpa@google.com> adb: fix subprocess exit handling, oom adjust fixes, extra debugging.

* Add support for correctly handling subprocess termination in shell service (b/3400254 b/3482112 b/2249397)
- have a waitpid() track the subprocess, then notify the fdevent via a socket
- force an eof on the pty master in fdevent's new subproc handler.
- modify fdevent to force-read the pty after an exit.
* Migrate the "shell:blabla" handling to "#if !ADB_HOST" sections, where it
belongs.
* Fix the race around OOM adjusting.
- Do it in the child before exec() instead of the in the parent as the
child could already have started or not (no /proc/pid/... yet).
* Allow for multi-threaded D() invocations to not clobber each other.
- Allow locks across object files.
- Add lock within D()
- Make sure sysdesp init (mutex init also) is called early.
* Add some missing close(fd) calls
- Match similar existing practices near dup2()
* Add extra D() invocations related to FD handling.
* Warn about using debugging as stderr/stdout is used for protocol.
* Fix some errno handling and make D() correctly handle it.
* Add new adb trace_mask: services.
* Make fdevent_loop's handle BADFDs more gracefully (could occur some subproc closed its pts explicitely).
* Remove obsolete commandline args reported in help. (b/3509092)


Change-Id: I928287fdf4f1a86777e22ce105f9581685f46e35
/system/core/adb/services.c
e3aeeb4de34dbb93e832e6554f494122ba633f3b 08-Mar-2011 Ken Sumrall <ksumrall@android.com> Try to unmount writable filesystems when rebooting

Ext4 filesystems like to be unmounted before rebooting. The Android system
doesn't have a traditional Linux init setup, and shutting down the system
was not much more than calling sync(2) and reboot(2). This adds a new
function to libcutils called android_reboot(). By default, it calls sync()
and then remounts all writable filesystems as read-only and marks them clean.
There is a flag parameter in which the caller can ask for sync() not to be
called, or to not remount the filesystems as read-only. Then it will call
reboot(2) as directed by the other parameters. This change also updates
adb, init and toolbox to call the new android_reboot() function.
Fixes bugs 3350709 and 3495575.

Change-Id: I16d71ffce3134310d7a260f61ec6f4dd204124a7
/system/core/adb/services.c
0e7c4274c687446dbe30a814278d7a6b99da8c4e 24-Feb-2011 JP Abgrall <jpa@google.com> Revert "Fix adb hang when subprocess dies early."

This is for http://b/3482112 "adb interactions with device causing test harness failures".

This reverts commit 69c5c4c45bd4f1575ae8bdba13795297be7deb8c.

Change-Id: I630bf2e04d2ecf0223bd2af4e87136754ff880d3
/system/core/adb/services.c
69c5c4c45bd4f1575ae8bdba13795297be7deb8c 18-Feb-2011 JP Abgrall <jpa@google.com> Fix adb hang when subprocess dies early.

* Handling of the subprocess and its FD.
This fixes http://b/3400254 "Many bugreports getting hung at the end in monkey"
- Start up a service thread that waits on the subprocess to terminate,
then closes the FD associated with it.
- Have the event handler select() with a timeout so that it can
detect the closed FD. Select() with no timeout does not return when an FD is closed.
- Have the event handler force a read on the closed FD to trigger the close sequence.
- Migrate the "shell:blabla" handling to "#if !ADB_HOST" sections.
* Fix the race around OOM adjusting.
- Do it in the child before exec() instead of the in the parent as the
child could already have started or not (no /proc/pid/... yet).
* Allow for multi-threaded D() invocations to not clobber each other.
- Allow locks across object files.
- Add lock within D()
* Add some missing close(fd) calls
- Match similar existing practices near dup2()
* Add extra D() invocations related to FD handling.
* Warn about using debugging as stderr/stdout is used for protocol.

Change-Id: Ie5c4a5e6bfbe3f22201adf5f9a205d32e069bf9d
Signed-off-by: JP Abgrall <jpa@google.com>
/system/core/adb/services.c
95ef82866c7a922bf588027aa38c58a45eb84d9c 02-Feb-2011 Benoit Goby <benoit@android.com> Fix adb leaking file descriptors to forked processes

accept() creates a new file descriptor that should be closed on exec so
that forked processes don't keep a fd opened on the socket.

This also fixes b/3297070 where adb hangs after running adb on the
target.

Change-Id: I8df511289e5549ae49b4824c9dfb71a3bf85eae8
/system/core/adb/services.c
d969faa161310d0a3792766320daa3200b84bd74 24-Feb-2010 Mike Lockwood <lockwood@android.com> adb: Attempt to unmount the SD card before rebooting.

Change-Id: Idd4d96b4704f4e1bd324e72bca87611a23e30801
Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/services.c
b6b40079e6d5b32026cc2abfcb71adfd49e8d954 19-Sep-2009 Mike Lockwood <lockwood@android.com> adb: Clean up argument passing for create_service_thread()

Change-Id: Id68b312e76215e8e217b42ca0301713dbddfee9e
Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/services.c
91acb14877e7138879057f794a61ee2fd424a41d 04-Sep-2009 Joe Onorato <joeo@android.com> Revert "adb: Another attempted workaround for the adb disconnect problem."

This reverts commit cc1de48dcdf06c76ee14abbe2a237aa51b5b3bad.

lockwood says to take this out.
/system/core/adb/services.c
f56d1b5a76c6cb282a7689fc93f85de63bd205f6 03-Sep-2009 Mike Lockwood <lockwood@android.com> Revert "adb: "adb bugreport" now runs dumpstate via init rather than execing it in the shell."

This reverts commit be0045aafdbc2ec2ee448be86952082361f5d672.
This change broke compatibility with previous versions of adbd, so I will be implementing this
by modifying the bugreport command on the device instead.
/system/core/adb/services.c
be0045aafdbc2ec2ee448be86952082361f5d672 03-Sep-2009 Mike Lockwood <lockwood@android.com> adb: "adb bugreport" now runs dumpstate via init rather than execing it in the shell.

This allows dumpstate to run as root even if adbd is not.

Change-Id: I04bda1ee0c8de91677149a2a9eda713c85067aa4
Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/services.c
ff19670d485fd5ee296e23b00b035ac22975c647 25-Aug-2009 Mike Lockwood <lockwood@android.com> adb: Improved support for running adb over TCP/IP

Added new commands:

adb connect <host>:<port> (to connect to a device via TCP/IP)
adb tcpip <port> (to restart adbd on the device to listen on TCP/IP)
adb usb (to restart adbd on the device to listen USB)

Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/services.c
ee15662140632672a6878787a1ff26f5ebdc1e68 05-Aug-2009 Mike Lockwood <lockwood@android.com> adb: add "adb reboot" command.

This will allow rebooting the device via adb on any build, including user builds.
An optional argument can be provided
(for example, "adb reboot bootloader" or adb reboot recovery")

Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/services.c
cc1de48dcdf06c76ee14abbe2a237aa51b5b3bad 31-Jul-2009 Mike Lockwood <lockwood@android.com> adb: Another attempted workaround for the adb disconnect problem.

For adb shell commands (as well as shell based commands like logcat and bugreport) we now
batch USB writes into 4K chunks instead of sending small packets of data as they come in.
A timeout prevents us from blocking for more than 100ms when our 4K buffer is partially full.

Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/services.c
02d40b51c6d9f9dfc91f7d3b17a1f4f6db1ea972 11-Jun-2009 Mike Lockwood <lockwood@android.com> Revert "adb: Workaround for adb disconnect problem."

This reverts commit e38a31e305b0944c0cd1ae782e47e3145d731f0f.

This change had the unfortunate side effect of breaking ctrl-C
when executing "adb shell <command>"

Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/services.c
e38a31e305b0944c0cd1ae782e47e3145d731f0f 03-Jun-2009 Mike Lockwood <lockwood@android.com> adb: Workaround for adb disconnect problem.

For non-interactive adb shell commands, batch USB writes into 4K chunks
instead of sending small packets of data as they come in.
Add a timeout so we do not block for more than 200ms when our 4K buffer is partially full.

Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/services.c
249ad57a887680538d1dc0195e746b1d877ebd6a 20-May-2009 Mike Lockwood <lockwood@android.com> adb: adbd no longer disables OOM and now sets children's OOM adjustment to zero

Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/services.c
e037fd7e193ecccbb5c0888e49f6d58c224bc11d 13-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake_rel/...@138607
/system/core/adb/services.c
dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/system/core/adb/services.c
e54eebbf1a908d65ee8cf80bab62821c05666d70 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/system/core/adb/services.c
5ae090ed949cea9d1e7ab1552b455a229f8f9757 10-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@125939
/system/core/adb/services.c
4f6e8d7a00cbeda1e70cc15be9c4af1018bdad53 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/system/core/adb/services.c