blob: 5442299881c0c054a3a12a515f0f7c4d2ed59d6a [file] [log] [blame]
Dianne Hackborn4c62fc02009-08-08 20:40:27 -07001/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Dianne Hackbornba398392011-08-01 16:11:57 -070017package com.android.systemui;
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070018
Ahan Wufa42c512019-05-15 19:52:51 +080019import android.app.ActivityManager;
wilsonshih3b2683a2019-01-19 17:01:19 +080020import android.content.Context;
Ahan Wu4e404402020-01-27 20:39:57 +080021import android.content.res.Configuration;
Dianne Hackborn759a39e2009-08-09 17:20:27 -070022import android.graphics.Rect;
Beverlyf8f2f162020-02-25 13:47:45 -050023import android.os.Handler;
Ahan Wu44ab58a2019-06-20 18:14:29 +080024import android.os.HandlerThread;
Beverlyf8f2f162020-02-25 13:47:45 -050025import android.os.SystemClock;
Ahan Wue88b1652019-09-19 22:12:46 +080026import android.os.Trace;
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070027import android.service.wallpaper.WallpaperService;
Ahan Wufa42c512019-05-15 19:52:51 +080028import android.util.Log;
29import android.util.Size;
Ahan Wu4e404402020-01-27 20:39:57 +080030import android.view.DisplayInfo;
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070031import android.view.SurfaceHolder;
Romain Guy407ec782011-08-24 17:06:58 -070032
Ahan Wufa42c512019-05-15 19:52:51 +080033import com.android.internal.annotations.VisibleForTesting;
34import com.android.systemui.glwallpaper.EglHelper;
35import com.android.systemui.glwallpaper.GLWallpaperRenderer;
Ahan Wu67e7f102019-01-14 20:38:14 +080036import com.android.systemui.glwallpaper.ImageWallpaperRenderer;
Ahan Wufa42c512019-05-15 19:52:51 +080037import com.android.systemui.plugins.statusbar.StatusBarStateController;
38import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
39import com.android.systemui.statusbar.StatusBarState;
40import com.android.systemui.statusbar.phone.DozeParameters;
Valentin Iftime6239e532018-08-24 17:17:26 +020041
Ahan Wu76884242019-05-22 20:04:23 +080042import java.io.FileDescriptor;
43import java.io.PrintWriter;
44
Dave Mankoff2aff6c32019-10-14 17:40:37 -040045import javax.inject.Inject;
46
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070047/**
48 * Default built-in wallpaper that simply shows a static image.
49 */
Romain Guy407ec782011-08-24 17:06:58 -070050@SuppressWarnings({"UnusedDeclaration"})
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070051public class ImageWallpaper extends WallpaperService {
Ahan Wub4924522019-02-20 19:15:04 +080052 private static final String TAG = ImageWallpaper.class.getSimpleName();
Ahan Wufa42c512019-05-15 19:52:51 +080053 // We delayed destroy render context that subsequent render requests have chance to cancel it.
54 // This is to avoid destroying then recreating render context in a very short time.
55 private static final int DELAY_FINISH_RENDERING = 1000;
Ahan Wub3780592019-07-04 20:50:00 +080056 private static final int INTERVAL_WAIT_FOR_RENDERING = 100;
Ahan Wu0e174802019-07-23 20:41:52 +080057 private static final int PATIENCE_WAIT_FOR_RENDERING = 10;
Ahan Wue88b1652019-09-19 22:12:46 +080058 private static final boolean DEBUG = true;
Dave Mankoff2aff6c32019-10-14 17:40:37 -040059 private final DozeParameters mDozeParameters;
Ahan Wu44ab58a2019-06-20 18:14:29 +080060 private HandlerThread mWorker;
61
Dave Mankoff2aff6c32019-10-14 17:40:37 -040062 @Inject
63 public ImageWallpaper(DozeParameters dozeParameters) {
64 super();
65 mDozeParameters = dozeParameters;
66 }
67
Ahan Wu44ab58a2019-06-20 18:14:29 +080068 @Override
69 public void onCreate() {
70 super.onCreate();
71 mWorker = new HandlerThread(TAG);
72 mWorker.start();
73 }
Dianne Hackborn759a39e2009-08-09 17:20:27 -070074
Romain Guyef654bd2009-08-11 19:12:17 -070075 @Override
Romain Guyef654bd2009-08-11 19:12:17 -070076 public Engine onCreateEngine() {
Dave Mankoff2aff6c32019-10-14 17:40:37 -040077 return new GLEngine(this, mDozeParameters);
Romain Guyef654bd2009-08-11 19:12:17 -070078 }
79
Ahan Wu44ab58a2019-06-20 18:14:29 +080080 @Override
81 public void onDestroy() {
82 super.onDestroy();
83 mWorker.quitSafely();
84 mWorker = null;
85 }
86
Ahan Wufa42c512019-05-15 19:52:51 +080087 class GLEngine extends Engine implements GLWallpaperRenderer.SurfaceProxy, StateListener {
88 // Surface is rejected if size below a threshold on some devices (ie. 8px on elfin)
89 // set min to 64 px (CTS covers this), please refer to ag/4867989 for detail.
90 @VisibleForTesting
91 static final int MIN_SURFACE_WIDTH = 64;
92 @VisibleForTesting
93 static final int MIN_SURFACE_HEIGHT = 64;
94
95 private GLWallpaperRenderer mRenderer;
96 private EglHelper mEglHelper;
97 private StatusBarStateController mController;
98 private final Runnable mFinishRenderingTask = this::finishRendering;
Ahan Wu4e404402020-01-27 20:39:57 +080099 private boolean mShouldStopTransition;
Ahan Wu4e404402020-01-27 20:39:57 +0800100 private final DisplayInfo mDisplayInfo = new DisplayInfo();
Ahan Wub3780592019-07-04 20:50:00 +0800101 private final Object mMonitor = new Object();
Beverlyf8f2f162020-02-25 13:47:45 -0500102 @VisibleForTesting
103 boolean mIsHighEndGfx;
104 private boolean mDisplayNeedsBlanking;
105 private boolean mNeedTransition;
Ahan Wufa42c512019-05-15 19:52:51 +0800106 private boolean mNeedRedraw;
Ahan Wub3780592019-07-04 20:50:00 +0800107 // This variable can only be accessed in synchronized block.
108 private boolean mWaitingForRendering;
Ahan Wu67e7f102019-01-14 20:38:14 +0800109
Dave Mankoff2aff6c32019-10-14 17:40:37 -0400110 GLEngine(Context context, DozeParameters dozeParameters) {
Beverlyf8f2f162020-02-25 13:47:45 -0500111 init(dozeParameters);
112 }
113
114 @VisibleForTesting
115 GLEngine(DozeParameters dozeParameters, Handler handler) {
116 super(SystemClock::elapsedRealtime, handler);
117 init(dozeParameters);
118 }
119
120 private void init(DozeParameters dozeParameters) {
Ahan Wu4e404402020-01-27 20:39:57 +0800121 mIsHighEndGfx = ActivityManager.isHighEndGfx();
122 mDisplayNeedsBlanking = dozeParameters.getDisplayNeedsBlanking();
Ahan Wu765f1782020-04-02 23:08:15 +0800123 mNeedTransition = false;
Ahan Wufa42c512019-05-15 19:52:51 +0800124
125 // We will preserve EGL context when we are in lock screen or aod
126 // to avoid janking in following transition, we need to release when back to home.
127 mController = Dependency.get(StatusBarStateController.class);
128 if (mController != null) {
129 mController.addCallback(this /* StateListener */);
130 }
Ahan Wufa42c512019-05-15 19:52:51 +0800131 }
132
133 @Override
134 public void onCreate(SurfaceHolder surfaceHolder) {
Ahan Wu4e404402020-01-27 20:39:57 +0800135 mEglHelper = getEglHelperInstance();
Ahan Wu287d8282019-12-17 16:23:17 +0800136 // Deferred init renderer because we need to get wallpaper by display context.
Ahan Wu4e404402020-01-27 20:39:57 +0800137 mRenderer = getRendererInstance();
138 getDisplayContext().getDisplay().getDisplayInfo(mDisplayInfo);
Ahan Wufa42c512019-05-15 19:52:51 +0800139 setFixedSizeAllowed(true);
Ahan Wu765f1782020-04-02 23:08:15 +0800140 setOffsetNotificationsEnabled(mNeedTransition);
Ahan Wufa42c512019-05-15 19:52:51 +0800141 updateSurfaceSize();
142 }
143
Ahan Wu4e404402020-01-27 20:39:57 +0800144 EglHelper getEglHelperInstance() {
145 return new EglHelper();
146 }
147
148 ImageWallpaperRenderer getRendererInstance() {
149 return new ImageWallpaperRenderer(getDisplayContext(), this /* SurfaceProxy */);
150 }
151
Ahan Wufa42c512019-05-15 19:52:51 +0800152 private void updateSurfaceSize() {
153 SurfaceHolder holder = getSurfaceHolder();
154 Size frameSize = mRenderer.reportSurfaceSize();
155 int width = Math.max(MIN_SURFACE_WIDTH, frameSize.getWidth());
156 int height = Math.max(MIN_SURFACE_HEIGHT, frameSize.getHeight());
157 holder.setFixedSize(width, height);
Ahan Wu67e7f102019-01-14 20:38:14 +0800158 }
159
Ahan Wu4e404402020-01-27 20:39:57 +0800160 /**
161 * Check if necessary to stop transition with current wallpaper on this device. <br/>
162 * This should only be invoked after {@link #onSurfaceCreated(SurfaceHolder)}}
163 * is invoked since it needs display context and surface frame size.
164 * @return true if need to stop transition.
165 */
166 @VisibleForTesting
167 boolean checkIfShouldStopTransition() {
168 int orientation = getDisplayContext().getResources().getConfiguration().orientation;
169 Rect frame = getSurfaceHolder().getSurfaceFrame();
170 Rect display = new Rect();
171 if (orientation == Configuration.ORIENTATION_PORTRAIT) {
172 display.set(0, 0, mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight);
173 } else {
174 display.set(0, 0, mDisplayInfo.logicalHeight, mDisplayInfo.logicalWidth);
175 }
176 return mNeedTransition
177 && (frame.width() < display.width() || frame.height() < display.height());
178 }
179
Ahan Wu67e7f102019-01-14 20:38:14 +0800180 @Override
Ahan Wue16e1fa2019-05-29 18:39:33 +0800181 public void onOffsetsChanged(float xOffset, float yOffset, float xOffsetStep,
182 float yOffsetStep, int xPixelOffset, int yPixelOffset) {
Ahan Wuc9c7ebb2020-02-17 18:49:59 +0800183 if (mWorker == null) return;
Ahan Wu44ab58a2019-06-20 18:14:29 +0800184 mWorker.getThreadHandler().post(() -> mRenderer.updateOffsets(xOffset, yOffset));
Ahan Wue16e1fa2019-05-29 18:39:33 +0800185 }
186
187 @Override
Ahan Wu67e7f102019-01-14 20:38:14 +0800188 public void onAmbientModeChanged(boolean inAmbientMode, long animationDuration) {
Ahan Wuc9c7ebb2020-02-17 18:49:59 +0800189 if (mWorker == null || !mNeedTransition) return;
Ahan Wu4e404402020-01-27 20:39:57 +0800190 final long duration = mShouldStopTransition ? 0 : animationDuration;
Ahan Wue88b1652019-09-19 22:12:46 +0800191 if (DEBUG) {
192 Log.d(TAG, "onAmbientModeChanged: inAmbient=" + inAmbientMode
Ahan Wu4e404402020-01-27 20:39:57 +0800193 + ", duration=" + duration
194 + ", mShouldStopTransition=" + mShouldStopTransition);
Ahan Wue88b1652019-09-19 22:12:46 +0800195 }
Ahan Wu44ab58a2019-06-20 18:14:29 +0800196 mWorker.getThreadHandler().post(
Ahan Wu4e404402020-01-27 20:39:57 +0800197 () -> mRenderer.updateAmbientMode(inAmbientMode, duration));
Ahan Wu0e174802019-07-23 20:41:52 +0800198 if (inAmbientMode && animationDuration == 0) {
Ahan Wub3780592019-07-04 20:50:00 +0800199 // This means that we are transiting from home to aod, to avoid
200 // race condition between window visibility and transition,
201 // we don't return until the transition is finished. See b/136643341.
202 waitForBackgroundRendering();
203 }
204 }
205
Lucas Dupin13f4b8a2020-02-19 13:41:52 -0800206 @Override
207 public boolean shouldZoomOutWallpaper() {
208 return true;
209 }
210
Ahan Wub3780592019-07-04 20:50:00 +0800211 private void waitForBackgroundRendering() {
212 synchronized (mMonitor) {
213 try {
214 mWaitingForRendering = true;
215 for (int patience = 1; mWaitingForRendering; patience++) {
216 mMonitor.wait(INTERVAL_WAIT_FOR_RENDERING);
217 mWaitingForRendering &= patience < PATIENCE_WAIT_FOR_RENDERING;
218 }
219 } catch (InterruptedException ex) {
220 } finally {
221 mWaitingForRendering = false;
222 }
223 }
Ahan Wu67e7f102019-01-14 20:38:14 +0800224 }
225
Ahan Wu48ebbd72019-03-12 20:59:13 +0800226 @Override
227 public void onDestroy() {
Ahan Wufa42c512019-05-15 19:52:51 +0800228 if (mController != null) {
229 mController.removeCallback(this /* StateListener */);
Ahan Wu48ebbd72019-03-12 20:59:13 +0800230 }
Ahan Wufa42c512019-05-15 19:52:51 +0800231 mController = null;
Ahan Wu44ab58a2019-06-20 18:14:29 +0800232
233 mWorker.getThreadHandler().post(() -> {
234 mRenderer.finish();
235 mRenderer = null;
236 mEglHelper.finish();
237 mEglHelper = null;
Ahan Wu44ab58a2019-06-20 18:14:29 +0800238 });
Ahan Wu48ebbd72019-03-12 20:59:13 +0800239 }
240
Ahan Wufa42c512019-05-15 19:52:51 +0800241 @Override
242 public void onSurfaceCreated(SurfaceHolder holder) {
Ahan Wu4e404402020-01-27 20:39:57 +0800243 mShouldStopTransition = checkIfShouldStopTransition();
Ahan Wuc9c7ebb2020-02-17 18:49:59 +0800244 if (mWorker == null) return;
Ahan Wu44ab58a2019-06-20 18:14:29 +0800245 mWorker.getThreadHandler().post(() -> {
Ahan Wu287d8282019-12-17 16:23:17 +0800246 mEglHelper.init(holder, needSupportWideColorGamut());
Ahan Wu44ab58a2019-06-20 18:14:29 +0800247 mRenderer.onSurfaceCreated();
248 });
Ahan Wufa42c512019-05-15 19:52:51 +0800249 }
Ahan Wu67e7f102019-01-14 20:38:14 +0800250
Ahan Wufa42c512019-05-15 19:52:51 +0800251 @Override
252 public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height) {
Ahan Wuc9c7ebb2020-02-17 18:49:59 +0800253 if (mWorker == null) return;
Ahan Wu44ab58a2019-06-20 18:14:29 +0800254 mWorker.getThreadHandler().post(() -> {
255 mRenderer.onSurfaceChanged(width, height);
256 mNeedRedraw = true;
257 });
Ahan Wufa42c512019-05-15 19:52:51 +0800258 }
Ahan Wu67e7f102019-01-14 20:38:14 +0800259
Ahan Wufa42c512019-05-15 19:52:51 +0800260 @Override
261 public void onSurfaceRedrawNeeded(SurfaceHolder holder) {
Ahan Wuc9c7ebb2020-02-17 18:49:59 +0800262 if (mWorker == null) return;
Ahan Wue88b1652019-09-19 22:12:46 +0800263 if (DEBUG) {
264 Log.d(TAG, "onSurfaceRedrawNeeded: mNeedRedraw=" + mNeedRedraw);
265 }
266
Ahan Wu44ab58a2019-06-20 18:14:29 +0800267 mWorker.getThreadHandler().post(() -> {
268 if (mNeedRedraw) {
Ahan Wue88b1652019-09-19 22:12:46 +0800269 drawFrame();
Ahan Wu44ab58a2019-06-20 18:14:29 +0800270 mNeedRedraw = false;
271 }
272 });
Ahan Wufa42c512019-05-15 19:52:51 +0800273 }
Ahan Wu67e7f102019-01-14 20:38:14 +0800274
Ahan Wufa42c512019-05-15 19:52:51 +0800275 @Override
Ahan Wue88b1652019-09-19 22:12:46 +0800276 public void onVisibilityChanged(boolean visible) {
277 if (DEBUG) {
278 Log.d(TAG, "wallpaper visibility changes: " + visible);
279 }
280 }
281
282 private void drawFrame() {
283 preRender();
284 requestRender();
285 postRender();
286 }
287
288 @Override
Ahan Wufa42c512019-05-15 19:52:51 +0800289 public void onStatePostChange() {
290 // When back to home, we try to release EGL, which is preserved in lock screen or aod.
Ahan Wuc9c7ebb2020-02-17 18:49:59 +0800291 if (mWorker != null && mController.getState() == StatusBarState.SHADE) {
Ahan Wu44ab58a2019-06-20 18:14:29 +0800292 mWorker.getThreadHandler().post(this::scheduleFinishRendering);
Ahan Wufa42c512019-05-15 19:52:51 +0800293 }
294 }
Ahan Wu67e7f102019-01-14 20:38:14 +0800295
Ahan Wufa42c512019-05-15 19:52:51 +0800296 @Override
297 public void preRender() {
Ahan Wub3780592019-07-04 20:50:00 +0800298 // This method should only be invoked from worker thread.
Ahan Wue88b1652019-09-19 22:12:46 +0800299 Trace.beginSection("ImageWallpaper#preRender");
Ahan Wub3780592019-07-04 20:50:00 +0800300 preRenderInternal();
Ahan Wue88b1652019-09-19 22:12:46 +0800301 Trace.endSection();
Ahan Wu44ab58a2019-06-20 18:14:29 +0800302 }
303
304 private void preRenderInternal() {
Ahan Wufa42c512019-05-15 19:52:51 +0800305 boolean contextRecreated = false;
306 Rect frame = getSurfaceHolder().getSurfaceFrame();
Ahan Wu44ab58a2019-06-20 18:14:29 +0800307 cancelFinishRenderingTask();
Ahan Wu67e7f102019-01-14 20:38:14 +0800308
Ahan Wufa42c512019-05-15 19:52:51 +0800309 // Check if we need to recreate egl context.
310 if (!mEglHelper.hasEglContext()) {
311 mEglHelper.destroyEglSurface();
312 if (!mEglHelper.createEglContext()) {
313 Log.w(TAG, "recreate egl context failed!");
314 } else {
315 contextRecreated = true;
316 }
317 }
Ahan Wu67e7f102019-01-14 20:38:14 +0800318
Ahan Wufa42c512019-05-15 19:52:51 +0800319 // Check if we need to recreate egl surface.
320 if (mEglHelper.hasEglContext() && !mEglHelper.hasEglSurface()) {
Ahan Wu287d8282019-12-17 16:23:17 +0800321 if (!mEglHelper.createEglSurface(getSurfaceHolder(), needSupportWideColorGamut())) {
Ahan Wufa42c512019-05-15 19:52:51 +0800322 Log.w(TAG, "recreate egl surface failed!");
323 }
324 }
325
326 // If we recreate egl context, notify renderer to setup again.
327 if (mEglHelper.hasEglContext() && mEglHelper.hasEglSurface() && contextRecreated) {
328 mRenderer.onSurfaceCreated();
329 mRenderer.onSurfaceChanged(frame.width(), frame.height());
330 }
331 }
332
333 @Override
334 public void requestRender() {
Ahan Wub3780592019-07-04 20:50:00 +0800335 // This method should only be invoked from worker thread.
Ahan Wue88b1652019-09-19 22:12:46 +0800336 Trace.beginSection("ImageWallpaper#requestRender");
Ahan Wub3780592019-07-04 20:50:00 +0800337 requestRenderInternal();
Ahan Wue88b1652019-09-19 22:12:46 +0800338 Trace.endSection();
Ahan Wu44ab58a2019-06-20 18:14:29 +0800339 }
340
341 private void requestRenderInternal() {
Ahan Wufa42c512019-05-15 19:52:51 +0800342 Rect frame = getSurfaceHolder().getSurfaceFrame();
343 boolean readyToRender = mEglHelper.hasEglContext() && mEglHelper.hasEglSurface()
344 && frame.width() > 0 && frame.height() > 0;
345
346 if (readyToRender) {
347 mRenderer.onDrawFrame();
348 if (!mEglHelper.swapBuffer()) {
349 Log.e(TAG, "drawFrame failed!");
350 }
351 } else {
352 Log.e(TAG, "requestRender: not ready, has context=" + mEglHelper.hasEglContext()
353 + ", has surface=" + mEglHelper.hasEglSurface()
354 + ", frame=" + frame);
355 }
356 }
357
358 @Override
359 public void postRender() {
Ahan Wub3780592019-07-04 20:50:00 +0800360 // This method should only be invoked from worker thread.
Ahan Wue88b1652019-09-19 22:12:46 +0800361 Trace.beginSection("ImageWallpaper#postRender");
Ahan Wub3780592019-07-04 20:50:00 +0800362 notifyWaitingThread();
363 scheduleFinishRendering();
Ahan Wue88b1652019-09-19 22:12:46 +0800364 Trace.endSection();
Ahan Wub3780592019-07-04 20:50:00 +0800365 }
366
367 private void notifyWaitingThread() {
368 synchronized (mMonitor) {
369 if (mWaitingForRendering) {
370 try {
371 mWaitingForRendering = false;
372 mMonitor.notify();
373 } catch (IllegalMonitorStateException ex) {
374 }
375 }
376 }
Ahan Wu44ab58a2019-06-20 18:14:29 +0800377 }
378
379 private void cancelFinishRenderingTask() {
Ahan Wuc9c7ebb2020-02-17 18:49:59 +0800380 if (mWorker == null) return;
Ahan Wu44ab58a2019-06-20 18:14:29 +0800381 mWorker.getThreadHandler().removeCallbacks(mFinishRenderingTask);
Ahan Wufa42c512019-05-15 19:52:51 +0800382 }
383
384 private void scheduleFinishRendering() {
Ahan Wuc9c7ebb2020-02-17 18:49:59 +0800385 if (mWorker == null) return;
Ahan Wu44ab58a2019-06-20 18:14:29 +0800386 cancelFinishRenderingTask();
387 mWorker.getThreadHandler().postDelayed(mFinishRenderingTask, DELAY_FINISH_RENDERING);
Ahan Wufa42c512019-05-15 19:52:51 +0800388 }
389
390 private void finishRendering() {
Ahan Wue88b1652019-09-19 22:12:46 +0800391 Trace.beginSection("ImageWallpaper#finishRendering");
Ahan Wufa42c512019-05-15 19:52:51 +0800392 if (mEglHelper != null) {
393 mEglHelper.destroyEglSurface();
394 if (!needPreserveEglContext()) {
395 mEglHelper.destroyEglContext();
396 }
397 }
Ahan Wue88b1652019-09-19 22:12:46 +0800398 Trace.endSection();
Ahan Wufa42c512019-05-15 19:52:51 +0800399 }
400
401 private boolean needPreserveEglContext() {
402 return mNeedTransition && mController != null
403 && mController.getState() == StatusBarState.KEYGUARD;
404 }
Ahan Wu76884242019-05-22 20:04:23 +0800405
Ahan Wu287d8282019-12-17 16:23:17 +0800406 private boolean needSupportWideColorGamut() {
407 return mRenderer.isWcgContent();
408 }
409
Ahan Wu76884242019-05-22 20:04:23 +0800410 @Override
411 protected void dump(String prefix, FileDescriptor fd, PrintWriter out, String[] args) {
412 super.dump(prefix, fd, out, args);
413 out.print(prefix); out.print("Engine="); out.println(this);
Ahan Wu4e404402020-01-27 20:39:57 +0800414 out.print(prefix); out.print("isHighEndGfx="); out.println(mIsHighEndGfx);
Ahan Wu76884242019-05-22 20:04:23 +0800415 out.print(prefix); out.print("displayNeedsBlanking=");
Ahan Wu4e404402020-01-27 20:39:57 +0800416 out.println(mDisplayNeedsBlanking);
417 out.print(prefix); out.print("displayInfo="); out.print(mDisplayInfo);
Ahan Wu76884242019-05-22 20:04:23 +0800418 out.print(prefix); out.print("mNeedTransition="); out.println(mNeedTransition);
Ahan Wu4e404402020-01-27 20:39:57 +0800419 out.print(prefix); out.print("mShouldStopTransition=");
420 out.println(mShouldStopTransition);
Ahan Wu76884242019-05-22 20:04:23 +0800421 out.print(prefix); out.print("StatusBarState=");
422 out.println(mController != null ? mController.getState() : "null");
423
424 out.print(prefix); out.print("valid surface=");
425 out.println(getSurfaceHolder() != null && getSurfaceHolder().getSurface() != null
426 ? getSurfaceHolder().getSurface().isValid()
427 : "null");
428
429 out.print(prefix); out.print("surface frame=");
430 out.println(getSurfaceHolder() != null ? getSurfaceHolder().getSurfaceFrame() : "null");
431
432 mEglHelper.dump(prefix, fd, out, args);
433 mRenderer.dump(prefix, fd, out, args);
434 }
Ahan Wu67e7f102019-01-14 20:38:14 +0800435 }
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700436}