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

Commit feda4df6 authored by Justin Weir's avatar Justin Weir
Browse files

Wrap NotificationShadeWindowView in a new window root view

The view will only be present when the scene_container flag is
enabled. When the flag is disabled, the view heirarchy will be
unchanged.

Fixes: 283835201
Test: used the Flipper app to verify the flag both on and off
Change-Id: I09362df88a9ec284654f58dc1d061a143c99c865
parent b9ad31a2
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2023, 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.
*/
-->

<!-- The root view of the scene window. -->
<com.android.systemui.scene.ui.view.SceneWindowRootView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:sysui="http://schemas.android.com/apk/res-auto"
    android:id="@+id/scene_window_root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <include layout="@layout/super_notification_shade"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</com.android.systemui.scene.ui.view.SceneWindowRootView>
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
<com.android.systemui.shade.NotificationShadeWindowView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:sysui="http://schemas.android.com/apk/res-auto"
    android:id="@+id/legacy_window_root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">
+7 −0
Original line number Diff line number Diff line
package com.android.systemui.scene.ui.view

import android.content.Context
import android.util.AttributeSet

/** A root view of the main SysUI window that supports scenes. */
class SceneWindowRootView(context: Context?, attrs: AttributeSet?) : WindowRootView(context, attrs)
 No newline at end of file
+8 −0
Original line number Diff line number Diff line
package com.android.systemui.scene.ui.view

import android.content.Context
import android.util.AttributeSet
import android.widget.FrameLayout

/** A view that can serve as the root of the main SysUI window.  */
open class WindowRootView(context: Context?, attrs: AttributeSet?) : FrameLayout(context, attrs)
 No newline at end of file
+20 −20
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
    private final KeyguardViewMediator mKeyguardViewMediator;
    private final KeyguardBypassController mKeyguardBypassController;
    private final AuthController mAuthController;
    private ViewGroup mNotificationShadeView;
    private ViewGroup mWindowRootView;
    private LayoutParams mLp;
    private boolean mHasTopUi;
    private boolean mHasTopUiChanged;
@@ -262,7 +262,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
        mLp.privateFlags |= PRIVATE_FLAG_BEHAVIOR_CONTROLLED;
        mLp.insetsFlags.behavior = BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE;

        mWindowManager.addView(mNotificationShadeView, mLp);
        mWindowManager.addView(mWindowRootView, mLp);

        mLpChanged.copyFrom(mLp);
        onThemeChanged();
@@ -274,13 +274,13 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
    }

    @Override
    public void setNotificationShadeView(ViewGroup view) {
        mNotificationShadeView = view;
    public void setWindowRootView(ViewGroup view) {
        mWindowRootView = view;
    }

    @Override
    public ViewGroup getNotificationShadeView() {
        return mNotificationShadeView;
    public ViewGroup getWindowRootView() {
        return mWindowRootView;
    }

    @Override
@@ -289,7 +289,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
    }

    private void setKeyguardDark(boolean dark) {
        int vis = mNotificationShadeView.getSystemUiVisibility();
        int vis = mWindowRootView.getSystemUiVisibility();
        if (dark) {
            vis = vis | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
            vis = vis | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
@@ -297,7 +297,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
            vis = vis & ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
            vis = vis & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        }
        mNotificationShadeView.setSystemUiVisibility(vis);
        mWindowRootView.setSystemUiVisibility(vis);
    }

    private void applyKeyguardFlags(NotificationShadeWindowState state) {
@@ -413,11 +413,11 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
            visible = true;
            mLogger.d("Visibility forced to be true");
        }
        if (mNotificationShadeView != null) {
        if (mWindowRootView != null) {
            if (visible) {
                mNotificationShadeView.setVisibility(View.VISIBLE);
                mWindowRootView.setVisibility(View.VISIBLE);
            } else {
                mNotificationShadeView.setVisibility(View.INVISIBLE);
                mWindowRootView.setVisibility(View.INVISIBLE);
            }
        }
    }
@@ -439,10 +439,10 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW

    private void applyFitsSystemWindows(NotificationShadeWindowState state) {
        boolean fitsSystemWindows = !state.isKeyguardShowingAndNotOccluded();
        if (mNotificationShadeView != null
                && mNotificationShadeView.getFitsSystemWindows() != fitsSystemWindows) {
            mNotificationShadeView.setFitsSystemWindows(fitsSystemWindows);
            mNotificationShadeView.requestApplyInsets();
        if (mWindowRootView != null
                && mWindowRootView.getFitsSystemWindows() != fitsSystemWindows) {
            mWindowRootView.setFitsSystemWindows(fitsSystemWindows);
            mWindowRootView.requestApplyInsets();
        }
    }

@@ -482,7 +482,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
        if (mDeferWindowLayoutParams == 0 && mLp != null && mLp.copyFrom(mLpChanged) != 0) {
            mLogger.logApplyingWindowLayoutParams(mLp);
            Trace.beginSection("updateViewLayout");
            mWindowManager.updateViewLayout(mNotificationShadeView, mLp);
            mWindowManager.updateViewLayout(mWindowRootView, mLp);
            Trace.endSection();
        }
    }
@@ -608,7 +608,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
        try {
            final IWindowSession session = WindowManagerGlobal.getWindowSession();
            session.updateTapExcludeRegion(
                    IWindow.Stub.asInterface(getNotificationShadeView().getWindowToken()),
                    IWindow.Stub.asInterface(getWindowRootView().getWindowToken()),
                    region);
        } catch (RemoteException e) {
            Log.e(TAG, "could not update the tap exclusion region:" + e);
@@ -847,8 +847,8 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
        pw.println("  mKeyguardPreferredRefreshRate=" + mKeyguardPreferredRefreshRate);
        pw.println("  mDeferWindowLayoutParams=" + mDeferWindowLayoutParams);
        pw.println(mCurrentState);
        if (mNotificationShadeView != null && mNotificationShadeView.getViewRootImpl() != null) {
            mNotificationShadeView.getViewRootImpl().dump("  ", pw);
        if (mWindowRootView != null && mWindowRootView.getViewRootImpl() != null) {
            mWindowRootView.getViewRootImpl().dump("  ", pw);
        }
        new DumpsysTableLogger(
                TAG,
@@ -864,7 +864,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW

    @Override
    public void onThemeChanged() {
        if (mNotificationShadeView == null) {
        if (mWindowRootView == null) {
            return;
        }

Loading