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

Commit 0b37e0b7 authored by Beverly's avatar Beverly
Browse files

Remove code for centering an icon in the SB

This code is no longer used.

Test: atest SystemUITests
Fixes: 196412082
Change-Id: If9933ffd17c91f8206d16fc245e42256ee80f32b
parent d7c5ca76
Loading
Loading
Loading
Loading
+0 −30
Original line number Original line 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.keyguard.AlphaOptimizedLinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/center_icon_area_inner"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:clipChildren="false">
    <com.android.systemui.statusbar.phone.NotificationIconContainer
        android:id="@+id/centeredIcon"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:orientation="horizontal"
        android:clipChildren="false"/>
</com.android.keyguard.AlphaOptimizedLinearLayout>
 No newline at end of file
+0 −8
Original line number Original line Diff line number Diff line
@@ -103,14 +103,6 @@
            android:gravity="center_horizontal|center_vertical"
            android:gravity="center_horizontal|center_vertical"
        />
        />


        <com.android.systemui.statusbar.AlphaOptimizedFrameLayout
            android:id="@+id/centered_icon_area"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="horizontal"
            android:clipChildren="false"
            android:gravity="center_horizontal|center_vertical"/>

        <com.android.keyguard.AlphaOptimizedLinearLayout android:id="@+id/system_icon_area"
        <com.android.keyguard.AlphaOptimizedLinearLayout android:id="@+id/system_icon_area"
            android:layout_width="0dp"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_height="match_parent"
+2 −12
Original line number Original line Diff line number Diff line
@@ -69,7 +69,6 @@ public class HeadsUpAppearanceController extends ViewController<HeadsUpStatusBar
    private final CommandQueue mCommandQueue;
    private final CommandQueue mCommandQueue;
    private final NotificationWakeUpCoordinator mWakeUpCoordinator;
    private final NotificationWakeUpCoordinator mWakeUpCoordinator;


    private View mCenteredIconView;
    private View mClockView;
    private View mClockView;
    private View mOperatorNameView;
    private View mOperatorNameView;


@@ -109,8 +108,7 @@ public class HeadsUpAppearanceController extends ViewController<HeadsUpStatusBar
                //  (which also removes the undesirable @VisibleForTesting).
                //  (which also removes the undesirable @VisibleForTesting).
                statusBarView.findViewById(R.id.heads_up_status_bar_view),
                statusBarView.findViewById(R.id.heads_up_status_bar_view),
                statusBarView.findViewById(R.id.clock),
                statusBarView.findViewById(R.id.clock),
                statusBarView.findViewById(R.id.operator_name_frame),
                statusBarView.findViewById(R.id.operator_name_frame));
                statusBarView.findViewById(R.id.centered_icon_area));
    }
    }


    @VisibleForTesting
    @VisibleForTesting
