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

Commit c7da4476 authored by Ben Lin's avatar Ben Lin Committed by Automerger Merge Worker
Browse files

Merge "Introduce NotificationInsetsController." into tm-qpr-dev am: f4c98502 am: 15a6074f

parents 41505186 15a6074f
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.dagger;
package com.android.systemui.dagger;


import com.android.systemui.keyguard.KeyguardQuickAffordanceProvider;
import com.android.systemui.keyguard.KeyguardQuickAffordanceProvider;
import com.android.systemui.statusbar.NotificationInsetsModule;
import com.android.systemui.statusbar.QsFrameTranslateModule;
import com.android.systemui.statusbar.QsFrameTranslateModule;


import dagger.Subcomponent;
import dagger.Subcomponent;
@@ -28,6 +29,7 @@ import dagger.Subcomponent;
@Subcomponent(modules = {
@Subcomponent(modules = {
        DefaultComponentBinder.class,
        DefaultComponentBinder.class,
        DependencyProvider.class,
        DependencyProvider.class,
        NotificationInsetsModule.class,
        QsFrameTranslateModule.class,
        QsFrameTranslateModule.class,
        SystemUIBinder.class,
        SystemUIBinder.class,
        SystemUIModule.class,
        SystemUIModule.class,
+2 −0
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@ import com.android.systemui.keyguard.KeyguardSliceProvider;
import com.android.systemui.media.muteawait.MediaMuteAwaitConnectionCli;
import com.android.systemui.media.muteawait.MediaMuteAwaitConnectionCli;
import com.android.systemui.media.nearby.NearbyMediaDevicesManager;
import com.android.systemui.media.nearby.NearbyMediaDevicesManager;
import com.android.systemui.people.PeopleProvider;
import com.android.systemui.people.PeopleProvider;
import com.android.systemui.statusbar.NotificationInsetsModule;
import com.android.systemui.statusbar.QsFrameTranslateModule;
import com.android.systemui.statusbar.QsFrameTranslateModule;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.unfold.FoldStateLogger;
import com.android.systemui.unfold.FoldStateLogger;
@@ -65,6 +66,7 @@ import dagger.Subcomponent;
@Subcomponent(modules = {
@Subcomponent(modules = {
        DefaultComponentBinder.class,
        DefaultComponentBinder.class,
        DependencyProvider.class,
        DependencyProvider.class,
        NotificationInsetsModule.class,
        QsFrameTranslateModule.class,
        QsFrameTranslateModule.class,
        SystemUIBinder.class,
        SystemUIBinder.class,
        SystemUIModule.class,
        SystemUIModule.class,
+23 −6
Original line number Original line Diff line number Diff line
@@ -24,6 +24,7 @@ import static com.android.systemui.statusbar.phone.CentralSurfaces.DEBUG;
import android.annotation.ColorInt;
import android.annotation.ColorInt;
import android.annotation.DrawableRes;
import android.annotation.DrawableRes;
import android.annotation.LayoutRes;
import android.annotation.LayoutRes;
import android.annotation.Nullable;
import android.content.Context;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.content.res.TypedArray;
@@ -36,6 +37,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.Bundle;
import android.os.Trace;
import android.os.Trace;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.util.Pair;
import android.view.ActionMode;
import android.view.ActionMode;
import android.view.DisplayCutout;
import android.view.DisplayCutout;
import android.view.InputQueue;
import android.view.InputQueue;
@@ -74,6 +76,7 @@ public class NotificationShadeWindowView extends FrameLayout {
    private ViewTreeObserver.OnPreDrawListener mFloatingToolbarPreDrawListener;
    private ViewTreeObserver.OnPreDrawListener mFloatingToolbarPreDrawListener;


    private InteractionEventHandler mInteractionEventHandler;
    private InteractionEventHandler mInteractionEventHandler;
    private LayoutInsetsController mLayoutInsetProvider;


    public NotificationShadeWindowView(Context context, AttributeSet attrs) {
    public NotificationShadeWindowView(Context context, AttributeSet attrs) {
        super(context, attrs);
        super(context, attrs);
@@ -108,12 +111,10 @@ public class NotificationShadeWindowView extends FrameLayout {
        mLeftInset = 0;
        mLeftInset = 0;
        mRightInset = 0;
        mRightInset = 0;
        DisplayCutout displayCutout = getRootWindowInsets().getDisplayCutout();
        DisplayCutout displayCutout = getRootWindowInsets().getDisplayCutout();
        if (displayCutout != null) {
        Pair<Integer, Integer> pairInsets = mLayoutInsetProvider
            mLeftInset = displayCutout.getSafeInsetLeft();
                .getinsets(windowInsets, displayCutout);
            mRightInset = displayCutout.getSafeInsetRight();
        mLeftInset = pairInsets.first;
        }
        mRightInset = pairInsets.second;
        mLeftInset = Math.max(insets.left, mLeftInset);
        mRightInset = Math.max(insets.right, mRightInset);
        applyMargins();
        applyMargins();
        return windowInsets;
        return windowInsets;
    }
    }
@@ -172,6 +173,10 @@ public class NotificationShadeWindowView extends FrameLayout {
        mInteractionEventHandler = listener;
        mInteractionEventHandler = listener;
    }
    }


    protected void setLayoutInsetsController(LayoutInsetsController provider) {
        mLayoutInsetProvider = provider;
    }

    @Override
    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
    public boolean dispatchTouchEvent(MotionEvent ev) {
        Boolean result = mInteractionEventHandler.handleDispatchTouchEvent(ev);
        Boolean result = mInteractionEventHandler.handleDispatchTouchEvent(ev);
@@ -353,6 +358,18 @@ public class NotificationShadeWindowView extends FrameLayout {
        }
        }
    }
    }


    /**
     * Controller responsible for calculating insets for the shade window.
     */
    public interface LayoutInsetsController {

        /**
         * Update the insets and calculate them accordingly.
         */
        Pair<Integer, Integer> getinsets(@Nullable WindowInsets windowInsets,
                @Nullable DisplayCutout displayCutout);
    }

    interface InteractionEventHandler {
    interface InteractionEventHandler {
        /**
        /**
         * Returns a result for {@link ViewGroup#dispatchTouchEvent(MotionEvent)} or null to defer
         * Returns a result for {@link ViewGroup#dispatchTouchEvent(MotionEvent)} or null to defer
+5 −0
Original line number Original line Diff line number Diff line
@@ -42,6 +42,7 @@ import com.android.systemui.keyguard.ui.binder.KeyguardBouncerViewBinder;
import com.android.systemui.keyguard.ui.viewmodel.KeyguardBouncerViewModel;
import com.android.systemui.keyguard.ui.viewmodel.KeyguardBouncerViewModel;
import com.android.systemui.statusbar.DragDownHelper;
import com.android.systemui.statusbar.DragDownHelper;
import com.android.systemui.statusbar.LockscreenShadeTransitionController;
import com.android.systemui.statusbar.LockscreenShadeTransitionController;
import com.android.systemui.statusbar.NotificationInsetsController;
import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
@@ -76,6 +77,7 @@ public class NotificationShadeWindowViewController {
    private final KeyguardUnlockAnimationController mKeyguardUnlockAnimationController;
    private final KeyguardUnlockAnimationController mKeyguardUnlockAnimationController;
    private final AmbientState mAmbientState;
    private final AmbientState mAmbientState;
    private final PulsingGestureListener mPulsingGestureListener;
    private final PulsingGestureListener mPulsingGestureListener;
    private final NotificationInsetsController mNotificationInsetsController;


    private GestureDetector mPulsingWakeupGestureHandler;
    private GestureDetector mPulsingWakeupGestureHandler;
    private View mBrightnessMirror;
    private View mBrightnessMirror;
@@ -111,6 +113,7 @@ public class NotificationShadeWindowViewController {
            CentralSurfaces centralSurfaces,
            CentralSurfaces centralSurfaces,
            NotificationShadeWindowController controller,
            NotificationShadeWindowController controller,
            KeyguardUnlockAnimationController keyguardUnlockAnimationController,
            KeyguardUnlockAnimationController keyguardUnlockAnimationController,
            NotificationInsetsController notificationInsetsController,
            AmbientState ambientState,
            AmbientState ambientState,
            PulsingGestureListener pulsingGestureListener,
            PulsingGestureListener pulsingGestureListener,
            FeatureFlags featureFlags,
            FeatureFlags featureFlags,
@@ -134,6 +137,7 @@ public class NotificationShadeWindowViewController {
        mKeyguardUnlockAnimationController = keyguardUnlockAnimationController;
        mKeyguardUnlockAnimationController = keyguardUnlockAnimationController;
        mAmbientState = ambientState;
        mAmbientState = ambientState;
        mPulsingGestureListener = pulsingGestureListener;
        mPulsingGestureListener = pulsingGestureListener;
        mNotificationInsetsController = notificationInsetsController;


        // This view is not part of the newly inflated expanded status bar.
        // This view is not part of the newly inflated expanded status bar.
        mBrightnessMirror = mView.findViewById(R.id.brightness_mirror_container);
        mBrightnessMirror = mView.findViewById(R.id.brightness_mirror_container);
@@ -165,6 +169,7 @@ public class NotificationShadeWindowViewController {
        mPulsingWakeupGestureHandler = new GestureDetector(mView.getContext(),
        mPulsingWakeupGestureHandler = new GestureDetector(mView.getContext(),
                mPulsingGestureListener);
                mPulsingGestureListener);


        mView.setLayoutInsetsController(mNotificationInsetsController);
        mView.setInteractionEventHandler(new NotificationShadeWindowView.InteractionEventHandler() {
        mView.setInteractionEventHandler(new NotificationShadeWindowView.InteractionEventHandler() {
            @Override
            @Override
            public Boolean handleDispatchTouchEvent(MotionEvent ev) {
            public Boolean handleDispatchTouchEvent(MotionEvent ev) {
+26 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2022 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.statusbar;

import com.android.systemui.shade.NotificationShadeWindowView;

/**
 * Calculates insets for the notification shade window view.
 */
public abstract class NotificationInsetsController
        implements NotificationShadeWindowView.LayoutInsetsController {
}
Loading