32 Commits

Author SHA1 Message Date
Elliott Hughes
8a741eaecc Merge "Clean up some shell script copy & paste." am: b4012baaf4
am: fda05c96c1

Change-Id: I104862db5d787ffc14512bf1181332c8ca7ba872
2019-05-10 11:22:58 -07:00
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
Colin Cross
0a2d8cbb26 Convert frameworks/base/cmds/media and bmgr to Android.bp
See build/soong/README.md for more information.

Bug: 122332340
Test: m media
Test: m RunBackupFrameworksServicesRoboTests
Change-Id: Ieb54feb3902bddfd5a571369fbf50161ae646647
2019-03-29 12:41:25 -07:00
Sungsoo Lim
c8b15b6b77 Remove direct use of ISessionController in media cmd
Test: manual
Change-Id: Ia955858bee1b9a270b44f37e5dec9f4a594618bd
2019-01-21 19:53:59 +09:00
Hyundo Moon
8cd0ae9041 Introduce ControllerCallbackLink
In order to avoid direct AIDL usages in framework, this CL introduces a
new public class ControllerCallbackLink which can prevent usages of
ISessionControllerCallback.

Bug: 122337578
Test: make update-api -j / make -j
      atest CtsMediaTestCases:android.media.cts.MediaSessionTest
      atest CtsMediaTestCases:android.media.cts.MediaControllerTest
Change-Id: Id674576aa071b7fdbd0082bf6189fef2af2d919b
2019-01-11 14:42:14 +09:00
Hyundo Moon
98e819216c Make PlaybackInfo implement Parcelable
This CL makes MediaController.PlaybackInfo implement Parcelable, and
replaces ParcelableVolumeInfo with the class.

Bug: 122243794
Test: make update-api -j; make -j;
Change-Id: I89d3df721a43e8c1454dbb3bdcb0b34c943339ce
2019-01-07 15:23:04 +09:00
Hyundo Moon
7053844db7 Revert "Introduce ControllerCallbackLink"
This reverts commit e521669b5d7aa6ce32bf965bd0bb9a84a2cdb19b.

Reason for revert: Another CL will be uploaded which makes the APIs public, not @SystemApi.

Bug: 122169124
Change-Id: Ie9ed1067596fe1724879e81d768ac8252eda7841
2019-01-04 14:27:45 +09:00
Hyundo Moon
e521669b5d Introduce ControllerCallbackLink
In order to avoid direct AIDL usages in framework, this CL introduces a
new class ControllerCallbackLink which can prevent usages of
ISessionControllerCallback.

Bug: 122169124
Test: make update-api -j / make -j
      atest CtsMediaTestCases:android.media.cts.MediaSessionTest
      atest CtsMediaTestCases:android.media.cts.MediaControllerTest
Change-Id: I860ea56afc046dd91e065ef207d374c0aa490c8f
2018-12-31 15:05:15 +09:00
Jaewan Kim
21c23e30b4 Differentiate MediaController in a process for MediaSession
MediaSession#getCurrentControllerInfo() can have more fine grained
differentiation for multiple MediaController in a package/process

Bug: 79728675
Test: Run CtsMediaTestCases
Change-Id: I81e94736e795ee5e7fbd28cb6cd834cc3a3b8f98
2018-05-19 08:36:51 +09:00
Jaewan Kim
77748b623c MediaSessionService: Provide caller information for media key events
Current limitation is that we cannot distinguish between key events
from Window#injectInputEvent() and key presses from physical devices.

Bug: 79185725
Test: Manually verified with the test app, and Cts
Change-Id: I1c3da4a963238512eec8b57fbc2d825c7436b140
2018-05-08 15:53:00 +09:00
Hyundo Moon
b1e344eaab MediaSession: Create getCurentControllerInfo()
Bug: 65739365
Test: Ran MediaControllerTest
Change-Id: I05c9179546d826e8fabb4fd4e4e03837dd4685ff
2018-03-29 11:25:03 +09:00
George Burgess IV
6c1688850e cmds: add #!s
Without this, exec()ing these fails.

Found with `grep -L bin/sh $(grep -Rl Script)`

