Commit graph

3761 commits

Author SHA1 Message Date
Remi NGUYEN VAN
4729949b50 Add NDK API for getprocdns, setprocdns
The API allows callers to control the default network that is used for
DNS hostname resolution.

Test: atest CtsNetTestCases
      Tests in change I00143cafcd3eb1d71e8d5c7ea9c839a99dc6f4ce
Bug: 171540887
Change-Id: I70d8113ae49cd1e0910a6dbc5929b6a157c44f42
2021-03-23 07:11:40 +00:00
Remi NGUYEN VAN
c698030937 Merge "Add NDK API for getprocnetwork" into sc-dev 2021-03-23 07:11:07 +00:00
Remi NGUYEN VAN
7a09ee1ab4 Add NDK API for getprocnetwork
The API is the getter couterpart for setprocnetwork.
Use it in NetworkUtils so that the NDK API can be the source of truth
for the process network.

Bug: 171540887
Test: atest CtsNetTestCases
Change-Id: I4c7a302df580cec6315e10d0d49a89cf93597ef0
2021-03-23 00:31:42 +00:00
Marin Shalamanov
0a99dbe344 Merge "Fix "end of file while inside a group" error in NDK" into sc-dev 2021-03-18 17:47:30 +00:00
Marin Shalamanov
574c58d992 Fix "end of file while inside a group" error in NDK
Add the missing end of group markers to the files
which generate the "end of file while inside a group"
warning.

Bug: 183024041
Test: development/tools/ndk/build_ndk_docs.py 2>&1 \
         | grep "end of file while inside a group"
Change-Id: Ib41840bbc72651ad90aaac878d36c233b5284cf3
2021-03-18 15:11:57 +01:00
Siarhei Vishniakou
2745c956d0 Update android/input.h docs
Fix doc generation error

Bug: 183013620
Test: ./_scripts/update_api_doc.py ~/android/master/ 2>&1 >/dev/null | grep -i input

