I use screen capture API of ddmlib to capture G1 screen (Android 1.5).
Sometime the captured result is the previous screen, not the current.
I think it is due to double buffer mechanism.
So that I decided to fix it in ddmlib code to get correct screen-shot
every-time.
I investigated in ddms/libs/ddmlib/src/com/android/ddmlib/
AdbHelper.java at:
AdbHelper.getFrameBuffer().
Is it a right way? However, I can not fix this problem.
Can you suggest me someway to solve this problem? modify
AdbHelper.getFrameBuffer(), invoke some system command to refresh
buffer, etc... ?
On Thu, 2010-02-11 at 01:16 -0800, alex2206 wrote:
> I use screen capture API of ddmlib to capture G1 screen (Android 1.5).
>
> Sometime the captured result is the previous screen, not the current.
> I think it is due to double buffer mechanism.
That's roughly correct.
DDMS ultimately just reads the contents of /dev/graphics/fb0. However,
that doesn't necessarily show the genuine screen image.
We believe this is due to these lines in SurfaceFlinger's
DisplayHardware.cpp:
if (mFlags & PARTIAL_UPDATES) {
mNativeWindow->setUpdateRectangle(dirty.getBounds());
}
Without these lines, the device screen shows exactly the same corruption
visible via DDMS.
> So that I decided to fix it in ddmlib code to get correct screen-shot
> every-time.
> I investigated in ddms/libs/ddmlib/src/com/android/ddmlib/
> AdbHelper.java at:
> AdbHelper.getFrameBuffer().
> Is it a right way? However, I can not fix this problem.
> Can you suggest me someway to solve this problem? modify
> AdbHelper.getFrameBuffer(), invoke some system command to refresh
> buffer, etc... ?
We (at RealVNC) would like to fix this, since ultimately we hope to
persuade the Android platform to add the APIs necessary to allow remote
control of Android phones. (One of those APIs we need is a reliable
screen shot API).
It would be great to hear from the Android platform architects about how
to fix this.
Our proposal is:
* SurfaceFlinger regains its old LayerScreenshot.cpp which it had
back in Android 1.0.
* But, it's modified to use glReadPixels to retrieve the genuine
screen image. (This works reliably, though it's quite slow).
* SurfaceFlinger exposes a new Binder interface to request a
screenshot.
* SurfaceFlinger checks that callers of this interface have
android.permission.READ_FRAME_BUFFER.
* A new native library is provided which exposes a simple C
interface, yet internally uses C++ to talk to the new Surface
Flinger Binder interface.
* The device-side part of adb is modified to link to this new C
library rather than reading /dev/graphics/fb0.
* The device-side part of adb gains
android.permission.READ_FRAME_BUFFER.
Android platform maintainers: Does that sound reasonable?
If so we'll get started! We have an engineer ready and waiting to do
this work; in fact we know the first three steps above work fine.
Later we'll want to provide a version of this screenshot API accessible
from on-device software, secured appropriately [1].
Regards
Adrian
[1]
http://groups.google.com/group/android-platform/browse_thread/thread/77a2add4384202dc
--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.
Hi,
I am also interested in Screenshot/remote control API.
I have an idea on the security for Screenshot/remote control API
and thought I should leave a comment.
Android has special checkboxes for 'Unkown sources' & 'USB debugging'
'Unkown sources' : Settings -> Applications
'USB debugging' : Settings -> Applications -> Development
Like so, add a checkbox for 'Remote Control'.
This setting will not just have a checkbox but add password field as
well.
So, the application not only requires to add
android.permission.READ_FRAME_BUFFER
and others, but also 'Remote Control' checkbox needs to be checked
(manually by the user) and the password has to be matched to access
remote control API.
It will be the application developer's task to prompt some kind of GUI
for the app users
to type in the correct password.
To avoid the security flaw of 'brute force attack', it may be a good
idea to
disable Remote Control checkbox if an app tried wrong password 3
times.
(then it has to be manually checked again by the user)
see http://groups.google.com/group/android-discuss/browse_thread/thread/939b320cea3c81d4
On Feb 12, 12:21 pm, brian <walsh.brian.patr...@gmail.com> wrote:
> I've used the DroidEx application that also works in conjuction with
> ddms tocaptureandroid screens. Ideally it would be great to use a
> facility like this tocapturevideo playback from the phone.
>
> seehttp://groups.google.com/group/android-discuss/browse_thread/thread/9...
I am still investigated in this problem.
Anyway, captured screen-shot will become correct after some seconds,
but we have to wait, sometime only 2-3 seconds, sometime 30 seconds!
Could you tell me the maximum time we should spend to wait until
captured screen-shot becomes correct ?
We've encountered this problem too in our attempts to build a VNC
server for Android.
I've noticed that the frame buffer contents sometimes become correct
at the turn of the minute, when the current time displayed in the top
right corner is updated. So you could have to wait for up to a minute
to get a correct screen image! However this behaviour is very hardware
dependent and we don't consider this to be reliable - I can easily
believe that there might be situations where /dev/graphics/fb0 never
becomes correct, no matter how long you wait.
We're working on a way to fix this by grabbing the screen using
glReadPixels() from within the SurfaceFlinger. This should be a much
more reliable way of getting an accurate screen image. Hopefully it
won't be long before we've got a proposed patch to post for
discussion.
Eventually we hope to build our VNC server on top of this mechanism,
but of course this depends on coming up with an acceptable security
model for protecting access to this interface. In the meantime though
it should be possible to improve the DDMS screenshot mechanism without
exposing any risky APIs to applications.
Regards,
Mike Playle
RealVNC
Our proposed screenshot fix is now on Gerrit here:
https://review.source.android.com/13953
https://review.source.android.com/13954
https://review.source.android.com/13955
Any comments are more than welcome.
Mike Playle
RealVNC