Loading packages/SystemUI/AndroidManifest.xml +5 −0 Original line number Diff line number Diff line Loading @@ -394,6 +394,11 @@ android:label="@string/screenshot_scroll_label" android:finishOnTaskLaunch="true" /> <service android:name=".screenshot.ScreenshotProxyService" android:permission="com.android.systemui.permission.SELF" android:exported="false" /> <service android:name=".screenrecord.RecordingService" /> <receiver android:name=".SysuiRestartReceiver" Loading packages/SystemUI/src/com/android/systemui/flags/Flags.java +1 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,7 @@ public class Flags { // 1300 - screenshots public static final UnreleasedFlag SCREENSHOT_REQUEST_PROCESSOR = new UnreleasedFlag(1300); public static final UnreleasedFlag SCREENSHOT_WORK_PROFILE_POLICY = new UnreleasedFlag(1301); // Pay no attention to the reflection behind the curtain. // ========================== Curtain ========================== Loading packages/SystemUI/src/com/android/systemui/screenshot/IScreenshotProxy.aidl 0 → 100644 +24 −0 Original line number Diff line number Diff line /** * Copyright (c) 2009, 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; /** Interface implemented by ScreenshotProxyService */ interface IScreenshotProxy { /** Is the notification shade currently exanded? */ boolean isNotificationShadeExpanded(); } No newline at end of file packages/SystemUI/src/com/android/systemui/screenshot/ImageCapture.kt +1 −1 Original line number Diff line number Diff line Loading @@ -22,5 +22,5 @@ interface ImageCapture { fun captureDisplay(displayId: Int, crop: Rect? = null): Bitmap? fun captureTask(taskId: Int): Bitmap? suspend fun captureTask(taskId: Int): Bitmap? } packages/SystemUI/src/com/android/systemui/screenshot/ImageCaptureImpl.kt +20 −9 Original line number Diff line number Diff line Loading @@ -27,13 +27,19 @@ import android.view.SurfaceControl import android.view.SurfaceControl.DisplayCaptureArgs import android.view.SurfaceControl.ScreenshotHardwareBuffer import androidx.annotation.VisibleForTesting import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.withContext private const val TAG = "ImageCaptureImpl" @SysUISingleton open class ImageCaptureImpl @Inject constructor( private val displayManager: DisplayManager, private val atmService: IActivityTaskManager private val atmService: IActivityTaskManager, @Background private val bgContext: CoroutineDispatcher ) : ImageCapture { override fun captureDisplay(displayId: Int, crop: Rect?): Bitmap? { Loading @@ -46,8 +52,8 @@ open class ImageCaptureImpl @Inject constructor( return buffer?.asBitmap() } override fun captureTask(taskId: Int): Bitmap? { val snapshot = atmService.takeTaskSnapshot(taskId) override suspend fun captureTask(taskId: Int): Bitmap? { val snapshot = withContext(bgContext) { atmService.takeTaskSnapshot(taskId) } ?: return null return Bitmap.wrapHardwareBuffer(snapshot.hardwareBuffer, snapshot.colorSpace) } Loading @@ -67,12 +73,17 @@ open class ImageCaptureImpl @Inject constructor( } @VisibleForTesting open fun captureDisplay(displayToken: IBinder, width: Int, height: Int, crop: Rect): ScreenshotHardwareBuffer? { val captureArgs = DisplayCaptureArgs.Builder(displayToken) open fun captureDisplay( displayToken: IBinder, width: Int, height: Int, crop: Rect ): ScreenshotHardwareBuffer? { val captureArgs = DisplayCaptureArgs.Builder(displayToken) .setSize(width, height) .setSourceCrop(crop) .build() return SurfaceControl.captureDisplay(captureArgs) } } Loading
packages/SystemUI/AndroidManifest.xml +5 −0 Original line number Diff line number Diff line Loading @@ -394,6 +394,11 @@ android:label="@string/screenshot_scroll_label" android:finishOnTaskLaunch="true" /> <service android:name=".screenshot.ScreenshotProxyService" android:permission="com.android.systemui.permission.SELF" android:exported="false" /> <service android:name=".screenrecord.RecordingService" /> <receiver android:name=".SysuiRestartReceiver" Loading
packages/SystemUI/src/com/android/systemui/flags/Flags.java +1 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,7 @@ public class Flags { // 1300 - screenshots public static final UnreleasedFlag SCREENSHOT_REQUEST_PROCESSOR = new UnreleasedFlag(1300); public static final UnreleasedFlag SCREENSHOT_WORK_PROFILE_POLICY = new UnreleasedFlag(1301); // Pay no attention to the reflection behind the curtain. // ========================== Curtain ========================== Loading
packages/SystemUI/src/com/android/systemui/screenshot/IScreenshotProxy.aidl 0 → 100644 +24 −0 Original line number Diff line number Diff line /** * Copyright (c) 2009, 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; /** Interface implemented by ScreenshotProxyService */ interface IScreenshotProxy { /** Is the notification shade currently exanded? */ boolean isNotificationShadeExpanded(); } No newline at end of file
packages/SystemUI/src/com/android/systemui/screenshot/ImageCapture.kt +1 −1 Original line number Diff line number Diff line Loading @@ -22,5 +22,5 @@ interface ImageCapture { fun captureDisplay(displayId: Int, crop: Rect? = null): Bitmap? fun captureTask(taskId: Int): Bitmap? suspend fun captureTask(taskId: Int): Bitmap? }
packages/SystemUI/src/com/android/systemui/screenshot/ImageCaptureImpl.kt +20 −9 Original line number Diff line number Diff line Loading @@ -27,13 +27,19 @@ import android.view.SurfaceControl import android.view.SurfaceControl.DisplayCaptureArgs import android.view.SurfaceControl.ScreenshotHardwareBuffer import androidx.annotation.VisibleForTesting import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.withContext private const val TAG = "ImageCaptureImpl" @SysUISingleton open class ImageCaptureImpl @Inject constructor( private val displayManager: DisplayManager, private val atmService: IActivityTaskManager private val atmService: IActivityTaskManager, @Background private val bgContext: CoroutineDispatcher ) : ImageCapture { override fun captureDisplay(displayId: Int, crop: Rect?): Bitmap? { Loading @@ -46,8 +52,8 @@ open class ImageCaptureImpl @Inject constructor( return buffer?.asBitmap() } override fun captureTask(taskId: Int): Bitmap? { val snapshot = atmService.takeTaskSnapshot(taskId) override suspend fun captureTask(taskId: Int): Bitmap? { val snapshot = withContext(bgContext) { atmService.takeTaskSnapshot(taskId) } ?: return null return Bitmap.wrapHardwareBuffer(snapshot.hardwareBuffer, snapshot.colorSpace) } Loading @@ -67,12 +73,17 @@ open class ImageCaptureImpl @Inject constructor( } @VisibleForTesting open fun captureDisplay(displayToken: IBinder, width: Int, height: Int, crop: Rect): ScreenshotHardwareBuffer? { val captureArgs = DisplayCaptureArgs.Builder(displayToken) open fun captureDisplay( displayToken: IBinder, width: Int, height: Int, crop: Rect ): ScreenshotHardwareBuffer? { val captureArgs = DisplayCaptureArgs.Builder(displayToken) .setSize(width, height) .setSourceCrop(crop) .build() return SurfaceControl.captureDisplay(captureArgs) } }