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

Commit decb0f1d authored by Mark Renouf's avatar Mark Renouf
Browse files

Adds ScreenshotPolicyModule

This moves the binding for RequestProcessor into the new module to
prepare for further changes.

Bug: 327613051
Test: compile
Flag: None
Change-Id: Icf73251f2fb45f711f1d0d29353756ee70f5e0c7
parent 37a10c94
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -18,14 +18,9 @@ package com.android.systemui.screenshot

import android.util.Log
import android.view.WindowManager.TAKE_SCREENSHOT_PROVIDED_IMAGE
import com.android.systemui.dagger.SysUISingleton
import javax.inject.Inject

/** Implementation of [ScreenshotRequestProcessor] */
@SysUISingleton
class RequestProcessor
@Inject
constructor(
class RequestProcessor(
    private val capture: ImageCapture,
    private val policy: ScreenshotPolicy,
) : ScreenshotRequestProcessor {
+2 −7
Original line number Diff line number Diff line
@@ -26,11 +26,9 @@ import com.android.systemui.screenshot.DefaultScreenshotActionsProvider;
import com.android.systemui.screenshot.ImageCapture;
import com.android.systemui.screenshot.ImageCaptureImpl;
import com.android.systemui.screenshot.LegacyScreenshotViewProxy;
import com.android.systemui.screenshot.RequestProcessor;
import com.android.systemui.screenshot.ScreenshotActionsProvider;
import com.android.systemui.screenshot.ScreenshotPolicy;
import com.android.systemui.screenshot.ScreenshotPolicyImpl;
import com.android.systemui.screenshot.ScreenshotRequestProcessor;
import com.android.systemui.screenshot.ScreenshotShelfViewProxy;
import com.android.systemui.screenshot.ScreenshotSoundController;
import com.android.systemui.screenshot.ScreenshotSoundControllerImpl;
@@ -42,6 +40,7 @@ import com.android.systemui.screenshot.TakeScreenshotExecutorImpl;
import com.android.systemui.screenshot.TakeScreenshotService;
import com.android.systemui.screenshot.appclips.AppClipsScreenshotHelperService;
import com.android.systemui.screenshot.appclips.AppClipsService;
import com.android.systemui.screenshot.policy.ScreenshotPolicyModule;
import com.android.systemui.screenshot.ui.viewmodel.ScreenshotViewModel;

import dagger.Binds;
@@ -53,7 +52,7 @@ import dagger.multibindings.IntoMap;
/**
 * Defines injectable resources for Screenshots
 */
@Module
@Module(includes = ScreenshotPolicyModule.class)
public abstract class ScreenshotModule {

    @Binds
@@ -82,10 +81,6 @@ public abstract class ScreenshotModule {
    @ClassKey(AppClipsService.class)
    abstract Service bindAppClipsService(AppClipsService service);

    @Binds
    abstract ScreenshotRequestProcessor bindScreenshotRequestProcessor(
            RequestProcessor requestProcessor);

    @Binds
    abstract ScreenshotSoundProvider bindScreenshotSoundProvider(
            ScreenshotSoundProviderImpl screenshotSoundProviderImpl);
+39 −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.policy

import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.screenshot.ImageCapture
import com.android.systemui.screenshot.RequestProcessor
import com.android.systemui.screenshot.ScreenshotPolicy
import com.android.systemui.screenshot.ScreenshotRequestProcessor
import dagger.Module
import dagger.Provides
import javax.inject.Provider

@Module
object ScreenshotPolicyModule {

    @Provides
    @SysUISingleton
    fun bindScreenshotRequestProcessor(
        imageCapture: ImageCapture,
        policyProvider: Provider<ScreenshotPolicy>,
    ): ScreenshotRequestProcessor {
        return RequestProcessor(imageCapture, policyProvider.get())
    }
}