Fixed
Status Update
Comments
8h...@gmail.com <8h...@gmail.com> #2
We use build flavours heavily with a lot of common code. The refactoring support in AS is really good but it continually catches us out when it doesn't work across all flavours in a project. It's a big gap for serious product development.
il...@google.com <il...@google.com>
ja...@google.com <ja...@google.com>
su...@google.com <su...@google.com> #3
We at my company need this same feature. We have a lot of white labels and need refactor the same class across flavours. :(
ar...@google.com <ar...@google.com> #4
I need this feature too...
Description
Version used: 25.1.0
Devices/Android versions reproduced on: Note 4 API23, emulator API23, emulator API22, emulator API21.
MediaBrowserCompat.connect() works fine the first time it is called and results in mConnections.put() being called.
But further calls to it, after .disconnect() has been called, mConnections.put() is not called and these warnings are seen in logcat when you try to use it:
01-14 17:12:07.698 29105-29105/com.example.android.uamp W/MBServiceCompat: addSubscription for callback that isn't registered id=__ROOT__
01-14 17:12:10.628 29105-29105/com.example.android.uamp W/MBServiceCompat: removeSubscription for callback that isn't registered id=__ROOT__
01-14 17:12:10.638 29105-29105/com.example.android.uamp W/MBServiceCompat: getMediaItem for callback that isn't registered id=__BY_GENRE__
01-14 17:12:10.638 29105-29105/com.example.android.uamp W/MBServiceCompat: addSubscription for callback that isn't registered id=__BY_GENRE__
This stops browsing from working - see
It can be recreated by updating UniversalMusicPlayer to support lib 25.0.1, running it, leaving the main activity then returning, then trying to navigate in the browse list.
This started happening in Support Library 24.0.0.
No problem on a device with API 17 and emulator API 24.
On an API 23 device:
MediaBrowserCompat.MediaBrowserImplApi21 constructor (MediaBrowserCompat:1339) builds mRootHints which is set in the MediaBrowser instance.
The first call to MediaBrowserServiceCompat.MediaBrowserServiceCompatApi21.BrowserRoot.onGetRoot() (MediaBrowserServiceCompat.java:272) removes EXTRA_CLIENT_VERSION from mRootHints and builds rootExtras which ends up being set as the MediaBrowser instance's mExtras. MediaBrowserCompat.onConnected() (MediaBrowserCompat.java:1528) checks MediaBrowser.mExtras is not null before posting a message which leads to mConnections.put() being called.
When .disconnect() is called and .connect() is called for a second time on the same MediaBrowser instance, this time onGetRoot() finds that EXTRA_CLIENT_VERSION is not in mRootHints (was removed in the previous call) so it does not build rootExtras which leads to MediaBrowser.mExtras being set to null.
Then MediaBrowserCompat.onConnected() drops out because mExtras is null, not posting the message that leads to mConnections.put() being called.