Commit Graph

6863 Commits

Author SHA1 Message Date
Jerry Zhang
6d319b8aaa Write descriptors for Mtp in UsbService
The current model for setting up a functionfs
function is:

UsbDeviceManager#setCurrentFunctions() ->
intent is sent to MtpReceiver to write the descriptors ->
init/hal waits for descriptors to write, then pulls up gadget ->
Gadget is configured, a USB_STATE intent starts MtpServer

The main downside of this is a lack of reliability because
the Mtp process could be killed at any point. Normally, a
gadget is unbound if its control endpoint is closed. no_disconnect
works around this, but is still a little janky. In addition, the
extra intent delays the startup of the gadget.

With the new model, UsbDeviceManager writes the descriptors
on initialization. Since it is a system service, it won't be killed.

UsbDeviceManager#setCurrentFunctions() ->
init/hal pulls up gadget ->
Gadget is configured, a USB_STATE intent starts MtpServer
MtpServer calls UsbManager#getControlFd to get a dup of the control
endpoint.

Also modify permissions so system server can access mtp files.

Bug: 72877174
Test: Change usb configurations to ptp/mtp
Change-Id: Id17d2b5930f4e1f37ec1b4f00add9d594174ad49
2018-03-22 11:35:19 -07:00
Mikhail Naganov
d51f47e193 Merge "Audio presentation: Docs & Testability fixes" into pi-dev am: 397962981c
am: 0056af933e

Change-Id: I588333753dab8f67e14b1521f6695ecbe5920af3
2018-03-22 16:57:05 +00:00
TreeHugger Robot
397962981c Merge "Audio presentation: Docs & Testability fixes" into pi-dev 2018-03-22 16:14:19 +00:00
Mike Digman
5527286e08 Add vol up + power ringer toggle gesture
It only runs when the screen is on.

Test: manual, invoking gesture with different system settings
Bug: 75252670
Change-Id: I934d0bbb0a9fffecf34ebaadf77f3e1241d4faf7
2018-03-22 10:55:24 -04:00
Hyundo Moon
f84c1c067a MediaSession2: Protect MediaSessionManager APIs with permission
Bug: 73226436
Test: Locally created custom CTS methods and run
Change-Id: Iec5d0900b30f9ec19faa5beb11a83f4e5696b57e
2018-03-22 23:55:21 +09:00
Jaewan Kim
f73bc870c0 MediaSession2: Add more detailed documentation for addPlaylistItem()
Bug: 73149584
Test: Run CTS with MediaComponents/runcts.sh
Change-Id: Ifc16e9d4ee210ac901941d8f3a6a228aa3f1ddd8
2018-03-22 21:29:03 +09:00
Christofer Åkersten
85701d1043 Merge "Remove unnecessary Context from ApiLoader" into pi-dev am: bf121d2f13
am: 0f524c02b2

Change-Id: I648e9a39a7c546cedae9b20cc264dc88d9598473
2018-03-22 12:07:20 +00:00
Sungsoo Lim
5d7e96b1d1 Use SessionPlaylistAgent in MediaSession2Impl
Bug: 74090741
Test: SessionPlaylistAgentTest, MediaComponentTests
Change-Id: I3f5ad7ab233fb1be51c5211b12a8292b173f3738
2018-03-22 20:44:29 +09:00
Christofer Åkersten
6bd3ab6dc6 Remove unnecessary Context from ApiLoader
Bug: 76001644
Test: compile
Change-Id: I6ac81dac16374d90facfe33c68607c5c286b335f
2018-03-22 14:55:55 +09:00
TreeHugger Robot
607282adf6 Merge "AudioService: check permission on forceVolumeControlStream" 2018-03-22 01:48:40 +00:00
Philip P. Moltmann
6951f56be0 Add SoundTriggerDetectionService am: 18e3eb8168
am: 9dd3e7d300

Change-Id: I13fd3f3d896825ddaf7cf5017eb027e5469208fb
2018-03-21 09:16:32 +00:00
Chong Zhang
19c88e2989 Merge "Merge "heif: address api review comments" into pi-dev am: ffb6521082" into pi-dev-plus-aosp
am: 9079589e0c

Change-Id: I13e3e5884e6ec6a86e587fa667e01cafe63850de
2018-03-21 06:58:03 +00:00
Philip P. Moltmann
9dd3e7d300 Add SoundTriggerDetectionService
am: 18e3eb8168

Change-Id: I4bb7ada74c36df4a64956c9c36a1675aad1f6645
2018-03-21 06:00:01 +00:00
TreeHugger Robot
6ed6340e3c Merge changes from topic "SoundTriggerJobService-steps" into pi-dev
* changes:
  Throttle number of sound trigger operations / day
  Add SoundTriggerDetectionService
  Expose SoundTriggerManager and SoundTrigger APIs
