Commit Graph

19 Commits

Author SHA1 Message Date
Martijn Brekhof 33043396b8
Fixed OutOfBounds exception (#708)
This fixes an array out of bounds exception when the playlist is cleared
and the PlaylistFragment.playlistsAvailable is called with an empty
list.
2020-02-13 08:46:12 +00:00
Synced Synapse 7dfd982643 Tweak connection threads
This PR fixes some issues with connections and threading. Specifically, the  change in #618 introduced threading in `HostConnection`, which had some issues. To fix them, the following changes were made:
- A specific TCP listener thread is used and manually started, instead of using one of the threads in the pool. The TCP listener thread is a long lived thread that should always be running (as long as the connection is through TCP), blocked listening on the TCP socket, so it shouldn't be managed in a pool, where, theoretically, it can be paused and reused. 
- Changed the number of threads to 5. We shouldn't need more than this, otherwise we can overwhelm some Kodi hardware.
- Had to sprinkle some `synchronized` to avoid race conditions. For instance, through a TCP connection, as soon as Kore is opened (on the remote screen) it will call at least `GetActivePlayers`, `GetProperties`, `Ping`. If the TCP socket isn't set up yet, each of these calls would create a socket (and a TCP listener thread), so we would open 3 or more sockets when we should just open 1. A `synchronized` in `executeThroughTcp` prevents this. The others prevent similar issues.

Aditionally:
- Tweaked the playlist fetching code, so that it happens exclusively in `HostConnectionObserver` and when PlaylistFragment is notified of changes, it already gets the playlist data. This somewhat simplifies the code, and makes it more consistent with the Player Observer code;
- Change `EventServerConnection` to accept a Handler on which to post the result of the connection, so that the caller can control on which thread the result is called;
- Calls to the various `RegisterObserver` loose the reply immediately parameter, as it was always true.
2019-09-28 22:10:04 +02:00
Martijn Brekhof 3b2447607b Implemented support for handling multiple playlists in tests (#657)
Added support for handling multiple playlists in the Mock TCP server.
Refactored SlideUpPanelTests to support the new playlist handler.

Some code cleanup and enhancements
- Removed throw exception declarations from methods that never throw the exception.
- Changed deleting the test database on the test device to delete all databases.
  The former method of only deleting the test database resulted in many old databases
  that were not removed when the test run crashed.
- Enhanced robustness of testing async code by explicitly waiting for a view
  to reach a certain state.
2019-07-03 18:54:51 +01:00
Synced Synapse c7fef43deb Fix ANR in service launch
Some ANRs are reported on Google Play. This is an atempt to remove them, by making sure that `startForeground` is always called when the service starts.
2019-05-14 22:06:34 +02:00
Martijn Brekhof cdbdd98d6a Implemented showing playlists even when not playing (#618)
Implemented showing a music/video/picture playlist in PlaylistFragment even
when playback has stopped but the playlist is still available on Kodi.
The playlist is now only cleared if the Playlist.OnClear event is received
from Kodi.

As the pictures playlist does not support moving/removing items this has
been disabled for the pictures playlist only.

Added a new package org.xbmc.kore.host.actions to hold all Callable's that
we use to handle complex interactions with Kodi that use multiple JSON RPC
calls.

Fixed issue in HostConnectionObserver in method notifySomethingIsPlaying
where hostState.lastGetItemResult.label might not be set.

Reduced calling (force)refreshPlaylist considerably as it should now be
handled by the playlist observer.
2019-03-30 11:08:58 +00:00
Synced Synapse c043c04264 Add support for OnAVStart event and tweak HostConnectionOberver 2019-02-08 22:30:48 +01:00
Martijn Brekhof e60df7e8ac Fixed issue with registering observers multiple times (#605)
Registering observers would cause the runnables to be
posted multiple times to the checkerHandler. This resulted
in callbacks being called more than once when a result was
received.
2019-02-07 16:39:56 +00:00
Synced Synapse 94693cb5a5 Fix NPE on volume change by not unbinding the controls in the Volume Level Indicator too soon 2018-07-04 20:54:12 +02:00
Martijn Brekhof 16b4044edf Fixed reported NPE when calling notifySomethingIsPlaying (#552) 2018-06-09 18:46:05 +01:00
Synced Synapse de683826ad Add support for handling Player.OnResume event through TCP
As detailed in https://github.com/xbmc/xbmc/pull/13726#issuecomment-378188082, Kodi will stop using the event Player.OnPlay when resuming a video, sending a Player.OnResume event instead. This PR handles that change.
2018-05-04 21:10:06 +02:00
Martijn Brekhof cb430aa20d Implemented a slideup panel with media controls and info (#320)
* The slideup panel is only displayed when something is
         playing. It starts collapsed showing the media poster
         and title of what is currently playing.

       * Media controls implemented are volume, progress, shuffle,
         repeat and play/pause for all items. Next and previous are only
         available when a music item is playing.

       * In collapsed mode the panel will display the mute button only
         if Kodi is muted. The mute button in expanded mode is always
         visible.

       * Panel is enabled by default. Users can disable the panel
         in Settings

       * Implemented listening to Player.OnPropertyChanged notifications
         to update shuffle and repeat button states.
2017-07-13 19:10:49 +01:00
Martijn Brekhof d993126c7e Fixed retrieving wrong handler for applicationNotificationsObserver (#319) 2016-12-02 11:04:17 +00:00
Martijn Brekhof c5848ce648 Implemented showing volume level on NowPlayingFragment (#312)
Replaced up/down volume buttons with a seekbar that displays the current
volume level and can be used to change the volume level
2016-11-30 12:20:21 +00:00
George Kankava 079cf4e759 squid:S1155 - Collection.isEmpty() should be used to test for emptiness 2016-06-29 14:17:39 +04:00
Synced Synapse 5509c99243 Workaround for issue #78: https://github.com/xbmc/Kore/issues/78 2015-05-25 22:37:32 +01:00
Synced Synapse 611dafc101 Add new intent to "Play on Kodi". This allows sharing videos from the YouTube app to Kodi (unfortunately the share option will appear in every app that shares plain text links, as that is what the YouTube app shares).
Tweaked the Now Playing and Playlist screens to better support YouTube videos
Changed HostConnectionObserver to notify clients not only when the id of what's playing changes but also when the label changes (YouTube videos and pictures for instance don't have ids, so the remote wasn't getting notified of a change in what's playing)
2015-04-08 22:28:19 +01:00
Synced Synapse e42c6dd486 Fix the way it's getting the current playlist id (call Player.GetProperties to get the current playlistId) 2015-03-17 18:45:21 +00:00
DanhDroid dfcb6d7d4d fix up typo on ApiCallback.onSucess() 2015-03-16 11:33:40 -07:00
Synced Synapse ed584fb9b7 Changed namespace/appid to org.xbmc.kore 2015-03-09 21:35:18 +00:00