History log of /external/devlib/devlib/utils/android.py
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
836f184ad6da4abf088973cd40a05b1d6351c4bc 25-Oct-2017 Kevin DuBois <kevindubois@google.com> Merge branch 'master' of ssh://github.com/ARM-software/devlib

Change-Id: I6d3051f6ef0e49ea2efb26daec42ff1cd0dce8b0
a679d579fd7bf4f7fbcf42b74334ee9b95db9931 20-Oct-2017 Brendan Jackman <brendan.jackman@arm.com> LogcatMonitor: Fix opening logfile for write
/external/devlib/devlib/utils/android.py
71d5b8bc79b4c2a89422836e6f7169f16a2d3640 12-Oct-2017 Brendan Jackman <brendan.jackman@arm.com> LogcatMonitor: Fix clear_log
/external/devlib/devlib/utils/android.py
1d85501181fd205f4c670dd4e7a2d4b1778459ed 21-Sep-2017 Brendan Jackman <brendan.jackman@arm.com> utils/android: Use pexpect for LogcatMonitor

Using a pexpect.spawn object simplifies the LogcatMonitor by removing
the need for a separate thread along with the synchronization that
brings. Since pexpect.spawn creates a logfile that is flushed with
each write, it also removes the need for code to handle flushing.

I originally wrote this to allow more complex features that are made
possible by the pexpect API, however I then discovered those features
are not necessary and did not submit this for merging.

