Loading core/java/com/android/internal/util/ScreenshotHelper.java +2 −0 Original line number Diff line number Diff line Loading @@ -279,6 +279,7 @@ public class ScreenshotHelper { final Runnable mScreenshotTimeout = () -> { synchronized (mScreenshotLock) { if (mScreenshotConnection != null) { Log.e(TAG, "Timed out before getting screenshot capture response"); mContext.unbindService(mScreenshotConnection); mScreenshotConnection = null; mScreenshotService = null; Loading Loading @@ -353,6 +354,7 @@ public class ScreenshotHelper { mScreenshotService = null; // only log an error if we're still within the timeout period if (handler.hasCallbacks(mScreenshotTimeout)) { Log.e(TAG, "Screenshot service disconnected"); handler.removeCallbacks(mScreenshotTimeout); notifyScreenshotError(); } Loading packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +21 −10 Original line number Diff line number Diff line Loading @@ -321,8 +321,17 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset Insets visibleInsets, int taskId, int userId, ComponentName topComponent, Consumer<Uri> finisher, Runnable onComplete) { // TODO: use task Id, userId, topComponent for smart handler mOnCompleteRunnable = onComplete; if (screenshot == null) { Log.e(TAG, "Got null bitmap from screenshot message"); mNotificationsController.notifyScreenshotError( R.string.screenshot_failed_to_capture_text); finisher.accept(null); mOnCompleteRunnable.run(); return; } if (aspectRatiosMatch(screenshot, visibleInsets, screenshotScreenBounds)) { saveScreenshot(screenshot, finisher, screenshotScreenBounds, visibleInsets, false); } else { Loading Loading @@ -569,7 +578,17 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset .build(); final SurfaceControl.ScreenshotHardwareBuffer screenshotBuffer = SurfaceControl.captureDisplay(captureArgs); final Bitmap screenshot = screenshotBuffer == null ? null : screenshotBuffer.asBitmap(); Bitmap screenshot = screenshotBuffer == null ? null : screenshotBuffer.asBitmap(); if (screenshot == null) { Log.e(TAG, "Screenshot bitmap was null"); mNotificationsController.notifyScreenshotError( R.string.screenshot_failed_to_capture_text); finisher.accept(null); mOnCompleteRunnable.run(); return; } saveScreenshot(screenshot, finisher, screenRect, Insets.NONE, true); } Loading @@ -593,14 +612,6 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset mScreenBitmap = screenshot; if (mScreenBitmap == null) { mNotificationsController.notifyScreenshotError( R.string.screenshot_failed_to_capture_text); finisher.accept(null); mOnCompleteRunnable.run(); return; } if (!isUserSetupComplete()) { // User setup isn't complete, so we don't want to show any UI beyond a toast, as editing // and sharing shouldn't be exposed to the user. Loading Loading
core/java/com/android/internal/util/ScreenshotHelper.java +2 −0 Original line number Diff line number Diff line Loading @@ -279,6 +279,7 @@ public class ScreenshotHelper { final Runnable mScreenshotTimeout = () -> { synchronized (mScreenshotLock) { if (mScreenshotConnection != null) { Log.e(TAG, "Timed out before getting screenshot capture response"); mContext.unbindService(mScreenshotConnection); mScreenshotConnection = null; mScreenshotService = null; Loading Loading @@ -353,6 +354,7 @@ public class ScreenshotHelper { mScreenshotService = null; // only log an error if we're still within the timeout period if (handler.hasCallbacks(mScreenshotTimeout)) { Log.e(TAG, "Screenshot service disconnected"); handler.removeCallbacks(mScreenshotTimeout); notifyScreenshotError(); } Loading
packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +21 −10 Original line number Diff line number Diff line Loading @@ -321,8 +321,17 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset Insets visibleInsets, int taskId, int userId, ComponentName topComponent, Consumer<Uri> finisher, Runnable onComplete) { // TODO: use task Id, userId, topComponent for smart handler mOnCompleteRunnable = onComplete; if (screenshot == null) { Log.e(TAG, "Got null bitmap from screenshot message"); mNotificationsController.notifyScreenshotError( R.string.screenshot_failed_to_capture_text); finisher.accept(null); mOnCompleteRunnable.run(); return; } if (aspectRatiosMatch(screenshot, visibleInsets, screenshotScreenBounds)) { saveScreenshot(screenshot, finisher, screenshotScreenBounds, visibleInsets, false); } else { Loading Loading @@ -569,7 +578,17 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset .build(); final SurfaceControl.ScreenshotHardwareBuffer screenshotBuffer = SurfaceControl.captureDisplay(captureArgs); final Bitmap screenshot = screenshotBuffer == null ? null : screenshotBuffer.asBitmap(); Bitmap screenshot = screenshotBuffer == null ? null : screenshotBuffer.asBitmap(); if (screenshot == null) { Log.e(TAG, "Screenshot bitmap was null"); mNotificationsController.notifyScreenshotError( R.string.screenshot_failed_to_capture_text); finisher.accept(null); mOnCompleteRunnable.run(); return; } saveScreenshot(screenshot, finisher, screenRect, Insets.NONE, true); } Loading @@ -593,14 +612,6 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset mScreenBitmap = screenshot; if (mScreenBitmap == null) { mNotificationsController.notifyScreenshotError( R.string.screenshot_failed_to_capture_text); finisher.accept(null); mOnCompleteRunnable.run(); return; } if (!isUserSetupComplete()) { // User setup isn't complete, so we don't want to show any UI beyond a toast, as editing // and sharing shouldn't be exposed to the user. Loading