@@ -126,12 +124,10 @@ public class HeadsUpAppearanceController extends ViewController<HeadsUpStatusBar
            NotificationPanelViewController notificationPanelViewController,
            NotificationPanelViewController notificationPanelViewController,
            HeadsUpStatusBarView headsUpStatusBarView,
            HeadsUpStatusBarView headsUpStatusBarView,
            View clockView,
            View clockView,
            View operatorNameView,
            View operatorNameView) {
            View centeredIconView) {
        super(headsUpStatusBarView);
        super(headsUpStatusBarView);
        mNotificationIconAreaController = notificationIconAreaController;
        mNotificationIconAreaController = notificationIconAreaController;
        mHeadsUpManager = headsUpManager;
        mHeadsUpManager = headsUpManager;
        mCenteredIconView = centeredIconView;


        // We may be mid-HUN-expansion when this controller is re-created (for example, if the user
        // We may be mid-HUN-expansion when this controller is re-created (for example, if the user
        // has started pulling down the notification shade from the HUN and then the font size
        // has started pulling down the notification shade from the HUN and then the font size
@@ -236,17 +232,11 @@ public class HeadsUpAppearanceController extends ViewController<HeadsUpStatusBar
                mView.setVisibility(View.VISIBLE);
                mView.setVisibility(View.VISIBLE);
                show(mView);
                show(mView);
                hide(mClockView, View.INVISIBLE);
                hide(mClockView, View.INVISIBLE);
                if (mCenteredIconView.getVisibility() != View.GONE) {
                    hide(mCenteredIconView, View.INVISIBLE);
                }
                if (mOperatorNameView != null) {
                if (mOperatorNameView != null) {
                    hide(mOperatorNameView, View.INVISIBLE);
                    hide(mOperatorNameView, View.INVISIBLE);
                }
                }
            } else {
            } else {
                show(mClockView);
                show(mClockView);
                if (mCenteredIconView.getVisibility() != View.GONE) {
                    show(mCenteredIconView);
                }
                if (mOperatorNameView != null) {
                if (mOperatorNameView != null) {
                    show(mOperatorNameView);
                    show(mOperatorNameView);
                }
                }
+6 −81
Original line number Original line Diff line number Diff line
@@ -44,7 +44,6 @@ import com.android.wm.shell.bubbles.Bubbles;


import java.util.ArrayList;
import java.util.ArrayList;
import java.util.List;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Function;


@@ -78,16 +77,12 @@ public class NotificationIconAreaController implements
    private int mIconSize;
    private int mIconSize;
    private int mIconHPadding;
    private int mIconHPadding;
    private int mIconTint = Color.WHITE;
    private int mIconTint = Color.WHITE;
    private int mCenteredIconTint = Color.WHITE;


    private List<ListEntry> mNotificationEntries = List.of();
    private List<ListEntry> mNotificationEntries = List.of();
    protected View mNotificationIconArea;
    protected View mNotificationIconArea;
    private NotificationIconContainer mNotificationIcons;
    private NotificationIconContainer mNotificationIcons;
    private NotificationIconContainer mShelfIcons;
    private NotificationIconContainer mShelfIcons;
    protected View mCenteredIconArea;
    private NotificationIconContainer mCenteredIcon;
    private NotificationIconContainer mAodIcons;
    private NotificationIconContainer mAodIcons;
    private StatusBarIconView mCenteredIconView;
    private final Rect mTintArea = new Rect();
    private final Rect mTintArea = new Rect();
    private Context mContext;
    private Context mContext;


@@ -159,8 +154,6 @@ public class NotificationIconAreaController implements
        mNotificationIconArea = inflateIconArea(layoutInflater);
        mNotificationIconArea = inflateIconArea(layoutInflater);
        mNotificationIcons = mNotificationIconArea.findViewById(R.id.notificationIcons);
        mNotificationIcons = mNotificationIconArea.findViewById(R.id.notificationIcons);


        mCenteredIconArea = layoutInflater.inflate(R.layout.center_icon_area, null);
        mCenteredIcon = mCenteredIconArea.findViewById(R.id.centeredIcon);
    }
    }


    /**
    /**
@@ -208,10 +201,6 @@ public class NotificationIconAreaController implements
            View child = mNotificationIcons.getChildAt(i);
            View child = mNotificationIcons.getChildAt(i);
            child.setLayoutParams(params);
            child.setLayoutParams(params);
        }
        }
        for (int i = 0; i < mCenteredIcon.getChildCount(); i++) {
            View child = mCenteredIcon.getChildAt(i);
            child.setLayoutParams(params);
        }
        if (mShelfIcons != null) {
        if (mShelfIcons != null) {
            for (int i = 0; i < mShelfIcons.getChildCount(); i++) {
            for (int i = 0; i < mShelfIcons.getChildCount(); i++) {
                View child = mShelfIcons.getChildAt(i);
                View child = mShelfIcons.getChildAt(i);
@@ -247,13 +236,6 @@ public class NotificationIconAreaController implements
        return mNotificationIconArea;
        return mNotificationIconArea;
    }
    }


    /**
     * Returns the view that represents the centered notification area.
     */
    public View getCenteredNotificationAreaView() {
        return mCenteredIconArea;
    }

    /**
    /**
     * See {@link com.android.systemui.statusbar.policy.DarkIconDispatcher#setIconsDarkArea}.
     * See {@link com.android.systemui.statusbar.policy.DarkIconDispatcher#setIconsDarkArea}.
     * Sets the color that should be used to tint any icons in the notification area.
     * Sets the color that should be used to tint any icons in the notification area.
@@ -272,27 +254,12 @@ public class NotificationIconAreaController implements
            mIconTint = iconTint;
            mIconTint = iconTint;
        }
        }


        if (DarkIconDispatcher.isInArea(tintArea, mCenteredIconArea)) {
            mCenteredIconTint = iconTint;
        }

        applyNotificationIconsTint();
        applyNotificationIconsTint();
    }
    }


    protected boolean shouldShowNotificationIcon(NotificationEntry entry,
    protected boolean shouldShowNotificationIcon(NotificationEntry entry,
            boolean showAmbient, boolean showLowPriority, boolean hideDismissed,
            boolean showAmbient, boolean showLowPriority, boolean hideDismissed,
            boolean hideRepliedMessages, boolean hideCurrentMedia, boolean hideCenteredIcon,
            boolean hideRepliedMessages, boolean hideCurrentMedia, boolean hidePulsing) {
            boolean hidePulsing, boolean onlyShowCenteredIcon) {

        final boolean isCenteredNotificationIcon = mCenteredIconView != null
                && entry.getIcons().getCenteredIcon() != null
                && Objects.equals(entry.getIcons().getCenteredIcon(), mCenteredIconView);
        if (onlyShowCenteredIcon) {
            return isCenteredNotificationIcon;
        }
        if (hideCenteredIcon && isCenteredNotificationIcon && !entry.isRowHeadsUp()) {
            return false;
        }
        if (entry.getRanking().isAmbient() && !showAmbient) {
        if (entry.getRanking().isAmbient() && !showAmbient) {
            return false;
            return false;
        }
        }
@@ -341,7 +308,6 @@ public class NotificationIconAreaController implements
        Trace.beginSection("NotificationIconAreaController.updateNotificationIcons");
        Trace.beginSection("NotificationIconAreaController.updateNotificationIcons");
        updateStatusBarIcons();
        updateStatusBarIcons();
        updateShelfIcons();
        updateShelfIcons();
        updateCenterIcon();
        updateAodNotificationIcons();
        updateAodNotificationIcons();


        applyNotificationIconsTint();
        applyNotificationIconsTint();
@@ -358,9 +324,7 @@ public class NotificationIconAreaController implements
                false /* hideDismissed */,
                false /* hideDismissed */,
                false /* hideRepliedMessages */,
                false /* hideRepliedMessages */,
                false /* hideCurrentMedia */,
                false /* hideCurrentMedia */,
                false /* hide centered icon */,
                false /* hidePulsing */);
                false /* hidePulsing */,
                false /* onlyShowCenteredIcon */);
    }
    }


    public void updateStatusBarIcons() {
    public void updateStatusBarIcons() {
@@ -370,21 +334,7 @@ public class NotificationIconAreaController implements
                true /* hideDismissed */,
                true /* hideDismissed */,
                true /* hideRepliedMessages */,
                true /* hideRepliedMessages */,
                false /* hideCurrentMedia */,
                false /* hideCurrentMedia */,
                true /* hide centered icon */,
                false /* hidePulsing */);
                false /* hidePulsing */,
                false /* onlyShowCenteredIcon */);
    }

    private void updateCenterIcon() {
        updateIconsForLayout(entry -> entry.getIcons().getCenteredIcon(), mCenteredIcon,
                false /* showAmbient */,
                true /* showLowPriority */,
                false /* hideDismissed */,
                false /* hideRepliedMessages */,
                false /* hideCurrentMedia */,
                false /* hide centered icon */,
                false /* hidePulsing */,
                true/* onlyShowCenteredIcon */);
    }
    }


    public void updateAodNotificationIcons() {
    public void updateAodNotificationIcons() {
@@ -397,9 +347,7 @@ public class NotificationIconAreaController implements
                true /* hideDismissed */,
                true /* hideDismissed */,
                true /* hideRepliedMessages */,
                true /* hideRepliedMessages */,
                true /* hideCurrentMedia */,
                true /* hideCurrentMedia */,
                true /* hide centered icon */,
                mBypassController.getBypassEnabled() /* hidePulsing */);
                mBypassController.getBypassEnabled() /* hidePulsing */,
                false /* onlyShowCenteredIcon */);
    }
    }


    @VisibleForTesting
    @VisibleForTesting
