Loading packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.kt +4 −23 Original line number Diff line number Diff line Loading @@ -60,7 +60,6 @@ import java.util.concurrent.Executor import java.util.concurrent.ExecutorService import java.util.concurrent.Executors import java.util.function.Consumer import javax.inject.Provider import kotlin.math.abs /** Controls the state and flow for screenshots. */ Loading @@ -73,7 +72,7 @@ internal constructor( screenshotNotificationsControllerFactory: ScreenshotNotificationsController.Factory, screenshotActionsControllerFactory: ScreenshotActionsController.Factory, actionExecutorFactory: ActionExecutor.Factory, screenshotSoundControllerProvider: Provider<ScreenshotSoundController?>, private val screenshotSoundController: ScreenshotSoundController, private val uiEventLogger: UiEventLogger, private val imageExporter: ImageExporter, private val imageCapture: ImageCapture, Loading @@ -100,7 +99,6 @@ internal constructor( private val currentRequestCallbacks: MutableList<TakeScreenshotService.RequestCallback> = mutableListOf() private var screenshotSoundController: ScreenshotSoundController? = null private var screenBitmap: Bitmap? = null private var screenshotTakenInPortrait = false private var screenshotAnimation: Animator? = null Loading Loading @@ -138,14 +136,6 @@ internal constructor( actionExecutor = actionExecutorFactory.create(window.window, viewProxy) { finishDismiss() } actionsController = screenshotActionsControllerFactory.getController(actionExecutor) // Sound is only reproduced from the controller of the default display. screenshotSoundController = if (display.displayId == Display.DEFAULT_DISPLAY) { screenshotSoundControllerProvider.get() } else { null } copyBroadcastReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { Loading Loading @@ -308,7 +298,7 @@ internal constructor( // Any cleanup needed when the service is being destroyed. override fun onDestroy() { removeWindow() releaseMediaPlayer() screenshotSoundController.releaseScreenshotSoundAsync() releaseContext() bgExecutor.shutdown() } Loading @@ -319,10 +309,6 @@ internal constructor( context.release() } private fun releaseMediaPlayer() { screenshotSoundController?.releaseScreenshotSoundAsync() } /** Update resources on configuration change. Reinflate for theme/color changes. */ private fun reloadAssets() { if (LogConfig.DEBUG_UI) { Loading Loading @@ -448,18 +434,13 @@ internal constructor( viewProxy.stopInputListening() } private fun playCameraSoundIfNeeded() { // the controller is not-null only on the default display controller screenshotSoundController?.playScreenshotSoundAsync() } /** * Save the bitmap but don't show the normal screenshot UI.. just a toast (or notification on * failure). */ private fun saveScreenshotAndToast(screenshot: ScreenshotData, finisher: Consumer<Uri?>) { // Play the shutter sound to notify that we've taken a screenshot playCameraSoundIfNeeded() screenshotSoundController.playScreenshotSoundAsync() saveScreenshotInBackground(screenshot, UUID.randomUUID(), finisher) { result: ImageExporter.Result -> Loading Loading @@ -488,7 +469,7 @@ internal constructor( viewProxy.createScreenshotDropInAnimation(screenRect, showFlash).apply { doOnEnd { onAnimationComplete?.run() } // Play the shutter sound to notify that we've taken a screenshot playCameraSoundIfNeeded() screenshotSoundController.playScreenshotSoundAsync() if (LogConfig.DEBUG_ANIM) { Log.d(TAG, "starting post-screenshot animation") } Loading Loading
packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.kt +4 −23 Original line number Diff line number Diff line Loading @@ -60,7 +60,6 @@ import java.util.concurrent.Executor import java.util.concurrent.ExecutorService import java.util.concurrent.Executors import java.util.function.Consumer import javax.inject.Provider import kotlin.math.abs /** Controls the state and flow for screenshots. */ Loading @@ -73,7 +72,7 @@ internal constructor( screenshotNotificationsControllerFactory: ScreenshotNotificationsController.Factory, screenshotActionsControllerFactory: ScreenshotActionsController.Factory, actionExecutorFactory: ActionExecutor.Factory, screenshotSoundControllerProvider: Provider<ScreenshotSoundController?>, private val screenshotSoundController: ScreenshotSoundController, private val uiEventLogger: UiEventLogger, private val imageExporter: ImageExporter, private val imageCapture: ImageCapture, Loading @@ -100,7 +99,6 @@ internal constructor( private val currentRequestCallbacks: MutableList<TakeScreenshotService.RequestCallback> = mutableListOf() private var screenshotSoundController: ScreenshotSoundController? = null private var screenBitmap: Bitmap? = null private var screenshotTakenInPortrait = false private var screenshotAnimation: Animator? = null Loading Loading @@ -138,14 +136,6 @@ internal constructor( actionExecutor = actionExecutorFactory.create(window.window, viewProxy) { finishDismiss() } actionsController = screenshotActionsControllerFactory.getController(actionExecutor) // Sound is only reproduced from the controller of the default display. screenshotSoundController = if (display.displayId == Display.DEFAULT_DISPLAY) { screenshotSoundControllerProvider.get() } else { null } copyBroadcastReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { Loading Loading @@ -308,7 +298,7 @@ internal constructor( // Any cleanup needed when the service is being destroyed. override fun onDestroy() { removeWindow() releaseMediaPlayer() screenshotSoundController.releaseScreenshotSoundAsync() releaseContext() bgExecutor.shutdown() } Loading @@ -319,10 +309,6 @@ internal constructor( context.release() } private fun releaseMediaPlayer() { screenshotSoundController?.releaseScreenshotSoundAsync() } /** Update resources on configuration change. Reinflate for theme/color changes. */ private fun reloadAssets() { if (LogConfig.DEBUG_UI) { Loading Loading @@ -448,18 +434,13 @@ internal constructor( viewProxy.stopInputListening() } private fun playCameraSoundIfNeeded() { // the controller is not-null only on the default display controller screenshotSoundController?.playScreenshotSoundAsync() } /** * Save the bitmap but don't show the normal screenshot UI.. just a toast (or notification on * failure). */ private fun saveScreenshotAndToast(screenshot: ScreenshotData, finisher: Consumer<Uri?>) { // Play the shutter sound to notify that we've taken a screenshot playCameraSoundIfNeeded() screenshotSoundController.playScreenshotSoundAsync() saveScreenshotInBackground(screenshot, UUID.randomUUID(), finisher) { result: ImageExporter.Result -> Loading Loading @@ -488,7 +469,7 @@ internal constructor( viewProxy.createScreenshotDropInAnimation(screenRect, showFlash).apply { doOnEnd { onAnimationComplete?.run() } // Play the shutter sound to notify that we've taken a screenshot playCameraSoundIfNeeded() screenshotSoundController.playScreenshotSoundAsync() if (LogConfig.DEBUG_ANIM) { Log.d(TAG, "starting post-screenshot animation") } Loading