@@ -2036,6 +2036,39 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
} else if (mLetterbox != null) {
mLetterbox.hide();
}
+ //adddddddd
+ android.view.Surface mTestSurface = new android.view.Surface();
+ DisplayContent mTestDisplayContent = mWmService.getDefaultDisplayContentLocked();
+ try{
+ SurfaceControl sc = mTestDisplayContent.makeOverlay()
+ .setName("test_background")
+ .setBufferSize(1920, 990)
+ .setParent(getSurfaceControl())
+ .setFormat(android.graphics.PixelFormat.RGB_888)
+ .build();
+ sc.setLayer(-1);
+ //sc.setColor(new float[]{255,0,0});
+ sc.setPosition(0, 48);
+
+ mTestSurface.copyFrom(sc);
+
+ Rect dirty = new Rect(0, 48, 1920, 990);
+ android.graphics.Canvas c = mTestSurface.lockCanvas(dirty);
+ if (c != null) {
+ c.save();
+ c.clipRect(new Rect(0, 48, 1920, 990));
+ c.drawColor(android.graphics.Color.YELLOW);
+ c.restore();
+ mTestSurface.unlockCanvasAndPost(c);
+ }
+ sc.show();
+ } catch (Exception e) {
+ Slog.e(TAG, "test_background Exception");
+ }
+ //adddddddd
}
【无标题】Android 添加layer图层
最新推荐文章于 2024-07-02 11:16:29 发布