Bug: None
Test: exec()ed each of these scripts; I no longer get "exec format
error" for any of them.
Change-Id: I47db5007e5cc14ab91eb846b7bffecb925d37874
2017-11-05 01:07:30 -07:00
Sungsoo
3e5a34ea8e Revert "MediaSession: Add methods for setting shuffle and repeat modes"
This reverts commit ba11085635ea3ef9383b34dd44c43f2a6cd832ff.

Bug: 36844917, Bug: 36525228, Bug: 36525325
Test: Pass MediaSessionTest and MediaControllerTest
Change-Id: I4805ea58107b5fab8c9f5f0fcaffd1e0e4882ed8
2017-04-13 09:43:23 +09:00
Frank Barchard
39a1fce439 media volume allow --get to be combined with --set and --adj
Bug: 33819516
Test: adb shell media volume --stream 3 --adj lower --get
Change-Id: Ie30f5c0ea54bfac59c2e05513da61a98658f7d0e
2017-01-24 23:47:19 +00:00
Frank Barchard
b6b3030539 media volume: remove old --set and rename --index to --set
The old --set did not take a parameter for volume and was
defaulting to volume index of 5.
The old --index option allowed the user to set the volume to
a specified value.
This CL removes the old --set that had limited usefulness, and
renames --index to --set, so --set now takes a parameter for
volume.
For backward compatibility the --index option is kept around
to allow scripts time to switch to --set

Bug: 33791633
Test: adb shell media volume --set 4
Change-Id: I43a87a878439b3416efa746708b62a869023acdc
2016-12-22 00:18:50 +00:00
Frank Barchard
f41d429ce7 media volume --get outputs the current volume
Add --get option to media volume to fetch the specified
stream volume and output it on the console.
Also displays the min and max volume for that stream.

Bug: 33559057
Test: adb shell media volume --stream 3 --get
Change-Id: Icc82ba1349dd75e07ccff4872e104843a69e5f17
2016-12-21 18:30:28 +00:00
Jean-Michel Trivi
be47e19355 Extend "media" shell command for volume control
Add option to the "media" command to set or adjust the volume.
Run "adb shell media" for options and examples.

Test: adb shell media

Change-Id: I434f9cd33a9fefb2cd21a3415ec8b2e0a569482e
2016-12-10 11:44:26 -08:00
Hyundo Moon
934a526e68 MediaSession: Rename methods related to shuffle mode
This CL remames following methods:
 - MediaController.getShuffleMode() -> isShuffleModeEnabled()
 - MediaController.TransportControls.setShuffleMode()
    -> setShuffleModeEnabled()
 - MediaSession.setShuffleMode() -> setShuffleModeEnabled()
 - MediaSession.Callback.onSetShuffleMode() -> onSetShuffleModeEnabled()

Change-Id: Ifb1ef5b5355ddec60c3e9e84d53eb4ead4671b4f
2016-09-12 21:15:41 +09:00
Sungsoo Lim
ba11085635 MediaSession: Add methods for setting shuffle and repeat modes
Bug: 27317954
Change-Id: Ie83b25f40dd84e5b521a186077f23d343314201a
2016-08-02 16:09:54 +09:00
John Spurlock
08c7116ab9 Remove unused imports in frameworks/base.
Change-Id: I031443de83f93eb57a98863001826671b18f3b17
2015-02-28 14:47:49 -05:00
RoboErik
03fce072ca Allow null queues to be set in MediaSession
Also add some test code for it to OneMedia.

bug:17593962
Change-Id: I074e2bb0329d9a97f623e4309bb7dada157b8324
2014-09-24 14:35:32 -07:00
RoboErik
78c64cdbd8 Fix crash in legacy apps that register without a looper
Some legacy apps registered their media button receiver in a thread
without a looper. If this happens we need to use the main looper to
prevent a crash.

bug: 16306226
Change-Id: Idf472e649393e2a7ce2a3e1cbb3476003ab17f34
2014-08-14 18:42:54 -07:00
RoboErik
24762bffc3 Add an onSessionDestroyed callback to MediaController.Callback
Callbacks on the controller need to know when the session ceases
to exist.