2018-03-21 03:27:56 +00:00
TreeHugger Robot
ffb6521082 Merge "heif: address api review comments" into pi-dev 2018-03-21 01:04:15 +00:00
Philip P. Moltmann
18e3eb8168 Add SoundTriggerDetectionService
The service is meant to replace the PendingIntent based API. Once all
users of the PendingIntent based API switched the PendingIntent based API
will be removed.

To have as little as possible impact on the whole SoundTrigger framework
the RemoteSoundTriggerDetectionService class implements the same
interface as the PendingIntent based class. Hence the exising code has
very little change. Further once the old code can be removed the amount
of changed (and added) code is limited.

The RemoteSoundTriggerDetectionService -> SoundTriggerDetectionService
is a vanilla as possible service implementation. The special behaviors
are:
- The system holds a wakelock while service operations are in progress
and the service is bound as foreground. Hence the service can e.g.
listen to the microphone.
- Service operations have a certain amount of time they are allowed to
run. Once every operation is either finished or the the operation
exceeded the allotted time, the system calls onStopOperation for each
still pending operation. This is a similar model as for the commonly
used JobService.
  Please note that if the time allowed for an operation is 15s and
op1 was run as 0si, and op1 was run at 5s, the service is allowed to run
until 20s. Hence _both_ onStopOperations will happen at 20s. This is
done for ease of implementation but should not give the service more
power than calling onStopOperation exactly 15s after each operation is
triggered.
- If an operation is done before the allotted time is reached, the
service can declare the operation as finished manually by calling
onOperationFinished. This is a call back into the system, hence a
'client' binder is sent to the service. If the operation is finished
by calling this method onStopOperation will not be called.
- As the service instance might be killed and restored between
operations we add a opaque bundle 'params' to each operations. The users
of the API can use this to send data from the start command to the
operations. It can also just be set to null. The params are not meant to
store changing state in between operations. Such state needs to be
persisted using the regular methods (e.g. write it to disk)
- A service can be used for multiple recognition sessions. Each
recognition is uniquelity defined by its sound model UUID. Hence each
operation gets at least tree arguments: Operation ID, sound mode UUID, params
- As a small optimization the params are cached inside of the service
instance.

The time allowed for each operation is in a @SystemAPI global setting,
so the service can make sure it finishes the operations before they are
stopped. It might take some time to deliver the operations via the
binder, hence it is not recommended to try to use every last ms of
allotted time.

Test: atest SoundTriggerDetectionServiceTest (added in separate CL)
      atest android.provider.SettingsBackupTest
Change-Id: I47f813b7a5138a6f24732197813a605d29f85a93
Fixes: 73829108
2018-03-20 13:57:14 -07:00
Paul Mclean
128f093ee8 Merge "(re)integrating Native MIDI API into NDK - base API" 2018-03-20 19:43:14 +00:00
Jean-Michel Trivi
60eddfde30 AudioService: check permission on forceVolumeControlStream
Check MODIFY_PHONE_STATE  permission on
   AudioManager.forceVolumeControlStream

Test: manual: verify UI can still select between two stream volumes

Change-Id: I50da25d50829193c9f9d7761bb6e58d1aa5cf3f4
2018-03-20 17:43:06 +00:00
Emilian Peev
a481fdf08f Merge "Camera: Populate Image tranformation in reader and writer" into pi-dev am: d41fed72c7
am: b05f2511e2

Change-Id: I273321efbb1691fdbfe5610e19aa084cd47c6e9a
2018-03-20 13:07:55 +00:00
TreeHugger Robot
d41fed72c7 Merge "Camera: Populate Image tranformation in reader and writer" into pi-dev 2018-03-20 12:33:37 +00:00
Emilian Peev
450a5ffdfd Camera: Populate Image tranformation in reader and writer
"ImageReader" and "ImageWriter" must pass information about the
specific buffer transformation.
Currently only the "ImageReader" implementation of the
"android.media.Image" abstract classs will populate the
corresponding transformation, the remaining implementations will
use the default identity tranformation.

Bug: 75316204
Test: Manual using test application,
Camera CTS

Change-Id: If5c12134fbbef8cc20c3d369986ba613bc4f2cec
2018-03-19 16:19:43 +00:00
Jaewan Kim
4a56163d19 Merge "MediaSession2: Implement fastForward() / rewind()" into pi-dev am: d65bb20283
am: 9d54368ecf

Change-Id: I6e860ef4eff3a7128e2f6169ebe7fb761a91d8d8
2018-03-19 11:18:28 +00:00
Jaewan Kim
83bc984a6c MediaSession2: Implement fastForward() / rewind()
Bug: 74724709
Test: Run CTS with MediaComponents/runcts.sh
Change-Id: Ibd313dc6eed82a5d7cc9fc156f7851aba13f9e29
2018-03-19 17:39:02 +09:00
Christofer Åkersten
161bf09120 Merge "Remove Context requirement from updatable" into pi-dev am: ac16fb5d41
am: f8f74a5e6d

