summaryrefslogtreecommitdiff
path: root/cmds/am/src
Commit message (Collapse)AuthorAgeFilesLines
* Add a way to instrument sdk sandbox processesNikita Ioffe2022-03-182-0/+7
| | | | | | | | | | | | | | | | | | The following restrictions applies to the instrumentation of the sdk sandbox processes: * Instrumentation must be signed with the same certificate as the client app the instrumented sdk sandbox belongs to. * If there is a running instance of to-be-instrumented sdk sandbox process, then it will be killed before the instrumentation starts. * While instrumentation is running the client app won't be allowed to connect to the instrumented sdk sandbox process. * The --no-restart instrumentation of the sdk sandbox processes is not supported. Bug: 209061624 Test: atest SdkSandboxInprocessTests Change-Id: Ia4b145c091bf8da600a77ea82fc9e3cd97757275
* Add a flag to always do the cert signature checkNikita Ioffe2022-02-162-0/+7
| | | | | | | | | | Right now signature check is unconditionally bypassed on debuggable builds, which makes things a little bit confusing - instrumentation will succeed on debuggable build, but fail on the user build. Bug: 209061624 Test: adb shell am --always-check-signature com.android.tests.supplemental.process/androidx.test.runner.AndroidJUnitRunner Change-Id: I66d6331156d4503e147141872cbe73a9330ea701
* Merge "Explicitly exit from the am instrument after test completes"Jing Ji2021-11-031-0/+2
|\
| * Explicitly exit from the am instrument after test completesJing Ji2021-11-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | To speed up the test. For a trivial am instrument run: [Before] 0m01.53s real 0m00.16s user 0m00.16s system [After] 0m00.72s real 0m00.21s user 0m00.11s system Bug: 204195830 Test: am instrument -w Change-Id: I66196d1db9169681dabb2e5dacdd18e6105ad75a
* | Fix: crash when running am.jar without parametershongzhu wang2021-10-091-13/+18
|/ | | | | | | | | | | | | | | | | | | Issure: When no args to run am.jar,mAm is not initialized before use process will crash in NRE Solution: Initialize mAm in constructor Bug: 202471754 Test: manual Running follow sh on the device displays help messages correctly base=/system export CLASSPATH=$base/framework/am.jar exec app_process $base/bin com.android.commands.am.Am Change-Id: I088f4f5b4072d350c217655a291658d0bfd506e9
* Fix the argument list to logcat from am instrumentJing Ji2021-05-071-1/+1
| | | | | | Bug: 186570682 Test: am instrument Change-Id: I3290022c865ca16150c3392657f1fe9d31834fc5
* Enable @TestApi access for instrumentation.Artur Satayev2021-01-201-5/+0
| | | | | | | | | | | | Since introduction of ALLOW_TEST_API_ACCESS, it is now possible to grant access to test apis for the whole UID, instead of just a starting process. This resolves the issue, where a forked test process cannot access @TestApi's. Bug: 147113465 Test: atest CameraEvictionTest#testBasicCamera2ActivityEviction Change-Id: I8dd3bbacdb263a3e30539f43d8081f6d78e80155
* Enable instrumentation of system server on debuggable devices.Oli Lan2020-11-052-0/+7
| | | | | | | | | | | | | | | | | | | | | This makes two changes to enable the instrumentation of system server and other system processes: - A new option '--no-restart' has been added to 'am instrument', that causes the test apk to be loaded without restarting the target app. - On debuggable devices, the check that the test apk has the same signature as the target app is not performed. With these changes, a test apk with instrumentation configured with targetPackage="android" can run a test from within the system server process, on debuggable devices. These options may also allow other system processes to be tested. See go/internal-api-testing for more information. Test: atest FrameworksInProcessTests Change-Id: I8829bcbe7f3373170bcf1e7fa869d5d31f40576d
* Start OP_NO_ISOLATED_STORAGE on `am instrument --no-isolated-storage`Nikita Ioffe2020-06-111-2/+2
| | | | | | | | | | | | | | | | | | | This provides a signal for MediaProvider to whitelist access for full external storage access. Here is an overview of how the flow looks like: 1. When app is started within instrumentation with --no-isolated-storage flag, ActivityManagerService will grant OP_NO_ISOLATED_STORAGE to that package. 2. MediaProvider will note the OP_NO_ISOLATED_STORAGE app op as fallback in case app doesn't have MANAGE_EXTERNAL_STORAGE permissions. 3. When instrumentation finishes, ActivityManagerService will change mode of OP_NO_ISOLATED_STORAGE app op to MODE_ERRORED. Test: atest ExternalStorageHostTest Bug: 149894531 Change-Id: I51cd87e5e887b887fd8ac7a1a7ffff208266ffa8
* Swap default for disableTestApiChecks.Artur Satayev2019-12-042-2/+6
| | | | | | | | | | | | | | | | There are more runners than those updated in tradefed/testtype/, which donot/cannot push --no-test-api-checks arg to `am instrument`. Instead reverse the default, so that by default `am instrument` disables test api enforcement policy. Test: atest CtsHiddenApiBlacklistApi27TestCases \ CtsHiddenApiBlacklistApi28TestCases \ CtsHiddenApiBlacklistCurrentApiTestCases \ CtsHiddenApiBlacklistDebugClassTestCases \ CtsHiddenApiBlacklistTestApiTestCases \ CtsAppSecurityHostTestCases:android.appsecurity.cts.ExternalStorageHostTest#testMediaEscalation \ CtsAppSecurityHostTestCases:android.appsecurity.cts.StorageHostTest#testVerify \ CtsAppSecurityHostTestCases:android.appsecurity.cts.DirectBootHostTest#testDirectBootNative Exempt-From-Owner-Approval: small fix Bug: 133832325 Change-Id: Id1870cdd4bb0a51bddede24afd7f87d6e5ec766c
* Add --no-test-api-acces to am instrument.Artur Satayev2019-11-122-0/+7
| | | | | | | | | By default instrumented processed have access to @TestApis; however for certain CTS tests we want to disable access to test APIs, where this flag would be used. Test: manual Bug: 133832325 Change-Id: Id56ce3079bcea2632d4002edcf120d9d5c9e0a26 Merged-In: Id56ce3079bcea2632d4002edcf120d9d5c9e0a26
* Make am instrument capture logcat during test run, and return it to the host.Joe Onorato2019-05-011-6/+66
| | | | | | | | | | | | | | Also makes bit print that logcat, if available, instead of just the stack trace. This means that when you run a test you don't also have to run logcat in some other window, and then scroll around forever looking for the one test in question. Test: bit -t GtsIncidentManagerTestCases:com.google.android.incident.gts.IncidentManagerTests\#testFail Test: bit -t GtsIncidentManagerTestCases:com.google.android.incident.gts.IncidentManagerTests\#testDoesntExist Bug: 129875642 Change-Id: I8940ff379c919482f4a545cb90d25bdbaa2b4f15
* Add instrumentation flag to get access to full exteranl storage.Sudheer Shanka2018-10-212-5/+13
| | | | | | | | | | | | When starting a process under instrumentation using this new "--no-isolated-storage" flag, the process would be able to see the full external storage. Bug: 117229024 Test: adb shell am instrument --no-isolated-storage \ -e class android.media.cts.EncodeDecodeTest#testEncodeDecodeVideoFromBufferToBuffer720p \ -w android.media.cts/android.test.InstrumentationTestRunner Change-Id: I7973b123cf4fc08e8ce2b05bd4c23fa41b1cdcdf
* Add flag to AMS.startInstrumentation() to disable hidden API checksDavid Brazdil2018-02-142-1/+9
| | | | | | | | | | | | | Some tests need to use hidden APIs to check the internal state of the framework. For those special use cases, we add a new flag to ActivityManagerService.startInstrumentation that enables to start instrumented processes without hidden API enforcement. Individual test harnesses can change their Am command to request the exemption. Bug: 64382372 Test: adb shell am instrument --no-hidden-api-checks <component> adb logcat | grep 'Accessing hidden' Change-Id: I1d734a95423fae90dae63ff09d5f606495830905
* Add instrumentation data to host proto libMike Ma2017-11-131-0/+10
| | | | | | | | Add instrumentation data proto to host proto lib and add a few comment to am instrument. Test: no test needed Change-Id: Ibbb0394dcf0ad27b53d5c97104456798863ce82c
* Record proto to file in am instrumentMike Ma2017-11-012-44/+97
| | | | | | | | | | | | | | | | | | Add an option -f to record instrumentdata proto produced by am instrument to a file in addition to printing to stdout. Default path is /sdcard/instrument-logs/log-yyyyMMdd-hhmmss-SSS.instrumentation_data_proto. If the file exits, it will be deleted before writing. Path can be changed via optional <FILE> argument after -f. If -f and -m are both present, proto will be written to a file and print to stdout. Test: build, flash and run: bit -bi FrameworksCoreTests adb shell am instrument -w -r -f tmp/tmp.log \ -e class com.android.internal.os.BatteryStatsNoteTest \ com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner Change-Id: Iabc320c066d5995eee842c26416623eeb3d403f4
* Fully implement "install" and "install-write" in PackageManagerShellCommand.Dianne Hackborn2017-10-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can use the new mechanism to ask the calling shell to open a file in order to implement the rest of these commands, allowing you to give the path to an apk to install. That API is thus extended to allow you to open readable files, not just opening file for writing. Doing this however means we no longer can pass a file path to AssetManager for the apk to parse, we only have an already open fd for that. Extending AssetManager to allow adding apks from fds is not that hard, however, since the underlying zip library already supports this. This main thing this changes is in AssetManager.cpp where we retrieve the open zip file for a particular apk that has been added. This used to look up the zip file by path every time it was needed, but that won't work anymore now that we can have things added by fd. Instead, we keep track of each opened zip in the AssetManager, so we can just directly retrieve it from the asset_path representing the item that was added. As a side-effect, this means for normal paths we no longer need to look up by name, but just have the opened zip file directly accessible. (This is probably good, but it does mean that we no longer run the logic of seeing if the zip file's timestamp has changed and re-opening it if it has. We probably shouldn't be relying on that for an active AssetManager anyway, and maybe it is even good that we don't allow the zip file to change under it?) A follow-up change will finally remove the Pm.java implementation and turn the pm "command" into a simple shell script that runs cmd package. Test: manual Change-Id: Ie103e3bdaa5b706796cc329254f2638151a3924f
* Bit: Don't ignore errors and crashesMakoto Onuki2017-08-021-1/+5
| | | | | | | | | | | | | | Bit used to only see success results and failures (== assertion failures?), and didn't see "errors" (other exceptions) and test process crashes. Fixed it. Now it also returns an error status code if there was a test failure. Bug 64292779 Test: manual Change-Id: Iaba93910d32abfc615ae595746a0e9be1108583a
* DO NOT MERGE ActivityView be gone!Andrii Kulian2017-07-211-45/+0
| | | | | | | | | | This hidden functionality is no longer support/needed since we now have multi-window/display. A new view group class will be added later that uses multi-window to support remaining functionality of this class. Test: go/wm-smoke Change-Id: Ie2fa2de92841d33199da9988741905060dd1ddf4
* Sort INSTRUMENTATION_STATUS keys on am instrument outputMakoto Onuki2017-06-281-3/+10
| | | | | | | | | | | | | | | | | | | Previously the output from perftests was printed in a random order: INSTRUMENTATION_STATUS: timeGetDataCapacity_standardDeviation=5 INSTRUMENTATION_STATUS: timeGetDataCapacity_median=486 INSTRUMENTATION_STATUS: timeGetDataCapacity_mean=489 INSTRUMENTATION_STATUS: timeGetDataCapacity_min=484 INSTRUMENTATION_STATUS_CODE: -1 Now it's always printed in the same (sorted) order. INSTRUMENTATION_STATUS: timeGetDataCapacity_mean=489 INSTRUMENTATION_STATUS: timeGetDataCapacity_median=486 INSTRUMENTATION_STATUS: timeGetDataCapacity_min=484 INSTRUMENTATION_STATUS: timeGetDataCapacity_standardDeviation=5 INSTRUMENTATION_STATUS_CODE: -1 Test: manual test Change-Id: I807aa05e6523b70a132ab97fc099156bb3dc1f96
* Make --no-window-animation flag apply to animators, tooChet Haase2017-06-141-0/+1
| | | | | | | | | | | | | | | | There is a flag for 'adb shell am instrument' that disables animations, which is useful for testing (if you want to, for example, disable animations to speed up tests or remove animation-caused side-effects as a factor). But only the pre-honeycomb animations (window transitions and window animations) were listening to this flag. This change makes animators listen as well, so all three duration scale settings are affected. Bug: 32072407 --no_window_animation ADB arg should set all animation scales to 0.0f Test: manual. Ran frameworks APCT tests with --no_window_animation and verified that all three types of animations had their duration scales set to 0 for the duration of the tests. Change-Id: I5ae4a60faa714c9534dfae58d1efcd54f577d82b
* Update usage of ActivityManagerNative.Sudheer Shanka2016-11-141-2/+1
| | | | | | | | | | | - Remove references to ActivityManagerProxy. - Add isSystemReady to ActivityManager. Bug: 30977067 Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test android.server.cts adb shell am instrument -e class com.android.server.am.ActivityManagerTest,com.android.server.am.TaskStackChangedListenerTest \ -w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner Change-Id: I07390b6124fb1515821f5c0b37baf6ae74adc8fa
* Switch am command to go through "cmd activity".Dianne Hackborn2016-11-011-355/+6
| | | | | | | | | | For almost everything... except instrument, which still needs to be run as the shell user so its UiAutomator callbacks will work correctly (and not create security holes). Test: manual Change-Id: I2e62714a2d5b52501aa261b7e4d6b282b54a0027
* am instrument gets protobufJoe Onorato2016-10-202-197/+466
| | | | | | | | | Refactor the am instrument command and add a version that outputs protobuf in addition to the old one that prints loosely formatted text. Change-Id: I34079d8af2b7b6c6c59837d54719806109ba286c Test: bit tool
* Work around issue #32096507: 'am send broadcast' fails the second...Dianne Hackborn2016-10-131-1/+88
| | | | | | | | | | | ...time it's called from dumpstate Bring back the shell-side implementation of this, until we can figure out why the raw shell command transaction is failing. Test: bugreport works Change-Id: Ia9422a653feffb0236613d43e022458c101b9583
* Move the remaining am commands to ActivityManagerShellCommand.Dianne Hackborn2016-10-101-1761/+12
| | | | | | | | | The only thing not removed is the "instrument" command, which really needs to run Java code in the shell. We'll deal with that later. Test: manual Change-Id: I9df0cdf831ac280cb0eb85c857d27166bc00604d
* New infrastructure to switch remaining commands to "cmd" calls.Dianne Hackborn2016-09-291-216/+51
| | | | | | | | | | | | | | | | | This introduces a new feature of the IBinder command protocol to allow the shell command implementation to call back into its caller to ask it to open files in the calling context. This is needed so that commands that have arguments specifying files can open those files as the calling shell, not the system (or whatever) process. To test this all out, move the "am start" implementation over to ActivityManagerShellCommand, in particular along with its option to specify a file in which to write profiling data. Test: Manual Change-Id: I0c1e3857defefbd19a2ac29413aafbb34b1e48a3
* Add error messages to send-trim-memoryJohn Reck2016-09-231-2/+1
| | | | | | Fixes: 23006305 Test: manual, adb shell am send-trim-memory Change-Id: Iae5607ea9abf0ffa5b5276a6540afb0dc6aa31f5
* Fix off-by-one in am start -R (repeat)Chong Zhang2016-06-281-2/+2
| | | | | bug: 26028552 Change-Id: I075b378b6f126d124d867282d76a78d865b54178
* Move the 'pretend idle jobs can run now' broadcast into AMSChristopher Tate2016-05-061-4/+4
| | | | | | | | | | It's a protected broadcast, so sending it directly from 'am' is no longer an option. This is needed for CTS as well as being generally useful during app development. Bug 28406044 Change-Id: I101915a8c6f19454330a8db2079a75023c112582
* Allow setting fullscreen stack as target via adb shellAndrii Kulian2016-04-261-4/+4
| | | | | Bug: 27906038 Change-Id: Ie6feede3f7c412bc51550626a008cb0729e5e0e0
* Remove unnecessary allocation+unboxing of objects.Narayan Kamath2016-04-181-27/+27
| | | | | | | | Transforming String->int can be done with 0 allocations using Integer.parseInt. bug: 28078871 Change-Id: I8d9f322d7154728849dde61ef282046032858d60
* Allow to provide only a component name prefix to 'am instrument'Philip P. Moltmann2016-04-041-10/+49
| | | | | Bug: 27831862 Change-Id: I1d57e416c47fc7d9ea212f0002986932663081b8
* Update PRE_BOOT_COMPLETED for FBE.Jeff Sharkey2016-03-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Now that CE data isn't available until after a user is unlocked, we need to delay the PRE_BOOT_COMPLETED broadcasts. This is done by adding a new RUNNING_UNLOCKING user state to the UserController lifecycle. We now track the last fingerprint a user was logged in under, and we dispatch PRE_BOOT receivers when that fingerprint changes. To work around battery pull issues, we only persist the updated fingerprint once all PRE_BOOT receivers have finished. This is less granular than the original solution, but it's still correct. We only consider a user as "logged in" once it transitions into the RUNNING_UNLOCKED state. When starting a process, track if the user was "unlocked" when started, so that we only spin up unaware providers in processes started before user unlock. Add generic IProgressListener to communicate PRE_BOOT progress and strings up to lock screen. For now, LockSettingsService just blocks until finished, but it could display these strings in the future. Bug: 27220885 Change-Id: I349439776b885acd32f6a578d8951ffd95640be2
* Added support to specify animation duration when resizing stackWale Ogunwale2016-03-211-1/+1
| | | | | | | Needed for sys-ui to control the duration of various Pip transitions. Bug: 27674339 Change-Id: I7bad27aaa19755a73c594e88b88b56db033e1a45
* Move more PM calls to ParceledListSlice.Jeff Sharkey2016-03-041-1/+1
| | | | | | | | Since the data returned by these calls can grow unbounded based on various GET flags, we need to switch 'em over. Bug: 27391893 Change-Id: Ie849ca30dbaaa91158da4c83675657715629a0ee
* Am.java: Use write-only file descriptorsNick Kralevich2016-03-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Use write only file descriptors for am commands. Having read-write file descriptors isn't needed, and not all SELinux app domains have read access to /data/local/tmp file descriptors. Addresses the following denial: avc: denied { read } for path="/data/local/tmp/foo" dev="dm-2" ino=654084 scontext=u:r:system_app:s0 tcontext=u:object_r:shell_data_file:s0 tclass=file permissive=0 Steps to reproduce: adb shell ps | grep settings adb shell am dumpheap PID_FROM_ABOVE /data/local/tmp/settings.hat Expected: 1) command works Actual: 1) SELinux denial and no settings.hat output. Bug: 27472701 Change-Id: Id8df0c5a41046b405444e14c70075c986d9936c3
* Fix issue #27385109: control activity behavior without triggering...Dianne Hackborn2016-02-291-4/+9
| | | | | | | | | ...isUserAMonkey for testing purpose Add an argument for the caller to specify if they are a poo flinging monkey. Change-Id: I0e149a8d78776abaf07517bd4ae886047b7f4252
* Added AM API to remove a stackWale Ogunwale2016-02-161-0/+12
| | | | | | | Use the new API when closing Pip. Bug: 26982752 Change-Id: I074d23b5535a4534626183ab77142d3932a803f0
* Password security for FBE disk encryption keysPaul Crowley2016-02-081-6/+11
| | | | | | | | | | Add the means to protect FBE keys with a combination of an auth token from Gatekeeper, and a hash of the password. Both of these must be passed to unlock_user_key. Keys are created unprotected, and change_user_key changes the way they are protected. Bug: 22950892 Change-Id: Ie13bc6f82059ce941b0e664a5b60355e52b45f30
* Merge "Add flag to "am start" to enable native debugging"Tamas Berghammer2016-02-061-1/+4
|\
| * Add flag to "am start" to enable native debuggingTamas Berghammer2016-02-011-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Specifying the new flag will enable several features in the runtime required by the native debugger to debug Java and C++ code at the same time. The enabled features: * Force JIT (never use the interpreter) * Debug info generation * Disbale some optimizations Change-Id: Iaf5ab649715a0c274bd1b0fc64e483705da53cd0
* | Infrastructure for animating of maximizing pip activity.Filip Gruszczynski2016-02-041-18/+26
| | | | | | | | | | Bug: 25672053 Change-Id: Ie8a83c626680e01ff7115f40731ab9e6c13769c0
* | Allow specifying stack when starting activity in AM command.Filip Gruszczynski2016-02-021-2/+17
|/ | | | Change-Id: I42032bdebf16b6cd2c0c87fd9aa5c261bc9fe25d
* Use resizeMode integer instead of resizeable boolean.Wale Ogunwale2016-01-291-4/+5
| | | | | | | | Changes activity manager and window manager to use resizeMode as defined by ActivityInfo#resizeMode instead of a boolean. Bug: 26774816 Change-Id: I8cef46d9fba6bfdd21df7da63ed5d5330ad03d4b
* Animate pinned stack resizing.Filip Gruszczynski2016-01-281-8/+22
| | | | | | | | | This introduces animating of stack bounds within window manager module. It also uses this type of animation when moving an activity from fullscreen stack to pinned stack. Bug: 25672053 Change-Id: I75914a685d10021f8a7535b47ef12b6920b3fd5e
* Adjusting AMN#requestBugReport() to be able to invoke 3 typesMichal Karpinski2016-01-081-3/+3
| | | | | | | | | | of bugreport services ActivityManagerNative#requestBugReport() now can accept 3 types: FULL, INTERACTIVE AND REMOTE. Bug: 26152603 Change-Id: Ife9bbef4691e172fb56b72b256880f0d4ad4d198
* Add am command for CTS tests for resizedDockedStack (1/2)Jorim Jaggi2016-01-051-1/+23
| | | | | | Bug: 25015474 Bug: 26311778 Change-Id: Ia2b1f8ffc5c777d8199409041090a0106503c2e4
* Changed ActivityManager.requestBugreport() to take a 'progress' parameter.Felipe Leme2015-12-051-3/+15
| | | | | | | | | | | | | | | When progress is set to 'true', it calls the new, enhanced 'bugreportplus' service, while when 'false' it calls the regular 'bugreport' service. 'bugreportplus' is more user-friendly (it shows a system notification with the progress, allow user to cancel, etc...), at the cost of consuming more resources. As such, the "Take Bug Report" UI will be changed to offer the user a combo with these 2 options, but for now it's always going to be 'bugreportplus' BUG: 26034608 Change-Id: I21a6b5b092a85614e91d523b8f4df1fb00e49b3b
* Added DISALLOW_RUN_IN_BACKGROUND user restrictionFyodor Kupolov2015-12-021-3/+14
| | | | | | | | | | | | It forces the user to stop instead of going into the background. Also changed behavior of stopUser method. Now it also attempts to stop related users along with the specified userId. Based on ag/807976, with the only difference that it's now a user restriction. Bug: 24579258 Bug: 24708668 Change-Id: I357298908816fc58feeed83b7e9979fc33d25da6