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

Commit f8b573a8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add PeopleHub to the notification shade"

parents 4465222d 58adc21f
Loading
Loading
Loading
Loading
+240 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2019 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.notification.stack.PeopleHubView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="105dp">

    <com.android.systemui.statusbar.notification.row.NotificationBackgroundView
        android:id="@+id/backgroundNormal"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <com.android.systemui.statusbar.notification.row.NotificationBackgroundView
        android:id="@+id/backgroundDimmed"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <LinearLayout
        android:id="@+id/people_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:paddingTop="8dp"
        android:paddingBottom="8dp"
        android:gravity="center"
        android:orientation="horizontal">

        <View
            android:layout_width="8dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
        />

        <LinearLayout
            android:layout_width="70dp"
            android:layout_height="match_parent"
            android:gravity="center"
            android:orientation="vertical"
            android:visibility="invisible">

            <ImageView
                android:id="@+id/person_icon"
                android:layout_width="36dp"
                android:layout_height="36dp"
                android:scaleType="fitCenter"
            />

            <TextView
                android:id="@+id/person_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingTop="8dp"
                android:ellipsize="end"
                android:maxLines="2"
                android:textAlignment="center"
            />

        </LinearLayout>

        <View
            android:layout_width="8dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
        />

        <View
            android:layout_width="8dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
        />

        <LinearLayout
            android:layout_width="70dp"
            android:layout_height="match_parent"
            android:gravity="center"
            android:orientation="vertical"
            android:visibility="invisible">

            <ImageView
                android:id="@+id/person_icon"
                android:layout_width="36dp"
                android:layout_height="36dp"
                android:scaleType="fitCenter"
            />

            <TextView
                android:id="@+id/person_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingTop="8dp"
                android:ellipsize="end"
                android:maxLines="2"
                android:textAlignment="center"
            />

        </LinearLayout>

        <View
            android:layout_width="8dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
        />

        <View
            android:layout_width="8dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
        />

        <LinearLayout
            android:layout_width="70dp"
            android:layout_height="match_parent"
            android:gravity="center"
            android:orientation="vertical"
            android:visibility="invisible">

            <ImageView
                android:id="@+id/person_icon"
                android:layout_width="36dp"
                android:layout_height="36dp"
                android:scaleType="fitCenter"
            />

            <TextView
                android:id="@+id/person_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingTop="8dp"
                android:ellipsize="end"
                android:maxLines="2"
                android:textAlignment="center"
            />

        </LinearLayout>

        <View
            android:layout_width="8dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
        />

        <View
            android:layout_width="8dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
        />

        <LinearLayout
            android:layout_width="70dp"
            android:layout_height="match_parent"
            android:gravity="center"
            android:orientation="vertical"
            android:visibility="invisible">

            <ImageView
                android:id="@+id/person_icon"
                android:layout_width="36dp"
                android:layout_height="36dp"
                android:scaleType="fitCenter"
            />

            <TextView
                android:id="@+id/person_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingTop="8dp"
                android:ellipsize="end"
                android:maxLines="2"
                android:textAlignment="center"
            />

        </LinearLayout>

        <View
            android:layout_width="8dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
        />

        <View
            android:layout_width="8dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
        />

        <LinearLayout
            android:layout_width="70dp"
            android:layout_height="match_parent"
            android:gravity="center"
            android:orientation="vertical"
            android:visibility="invisible">

            <ImageView
                android:id="@+id/person_icon"
                android:layout_width="36dp"
                android:layout_height="36dp"
                android:scaleType="fitCenter"
            />

            <TextView
                android:id="@+id/person_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingTop="8dp"
                android:ellipsize="end"
                android:maxLines="2"
                android:textAlignment="center"
            />

        </LinearLayout>

        <View
            android:layout_width="8dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
        />

    </LinearLayout>

    <com.android.systemui.statusbar.notification.FakeShadowView
        android:id="@+id/fake_shadow"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</com.android.systemui.statusbar.notification.stack.PeopleHubView>
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.content.pm.PackageManager;
import com.android.systemui.assist.AssistModule;
import com.android.systemui.model.SysUiState;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.notification.people.PeopleHubModule;
import com.android.systemui.statusbar.phone.KeyguardLiftController;
import com.android.systemui.util.sensors.AsyncSensorManager;

@@ -35,7 +36,7 @@ import dagger.Provides;
 * A dagger module for injecting components of System UI that are not overridden by the System UI
 * implementation.
 */
@Module(includes = {AssistModule.class, ComponentBinder.class})
@Module(includes = {AssistModule.class, ComponentBinder.class, PeopleHubModule.class})
public abstract class SystemUIModule {

    @Singleton
+3 −1
Original line number Diff line number Diff line
@@ -126,7 +126,9 @@ public class NotificationEntryManager implements
    }

    @Inject
    public NotificationEntryManager(NotificationData notificationData, NotifLog notifLog) {
    public NotificationEntryManager(
            NotificationData notificationData,
            NotifLog notifLog) {
        mNotificationData = notificationData;
        mNotifLog = notifLog;
    }
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ class NotificationSectionsFeatureManager @Inject constructor(
private fun usePeopleFiltering(proxy: DeviceConfigProxy): Boolean {
    if (sUsePeopleFiltering == null) {
        sUsePeopleFiltering = proxy.getBoolean(
                DeviceConfig.NAMESPACE_SYSTEMUI, NOTIFICATIONS_USE_PEOPLE_FILTERING, false)
                DeviceConfig.NAMESPACE_SYSTEMUI, NOTIFICATIONS_USE_PEOPLE_FILTERING, true)
    }

    return sUsePeopleFiltering!!
+11 −3
Original line number Diff line number Diff line
@@ -98,6 +98,9 @@ public class NotificationData {
            int aRank = getRank(a.getKey());
            int bRank = getRank(b.getKey());

            boolean aPeople = isPeopleNotification(a);
            boolean bPeople = isPeopleNotification(b);

            boolean aMedia = isImportantMedia(a);
            boolean bMedia = isImportantMedia(b);

@@ -107,8 +110,8 @@ public class NotificationData {
            boolean aHeadsUp = a.isRowHeadsUp();
            boolean bHeadsUp = b.isRowHeadsUp();

            if (mUsePeopleFiltering && a.hasAssociatedPeople() != b.hasAssociatedPeople()) {
                return a.hasAssociatedPeople() ? -1 : 1;
            if (mUsePeopleFiltering && aPeople != bPeople) {
                return aPeople ? -1 : 1;
            } else if (aHeadsUp != bHeadsUp) {
                return aHeadsUp ? -1 : 1;
            } else if (aHeadsUp) {
@@ -447,7 +450,7 @@ public class NotificationData {
            boolean isHeadsUp,
            boolean isMedia,
            boolean isSystemMax) {
        if (mUsePeopleFiltering && e.hasAssociatedPeople()) {
        if (mUsePeopleFiltering && isPeopleNotification(e)) {
            e.setBucket(BUCKET_PEOPLE);
        } else if (isHeadsUp || isMedia || isSystemMax || e.isHighPriority()) {
            e.setBucket(BUCKET_ALERTING);
@@ -456,6 +459,11 @@ public class NotificationData {
        }
    }

    private boolean isPeopleNotification(NotificationEntry e) {
        return e.getSbn().getNotification().getNotificationStyle()
                == Notification.MessagingStyle.class;
    }

    public void dump(PrintWriter pw, String indent) {
        int filteredLen = mSortedAndFiltered.size();
        pw.print(indent);
Loading