Change-Id: I0a999e6863145243ee7bb17d34bde19825bb110f
2018-03-19 04:25:40 +00:00
Christofer Åkersten
72a86922d4 Remove Context requirement from updatable
Bug: 74843539
Test: runtest-cts-MediaComponents && atest VideoView2Test
Change-Id: Iba5422f8d092205316ec3fa2c10da6d3f983fde6
2018-03-17 18:56:28 +09:00
Hyundo Moon
6df7c2c3a7 MediaSession2: Implement getPlayerState/Position/BufferedPosition am: 78e4f84f04
am: 5563e8f5de

Change-Id: I79ff65c6e5a70f0bc6a693c9b84ac17d4133380e
2018-03-16 10:06:51 +00:00
Hyundo Moon
78e4f84f04 MediaSession2: Implement getPlayerState/Position/BufferedPosition
Bug: 74578458
Test: Passed CTS
Change-Id: If215e8e16bdce9fdc04ca18ed8d08ed374d13a98
2018-03-16 18:03:17 +09:00
Jaewan Kim
c9871326dd Merge "MediaSession2: Implement PlaylistParams replacements" into pi-dev am: 328df91d99
am: 05ccd347d1

Change-Id: I547d96c04a7b4264dbb29ccf55bac44b74138acd
2018-03-16 07:05:14 +00:00
Jaewan Kim
2d7cfda523 Merge "MediaSession2: Remove MediaSession2#registerPlayerEventCallback()" into pi-dev am: eb8e914ea7
am: d28a13b41e

Change-Id: Iec8385c88d8b5951b588ba71a09123faf415e541
2018-03-16 05:03:07 +00:00
Jaewan Kim
f4abf4a0fe Merge "MediaSession2: Remove onPlaylistChanged() without metadata" into pi-dev am: 9cc144850f
am: 94454404a5

Change-Id: If65047774343ba0d6a6676dac2885a7f73559a97
2018-03-16 04:51:33 +00:00
Jaewan Kim
f10ca2f960 MediaSession2: Implement PlaylistParams replacements
This includes following changes
  - Remove PlaylistParams
  - Implement PlaylistParams replacements. Here's the list.
    - get/setShuffleMode()
    - get/setRepeatMode()
    - Note: Playlist metadata APIs are already submitted (b/74174649)

Bug: 74116823, Bug: 74118768
Test: Run CTS with MediaComponents/runcts.sh
Change-Id: I0267ffeaf92257eb7b81ffc8b6a3f40b5a2f6f9c
2018-03-16 12:21:29 +09:00
Hyundo Moon
9182a7964a Merge "MediaSession2: Convert DataSourceDesc to MediaItem2 in MyPlayerEventCallback" into pi-dev am: b0179a3a44
am: 0cbac17c98

Change-Id: Ia32f2e68d1317bfbc5aab20b6b255d3a59c45207
2018-03-16 03:04:54 +00:00
Wei Jia
15bae53fe0 Merge "MediaPlayer2Impl: fix null object reference." into pi-dev am: 2d76c3ce82
am: ce07768acf

Change-Id: Ida5bacd7c9a2a5f9680ec200d1ad012412515bcc
2018-03-16 02:10:01 +00:00
Jaewan Kim
8e17db5554 MediaSession2: Remove MediaSession2#registerPlayerEventCallback()
Bug: 74157064
Test: Run CTS with MediaComponents/runcts.sh
Change-Id: Ia976c0ebe9f2b7eff0ae603db96ab106aa045cbc
2018-03-16 10:59:32 +09:00
Jaewan Kim
15fc050432 MediaSession2: Remove onPlaylistChanged() without metadata
Bug: 74174728
Test: Run CTS with MediaComponents/runcts.sh
Change-Id: I84495aa19bc03009c81cdefdf8e65fbff4b7bcb6
2018-03-16 10:52:18 +09:00
Hyundo Moon
b0179a3a44 Merge "MediaSession2: Convert DataSourceDesc to MediaItem2 in MyPlayerEventCallback" into pi-dev 2018-03-16 00:18:41 +00:00
Paul McLean
8a3e33b36a (re)integrating Native MIDI API into NDK - base API
Implement native MIDI API (amidi)

Bug: 30252756
Bug: 37090545

Test: manual - Connect PreSonus AudioBox 22VSL and run tests in NativeMidiTestbed app.
Verify MIDI messages sent to external MIDI synthesizer.
Verify MIDI messages received from external MIDI synthesizer.
CTS

