volume down + power key ScreenShot 流程

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
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值