Before:
android/input.h:680: warning: unable to resolve link to `RELATIVE_X' for \link command
After:
the line above is not present

Change-Id: I995ac91d8bfd53309607e3cdac305adb68d40d78
2021-03-17 21:39:44 +00:00
Brian Duddie
e02c066af6 Add missing union members to ASensorEvent
Named fields for accessing data from the gyroscope and uncalibrated
accelerometer sensor types were mistakenly left out of the union.
Although this data was accessible directly before, these fields make
developers' lives easier.

Fixes: 182903112
Test: compile only
Change-Id: If8189658030fab96b54b79dd318935b9116b5e58
2021-03-16 17:40:29 +00:00
Siarhei Vishniakou
eedd0fc7b1 Use Result<InputPublisher::Finished> instead of callback -- try 2
When the 'Finished' message is received inside InputDispatcher, we are
currently providing a callback function that gets executed with the
parameters that are matching the InputMessage fields.

This does not scale well for the case where there is more than 1 type of
InputMessage received from the InputConsumer. We would have to provide 2
callbacks, which is not user-friendly.

The calling code inside InputDispatcher is already aware of the
InputMessage struct, but InputMessage is intended to be a protocol of
communication between input channels, and is not meant to be used
elsewhere. To provide the output of 'finished' signal, we introduce a
new 'Finished' struct into InputPublisher. InputPublisher will now try
to read a message, and will provide a response in that struct.

This approach will also now force the caller to check ok(), which will
increase correctness.

Bug: 167947340
Test: atest inputflinger_tests
Test: TBD

Revert submission 13838212-revert-13780058-receiveFinishedSignal-UGCLLLUBPW

Reason for revert: Relanding with fix
Reverted Changes:
Idb3a44b4a:Revert "Update the usage of receiveFinishedSignal"...
I1e71010f5:Revert "Use Result<InputPublisher::Finished> inste...

Change-Id: I9c425bb7249d43648e558214e40fa35aeaa0bb11
2021-03-12 20:25:07 +00:00
Yohei Yukawa
7cce0ad081 Revert "Use Result<InputPublisher::Finished> instead of callback"
Revert submission 13780058-receiveFinishedSignal

Reason for revert:
Caused severe delay in back navigation on IME-focusable window.

Reverted Changes:
I301c6e9c3:Use Result<InputPublisher::Finished> instead of ca...
I43a0f2d31:Update the usage of receiveFinishedSignal

Bug: 167947340
Fix: 182514338
Test: Manually verified as follows:
 1. Set up the device as "Set up offline" mode.
 2. adb shell am start -n com.google.android.dialer/.extensions.GoogleDialtactsActivity
 3. On one terminal, run adb logcat -s InputMethodManager:*
 4. On another terminal, run adb shell input keyevent 4
 5. Make sure that the following message is not shown.
  "Timeout waiting for IME to handle input event after 2500 ms"

Change-Id: I1e71010f5f4ae268dfcbc3bde50881c2fa3d51d5
2021-03-12 04:18:38 +00:00
Siarhei Vishniakou
4c92c5f630 Use Result<InputPublisher::Finished> instead of callback
When the 'Finished' message is received inside InputDispatcher, we are
currently providing a callback function that gets executed with the
parameters that are matching the InputMessage fields.

This does not scale well for the case where there is more than 1 type of
InputMessage received from the InputConsumer. We would have to provide 2
callbacks, which is not user-friendly.

The calling code inside InputDispatcher is already aware of the
InputMessage struct, but InputMessage is intended to be a protocol of
communication between input channels, and is not meant to be used
elsewhere. To provide the output of 'finished' signal, we introduce a
new 'Finished' struct into InputPublisher. InputPublisher will now try
to read a message, and will provide a response in that struct.

This approach will also now force the caller to check ok(), which will
increase correctness.

Bug: 167947340
Test: atest inputflinger_tests
Change-Id: I301c6e9c39c02692f5565aa8affdcfd0e17bcefc
2021-03-11 03:38:48 +00:00
arthurhung
7632c33913 Move drag event to InputDispatcher (1/n)
This CL adds the ability to send a DRAG event through the
InputChannel, and adds the appropriate processing logic to
InputPublisher and InputConsumer.

Bug: 158242495
Test: atest libinput_tests InputPublisherAndConsumerTest
Change-Id: I7aead341a9851facf654024c476bd6d7eaae4590
2021-03-08 21:40:13 +08:00
Siarhei Vishniakou
38b7f7faae Use bool directly in InputMessage
In order to send the data via socket, we use the InputMessage struct. In
this struct, various fields are stored. This struct's purpose is to
serialize the input event information.

We are storing bools in InputMessage as various integer types. To read
these bools, we compare the integers to 1. It's not very convenient.

To simplify this, let's store bools directly in InputMessage. Bool size
is implementation-dependent, but it's typically 1, so we can just guard
against that with a static_assert.

Bug: 169866723
Test: presubmit
Change-Id: Iae4870fac95e884cc328791c0035df6e31e34a7b
2021-03-05 02:29:16 +00:00
Siarhei Vishniakou
7766c03ec5 Use NamedEnum for printing Entry type
Currently, we are using InputMessage::typeToString, a manually written
function, to print the entry type.

Let's use "NamedEnum" instead to simplify the process of adding new
types.

Bug: 167947340
Test: compile only
Change-Id: I26d0a469bf93adbe2795d8a378c25e6ded891274
2021-03-02 20:46:34 +00:00
Ady Abraham
9dce082f0b Merge changes from topic "sf_planner" into sc-dev
* changes:
  SF: Add initial Planner infrastructure
  SF: add a sysprop to control layer caching
2021-02-25 19:48:19 +00:00
Leon Scroggins
96a824cecf Merge "AImageDecoder: Recommend only downscaling with setTargetSize" into sc-dev 2021-02-25 16:57:26 +00:00
Leon Scroggins III
159ab12de6 AImageDecoder: Recommend only downscaling with setTargetSize
Fixes: 180037959
Test: NA
Change-Id: I19076b4368623806f7a9f6312a780a6d5886e49e
2021-02-24 15:32:42 -05:00
Dan Stoza
269dc4d22a SF: Add initial Planner infrastructure
Adds infrastructure for the SF Planner, which will support layer
caching/flattening and composition strategy prediction.

Bug: 158790260
Test: atest libcompositionengine_test libsurfaceflinger_unittest
Change-Id: I0d3027cea073fe25f269f3d5e83fe621dfbe7b2b
2021-02-24 11:32:41 -08:00
Chris Ye
87645ab5f5 Merge "Support Inputdevice LightsManager feature in frameworks." into sc-dev 2021-02-23 08:19:10 +00:00
Alec Mouri
76a16cf5d3 Merge "Document DisplayManager atomicity with AChoreographer" into sc-dev 2021-02-23 01:35:24 +00:00
Chris Ye
3fdbfef367 Support Inputdevice LightsManager feature in frameworks.
Add lights manager support to input frameworks.

Bug: 161633625
Test: atest LightsManagerTest, atest InputDeviceLightsManagerTest
Change-Id: Ie00357bce0f6c98e9eada5e0a79f93f48e7a4d1b
2021-02-22 16:19:29 -08:00
Marin Shalamanov
af9b2ae560 Merge "Introduce DynamicDisplayInfo" into sc-dev 2021-02-22 18:28:27 +00:00
Marin Shalamanov
228f46b5b9 Introduce DynamicDisplayInfo
In this CL we introduce the getDynamicDisplayInfo call
on ISurfaceComposer which replaces the existing
 - getDisplayModes
 - getActiveDisplayMode
 - getColorModes
 - getActiveColorMode
 - getHdrCapabilities

This way all display properties can be queried atomically.

The current DisplayInfo class is moved to the androd::ui
namespace and it's renamed to StaticDisplayInfo.

ui::DisplayMode is now LightFlattenable and the mode ID is
int32_t instead of size_t in order to prevent serialization
problems.

Additionally we add the ID field to ui::DisplayMode. This
way we no longer need the supported display IDs to be
from 0 to N-1.

Bug: 159590486
Bug: 180539476
Test: presubmit, manually test that device boots
Change-Id: I52b170913ce47cb5df2e8417e6cc95d395df1fda
2021-02-22 16:44:08 +01:00
TreeHugger Robot
e2edd2237b Merge "Add @addtogroup to permission_manager.h for doc to appear in DAC" into sc-dev 2021-02-17 19:36:48 +00:00
Jorim Jaggi
efc92f464e Merge "Add GPU completion to FrameMetrics (2/3)" into sc-dev 2021-02-17 17:38:20 +00:00
Alec Mouri
7015fa97ee Document DisplayManager atomicity with AChoreographer
Very early in Android 12's development, AChoreographer's refresh rate
callbacks were updated to dispatch from DisplayManager rather than from
SurfaceFlinger. Now that we've written a test enforcing this behavior,
update the documentation so that API users can depend on more reliable
behavior.

Bug: 168708518
Test: builds
Change-Id: I4f28c7a8d7b92b45dc2b89ba43595a6f0434d09d
2021-02-16 17:43:27 -08:00
Chong Zhang
7f7db5a8f9 Add @addtogroup to permission_manager.h for doc to appear in DAC
bug: 180406708
test: build and treehugger
Change-Id: Iaf8d2824c99762051553de39a0926a1fea9363fa
2021-02-16 15:01:53 -08:00
Jorim Jaggi
f51775dbb6 Add GPU completion to FrameMetrics (2/3)
- Add SurfaceStatsCallback to TransactionCompletedListener
- Register a callback in RenderProxy to be called when we have
surface stats from SF via the BLAST callback.
- Instead of finishing a frame for frame metrics reporting
immediately, wait until BLAST callback fires, note GPU completion
time and finish frame.
- Expose GPU_COMPLETION in FrameMetrics
- Modify TOTAL_DURATION to also include GPU_COMPLETION

Test: FrameMetricsListenerTest
Fixes: 171046219
Change-Id: If4b63c6a4c49c9ce2f31410d7f33541b0e6bf594
2021-02-12 12:41:01 +00:00
Huihong Luo
db5778ee16 Add ASurfaceControl_acquire api
hwui needs this api to hold a reference to a surface control object passed from java layer.

Bug: 173671170
Test: manual
Change-Id: I1ca9cbe5caad4bdb8594b421e5444d7bdb7b71a8
2021-02-11 17:59:24 +00:00
TreeHugger Robot
618dcfef3f Merge "Send consumeTime from the app to InputDispatcher" into sc-dev 2021-02-10 19:16:36 +00:00
Siarhei Vishniakou
3531ae7db4 Send consumeTime from the app to InputDispatcher
When the app completes an input event by calling 'finishInputEvent', it
will now notify InputDispatcher about the time when the event was first
read by the app.

This will help InputManager collect dispatching latency statistics.

Sample dumpsys output for validation:
    android.view.ViewRootImpl$WindowInputEventReceiver
       mInputChannel: da2dbc7 com.google.latencyTester/com.google.latencyTester.activities.MainActivity (client)
       mSeqMap: {}
       mReceiverPtr:
        mInputConsumer:
          mResampleTouch = true
          mChannel = da2dbc7 com.google.latencyTester/com.google.latencyTester.activities.MainActivity (client)
          mMsgDeferred: false
          Batches:
              Batch:
                  Message 2277: MOTION action=MOVE
                      Pointer 0 : x=643.0 y=961.0
          mSeqChains:
              <empty>
          mConsumeTimes:
              seq = 2277 consumeTime = 74385633441431
The above dump was acquired during touch of the latencyTester app.
Also verified that normally, mConsumeTimes is empty.

Bug: 169866723
Test: atest inputflinger_tests
Test: adb shell dumpsys activity all | grep -i consume -C 20
Change-Id: Ib173bb38e5decc2e4a6b0cf9bca9aceb32352ec0
2021-02-09 18:14:04 +00:00
Elliott Hughes
627873f3a6 Merge "Stop #define'ing __ANDROID_API__." am: 94be650e36 am: 73a4ac7daf am: 677f8c48f4
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1580211

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I66d850d16d5ff7c480cb5f8506801660dbb84b3f
2021-02-09 03:19:10 +00:00
Elliott Hughes
08e6cf5d7a Stop #define'ing __ANDROID_API__.
Also normalize the non-bionic definitions of __INTRODUCED_IN() to match
the majority.

Bug: http://b/178449269
Test: treehugger
Change-Id: I378a6d8a01999958f397c896a375d38a9de43f8f
2021-02-08 12:37:53 -08:00
Eric Laurent
e5d7b701a3 Merge "IAudioManager: add audio session ID to trackPlayer()" into sc-dev 2021-02-08 15:47:19 +00:00
Ady Abraham
767dc08c38 Merge "Remove stoza@ from OWNERS" am: 6b9a50419a am: 38f77ce227 am: 101035169c
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1575981

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If5d5f36f1e25996bd46a9649089df96546faf4aa
2021-02-06 02:31:36 +00:00
Ady Abraham
6b9a50419a Merge "Remove stoza@ from OWNERS" 2021-02-06 00:49:16 +00:00
Eric Laurent
bf28ea6181 IAudioManager: add audio session ID to trackPlayer()
Add the audio session ID to the information returned by the PlayerBase
class to AudioPlaybackMonitor via trackPlayer().

Bug: 178909700
Test: atest AudioPlaybackConfigurationTest
Change-Id: Ieb3e075d8edbef846ee5864e68ac5b774ac7cfc1
2021-02-05 14:55:44 +01:00
Dan Stoza
5dd2e398b7 Remove stoza@ from OWNERS
Removing stoza@ from OWNERS since he's leaving

Bug: N/A
Test: N/A
BYPASS_INCLUSIVE_LANGUAGE_REASON=Correct pronouns for stoza@
Change-Id: I800d39d2e1d8bde690cae696df38c7e6c6e459a5
2021-02-04 20:51:39 +00:00
Leon Scroggins III
c1f093f6bd Support building libjnigraphics on the host
Bug: 169137236
Test: SANITIZE_HOST=address make imagedecoder_fuzzer

Along with a change in frameworks/base
(I0ffc4e90b4083db79fbb12012e2e1284206b43e3), this will make it possible
to run imagedecoder_fuzzer on the host, for faster fuzzing.

imagedecoder.h:
- define __ANDROID_API__ and __INTRODUCED_IN on non-Android systems, so
  methods can be called on those systems.

bitmap.h:
- define __ANDROID_API__ and __INTRODUCED_IN on non-Android systems, so
  methods can be called on those systems.
- include <stddef.h>, which is needed on non-Android systems for size_t.
- on Android, unguard types and enums for easier opportunistic usage via
  dlsym.

nativewindow/Android.bp
- make libnativewindow_headers host_supported, so that libjnigraphics
  can access android/data_space.h

Bug: http://b/179303032
Change-Id: Iefdb4132d6f10f9164be85f4dc6e11883f6fd37e
Merged-In: Iefdb4132d6f10f9164be85f4dc6e11883f6fd37e
2021-02-04 00:35:30 +00:00
Elliott Hughes
66f7bc4e82 Merge "Remove __ANDROID_API__ #if checks." into sc-dev 2021-02-03 17:33:53 +00:00
Kim Low
03ea035572 Added the ability to read external batteries
Extended InputDevice and EventHub with capabilites to detect and read
external battery status and capacity. This allows devices such as
wireless gamepads to provide battery information to applications.

Bug: 161633432
Test: atest InputDeviceBatteryTest

Change-Id: I3c65166a1f0b055c5b85bad286afd5beb60bb303
Merged-In: I3c65166a1f0b055c5b85bad286afd5beb60bb303
2021-02-02 01:17:14 +00:00
Chris Ye
0230344dcd Update SOURCE_SENSOR source for input device.
Update the SOURCE_SENSOR input source to not limited to Joystick deivce
class.

Bug: 170131554
Test: atest InputDeviceSensorManagerTest
Change-Id: I08cb72f22d9a06f63139317551c821fd5eaa3e46
Merged-In: I08cb72f22d9a06f63139317551c821fd5eaa3e46
2021-02-01 22:14:01 +00:00
Elliott Hughes
23e82b4798 Remove __ANDROID_API__ #if checks.
__INTRODUCED_IN() does the right thing automatically now.

Bug: http://b/178449269
Test: treehugger
Change-Id: I94d2ad6fafb6d907793a416db82a9e56f4f61d1c
Merged-In: I94d2ad6fafb6d907793a416db82a9e56f4f61d1c
2021-02-01 13:34:00 -08:00
Elliott Hughes
b7425079bf Remove __ANDROID_API__ #if checks.
__INTRODUCED_IN() does the right thing automatically now.

Bug: http://b/178449269
Test: treehugger
Change-Id: I94d2ad6fafb6d907793a416db82a9e56f4f61d1c
Merged-In: I94d2ad6fafb6d907793a416db82a9e56f4f61d1c
2021-02-01 11:42:45 -08:00
Chong Zhang
2887ed93c5 Remove __ANDROID_API__ guards from thermal.h
__ANDROID_API__ guards are removed in favor of __INTRODUCED_IN macros.

bug: 163288375
bug: 169452730
test: builds

Change-Id: I145a86a5f8143977c8638aa3a3f14324a488fefb
2021-01-22 10:37:28 -08:00
Leon Scroggins
2416f131f6 Merge "Support building libjnigraphics on the host" 2021-01-15 14:24:34 +00:00
Leon Scroggins III
726a550804 Support building libjnigraphics on the host
Bug: 169137236
Test: SANITIZE_HOST=address make imagedecoder_fuzzer

Along with a change in frameworks/base
(I0ffc4e90b4083db79fbb12012e2e1284206b43e3), this will make it possible
to run imagedecoder_fuzzer on the host, for faster fuzzing.

imagedecoder.h:
- define __ANDROID_API__ and __INTRODUCED_IN on non-Android systems, so
  methods can be called on those systems.

bitmap.h:
- define __ANDROID_API__ and __INTRODUCED_IN on non-Android systems, so
  methods can be called on those systems.
- include <stddef.h>, which is needed on non-Android systems for size_t.
- on Android, unguard types and enums for easier opportunistic usage via
  dlsym.

nativewindow/Android.bp
- make libnativewindow_headers host_supported, so that libjnigraphics
  can access android/data_space.h

Change-Id: Iefdb4132d6f10f9164be85f4dc6e11883f6fd37e
2021-01-14 12:02:31 -05:00
Jiyong Park
fd86f1a545 Remove __ANDROID_API__ guards
__ANDROID_API__ guards are removed in favor of __INTRODUCED_IN macros.

Currently, __INTRODUCED_IN macro does nothing for these headers (it's
meaningful only to the headers processed by versioner which are limited
to binic headers). The plan is to make the macros to tag the declaration
with the availability attribute. Then, when the min_sdk_version of a
caller is set to an API level that is older than the API level of the
APIs, the compiler will provide them as weak symbols and enforce that
calling the APIs are guarded with a runtime check.

For now, these guards are preventing from making a build system change
to let __ANDROID_API__ track the min_sdk_version property instead of the
sdk_version property. With the build system change, __ANDROID_API__ will
suddenly drop for the native modules where min_sdk_version <
sdk_version, which is the case when the modules are included in APEXes.
As a result, some new APIs will be unavailable at build-time. Dropping
the hand-written guards fixes the problem.

Bug: 163288375
Test: m
Change-Id: Ia1292327fd995e847f3d6a5837adef048220fd78
2021-01-14 17:40:23 +09:00
TreeHugger Robot
df6bae2a61 Merge changes from topic "AImageDecoder_setInternallyHandleDisposePrevious"
* changes:
  Add AImageDecoder_setInternallyHandleDisposePrevious
  AImageDecoder: Hide support for animated HEIF
2021-01-14 06:06:03 +00:00
Leon Scroggins III
78859b42b5 Add AImageDecoder_setInternallyHandleDisposePrevious
Bug: 160984428
Test: I00682f201a52f894b0e1335c00c4368ce675a805
Change-Id: I1262f6003e45f8217cb1adb90ffcc5a165a24b7a
2021-01-13 12:00:01 -05:00
Leon Scroggins III
ec2cbe34d7 AImageDecoder: Hide support for animated HEIF
Bug: 160984428
Bug: 170672785
Test: none

The system currently requires decoding the pixels of the frame of an
HEIF/AVIF animated image before the actual duration of that frame can
be retrieved. Rather than handling this (likely temporary) limitation by
- documenting it
- providing extra APIs
- limiting other formats in the same way
remove documentation specifying that animated HEIF is supported.
Developers are likely to be more interested in the other formats (GIF,
WebP) anyway. If they do attempt to animate an HEIF file, they will
still see the default duration specified for the sequence.

Change-Id: I5b97aeddee1311b694d73ac67b6157032d9ad745
2021-01-13 12:00:01 -05:00