Status Update
Comments
am...@google.com <am...@google.com>
am...@google.com <am...@google.com> #2
* GC ROOT android.support.v4.media.session.MediaSessionCompat$MediaSessionImplApi21$ExtraSession.this$0
* references android.support.v4.media.session.MediaSessionCompat$MediaSessionImplApi21.mSessionObj
* references android.media.session.MediaSession.mController
* references android.media.session.MediaController.mContext
* leaks com.bubenheimer.rucksack.d.q instance
ca...@gmail.com <ca...@gmail.com> #3
ki...@gmail.com <ki...@gmail.com> #4
am...@google.com <am...@google.com> #5
Can you please confirm whether this is still reproducible on API 33?
And if you happen to have access, also on the Developer Preview of API 34?
[Deleted User] <[Deleted User]> #6
lo...@gmail.com <lo...@gmail.com> #7
Final thing, is this a dup of
t....@gmail.com <t....@gmail.com> #8
Thanks, I believe it's a dup at this point.
The other issue was marked as fixed a year ago, but is still as reproducible as ever, I had just tested it on API 33 and UpsideDownCake DP2.
[Deleted User] <[Deleted User]> #9
I suppose I cannot say for sure that the two issues have the same root cause, there may be more than one cause for MediaBrowserService(Compat) leaks.
I just tested this issue here once more on my production app, on API 33 (emulator), and got a leak trace (with current LeakCanary) that closely resembles the original one I posted years ago. I let the app sit idle for another half hour, occasionally forcing a garbage collection via Android Studio Profiler, but my destroyed MediaBrowserServiceCompat (CW) instance just would not release. (I validated non-release by logging from finalize()
method, which looks very reliable.)
====================================
HEAP ANALYSIS RESULT
====================================
1 APPLICATION LEAKS
References underlined with "~~~" are likely causes.
Learn more at https://squ.re/leaks.
Signature: 881c4404fc048402f456764f134ed07390863849
┬───
│ GC Root: Global variable in native code
│
├─ android.os.Handler$MessengerImpl instance
│ Leaking: UNKNOWN
│ ↓ Handler$MessengerImpl.this$0
│ ~~~~~~
├─ androidx.media.MediaBrowserServiceCompat$ServiceHandler instance
│ Leaking: UNKNOWN
│ this$0 instance of com.bubenheimer.rucksack.d.CW
│ ↓ MediaBrowserServiceCompat$ServiceHandler.this$0
│ ~~~~~~
╰→ com.bubenheimer.rucksack.d.CW instance
Leaking: YES (ObjectWatcher was watching this because com.bubenheimer.rucksack.d.CW received Service#onDestroy()
callback and Service not held by ActivityThread)
key = 0cda35fa-fa79-4035-89ca-6ab496bd1ddc
watchDurationMillis = 5400
retainedDurationMillis = 392
mApplication instance of com.bubenheimer.rucksack.d.D
mBase instance of android.app.ContextImpl
====================================
0 LIBRARY LEAKS
A Library Leak is a leak caused by a known bug in 3rd party code that you do not have control over.
See https://square.github.io/leakcanary/fundamentals-how-leakcanary-works/#4-categorizing-leaks
====================================
0 UNREACHABLE OBJECTS
An unreachable object is still in memory but LeakCanary could not find a strong reference path
from GC roots.
====================================
METADATA
Please include this in bug reports and Stack Overflow questions.
Build.VERSION.SDK_INT: 33
Build.MANUFACTURER: Google
LeakCanary version: 2.10
App process name: com.bubenheimer.rucksack
Class count: 28324
Instance count: 179717
Primitive array count: 132390
Object array count: 25025
Thread count: 39
Heap total bytes: 27055417
Bitmap count: 0
Bitmap total bytes: 0
Large bitmap count: 0
Large bitmap total bytes: 0
Db 1: open /data/user/0/com.bubenheimer.rucksack/databases/com.google.android.datatransport.events
Db 2: open /data/user/0/com.bubenheimer.rucksack/databases/rucksack-5031356898991293088.db
Stats: LruCache[maxSize=3000,hits=32348,misses=41728,hitRate=43%]
RandomAccess[bytes=1991236,reads=41728,travel=35597905162,range=32212305,size=40115227]
Heap dump reason: 1 retained objects, app is visible
Analysis duration: 16991 ms
Heap dump file path: /storage/emulated/0/Download/leakcanary-com.bubenheimer.rucksack/2023-04-25_11-53-35_598.hprof
Heap dump timestamp: 1682438042701
Heap dump duration: 4546 ms
====================================
ad...@gmail.com <ad...@gmail.com> #10
I ended up letting the app sit idle for an hour, but the service still would not finalize.
[Deleted User] <[Deleted User]> #11
I also tried this, but still no finalization:
adb shell am send-trim-memory com.bubenheimer.rucksack:appexternal RUNNING_CRITICAL
ch...@google.com <ch...@google.com> #12
I've dug into this further, and identified a leak in AndroidX code that I was using (
Eliminating this leak lets the MediaBrowserService(Compat) call its finalizer eventually. I assume that the leak-related fixes in API 33 are also essential for reaching this stage.
However, there is still some unidentified holdup between onDestroy() and finalize() in my production app triggering various LeakCanary traces, before finalization after about 30 seconds. (LeakCanary triggers garbage collections, but those do not force finalization in this case.)
I assume the holdup is related to more general problems with service/binder/messenger cleanup. It's an issue, because it makes it very difficult to spot more real problems.
Can anything be done to eliminate these delays?
I am attaching the various leak traces I got from excluding each, one at a time (this is how I eventually found the AndroidX leak).
[Deleted User] <[Deleted User]> #13
I think the issue can be closed, I am no longer able to reproduce the delayed finalization issue, and I am hoping to switch to media3 MediaSessionService anyway. I have not tried the minimal repro again, though. Ultimately I think the API 33 fixes took care of what was broken here, in addition to avoiding the referenced AndroidX leak.
Thank you for your effort to reopen this.
ja...@gmail.com <ja...@gmail.com> #14
PY Ricau, the guy behind LeakCanary, suggested that there is more to this, and that there are several actual leaks here. I will update this issue with more info as soon as I find some time, I'm in a bit of a crunch right now.
ch...@google.com <ch...@google.com> #15
The 3 LeakCanary leak reports that I attached above point at 2 distinct leaks that are still real, according to PY's analysis from the Github issue here:
Can these leaks be addressed, please?
MediaBrowserServiceCompat$ServiceHandler is an inner class of MediaBrowserServiceCompat (super class of CW) and it's there so that your service can respond to IPC callbacks. It extends Handler and is passed to a Messenger instance created by MediaBrowserServiceCompat in onCreate(), and that Messenger essentially pulls a Binder out of the Handler and passes that binder back to anything calling your service. In other words, every time something binds to your service, the thing that binds to your service is getting an indirect reference to the ServiceHandler which allows it to post messages to that handler which the service will eventually process. However, for this to work, the native framework code keeps a strong native reference locally to the binder until the calling service finalizes the ownership of the binder on its side.
This is actually a common leak pattern in the Android framework: binders are held until the other side runs garbage collection and finalizes the binder on its end, no matter what we're doing with service lifecycle (that's because binders are used beyond services, the only way to be certain the other side won't call is when it doesn't have that pointer). The proper way to handler this is for the service code to finish its handler in onDestroy, or set the reference from the handler to the service to null in onDestroy.
The first and second leak traces are identical, the problem is that MediaBrowserServiceCompat$ServiceHandler has several direct and indirect references to the service.
The last leak is the exact same issue elsewhere, ExtraSession is a stub that won't be GCed until the other side has run its own GC
https://github.com/aosp-mirror/platform_frameworks_support/blob/a9ac247af2afd4115c3eb6d16c05bc92737d6305/media/src/main/java/android/support/v4/media/session/MediaSessionCompat.java#L3413
So these 2 leaks are binder related leaks, and the leaks stay in place until a GC runs in the calling process, and you have no control over that. They really should be fixed.
[Deleted User] <[Deleted User]> #16
I've not been able to reproduce the leak on a device running Android 14 (UDC / API 34).
For unimportant reasons I had to build my own toy app from scratch (using
ch...@google.com <ch...@google.com> #17
In conclusion, I was able to reproduce on S (Android 12), but unable to reproduce the issue on T (Android 13) or U (Android 14). I'm attaching the project I used for testing in case you find anything wrong.
Can you use that project to reproduce the issue? If yes, we need to figure out what we are doing differently. Also please kindly include a bugreport (running adb bugreport
shortly after the leak is detected) if you are able to repro.
Please assign back to me once you've replied (if you are not able to, ignore).
am...@google.com <am...@google.com> #18
I've beefed up your example to make it repro the leaks that I attached in #12. I'll attach the updated example. The relevant changes were:
- Run service & receiver in separate process from Activity.
- Customize LeakCanary to support multiple processes.
- Add some additional media-related code to trigger a leak.
Even when not running the service in a separate process there is a leak in the Activity. I'll attach that one, too. May be a similar root cause. I have not investigated this one.
I am attaching the bugreport, too. I took it right after LeakCanary GC'ed and detected a leak. (About 5 seconds after onDestroy().) But it looks easy to reproduce now.
ar...@google.com <ar...@google.com> #19
(I did the repro on API 33)
az...@gmail.com <az...@gmail.com> #20
Also, I don't think non-Googlers are able to reassign an issue, so please take it from here.
dg...@gmail.com <dg...@gmail.com> #21
Thanks. Will provide an update in the next few days.
[Deleted User] <[Deleted User]> #22
Correct me if I'm wrong but the only issue we are aware that still exists is in MediaBrowserServiceCompat, right? (not in the platform MediaBrowserService)
I've sent
Once merged, you should just need to update your androidx.media dependency to pick up the fix.
jo...@gmail.com <jo...@gmail.com> #23
Thanks for the fix.
I'd think that MediaSessionCompat needs a similar fix, based on the leak traces (MediaBrowserServiceCompatLeak4.txt & MediaBrowserActivityLeak.txt) and PY's comments. You can repro MediaBrowserActivityLeak.txt by running the service in the same process as the Activity.
I'll ping PY about possibly chiming in on the code review.
dr...@gmail.com <dr...@gmail.com> #24
The change has now been merged. I'll now look into the media session compat issue, which seems to persist.
fa...@gmail.com <fa...@gmail.com> #25
Sorry for the late review. Not sure if you get notifications there, I left a comment:
TL;DR is that using weak refs isn't ideal, you could stick to a strong ref set to null from Service.onDestroy()
ps...@gmail.com <ps...@gmail.com> #26
Ack. Will implement the proposed fix.
dr...@gmail.com <dr...@gmail.com> #27
Есть ли утечка информации?
dr...@gmail.com <dr...@gmail.com> #28
Есть ли утечка информации?
According to translate: Is there any information leak?
No. This is a resources leak, no security issues here.
al...@google.com <al...@google.com> #29
Another fix for MediaSessionCompat...ExtraSession here:
Only one pending fix after this change is MediaSessionCompat...MediaSessionStub, after which I plan to mark this as fixed. Still, people should migrate to media3, but at least you can upgrade your MediaSessionCompat dep to get a quick fix of the leaks. Feel free to leave any comments here or in the patch.
am...@google.com <am...@google.com> #30
If there are more leaks to fix in androidx, please kindly file a fresh issue.
ps...@gmail.com <ps...@gmail.com> #31
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.media:media:1.7.0-beta01
de...@gmail.com <de...@gmail.com> #32
Hi im wondering if the leak happening in this issue on media3's issue tracker
is related to this.
By taking UAMP and having the MusicServiceConnection
be a Dagger @Singleton
, the MusicService
is leaked with a very similar stack trace that is exposed here, which contains only stacktraces from androidx.media
(until the MusicService
, that is):
====================================
HEAP ANALYSIS RESULT
====================================
1 APPLICATION LEAKS
References underlined with "~~~" are likely causes.
Learn more at https://squ.re/leaks.
43381 bytes retained by leaking objects
Signature: 80f093d135adc2b278b02ca2f66fbd46aaa36bea
┬───
│ GC Root: Global variable in native code
│
├─ android.support.v4.media.session.MediaSessionCompat$MediaSessionImplApi21$ExtraSession instance
│ Leaking: UNKNOWN
│ Retaining 6,7 MB in 1826 objects
│ ↓ MediaSessionCompat$MediaSessionImplApi21$ExtraSession.this$0
│ ~~~~~~
├─ android.support.v4.media.session.MediaSessionCompat$MediaSessionImplApi29 instance
│ Leaking: UNKNOWN
│ Retaining 6,7 MB in 1825 objects
│ ↓ MediaSessionCompat$MediaSessionImplApi21.mSessionFwk
│ ~~~~~~~~~~~
├─ android.media.session.MediaSession instance
│ Leaking: UNKNOWN
│ Retaining 1,8 kB in 12 objects
│ mContext instance of com.example.android.uamp.media.MusicService
│ ↓ MediaSession.mContext
│ ~~~~~~~~
╰→ com.example.android.uamp.media.MusicService instance
Leaking: YES (ObjectWatcher was watching this because com.example.android.uamp.media.MusicService received
Service#onDestroy() callback and Service not held by ActivityThread)
Retaining 43,4 kB in 896 objects
key = 11c50fab-5b0c-4267-8c51-ad235a51d861
watchDurationMillis = 5391
retainedDurationMillis = 390
mApplication instance of com.example.android.uamp.UampApplication
mBase instance of android.app.ContextImpl
====================================
`
I really dont see how using @Singleton
is any different from the default:
companion object {
// For Singleton instantiation.
@Volatile
private var instance: MusicServiceConnection? = null
fun getInstance(context: Context, serviceComponent: ComponentName) =
instance ?: synchronized(this) {
instance ?: MusicServiceConnection(context, serviceComponent)
.also { instance = it }
}
}
The issue can be reproduced on this branch of my fork of UAMP:
Which uses Dagger Hilt and removes Cast for simplification.
To reproduce:
- Open UAMP
- Play something
- Swipe the app away in the task manager
- Music Service is leaked.
From this point restarting UAMP also reveals the issue because nothing is loaded as there will be two MusicService instances.
de...@gmail.com <de...@gmail.com> #33
Also note that the example uses media 1.7.0 so fixes above should be included already.
pr...@gmail.com <pr...@gmail.com> #34
@ke...@gmail.com might be an issue with MediaSessionCompat, but we'll need a fresh ticket to look into this.
[Deleted User] <[Deleted User]> #35
Should I create that one then?
ay...@gmail.com <ay...@gmail.com> #36
9g...@gmail.com <9g...@gmail.com> #37
[Deleted User] <[Deleted User]> #38
za...@gmail.com <za...@gmail.com> #39
sh...@gmail.com <sh...@gmail.com> #40
ja...@gmail.com <ja...@gmail.com> #41
de...@gmail.com <de...@gmail.com> #42
pe...@gmail.com <pe...@gmail.com> #43
Hoping to see a proper solution, currently this is my workaround until then. Not the best workaround, but does work for me:
Override
public void onScrollStateChanged(final int state)
{
super.onScrollStateChanged(state);
if (state == RecyclerView.SCROLL_STATE_SETTLING)
{
this.stopScroll();
}
}
pe...@gmail.com <pe...@gmail.com> #44
hu...@gmail.com <hu...@gmail.com> #45
[Deleted User] <[Deleted User]> #46
an...@gmail.com <an...@gmail.com> #47
[Deleted User] <[Deleted User]> #49
ha...@gmail.com <ha...@gmail.com> #50
ri...@gmail.com <ri...@gmail.com> #51
fa...@gmail.com <fa...@gmail.com> #52
de...@gmail.com <de...@gmail.com> #53
au...@google.com <au...@google.com> #54
sh...@google.com <sh...@google.com> #55
The issue is that after a fling event, the nested scrolling api has no way of informing the RecyclerView that a fling animation has reached the end of the scroll distance, and thus sometimes, the scroll animation is continuing in the background such that when the first tap occurs, it is interpreted as an interruption to the fling, which puts the RV back into its scrolling state as if the user started scrolling, and thus, the touch events don't propagate down to the child to cause a click to occur.
Some larger changes are needed to fix this (and at least one other) issue, and I'm in the midst of that work.
Sorry for the inconvenience.
za...@gmail.com <za...@gmail.com> #56
dr...@gmail.com <dr...@gmail.com> #57
May I ask in this version, fix this issue?
sh...@google.com <sh...@google.com> #58
sp...@gmail.com <sp...@gmail.com> #59
sh...@google.com <sh...@google.com> #60
When RecyclerView is flung, and it hits the bounds of it's scrollable distance and has a NestedScrollingParent, it continues to animate the fling so that the NestedScrollingParent might receive the events and scroll. RV has no way of knowing if any NestedScrollingParents have hit their bounds, and thus it continues the fling even if nothing is moving.
On top of that, when RV is flinging and is touched, it stops it's fling and prevents the touch event from causing a click, so that a touch meant to stop a fling doesn't cause a click.
Put those two things together and you get the perceived behavior that when an RV is flung, and stops, the next touch event doesn't click.
I'm pursuing a but can't make any promises as to when it will be available. Sorry for the inconvenience.
ha...@gmail.com <ha...@gmail.com> #61
pr...@gmail.com <pr...@gmail.com> #63
su...@gmail.com <su...@gmail.com> #64
sh...@google.com <sh...@google.com> #65
ny...@gmail.com <ny...@gmail.com> #66
fa...@gmail.com <fa...@gmail.com> #67
le...@gmail.com <le...@gmail.com> #68
pi...@gmail.com <pi...@gmail.com> #69
yi...@gmail.com <yi...@gmail.com> #70
de...@gmail.com <de...@gmail.com> #71
t....@gmail.com <t....@gmail.com> #72
cn...@gmail.com <cn...@gmail.com> #73
za...@gmail.com <za...@gmail.com> #74
da...@gmail.com <da...@gmail.com> #75
[Deleted User] <[Deleted User]> #76
ro...@gmail.com <ro...@gmail.com> #77
an...@googlemail.com <an...@googlemail.com> #78
sh...@google.com <sh...@google.com> #79
I am actively solving this issue. In fact, the CL that makes the necessary changes in RecyclerView has been submitted to aosp (as AndroidX is now developed there):
The fix is coming by way of an update to nested scrolling and thus need to be implemented across multiple classes. For example, for the issue to be fixed when a RecyclerView is in a CoordinatorLayout with the AppBarLayout.Behavior, implementation has to be done in each of those classes.
Unfortunately the rollout of these changes is also going to take some time, but do know that we are taking as seriously as we can.
fr...@gmail.com <fr...@gmail.com> #80
sh...@google.com <sh...@google.com> #81
sh...@gmail.com <sh...@gmail.com> #83
I've tried both java and xml ways but in vain.
Checked on emulator running on 5.0 and physical device running on 7.1.1
Any ideas ?
sh...@gmail.com <sh...@gmail.com> #84
ss...@gmail.com <ss...@gmail.com> #85
am...@gmail.com <am...@gmail.com> #87
am...@google.com <am...@google.com>
pa...@gmail.com <pa...@gmail.com> #88
Dear Google developers, can you please take it on priority?
we...@gmail.com <we...@gmail.com> #89
kp...@gmail.com <kp...@gmail.com> #90
I think it is related with NestedScrollingChild3 and NestedScrollingParent3 and since 1.1.0-alpha01 RecyclerView and CoordinatorLayout implements those.
sh...@google.com <sh...@google.com> #91
sh...@google.com <sh...@google.com> #92
androidx.core 1.1.0-alpha01
androidx.appcompat 1.1.0-alpha01
androidx.coordinatorlayout 1.1.0-alpha01
androidx.recyclerview 1.1.0-alpha01
androidx.swiperefreshlayout 1.1.0-alpha01
(and an upcoming release of the android material design library)
This issue should be fixed!
I'm closing it, but do let me know if it seems to still be happening!
pa...@outlook.com <pa...@outlook.com> #93
This is a BottomSheet with a NestedScrollView, it does not contain any RecyclerView:
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="
xmlns:app="
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--Other views and tested with and without a Toolbar inside-->
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="8dp"
android:paddingTop="8dp">
<!--Enough views to create a scrollable area-->
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
In this scenario (with or without a Toolbar view in the AppBarLayout parent) whenever you scroll the NestedScrollView to the top or to the bottom and try to tap on any items inside the LinearLayout the first tap will always fail to initiate the expected action, forcing you to do a second tap since after the first one the taps start working. This happens whenever you scroll to the top or bottom of the NestedScrollView every single time, even after you tap for a second or n times.
I am using the library versions or most up to date (a couple were already updated since then) the Assignee listed in his last reply.
sh...@google.com <sh...@google.com> #94
There isn't a public bug that I'm aware of that is tracking that precise work, but know that your specific issue will be fixed in an upcoming release of the Android Material Design library.
pa...@outlook.com <pa...@outlook.com> #95
me...@google.com <me...@google.com> #96
yq...@gmail.com <yq...@gmail.com> #97
pv...@gmail.com <pv...@gmail.com> #98
recyclerview-v7:28.0.0
vz...@gmail.com <vz...@gmail.com> #99
sh...@google.com <sh...@google.com> #100
The AndroidX version of RecyclerView picks up where that version left off and is currently supported:
sh...@google.com <sh...@google.com> #101
sa...@gmail.com <sa...@gmail.com> #102
[Deleted User] <[Deleted User]> #103
[Deleted User] <[Deleted User]> #104
sh...@google.com <sh...@google.com> #105
te...@gmail.com <te...@gmail.com> #106
sh...@google.com <sh...@google.com> #107
ma...@gmail.com <ma...@gmail.com> #108
ma...@gmail.com <ma...@gmail.com> #109
but it's working fine if I double tap it quickly
sh...@google.com <sh...@google.com> #110
bo...@gmail.com <bo...@gmail.com> #111
Updated my AndroidX dependencies and fixed the issue with appbarlayout/bottomnav/recyclerview. Did not try out MotionLayout
Description
Version used: 26.0.2
Theme used: Theme.AppCompat.NoActionBar
Devices/Android versions reproduced on: AVD API 25
I just upgraded to API 26 and support library 26.0.2. But I found that my RecyclerView items is not clickable right after the scrolling. If you wait for a second, it will work. But if you click the item immediately, it won't. Even if the RecyclerView is not scrolling at all(e.g. has scrolled to the top).
When I downgraded to support library 25.4.0 everything goes fine again. The key point is that my RecyclerView is in a CoordinatorLayout and has a SCROLL_FLAG_SCROLL flag on my Toolbar of the AppBarLayout. If I don't use this flag, then this problem will disappear.
I've tried to add focusable="false" to the CoordinatorLayout but still had no luck.
Is there any way to disable this behavior? Because it's really annoying to click twice to trigger the click event.
I think the problem is the scrollState of the RecyclerView. When it's stopped scrolling, it's not changed to SCROLL_STATE_IDLE immediately. Looking into the source code of RecyclerView, I found there's a ViewFlinger controlling the scroll state. When I fling down to scroll to the top, it's not calling setScrollState(SCROLL_STATE_IDLE) immediately. Instead, it wait for a while to trigger this method. The more fast I fling, the more time I need to wait. It just like the RecyclerView is still scrolling in the background. Because the scroller.isFinished() doesn't return true right after the RecyclerView stop scrolling when it touched the top. Maybe it's a bug of the RecyclerView when it's in a CoordinatorLayout.
The attachment is a screen recording of this behavior.
<android.support.design.widget.CoordinatorLayout
android:id="@+id/coordinateLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/fragmentAppBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp"
android:background="@null">
<include
android:id="@+id/dynamicActionBarHolder"
layout="@layout/dynamic_action_bar"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/pullToRefreshMailRecycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v7.widget.RecyclerView
android:id="@+id/mailRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.v4.widget.SwipeRefreshLayout>
</android.support.design.widget.CoordinatorLayout>
layout/dynamic_action_bar.xml
<FrameLayout xmlns:android="
xmlns:app="
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll"
android:clickable="true"
android:background="?theme.dynamicActionBarBackground">
<ImageButton
android:id="@+id/dynamicAcbMenuIcon"
android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/article_explicit_button_background"
android:src="?theme.menuIcon"/>
<RelativeLayout
android:id="@+id/dynamicAcbTitleHolder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="?attr/actionBarSize"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:paddingEnd="5dp"
android:layout_gravity="center_vertical">
<TextView
android:id="@+id/dynamicAcbTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textSize="@dimen/action_bar_title_portrait_size"
android:textColor="?theme.listItemTitleColor"
android:ellipsize="end"
android:text="ActionBar"/>
<TextView
android:id="@+id/dynamicAcbSubtitle"
android:layout_below="@+id/dynamicAcbTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textSize="@dimen/action_bar_subtitle_portrait_size"
android:textColor="?theme.listItemTitleColor"
android:ellipsize="end"
android:text="If you say so"/>
</RelativeLayout>
</FrameLayout>