Loading packages/SystemUI/src/com/android/systemui/screenshot/ReferenceScreenshotModule.java +6 −0 Original line number Diff line number Diff line Loading @@ -35,4 +35,10 @@ public interface ReferenceScreenshotModule { @Binds ScreenshotActionsProvider.Factory bindScreenshotActionsProviderFactory( DefaultScreenshotActionsProvider.Factory defaultScreenshotActionsProviderFactory); /** */ @Provides static ThumbnailObserver providesThumbnailObserver() { return new ThumbnailObserver(); }; } packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotShelfViewProxy.kt +12 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.view.WindowManager import android.window.OnBackInvokedCallback import android.window.OnBackInvokedDispatcher import androidx.core.animation.doOnEnd import androidx.core.animation.doOnStart import com.android.internal.logging.UiEventLogger import com.android.systemui.log.DebugLogger.debugLog import com.android.systemui.res.R Loading @@ -56,6 +57,7 @@ constructor( private val logger: UiEventLogger, private val viewModel: ScreenshotViewModel, private val windowManager: WindowManager, private val thumbnailObserver: ThumbnailObserver, @Assisted private val context: Context, @Assisted private val displayId: Int ) : ScreenshotViewProxy { Loading Loading @@ -99,6 +101,10 @@ constructor( info.touchableRegion.set(touchableRegion) } screenshotPreview = view.screenshotPreview thumbnailObserver.setViews( view.screenshotPreview, view.requireViewById(R.id.screenshot_preview_border) ) } override fun reset() { Loading @@ -111,8 +117,12 @@ constructor( override fun createScreenshotDropInAnimation(screenRect: Rect, showFlash: Boolean): Animator { val entrance = animationController.getEntranceAnimation(screenRect, showFlash) entrance.doOnStart { thumbnailObserver.onEntranceStarted() } entrance.doOnEnd { // reset the timeout when animation finishes entrance.doOnEnd { callbacks?.onUserInteraction() } callbacks?.onUserInteraction() thumbnailObserver.onEntranceComplete() } return entrance } Loading packages/SystemUI/src/com/android/systemui/screenshot/ThumbnailObserver.kt 0 → 100644 +32 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.screenshot import android.view.View import android.widget.ImageView /** An observer of thumbnail UI and entrance state that can be overridden if needed. */ open class ThumbnailObserver { /** Thumbnail image and border views. */ open fun setViews(image: ImageView, border: View) {} /** Entrance animation has begun. */ open fun onEntranceStarted() {} /** Entrance animation has completed/stopped. */ open fun onEntranceComplete() {} } Loading
packages/SystemUI/src/com/android/systemui/screenshot/ReferenceScreenshotModule.java +6 −0 Original line number Diff line number Diff line Loading @@ -35,4 +35,10 @@ public interface ReferenceScreenshotModule { @Binds ScreenshotActionsProvider.Factory bindScreenshotActionsProviderFactory( DefaultScreenshotActionsProvider.Factory defaultScreenshotActionsProviderFactory); /** */ @Provides static ThumbnailObserver providesThumbnailObserver() { return new ThumbnailObserver(); }; }
packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotShelfViewProxy.kt +12 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.view.WindowManager import android.window.OnBackInvokedCallback import android.window.OnBackInvokedDispatcher import androidx.core.animation.doOnEnd import androidx.core.animation.doOnStart import com.android.internal.logging.UiEventLogger import com.android.systemui.log.DebugLogger.debugLog import com.android.systemui.res.R Loading @@ -56,6 +57,7 @@ constructor( private val logger: UiEventLogger, private val viewModel: ScreenshotViewModel, private val windowManager: WindowManager, private val thumbnailObserver: ThumbnailObserver, @Assisted private val context: Context, @Assisted private val displayId: Int ) : ScreenshotViewProxy { Loading Loading @@ -99,6 +101,10 @@ constructor( info.touchableRegion.set(touchableRegion) } screenshotPreview = view.screenshotPreview thumbnailObserver.setViews( view.screenshotPreview, view.requireViewById(R.id.screenshot_preview_border) ) } override fun reset() { Loading @@ -111,8 +117,12 @@ constructor( override fun createScreenshotDropInAnimation(screenRect: Rect, showFlash: Boolean): Animator { val entrance = animationController.getEntranceAnimation(screenRect, showFlash) entrance.doOnStart { thumbnailObserver.onEntranceStarted() } entrance.doOnEnd { // reset the timeout when animation finishes entrance.doOnEnd { callbacks?.onUserInteraction() } callbacks?.onUserInteraction() thumbnailObserver.onEntranceComplete() } return entrance } Loading
packages/SystemUI/src/com/android/systemui/screenshot/ThumbnailObserver.kt 0 → 100644 +32 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.screenshot import android.view.View import android.widget.ImageView /** An observer of thumbnail UI and entrance state that can be overridden if needed. */ open class ThumbnailObserver { /** Thumbnail image and border views. */ open fun setViews(image: ImageView, border: View) {} /** Entrance animation has begun. */ open fun onEntranceStarted() {} /** Entrance animation has completed/stopped. */ open fun onEntranceComplete() {} }