Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 37a10c94 authored by Mark Renouf's avatar Mark Renouf
Browse files

Separate RequestProcessor from interface

This is in preparation for a new implementation to add
support for private profile handling. The interactions
between work and private profile combine in ways that
make it simpler to create  new version with the new
requirements in mind.

The implementation will be switched via Dagger binding,
controlled by a flag.

Bug: 327613051
Test: N/A; pure mechanical refactor, no changes
Flag: N/A
Change-Id: I4ea124fbaa22c1afe1ce999016f4976e43598dfa
parent 13615a60
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -21,16 +21,6 @@ import android.view.WindowManager.TAKE_SCREENSHOT_PROVIDED_IMAGE
import com.android.systemui.dagger.SysUISingleton
import javax.inject.Inject

/** Processes a screenshot request sent from [ScreenshotHelper]. */
interface ScreenshotRequestProcessor {
    /**
     * Inspects the incoming ScreenshotData, potentially modifying it based upon policy.
     *
     * @param screenshot the screenshot to process
     */
    suspend fun process(screenshot: ScreenshotData): ScreenshotData
}

/** Implementation of [ScreenshotRequestProcessor] */
@SysUISingleton
class RequestProcessor
@@ -75,6 +65,3 @@ constructor(
}

private const val TAG = "RequestProcessor"

/** Exception thrown by [RequestProcessor] if something goes wrong. */
class RequestProcessorException(message: String) : IllegalStateException(message)
+30 −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

/** Processes a screenshot request sent from [ScreenshotHelper]. */
interface ScreenshotRequestProcessor {
    /**
     * Inspects the incoming ScreenshotData, potentially modifying it based upon policy.
     *
     * @param screenshot the screenshot to process
     */
    suspend fun process(screenshot: ScreenshotData): ScreenshotData
}

/** Exception thrown by [RequestProcessor] if something goes wrong. */
class RequestProcessorException(message: String) : IllegalStateException(message)