17 Commits

Author SHA1 Message Date
Elliott Hughes
5a03b69fc8 Clean up some shell script copy & paste.
Remove apparently meaningless comment that's been copy & pasted all over.

Remove trailing whitespace.

Consistently use "$@".

Inline single-use constant.

Test: treehugger
Change-Id: Ie3b3e285cd35ecff9e6fdb7144fe4bbd04e42452
2019-05-09 22:01:14 -07:00
Colin Cross
45c0d71e77 Convert frameworks/base/cmds/* to Android.bp
See build/soong/README.md for more information.

Also converts the rest of frameworks/base/tools/streaming_proto.

Bug: 122332340
Test: m checkbuild
Change-Id: I87c500c5464fb1722b4b518d89065f5e1ee29a97
Merged-In: Ieb54feb3902bddfd5a571369fbf50161ae646647
2019-03-29 16:35:06 -07:00
Martin Stjernholm
afe98696e4 Preload libnativehelper.so which cannot be loaded through the Java classloader.
Test: atest CtsHardwareTestCases (between 2 and 4 failing tests, but that
  happens on clean ToT too; no dlopen failures)
Bug: 126601993

Change-Id: Icfe58fad93b97992e39758c02c92c488a13c717f
2019-03-01 19:40:26 +00:00
Kim Low
d47c0131eb Add support for UHID_GET_REPORT requests
Updated to support UHID_GET_REPORT requests mainly for CTS use.
All feature reports are assumed to be static and should be specified
along with the register json.

For example, in sony_dualshock4_register.json, add the following.
  "feature_reports": [
    {
      "id": 5,
      "data": [0x05, 0x1e, 0x00, 0x05, 0x00, 0xe2, 0xff, 0xf2, 0x22, 0xbe, 0x22, 0x8d, 0x22, 0x4f,
        0xdd, 0x4d, 0xdd, 0x39, 0xdd, 0x1c, 0x02, 0x1c, 0x02, 0xe3, 0x1f, 0x8b, 0xdf, 0x8c, 0x1e,
        0xb4, 0xde, 0x30, 0x20, 0x71, 0xe0, 0x10, 0x00, 0xca, 0xfc, 0x64, 0x4d]
    }
  ]

Test: Make sure build has hid-sony driver that's backported from >4.10.
    Run Dualshock4 CTS
        > atest cts/tests/tests/hardware/src/android/hardware/input/cts/tests/SonyDualshock4TestCase.java

Change-Id: Ib0d534d47c6aa6fcc11af68b913c3db1cfa72752
2018-12-06 09:35:27 -08:00
Siarhei Vishniakou
6c6dd65deb Refactor hid command, mitigate overflows
Currently there are a few overflows possible in the hid command by
sending malformed json requests. Refactor the code to avoid these
overflows. These are mostly memcpy usage, where the size comes
(indirectly) from the size of the json array.
The json array must still be valid, because invalid json will produce an
earlier exception in the java layer.

Test: hid malformed_commands.json
The file "malformed_commands.json" can be found in the bug.
Bug: 111363077

Merged-In: I2f9dd31e0bfa2badc58779f40f4a80e025754cd2
(cherry picked from commit d54b70c8bfe393ef57445bd59962e6730b0b13c0)
Change-Id: I2f9dd31e0bfa2badc58779f40f4a80e025754cd2
2018-11-29 15:26:00 -08:00
Dan Willemsen
c80623a641 Merge "Convert libhidcommand_jni to Android.bp" into stage-aosp-master am: a97f4d4ac3 am: 21d5fdbbce
am: f1ae466af8

Change-Id: I5a1c6df3f934706753f72718b2ca5d37add84ca3
2017-09-09 19:53:11 +00:00
Dan Willemsen
f1ae466af8 Merge "Convert libhidcommand_jni to Android.bp" into stage-aosp-master am: a97f4d4ac3
am: 21d5fdbbce

Change-Id: I7d2ca2f6c9b9c8522510d4e7ac1d9ded0167b38b
2017-09-09 19:43:54 +00:00
Dan Willemsen
8119ffa299 Convert libhidcommand_jni to Android.bp
See build/soong/README.md for more information.

Test: m libhidcommand_jni
Change-Id: Ica144979a2f89e0a9ed8eb4a816024aa318043e6
2017-09-08 23:27:36 -07:00
Siarhei Vishniakou
235b6fb59c Merge "DO NOT MERGE Use CREATE instead of CREATE2 for 3.10 kernel" into oc-mr1-dev
am: d7d9b8939e

Change-Id: I4bb5e08e8019527bd5a3847ae32798187e0a4b0a
2017-08-26 11:33:16 +00:00
Siarhei Vishniakou
388ca7feb0 DO NOT MERGE Use CREATE instead of CREATE2 for 3.10 kernel
CREATE2 structs were introduced after kernel 3.18,
so cannot compile user code with uapi headers from
newer 3.18+ kernels. If using CREATE structs then
compatibility is preserved.

Bug: 64981084
Test: bit
Change-Id: I97c7725918b09a817a51c13384ac2d55a6cfab25
CtsHardwareTestCases:android.hardware.input.cts.tests.GamepadTestCase
2017-08-26 05:05:19 +00:00
Steven Moreland
65e2ca2808 ScopedUtfChars: use proper nativehelper headers
libnativehelper exports headers under nativehelper. These were
available before incorrectly as global headers in order to give
access to jni.h.

Test: modules using ScopedUtfChars find headers
Bug: 63762847
Change-Id: I5e9f2b56f569b83ece0d854f7066655e1d64cc65
2017-08-10 23:00:10 +00:00
Steven Moreland
795bcc5b75 Merge "com.android.server: use proper nativehelper headers" into stage-aosp-master am: 7d7c269944
am: 81972a18e4

Change-Id: Id008ba3508c972d8d27eebca22009b4823e387e0
2017-08-02 15:30:37 +00:00
Steven Moreland
c95dca8ce1 com.android.server: use proper nativehelper headers
libnativehelper exports headers under nativehelper. These were
available before incorrectly as global headers in order to give
access to jni.h.

Test: com.android.server finds headers
Bug: 63762847
Change-Id: Icb3018f520004f65e8dd565d6e1d563551548eba
2017-08-01 20:04:50 +00:00
Siarhei Vishniakou
55656e4cb9 Fix GamepadTestCase#testButtonA CTS test
Hid command, JNI layer:
- Removed dependency of the hid device on libandroid_runtime
and libutils. Using ALooper from libandroid to process callbacks from
/dev/uhid file descriptor.
- Switched to using "CREATE2" and "INPUT2" constructs in uhid driver

Hid command, Java layer:
- Removed delay workarounds, user now responsible for waiting for
onInputDeviceChanged notification prior to using the hid commands.

UiAutomation:
- Added a new executeShellCommandRw function that allows bidirectional
communication to shell command

platform.xml:
- Added uhid permissions to bluetooth stack for /dev/uhid access

- CTS test now consistently passes

Bug: 34052337
Test: CTS test case invoked with the following command:
run cts -t android.hardware.input.cts.tests.GamepadTestCase
-m CtsHardwareTestCases --skip-system-status-check
com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker

Change-Id: Ic916c513b7e652b1e25675f0f38f0f1f3a65d214
2017-05-12 21:01:02 +00:00
Aurimas Liutikas
1c8cbb5440 Fix a set of random warnings in frameworks/base/
Bug: 26936282
Change-Id: Ic411d7a1673503d5945f952ebf5a8be964bb54a4
2016-02-19 13:44:25 -08:00
Seigo Nonaka
edbeacc562 Add libhidcommand_jni.so to required module.
To install libhidcommand_jni.so and hid command at the same time,
set libhidcommand_jni as a required module of hid command.

Bug: 22131060
Change-Id: I73ad1954eb73896425362a63fab0e63a61b9c0a0
2015-07-02 17:58:29 +09:00
Michael Wright
1f2c7688c1 Add new hid command.
This allows the shell user to inject HID events.

Change-Id: I37faff576299ff14092b61ed39f2a1c086f672a5
2015-06-12 11:49:29 +01:00