chipset: MSM8x25Q
codebase: Android 4.1
interceptKeyBeforeQueueing -> PhoneWindowManager.java
interceptScreenshotChord ->
postDelayed ->
takeScreenshot ->
handleMessage -> TakeScreenshotService.java
screenshot -> GlobalScreenshot.java
screenshot -> Surface.java
Surface_screenshotAll -> android_view_surface.cpp
doScreenshot ->
update ->
update -> SurfaceComposerClient.cpp
captureScreen -> SurfaceFlinger.cpp
handler ->
captureScreenImplLocked //将重新绘制得到的显示数据保存到base中
如果发现屏幕反向180°之后,可以做如下修改, system property 可以定义在system.prop中。
void takeScreenshot(Runnable finisher, boolean statusBarVisible, boolean navBarVisible) {
~~snip
// We need to orient the screenshot correctly (and the Surface api seems to take screenshots
// only in the natural orientation of the device :!)
mDisplay.getRealMetrics(mDisplayMetrics);
float[] dims = {mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels};
/*Kris.Fei, 20130208, WMS dose not know we rotate the layer in SF. {*/
float degrees;
if (SystemProperties.getInt("debug.sf.hwrotation",0) == 180) {
degrees = getDegreesForRotation(Surface.ROTATION_180);
Slog.e("Rotation", "Screenshot with 180 degree rotation.");
} else {
degrees = getDegreesForRotation(mDisplay.getRotation());
}
/*Kris.Fei, 20130208, WMS dose not know we rotate the layer in SF. }*/
boolean requiresRotation = (degrees > 0);
~~snip
}