Obsolete
Status Update
Comments
so...@gmail.com <so...@gmail.com> #2
bump ? google ?? anyone ?
wi...@gmail.com <wi...@gmail.com> #3
I had to rely on this 'hack' to use a YouTubePlayerSupportFragment inside of a ViewPager.
Adding dummy Views to force certain kind of behavior can't be good coding practice!
Please look into it, Android Engineers.
Perhaps the TextureView could be used for the YouTubePlayerSupportFragment API in > 4.0 ?
Adding dummy Views to force certain kind of behavior can't be good coding practice!
Please look into it, Android Engineers.
Perhaps the TextureView could be used for the YouTubePlayerSupportFragment API in > 4.0 ?
en...@google.com <en...@google.com>
di...@gmail.com <di...@gmail.com> #4
facing same issue with in Kitkat and Lolipop. I am adding video views dynamically in ListView inside fragment after fragment creation.
di...@gmail.com <di...@gmail.com> #5
This issue does NOT appear to be obsolete as it still exists on 5.1.1
A project member should provide details on how to deal with the reported behavior or move the ticket into an active state.
A project member should provide details on how to deal with the reported behavior or move the ticket into an active state.
ra...@gmail.com <ra...@gmail.com> #6
Yes, it still exists. I am also interested in a fix, besides the "hack" :)
sh...@gmail.com <sh...@gmail.com> #7
Voting for this question
ch...@gmail.com <ch...@gmail.com> #8
[Comment deleted]
sh...@gmail.com <sh...@gmail.com> #9
I replaced SurfaceView with TextureView now there is not any flickering problem.
[Deleted User] <[Deleted User]> #10
I am also facing the same issue. Can anyone tell me how to fix this?
Description
I have encountered a problem similar to the one asked in the
I`m running 2.3.4 (and my source reference in from 2.3.4) but i have checked that the problem still exists even in jelly bean.
I have digged into a source code and here is my findings :
1) When i create and activity with non-translucent theme for example with "@android:style/Theme.Black.NoTitleBar.Fullscreen", your are using 565 RGB layout in surface flinger .. (16 bits per pixel),
2) when you are adding SurfaceView to that layout view format is changed [in order to draw transparent region which is needed to enable video display beneath android frame buffer] (here is the source code):
from SurfaceView:
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
============>mParent.requestTransparentRegion(this);
mSession = getWindowSession();
mLayout.token = getWindowToken();
mLayout.setTitle("SurfaceView");
mViewVisibility = getVisibility() == VISIBLE;
getViewTreeObserver().addOnScrollChangedListener(mScrollChangedListener);
}
which in turn does the following: (from viewgroup.java)
public void requestTransparentRegion(View child) {
if (child != null) {
============>child.mPrivateFlags |= View.REQUEST_TRANSPARENT_REGIONS;
if (mParent != null) {
mParent.requestTransparentRegion(this);
}
}
}
and this in turn causes the following code in ViewRoot.performTraversals()
if (params != null && (host.mPrivateFlags & View.REQUEST_TRANSPARENT_REGIONS) != 0) {
if (!PixelFormat.formatHasAlpha(params.format)) {
============>params.format = PixelFormat.TRANSLUCENT;
}
}
so you can see that now we have changed the format to translucent. Now lets check the code in WindowManagerService
When we re-layout the following code runs WindowManager .copyFrom and it has the following lines:
if (format != o.format) {
format = o.format;
============>changes |= FORMAT_CHANGED;
}
we obviously fall into this "case" because we just changed format. Now what happens next in WindowManagerService.relayoutWindow
if ((attrChanges&WindowManager.LayoutParams.FORMAT_CHANGED) != 0) {
// To change the format, we need to re-build the surface.
============> win.destroySurfaceLocked();
displayed = true;
}
try {
Surface surface = win.createSurfaceLocked();
if (surface != null) {
outSurface.copyFrom(surface);
win.mReportDestroySurface = false;
win.mSurfacePendingDestroy = false;
if (SHOW_TRANSACTIONS) Slog.i(TAG,
" OUT SURFACE " + outSurface + ": copied");
} else {
// For some reason there isn't a surface. Clear the
// caller's object so they see the same state.
outSurface.release();
}
And this is where the flickering happens, what just had happened is that we have DELETED the surface that hosts our activity, and caused surfaceflinger to immediately redraw the screen, (without our activity on it), in which case "Wormhole" will be displayed as our activity took full-screen and left all other windows invisible.
The only workaround i have found for this is to put dummy surface into activity XML (with visibility set to invisible) which will cause my activity to be 32bpp (bits per pixel) from the beginning and avoid flickering when adding video view.