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

Commit 7c7a4f13 authored by Darrell Shi's avatar Darrell Shi
Browse files

Fix multiple bindings to TouchInsetManager

Bug: 292676146
Fix: 292676146
Test: verify dream touch behavior works correctly, and the manager is
constructed once each time dream starts

Change-Id: I42708ca44cda738d7bcd7e0b508c9a0f9160e4ea
parent eaf5ec33
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.dreams;

import static com.android.systemui.dreams.dagger.DreamModule.DREAM_OVERLAY_WINDOW_TITLE;
import static com.android.systemui.dreams.dagger.DreamModule.DREAM_TOUCH_INSET_MANAGER;

import android.content.ComponentName;
import android.content.Context;
@@ -161,7 +162,7 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
            DreamOverlayStateController stateController,
            KeyguardUpdateMonitor keyguardUpdateMonitor,
            UiEventLogger uiEventLogger,
            TouchInsetManager touchInsetManager,
            @Named(DREAM_TOUCH_INSET_MANAGER) TouchInsetManager touchInsetManager,
            @Nullable @Named(LowLightDreamModule.LOW_LIGHT_DREAM_COMPONENT)
                    ComponentName lowLightDreamComponent,
            DreamOverlayCallbackController dreamOverlayCallbackController,
+12 −1
Original line number Diff line number Diff line
@@ -31,11 +31,13 @@ import com.android.systemui.dreams.DreamOverlayNotificationCountProvider;
import com.android.systemui.dreams.DreamOverlayService;
import com.android.systemui.dreams.complication.dagger.ComplicationComponent;
import com.android.systemui.dreams.touch.scrim.dagger.ScrimModule;
import com.android.systemui.touch.TouchInsetManager;

import dagger.Module;
import dagger.Provides;

import java.util.Optional;
import java.util.concurrent.Executor;

import javax.inject.Named;

@@ -55,7 +57,7 @@ public interface DreamModule {
    String DREAM_ONLY_ENABLED_FOR_DOCK_USER = "dream_only_enabled_for_dock_user";
    String DREAM_OVERLAY_SERVICE_COMPONENT = "dream_overlay_service_component";
    String DREAM_OVERLAY_ENABLED = "dream_overlay_enabled";

    String DREAM_TOUCH_INSET_MANAGER = "dream_touch_inset_manager";
    String DREAM_SUPPORTED = "dream_supported";
    String DREAM_OVERLAY_WINDOW_TITLE = "dream_overlay_window_title";

@@ -68,6 +70,15 @@ public interface DreamModule {
        return new ComponentName(context, DreamOverlayService.class);
    }

    /**
     * Provides a touch inset manager for dreams.
     */
    @Provides
    @Named(DREAM_TOUCH_INSET_MANAGER)
    static TouchInsetManager providesTouchInsetManager(@Main Executor executor) {
        return new TouchInsetManager(executor);
    }

    /**
     * Provides whether dream overlay is enabled.
     */
+1 −6
Original line number Diff line number Diff line
@@ -25,16 +25,12 @@ import android.view.ViewGroup;

import androidx.concurrent.futures.CallbackToFutureAdapter;

import com.android.systemui.dagger.qualifiers.Main;

import com.google.common.util.concurrent.ListenableFuture;

import java.util.HashMap;
import java.util.HashSet;
import java.util.concurrent.Executor;

import javax.inject.Inject;

/**
 * {@link TouchInsetManager} handles setting the touchable inset regions for a given View. This
 * is useful for passing through touch events for all but select areas.
@@ -153,8 +149,7 @@ public class TouchInsetManager {
     * Default constructor.
     * @param executor An {@link Executor} to marshal all operations on.
     */
    @Inject
    public TouchInsetManager(@Main Executor executor) {
    public TouchInsetManager(Executor executor) {
        mExecutor = executor;
    }