bug:17009030
Change-Id: I0f1c1cfc51f7dd2203955287cc269667d3765ee4
2014-08-13 15:00:21 -07:00
RoboErik
75847b98f3 Add display metadata and change strings to CharSequences
This adds some fields for display purposes to MediaMetadata and also
makes the default for all text CharSequence instead of String. Also
adds a hidden method for getting a Description for the metadata.

bug: 11708293
Change-Id: I0ed58d9ac3aeff41325c4ccf5fed0539bbf03b4d
2014-08-05 14:30:27 -07:00
RoboErik
031149cd5f Add context to MediaController constructor
This also adds a convenience method to MediaSession to allow getting
a controller instead of having to create and cache your own.

bug:16561220
Change-Id: I87f551a7474e71f1cf2f07e0e541c3a4515cd977
2014-07-28 11:02:15 -07:00
RoboErik
aa4e23bbb3 Add getPackageName to MediaController
This removes the MediaSessionInfo class and adds a method on the
controller to get the package name. This also converts code that
depended on the session's UUID to use the token for comparison or
the Tag in the case of test code that needs a string identifier.

Change-Id: Icb8dc76c70e23e897da8fd07651c524b96372bf9
2014-07-25 16:22:59 -07:00
RoboErik
8b4bffcac9 Make MediaSession and MediaController constructors public
This makes the MediaSession/Controller constructors public and registers
with the system behind the scenes.

This also adds a bit about needing to call setActive(true) to start receiving
commands in MediaSession's docs.

Change-Id: If882d229b54c36bf0831aca0255052dda667a2bc
2014-07-16 12:03:45 -07:00
Jeff Brown
01a500ed1c Delete first draft of media routing APIs.
The new APIs will not be as tightly integrated into MediaSession.

Change-Id: I5cfd37d9d8d0c5d46c55edb5cf0772a8f1ef13ab
2014-07-14 04:06:44 -07:00
RoboErik
d3c8642dae Remove some more old code and fix Media command
Removes some more hidden apis from AudioService/Manager. This also
fixes up Media.java to support commands for the new service to help
with debugging. Also fixes a couple bugs that were found while fixing
up Media.

Change-Id: I68e4aa80a4de430b98236aafc883664b9432c62b
2014-06-19 10:37:00 -07:00
Jean-Michel Trivi
f108cdd9ee Also rely on enabled notification listeners for RemoteController registration
Registration of a RemoteController may succeed only if:
 - the caller has the MEDIA_CONTENT_CONTROL permission,
 - or if the RemoteController.OnClientUpdateListener it
   registers if one of the enabled notification listeners.

For using the "enabled notification listener" functionality,
 the CL involved:
 - making OnClientUpdateListener an interface so a 3rd-party
   application may have its implementation extend
   NotificationListenerService, which is required for a
   listener to be enabled by the user.
 - add the concept of "enabled" status in an
   IRemoteControlDisplay, so a RemoteController (which
   encapsulates the IRemoteControlDisplay implementation)
   may be registered, but later temporarily disabled by
   the user, as a result of a user action in the security
   settings, or a user switch.
 - making MediaFocusControl, the component tied to
   AudioService, monitor changes in enabled notification
   listeners, and act upon enable/disable changes.

Bug 8209392

Change-Id: Ia8dfa2156c65668b2b0d4ae92048005912652d84
2013-10-04 17:50:44 -07:00
Dianne Hackborn
79f7ec70eb Have audio service clean up new receivers in crashing processes.
The new media button receiver with only a pending intent (no
component name) could be left hanging if the process that
registered it went away.  These semantically need to be tied
to the calling process's lifetime; we now clean them up when
the calling process goes away.

Also added some additional cleanup of media button receivers
when packages change (updated, cleared).

And on top of that, a new "media" command for doing media
things.  Currently lets you send media keys and monitor
remote display data.

Oh and finally added a new BaseCommand base class for
implementing these command line utilities.

Change-Id: Iba1d56f10bab1eec4a94a7bb1d1c2ae614c8bcf5
2013-04-08 13:08:37 -07:00