However I then discovered that in Python 2.7,
threading.Event.wait (used in the `wait_for` method) makes the task
uninterriptible (i.e. can't be killed with Ctrl+C/SIGINT), which is
rather frustrating. This issue doesn't arise when using pexpect's
expect method, so that's why I'm submitting this now.
/external/devlib/devlib/utils/android.py
da22befd8006e4927a039c503fb688f3643f07a5 21-Sep-2017 Brendan Jackman <brendan.jackman@arm.com> libs/android: Add get_adb_command function

This is just like adb_command but instead of executing the command it just
returns it.
/external/devlib/devlib/utils/android.py
99aca2543835d56001eec63ce60e6c7dc73a4570 09-Oct-2017 Brendan Jackman <brendan.jackman@arm.com> ApkInfo: Improve error for bad .apk files

Provide a more specific error, including the output from aapt.
/external/devlib/devlib/utils/android.py
e7a319b0a751079a76d0323508df1c764305b311 21-Sep-2017 setrofim <setrofim@gmail.com> Merge pull request #176 from bjackman/logcat-docs

utils/anroid: Documentation for LogcatMonitor
fb5a260f4b4879503bd5385f96a97612b0e49d13 21-Sep-2017 Brendan Jackman <brendan.jackman@arm.com> utils/anroid: Documentation for LogcatMonitor
/external/devlib/devlib/utils/android.py
e1ec1eacfb901460ca05bde7b7ab6042ba8bd86e 20-Sep-2017 setrofim <setrofim@gmail.com> Merge pull request #175 from bjackman/logcat-race

Fix race in LogcatMonitor
22c1f5e911356867c4feb419379b50a83e5317b6 20-Sep-2017 Brendan Jackman <brendan.jackman@arm.com> utils/android: Don't lock up if LogcatMonitor stopped before start

Calling stop before start will result in hanging in self._started.wait(),
because that event will never get set. Although stop before start is an illegal
usage pattern, let's try not to fail annoyingly.
/external/devlib/devlib/utils/android.py
8cf4a44bd74fefa78b25bc01a508482517adf2d1 20-Sep-2017 Brendan Jackman <brendan.jackman@arm.com> utils/android: Fix race condition in LogcatMonitor

If you call .start then immediately call .stop, the thread may not
yet have set ._logcat, resulting in an AttributeError.

I initially fixed this by setting _logcat = None in __init__, then putting the
`kill` calls inside `if self._logcat`. The problem with this, as pointed out by
@valschneider, is that we can then have this sequence:

main thread: monitor thread

stop() run()
if self._logcat: .
# False, don't kill process .
join() .
self._logcat = <...>

Therefore, just have the stop() method wait until the process is started before
unconditionally killing it.
/external/devlib/devlib/utils/android.py
b3242a1ee4d16eb05b303f49538748f66e1b8dac 20-Sep-2017 Brendan Jackman <brendan.jackman@arm.com> utils/android: whitespace
/external/devlib/devlib/utils/android.py
a290d2883512d50829afc38eec1ccd734ecee883 20-Sep-2017 Brendan Jackman <brendan.jackman@arm.com> utils/android: Start ADB server before listing devices

Otherwise if the server isn't started we fail to parse the output of
'adb devices'
/external/devlib/devlib/utils/android.py
90040e8b5877646ce111107f63b315a24768ae48 13-Sep-2017 Sergei Trofimov <sergei.trofimov@arm.com> utils/android: grant_app_permissions fix.

Handle the case where an app does not specify any permissions.
/external/devlib/devlib/utils/android.py
24d5630e54cb6af1915175e63f53a2d9b03f2b11 13-Sep-2017 Valentin Schneider <valentin.schneider@arm.com> utils/android: Add grant_app_permissions

This is mostly useful to avoid having to manually click/tap
on the permission requests that may pop up when opening apps,
which would ruin automation
/external/devlib/devlib/utils/android.py
6bda0934ad97a48236c0d9545b4d17f5a2571547 12-Sep-2017 Valentin Schneider <valentin.schneider@arm.com> utils/android: LogcatMonitor fixes

host.kill_children() is used to properly kill the logcat process
when it is IO blocked.

The logcat regexp argument is now within double quotes, as having
parenthesis within the regexp could break the command.

LogcatMonitor.search() has been renamed to wait_for() to make the
behaviour of the method more explicit. A non-blocking version of
this method has been added and is named search().
/external/devlib/devlib/utils/android.py
035181a8f17adfb92c2be90776867fba908dc754 11-Sep-2017 Valentin Schneider <valentin.schneider@arm.com> utils/android: Add LogcatMonitor
/external/devlib/devlib/utils/android.py
1da8d3f95fee8bbd06efe0b18b37be5829fc87ff 31-Jul-2017 setrofim <setrofim@gmail.com> Merge pull request #151 from AnthonyARM/master

Add support for arbitrary ADB servers
7919a5643c9e2178a96e8a7292c953ad16081dc8 25-Jul-2017 Anthony Barbier <anthony.barbier@arm.com> Add support for arbitrary ADB servers
/external/devlib/devlib/utils/android.py
68be9d8acc7d6c00b212d42b27c2575dab826062 14-Jul-2017 Marc Bonnici <marc.bonnici@arm.com> utils/android: Added native code extraction of apks from WA2
/external/devlib/devlib/utils/android.py
85036fbb303681cc09bbf7800aac1a9e4648a247 12-Jul-2017 Sergei Trofimov <sergei.trofimov@arm.com> utils/android: better error message when exit code not detected

Include the stdout/stderr output in the message of the exception raised
when the exit code of the adb command cannot be detected.
/external/devlib/devlib/utils/android.py
a928cca9a2dfb75b990d5f03cc65ad7096869e88 24-Jun-2017 Joel Fernandes <joelaf@google.com> Merge remote-tracking branch 'goog/mirror-upstream-master' into HEAD
2d96840873d6b57917364351345bf8ba3bd4c160 12-Jun-2017 Valentin Schneider <valentin.schneider@arm.com> utils/android: Fix error detection in adb_shell()

If we execute a command such as:
'am start -a android.intent.action.VIEW -d nothing'
on Hikey960 with AOSP master, we do get an error message:
'Error: Activity not started, unable to resolve Intent ...'
but the error code is set to 0. Furthermore, that error message
is outputted to STDERR and not STDOUT.

The current error checking in adb_shell() is done by either
reading the error code or finding an error string in the
standard output. This commit adds a check of the error output,
and also changes the regular expression that is used to find
an error string as it wasn't generic enough.
/external/devlib/devlib/utils/android.py
9c29690314577c966c69c481547d3c376abb257f 01-Jun-2017 Joel Fernandes <joelaf@google.com> android env: Remove dependency on SDK

Currently devlib will error out if ANDROID_HOME isn't set, it looks like aapt
is the only thing it needs from what I see. If ANDROID_HOME isn't set, just get
it from the environment.

Change-Id: I9b0ea8129cf3e4feec4f7ddf08bf843733635d92
Signed-off-by: Joel Fernandes <joelaf@google.com>
/external/devlib/devlib/utils/android.py
97a89970d027f6e15e8a1606757638c88040ced2 12-May-2017 Sergei Trofimov <sergei.trofimov@arm.com> android: downgrading ls command log to debug

The format of an ls command is an implementation detail rather than
something of immediate interest to the user. Debug level is more
appropriate than info for this kind of message.
/external/devlib/devlib/utils/android.py
e17b9c33d1b1233cad6205ea10f146a4d290766a 28-Apr-2017 Brendan Jackman <brendan.jackman@arm.com> android: Raise better error when trying to push non-existent file
/external/devlib/devlib/utils/android.py
3298205b42cdd75f96768e9f07225af6af8efe71 01-Mar-2017 Brendan Jackman <brendan.jackman@arm.com> android: Improve error when _setup_ls fails

If the ADB command fails (e.g. if you provide the wrong device ID), adb_command
raises a CalledProcessError. CalledProcessError doesn't print the output of the
failed command, so you get a useless error message.

This is relevent here in particular as _setup_ls is the first thing to run an
ADB command if a non-IP device ID is provided.

Catch the CalledProcessError and instead raise a HostError with the command
output in the exception message.
/external/devlib/devlib/utils/android.py
da588ea09153a705ab36327bc0684169b741d87a 16-Feb-2017 Patrick Bellasi <patrick.bellasi@arm.com> android: allow to specify a target for fastboot commands

ADB commands always expect a device ID as first parameter, here
unfortunately we need to pass it as an optional one to avoid breaking
existing clients.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
/external/devlib/devlib/utils/android.py
29a7940731cb1ec8559d3ae93648de6dc33f7bf8 31-Jan-2017 Anouk Van Laer <anouk.vanlaer@arm.com> gem5: Addition of a gem5 connection

This is the first in a series of commits to allow for the use of gem5 as a target in devlib.
The interaction with the gem5 simulation is done by the Gem5Connection, a type of TelnetConnection.
There are two types of Gem5Connections (Linux and Android) as they differ slightly in the implementation
of some methods. Other types of connections have only been changed to make them uniform (e.g. arguments for init method)

Changes to be committed:
modified: devlib/__init__.py
modified: devlib/host.py
modified: devlib/utils/android.py
modified: devlib/utils/ssh.py
/external/devlib/devlib/utils/android.py
44fe0370f8fc1ad34db859d67f86661caf7718fa 25-Jan-2017 Brendan Jackman <brendan.jackman@arm.com> android: Handle variation in ADB behaviour

On older combinations of ADB/Android versions, the adb host command always
exits with 0 if it was able to run the command on the target, even if the
command failed (https://code.google.com/p/android/issues/detail?id=3254).

When we need the target's exit code (check_exit_code=True), we currently work
around this behaviour by echoing the target's exit code after the command and
parsing it out of the output.

The ADB behaviour is now "fixed" on newer versions with newer Androids (It's not
clear which versions these are and it appears that different builds of ADB with
the same version number differ in this respect). For those version combinations
adb_shell will currently raise a CalledProcessError when check_exit_code=False
and the target command fails.

So lets now use the "echo $?" trick whether or not we need the exit code.

Fixes https://github.com/ARM-software/devlib/issues/85
/external/devlib/devlib/utils/android.py
d5460e1185bdccb08a55d9a21debcfb457d9cd4d 13-Dec-2016 Sergei Trofimov <sergei.trofimov@arm.com> android: pick ANDROID_HOME/platform-tools over PATH

When ANDROID_HOME is defined, ANDROID_HOME/platform-tools was appended
to the PATH in the environment of the Python interpreter. That meant
that if an adb binary was in PATH, it would be picked in preference to
the one under ANDROID_HOME. This is now reversed so that ANDROID_HOME
takes precedence.
/external/devlib/devlib/utils/android.py
ee38a4244a3175ff290c1cbc3161e3c2c18a7824 18-Nov-2016 Brendan Jackman <brendan.jackman@arm.com> android: Fix whitespace in wildcard match for ADB pull

When there are multiple matches for the wildcard, the output has been
observed to have a space at the end. That means the pull command doesn't
work. This commit fixes that.
/external/devlib/devlib/utils/android.py
b59f7c360e60e6d0f0b19f41dce11aeec511333a 01-Nov-2016 Marc Bonnici <marc.bonnici@arm.com> android: Fixed issue using single quoted command with adb_shell

When using 'check_exit_code' and 'as_root' options for adb_shell with
a command containing single quotes, the provided command was escaped
twice which has now been avoided.
/external/devlib/devlib/utils/android.py
e8e945a700fd4edeca201ecadc5186820a3a859a 14-Oct-2016 Chris Redpath <chris.redpath@arm.com> Fix adb pull with wildcard on Android v7+

Similarly to other uses of ls, the change to multi-column default output
format has confused this API. Add in a similar routine to other objects
which use ls, so that we can try to figure out if we have a multi-column
default and control the output if so, or just use the plain command if
that doesn't work and hope it is still single column output.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
/external/devlib/devlib/utils/android.py
119fd7dc246a8d871bffe81b88d283b621b81eaf 06-Oct-2016 Chris Redpath <chris.redpath@arm.com> android: don't try to disconnect devices which aren't connected

If you try to disconnect a device and there are none, certain versions
of adb return 1, which leads to a TargetError and stops everything in
its tracks.

Try to mitigate this by checking if the device we want to disconnect is
connected before we make the disconnect call.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
/external/devlib/devlib/utils/android.py
f714dd39f1fc5fc64ba28d4c89b883b1a5db8953 15-Jul-2016 Patrick Bellasi <patrick.bellasi@arm.com> android: avoid connect for USB target

The "adb connect" command is not required for USB connected devices.
This patch is a small update to use "adb connect" only for android devices
accessed by IP address.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
/external/devlib/devlib/utils/android.py
89256fd408571f1f913471fd013f4d170ebaf38c 17-May-2016 Sergei Trofimov <sergei.trofimov@arm.com> connetion: fixing None timeout issue

Connection objects set timeout to a default value in case a timeout is
not specified. However, Target defaults timeout to None and passes that
to connection, overridng the default.

This commit ensures that default timeout remains set if calling code
specified timemout as None.

Fix for issue

https://github.com/ARM-software/devlib/issues/34
/external/devlib/devlib/utils/android.py
c2329bd80e598cde52a1c895a1662933b27f303f 28-Mar-2016 Patrick Bellasi <patrick.bellasi@arm.com> fix: AdbConnection: added automatic detection of new line separators

The newline separator is a property of AdbConnection while the adb_shell is
just a method of the android module, thus we do not have a "self" pointer
to and AdbConnection from within the adb_shell function.

This patch fixes 8de24b5 by exposing the newline_separator used by adb_shell
as a parameter of that method and using the AdbConnection::newline_separator
to properly initialize it at executue() time.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
/external/devlib/devlib/utils/android.py
8de24b56019e90cf3881a9876442473d5b267a08 23-Mar-2016 Sebastian Goscik <sebastian.goscik@live.co.uk> AdbConnection: added automatic detection of new line separators
/external/devlib/devlib/utils/android.py
0c11289e189b541b740d18ecea79514ad76c2f66 15-Feb-2016 Sebastian Goscik <sebastian.goscik@live.co.uk> Android: Updated ANDROID_VERSION_MAP
/external/devlib/devlib/utils/android.py
1424cebb909a80af3a688cc7a5a762b2f3099c59 15-Feb-2016 Sebastian Goscik <sebastian.goscik@live.co.uk> Added quotes around commands using raw paths

This fixes issues with spaces in path names.
/external/devlib/devlib/utils/android.py
aab487c1ac91197ba8f285415481ec80fe9880c1 15-Feb-2016 Sebastian Goscik <sebastian.goscik@live.co.uk> pylint
/external/devlib/devlib/utils/android.py
c93e3d6d83e9f050f1032e6c68e8c2a7e2d869c2 25-Nov-2015 Patrick Bellasi <patrick.bellasi@arm.com> android: add support to pull multiple files using wildcard expressions

The ADB pull command allows only to pull a single file or a whole directory.

This patch adds the required support to pull only a selection of files, from
a target folder, which match a path specified using '*' and/or '?' wildcards.
In this case we first get the list of files on the target, using the
wildcard expansion support provided by the "ls" command, and than we pull
each and every file returned from the previous command.

This operation mode is available only if the 'dest' parameter is a valid
host-side folder.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
/external/devlib/devlib/utils/android.py
485b4a62e382bba0777a1b108420f60de431e865 15-Dec-2015 setrofim <setrofim@gmail.com> Merge pull request #8 from JaviMerino/fix_android_without_home

android: fix initialization without android
7f32efcb64e86f6e059adcc7d6f62fcacdc4e1ea 15-Dec-2015 Javi Merino <javi.merino@arm.com> android: fix initialization without android

In workload automation, utils.android._initialize_without_android_home()
gets android_home from adb's path. When this code was copied to devlib,
we mistakenly dropped parsing the output of "which" and instead call
os.path.dirname() on "adb", which always returns "" and makes
_initialize_without_android_home() fail.

Make _initialize_without_android_home() parse the output of "which"
again.
/external/devlib/devlib/utils/android.py
171cc25d508a7a661d6372866264a7e991e113db 14-Dec-2015 Sergei Trofimov <sergei.trofimov@arm.com> AndroidTarget: fixed use of variables in as_root=True commands.

In order to execute as root, the command string gets echo'd into so;
previusly, double quotes were used in echo, which caused any veriables
in the command string to be expanded _before_ it was echoed.
/external/devlib/devlib/utils/android.py
f52bf79eb6d716ba0e7e8b385a0bfedbc397090e 11-Dec-2015 Sergei Trofimov <sergei.trofimov@arm.com> android: fixing exit code checking

This fixes an issue introduced in
64261a65cb8c4c7daeb35186f16d246d3211fa0a

The addtional echo means that $? will always have "0" (the exit code for
the echo). This removes the extra echo, prepending \n to $? instead
/external/devlib/devlib/utils/android.py
64261a65cb8c4c7daeb35186f16d246d3211fa0a 24-Nov-2015 Sergei Trofimov <sergei.trofimov@arm.com> adb_shell: fixing handling of line breaks at the end of the output

- adb protcol uses "\r\n" for line breaks. This is not handled by
Python's line break translation, as not a file. So spliting on '\n'
when extracting the exit code resulted in stray '\r' in the output.
- adb_shell expects exit code to be echoed on the same line. This may
not have been the case if latest output from executed command was not
a complete line. An extra echo will now ensure that the exit code will
be on its own line even in that case.
/external/devlib/devlib/utils/android.py
4e6afe960b0540a0e9781bdfbd82352ff157d248 09-Oct-2015 Sergei Trofimov <sergei.trofimov@arm.com> devlib initial commit.
/external/devlib/devlib/utils/android.py