@@ -421,15 +369,14 @@ public class NotificationIconAreaController implements
    private void updateIconsForLayout(Function<NotificationEntry, StatusBarIconView> function,
    private void updateIconsForLayout(Function<NotificationEntry, StatusBarIconView> function,
            NotificationIconContainer hostLayout, boolean showAmbient, boolean showLowPriority,
            NotificationIconContainer hostLayout, boolean showAmbient, boolean showLowPriority,
            boolean hideDismissed, boolean hideRepliedMessages, boolean hideCurrentMedia,
            boolean hideDismissed, boolean hideRepliedMessages, boolean hideCurrentMedia,
            boolean hideCenteredIcon, boolean hidePulsing, boolean onlyShowCenteredIcon) {
            boolean hidePulsing) {
        ArrayList<StatusBarIconView> toShow = new ArrayList<>(mNotificationEntries.size());
        ArrayList<StatusBarIconView> toShow = new ArrayList<>(mNotificationEntries.size());
        // Filter out ambient notifications and notification children.
        // Filter out ambient notifications and notification children.
        for (int i = 0; i < mNotificationEntries.size(); i++) {
        for (int i = 0; i < mNotificationEntries.size(); i++) {
            NotificationEntry entry = mNotificationEntries.get(i).getRepresentativeEntry();
            NotificationEntry entry = mNotificationEntries.get(i).getRepresentativeEntry();
            if (entry != null && entry.getRow() != null) {
            if (entry != null && entry.getRow() != null) {
                if (shouldShowNotificationIcon(entry, showAmbient, showLowPriority, hideDismissed,
                if (shouldShowNotificationIcon(entry, showAmbient, showLowPriority, hideDismissed,
                        hideRepliedMessages, hideCurrentMedia, hideCenteredIcon, hidePulsing,
                        hideRepliedMessages, hideCurrentMedia, hidePulsing)) {
                        onlyShowCenteredIcon)) {
                    StatusBarIconView iconView = function.apply(entry);
                    StatusBarIconView iconView = function.apply(entry);
                    if (iconView != null) {
                    if (iconView != null) {
                        toShow.add(iconView);
                        toShow.add(iconView);
@@ -523,7 +470,6 @@ public class NotificationIconAreaController implements


    /**
    /**
     * Applies {@link #mIconTint} to the notification icons.
     * Applies {@link #mIconTint} to the notification icons.
     * Applies {@link #mCenteredIconTint} to the center notification icon.
     */
     */
    private void applyNotificationIconsTint() {
    private void applyNotificationIconsTint() {
        for (int i = 0; i < mNotificationIcons.getChildCount(); i++) {
        for (int i = 0; i < mNotificationIcons.getChildCount(); i++) {
@@ -535,15 +481,6 @@ public class NotificationIconAreaController implements
            }
            }
        }
        }


        for (int i = 0; i < mCenteredIcon.getChildCount(); i++) {
            final StatusBarIconView iv = (StatusBarIconView) mCenteredIcon.getChildAt(i);
            if (iv.getWidth() != 0) {
                updateTintForIcon(iv, mCenteredIconTint);
            } else {
                iv.executeOnLayout(() -> updateTintForIcon(iv, mCenteredIconTint));
            }
        }

        updateAodIconColors();
        updateAodIconColors();
    }
    }


@@ -558,17 +495,6 @@ public class NotificationIconAreaController implements
        v.setDecorColor(tint);
        v.setDecorColor(tint);
    }
    }


    /**
     * Shows the icon view given in the center.
     */
    public void showIconCentered(NotificationEntry entry) {
        StatusBarIconView icon = entry == null ? null : entry.getIcons().getCenteredIcon();
        if (!Objects.equals(mCenteredIconView, icon)) {
            mCenteredIconView = icon;
            updateNotificationIcons();
        }
    }

    public void showIconIsolated(StatusBarIconView icon, boolean animated) {
    public void showIconIsolated(StatusBarIconView icon, boolean animated) {
        mNotificationIcons.showIconIsolated(icon, animated);
        mNotificationIcons.showIconIsolated(icon, animated);
    }
    }
@@ -603,7 +529,6 @@ public class NotificationIconAreaController implements
        if (mAodIcons != null) {
        if (mAodIcons != null) {
            mAodIcons.setAnimationsEnabled(mAnimationsEnabled && !inShade);
            mAodIcons.setAnimationsEnabled(mAnimationsEnabled && !inShade);
        }
        }
        mCenteredIcon.setAnimationsEnabled(mAnimationsEnabled && inShade);
        mNotificationIcons.setAnimationsEnabled(mAnimationsEnabled && inShade);
        mNotificationIcons.setAnimationsEnabled(mAnimationsEnabled && inShade);
    }
    }


+0 −5
Original line number Original line Diff line number Diff line
@@ -50,8 +50,6 @@ public class PhoneStatusBarView extends FrameLayout {
    private DarkReceiver mClock;
    private DarkReceiver mClock;
    private int mRotationOrientation = -1;
    private int mRotationOrientation = -1;
    @Nullable
    @Nullable
    private View mCenterIconSpace;
    @Nullable
    private View mCutoutSpace;
    private View mCutoutSpace;
    @Nullable
    @Nullable
    private DisplayCutout mDisplayCutout;
    private DisplayCutout mDisplayCutout;
@@ -79,7 +77,6 @@ public class PhoneStatusBarView extends FrameLayout {
        mBattery = findViewById(R.id.battery);
        mBattery = findViewById(R.id.battery);
        mClock = findViewById(R.id.clock);
        mClock = findViewById(R.id.clock);
        mCutoutSpace = findViewById(R.id.cutout_space_view);
        mCutoutSpace = findViewById(R.id.cutout_space_view);
        mCenterIconSpace = findViewById(R.id.centered_icon_area);


        updateResources();
        updateResources();
    }
    }
@@ -228,12 +225,10 @@ public class PhoneStatusBarView extends FrameLayout {


        boolean hasCornerCutout = mContentInsetsProvider.currentRotationHasCornerCutout();
        boolean hasCornerCutout = mContentInsetsProvider.currentRotationHasCornerCutout();
        if (mDisplayCutout == null || mDisplayCutout.isEmpty() || hasCornerCutout) {
        if (mDisplayCutout == null || mDisplayCutout.isEmpty() || hasCornerCutout) {
            mCenterIconSpace.setVisibility(View.VISIBLE);
            mCutoutSpace.setVisibility(View.GONE);
            mCutoutSpace.setVisibility(View.GONE);
            return;
            return;
        }
        }


        mCenterIconSpace.setVisibility(View.GONE);
        mCutoutSpace.setVisibility(View.VISIBLE);
        mCutoutSpace.setVisibility(View.VISIBLE);
        LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mCutoutSpace.getLayoutParams();
        LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mCutoutSpace.getLayoutParams();


Loading