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

Commit aa9db1f3 authored by Selim Cinek's avatar Selim Cinek
Browse files

Insetting heads up notifications

Heads up notifications are now corretly respecting insets.
instead of overlapping with any possible notches, we're
insetting heads up notifications and splitting the main
content from the header.

Fixes: 72748440
Test: runtest systemui
Change-Id: Ie53ea31fef4e468239c4346f9d1f192bcb26e11d
parent 29aab967
Loading
Loading
Loading
Loading
+45 −0
Original line number Diff line number Diff line
@@ -5577,6 +5577,24 @@ public class Notification implements Parcelable
        public void setRebuildStyledRemoteViews(boolean rebuild) {
            mRebuildStyledRemoteViews = rebuild;
        }

        /**
         * Get the text that should be displayed in the statusBar when heads upped. This is
         * usually just the app name, but may be different depending on the style.
         *
         * @param publicMode If true, return a text that is safe to display in public.
         *
         * @hide
         */
        public CharSequence getHeadsUpStatusBarText(boolean publicMode) {
            if (mStyle != null && !publicMode) {
                CharSequence text = mStyle.getHeadsUpStatusBarText();
                if (!TextUtils.isEmpty(text)) {
                    return text;
                }
            }
            return loadHeaderAppName();
        }
    }

    /**
@@ -5954,6 +5972,16 @@ public class Notification implements Parcelable
         * @hide
         */
        public abstract boolean areNotificationsVisiblyDifferent(Style other);
        
        /**
         * @return the the text that should be displayed in the statusBar when heads-upped.
         * If {@code null} is returned, the default implementation will be used.
         *
         * @hide
         */
        public CharSequence getHeadsUpStatusBarText() {
            return null;
        }
    }

    /**
@@ -6402,6 +6430,23 @@ public class Notification implements Parcelable
            }
        }

        /**
         * @return the the text that should be displayed in the statusBar when heads upped.
         * If {@code null} is returned, the default implementation will be used.
         *
         * @hide
         */
        @Override
        public CharSequence getHeadsUpStatusBarText() {
            CharSequence conversationTitle = !TextUtils.isEmpty(super.mBigContentTitle)
                    ? super.mBigContentTitle
                    : mConversationTitle;
            if (!TextUtils.isEmpty(conversationTitle) && !hasOnlyWhiteSpaceSenders()) {
                return conversationTitle;
            }
            return null;
        }

        /**
         * @return the user to be displayed for any replies sent by the user
         */
+1 −0
Original line number Diff line number Diff line
@@ -3232,6 +3232,7 @@
  <java-symbol type="id" name="remote_input_progress" />
  <java-symbol type="id" name="remote_input_send" />
  <java-symbol type="id" name="remote_input" />
  <java-symbol type="dimen" name="notification_content_margin" />
  <java-symbol type="dimen" name="slice_shortcut_size" />
  <java-symbol type="dimen" name="slice_icon_size" />
  <java-symbol type="dimen" name="slice_padding" />
+47 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2018 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
  -->
<com.android.systemui.statusbar.HeadsUpStatusBarView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:visibility="invisible"
    android:id="@+id/heads_up_status_bar_view"
>
    <!-- This is a space just used as a layout and it's not actually displaying anything. We're
         repositioning the statusbar icon to the position where this is laid out when showing this
         view. -->
    <Space
        android:id="@+id/icon_placeholder"
        android:layout_width="@dimen/status_bar_icon_drawing_size"
        android:layout_height="@dimen/status_bar_icon_drawing_size"
        android:layout_gravity="center_vertical"
    />
    <TextView
        android:id="@+id/text"
        android:textAppearance="@style/TextAppearance.HeadsUpStatusBarText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:singleLine="true"
        android:ellipsize="marquee"
        android:fadingEdge="horizontal"
        android:textAlignment="viewStart"
        android:paddingStart="6dp"
        android:layout_weight="1"
        android:layout_gravity="center_vertical"
    />

</com.android.systemui.statusbar.HeadsUpStatusBarView>
+4 −2
Original line number Diff line number Diff line
@@ -18,12 +18,14 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/notification_icon_area_inner"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    android:layout_height="match_parent"
    android:clipChildren="false">
    <com.android.systemui.statusbar.phone.NotificationIconContainer
        android:id="@+id/notificationIcons"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentStart="true"
        android:gravity="center_vertical"
        android:orientation="horizontal"/>
        android:orientation="horizontal"
        android:clipChildren="false"/>
</com.android.keyguard.AlphaOptimizedLinearLayout>
 No newline at end of file
+40 −32
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@
        android:id="@+id/notification_lights_out"
        android:layout_width="@dimen/status_bar_icon_size"
        android:layout_height="match_parent"
        android:paddingStart="6dip"
        android:paddingStart="@dimen/status_bar_padding_start"
        android:paddingBottom="2dip"
        android:src="@drawable/ic_sysbar_lights_out_dot_small"
        android:scaleType="center"
@@ -44,7 +44,7 @@
    <LinearLayout android:id="@+id/status_bar_contents"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingStart="6dp"
        android:paddingStart="@dimen/status_bar_padding_start"
        android:paddingEnd="8dp"
        android:orientation="horizontal"
        >
@@ -53,11 +53,17 @@
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout="@layout/operator_name" />
        <FrameLayout
            android:layout_height="match_parent"
            android:layout_width="0dp"
            android:layout_weight="1">

            <include layout="@layout/heads_up_status_bar_layout" />

            <LinearLayout
                android:layout_height="match_parent"
            android:layout_width="0dp"
            android:layout_weight="1"
                android:layout_width="match_parent"
                android:clipChildren="false"
            >
                <com.android.systemui.statusbar.policy.Clock
                    android:id="@+id/clock"
@@ -77,9 +83,11 @@
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                android:orientation="horizontal" />
                    android:orientation="horizontal"
                    android:clipChildren="false"/>

            </LinearLayout>
        </FrameLayout>

        <!-- Space should cover the notch (if it exists) and let other views lay out around it -->
        <android.widget.Space
Loading