Change-Id: I7bb02b8926d01090132ce873c785b5323a9fa5f8
2018-03-15 16:20:07 -07:00
TreeHugger Robot
2d76c3ce82 Merge "MediaPlayer2Impl: fix null object reference." into pi-dev 2018-03-15 22:54:49 +00:00
Chong Zhang
6c8512978a heif: address api review comments
- renaming of MediaFormat keys related to grid config

- add methods to MediaMetadataRetriever to get image/frame
  with default bitmap config

- fix java doc

bug: 74831433

Change-Id: Iec607e615d34bea0620070592e4adcfc04cbccae
2018-03-15 15:05:29 -07:00
TreeHugger Robot
991ae64ffe Merge "fix slow get caps -- DO NOT MERGE" into pi-dev 2018-03-15 21:40:32 +00:00
Wei Jia
371144fcc2 MediaPlayer2Impl: fix null object reference.
Test: cts tests pass
Bug: 74204684
Change-Id: I906eeb9d907ae1a798be585c54126f02eb66448f
2018-03-15 11:26:37 -07:00
Chong Zhang
a0b72a6cdd fix slow get caps -- DO NOT MERGE
When get caps is called on an MediaCodec object, try to
use the codec info for that MediaCodec first as it should
be available during codec construction. Only when that
somehow failed go and initialize the full MediaCodecList,
as building the entire list could be very slow.

And when cloning the CodecCapabilities from MediaCodecInfo,
copy the fields directly and the fields (other than the ones
modifiable by client) are immutable after construction.

bug: 74073607

Test:
CTS media post submit:
cts-tradefed run cts-dev --module CtsMediaTestCases --compatibility:module-arg CtsMediaTestCases:include-annotation:android.platform.test.annotations.RequiresDevice

Change-Id: I4ae5f2431da8528e1eca093c5cfb98abcb4a5bbf
(cherry picked from commit 90d7304a83)
2018-03-15 18:17:53 +00:00
Wei Jia
af69920572 Merge "MediaPlayer2Impl: fix several functions" into pi-dev am: 50f118a121
am: 036f9d1436

Change-Id: I28e6d4d1e596b47ee6e878be011184936f314dcf
2018-03-15 16:05:51 +00:00
TreeHugger Robot
50f118a121 Merge "MediaPlayer2Impl: fix several functions" into pi-dev 2018-03-15 15:40:10 +00:00
Hyundo Moon
e14acb53fa MediaSession2: Convert DataSourceDesc to MediaItem2 in MyPlayerEventCallback
This CL adds a hidden API getMediaItem() in MediaPlaylistAgent.

Bug: 74506462
Test: Passed CTS
Change-Id: I1aefd7e47e1881fe14fcd1cc681095a6130624cf
2018-03-15 20:37:35 +09:00
Jaewan Kim
5772194a6f Merge "MediaSession2: Implement skipTo APIs" into pi-dev am: a01d80b97e
am: a1e87d864b

Change-Id: Ic1bf43157d319525d66a01c6244fe89a725b0934
2018-03-15 10:47:07 +00:00
Jaewan Kim
68c774a1ee MediaSession2: Implement skipTo APIs
This implements following APIs from both session and controller.
  - skipToPlaylistItem()
  - skipToNextItem()
  - skipToPreviousItem()

Bug: 74175632
Test: Run CTS with MediaComponents/runcts.sh
Change-Id: I47d94346c997314ff39797bac3034aa507058036
2018-03-15 15:49:58 +09:00
Wei Jia
096d97ac3e MediaPlayer2Impl: fix several functions
Test: MediaPlayer2 plays
Bug: 74204684
Change-Id: I0e4fbd2915f2a726a6016c13f47e7d1433593c74
2018-03-14 14:46:24 -07:00
Jaewan Kim
b8a4df9d40 Merge "MediaSession2: Refactor incoming binder calls to the MediaSession2Stub" into pi-dev am: 3b8eedcb34
am: c06466a8c1

Change-Id: Ie4510ec763f8b2f2f6f74cb5f49c28f6c078fb1a
2018-03-14 10:53:42 +00:00
Jaewan Kim
009c393ca1 MediaSession2: Refactor incoming binder calls to the MediaSession2Stub
This CL refactors methods in MediaSession2Stub that handles incoming
binder calls from the controller by adding methods to do followings
in one place.
  1. Check if the session hasn't closed.
  2. Check if the controller is allowed for the command
  3. Call SessionCallback#onCommandRequest() for APIs that would be
     sent directly to the MediaPlayerBase or MediaPlaylistAgent if
     allowed.

This CL also adds missing command code for setRating().

Bug: 74581821
Test: Run CTS tests with MediaComponents/runcts.sh
Change-Id: I9b96e26b7644cff3c54269773590c73ff30f956c
2018-03-14 10:02:36 +09:00