在安卓4.0 到 4.2时,com.android.view.Surface有个隐藏的API: public static Bitmap screenshot(int width, int height) 可以用于截屏,Surface这个class本身是没有hide标志的,只是screenshot方法有hide。添加READ_FRAME_BUFFER权限,在源码环境下用platform签名编译,调用Surface.screenshot(width, height)能正确运行并截屏返回Bitmap。
在安卓4.0 到 4.2时,com.android.view.Surface有个隐藏的API: