Remove code for centering an icon in the SB

This code is no longer used.

Test: atest SystemUITests
Fixes: 196412082
Change-Id: If9933ffd17c91f8206d16fc245e42256ee80f32b
This commit is contained in:
Beverly
2022-02-04 20:34:26 +00:00
parent d7c5ca769d
commit 0b37e0b752
8 changed files with 9 additions and 156 deletions

View File

@@ -1,30 +0,0 @@
<?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>

View File

@@ -103,14 +103,6 @@
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"
android:layout_width="0dp"
android:layout_height="match_parent"

View File

@@ -69,7 +69,6 @@ public class HeadsUpAppearanceController extends ViewController<HeadsUpStatusBar
private final CommandQueue mCommandQueue;
private final NotificationWakeUpCoordinator mWakeUpCoordinator;
private View mCenteredIconView;
private View mClockView;
private View mOperatorNameView;
@@ -109,8 +108,7 @@ public class HeadsUpAppearanceController extends ViewController<HeadsUpStatusBar
// (which also removes the undesirable @VisibleForTesting).
statusBarView.findViewById(R.id.heads_up_status_bar_view),
statusBarView.findViewById(R.id.clock),
statusBarView.findViewById(R.id.operator_name_frame),
statusBarView.findViewById(R.id.centered_icon_area));
statusBarView.findViewById(R.id.operator_name_frame));
}
@VisibleForTesting
@@ -126,12 +124,10 @@ public class HeadsUpAppearanceController extends ViewController<HeadsUpStatusBar
NotificationPanelViewController notificationPanelViewController,
HeadsUpStatusBarView headsUpStatusBarView,
View clockView,
View operatorNameView,
View centeredIconView) {
View operatorNameView) {
super(headsUpStatusBarView);
mNotificationIconAreaController = notificationIconAreaController;
mHeadsUpManager = headsUpManager;
mCenteredIconView = centeredIconView;
// 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
@@ -236,17 +232,11 @@ public class HeadsUpAppearanceController extends ViewController<HeadsUpStatusBar
mView.setVisibility(View.VISIBLE);
show(mView);
hide(mClockView, View.INVISIBLE);
if (mCenteredIconView.getVisibility() != View.GONE) {
hide(mCenteredIconView, View.INVISIBLE);
}
if (mOperatorNameView != null) {
hide(mOperatorNameView, View.INVISIBLE);
}
} else {
show(mClockView);
if (mCenteredIconView.getVisibility() != View.GONE) {
show(mCenteredIconView);
}
if (mOperatorNameView != null) {
show(mOperatorNameView);
}

View File

@@ -44,7 +44,6 @@ import com.android.wm.shell.bubbles.Bubbles;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;
@@ -78,16 +77,12 @@ public class NotificationIconAreaController implements
private int mIconSize;
private int mIconHPadding;
private int mIconTint = Color.WHITE;
private int mCenteredIconTint = Color.WHITE;
private List<ListEntry> mNotificationEntries = List.of();
protected View mNotificationIconArea;
private NotificationIconContainer mNotificationIcons;
private NotificationIconContainer mShelfIcons;
protected View mCenteredIconArea;
private NotificationIconContainer mCenteredIcon;
private NotificationIconContainer mAodIcons;
private StatusBarIconView mCenteredIconView;
private final Rect mTintArea = new Rect();
private Context mContext;
@@ -159,8 +154,6 @@ public class NotificationIconAreaController implements
mNotificationIconArea = inflateIconArea(layoutInflater);
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);
child.setLayoutParams(params);
}
for (int i = 0; i < mCenteredIcon.getChildCount(); i++) {
View child = mCenteredIcon.getChildAt(i);
child.setLayoutParams(params);
}
if (mShelfIcons != null) {
for (int i = 0; i < mShelfIcons.getChildCount(); i++) {
View child = mShelfIcons.getChildAt(i);
@@ -247,13 +236,6 @@ public class NotificationIconAreaController implements
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}.
* 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;
}
if (DarkIconDispatcher.isInArea(tintArea, mCenteredIconArea)) {
mCenteredIconTint = iconTint;
}
applyNotificationIconsTint();
}
protected boolean shouldShowNotificationIcon(NotificationEntry entry,
boolean showAmbient, boolean showLowPriority, boolean hideDismissed,
boolean hideRepliedMessages, boolean hideCurrentMedia, boolean hideCenteredIcon,
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;
}
boolean hideRepliedMessages, boolean hideCurrentMedia, boolean hidePulsing) {
if (entry.getRanking().isAmbient() && !showAmbient) {
return false;
}
@@ -341,7 +308,6 @@ public class NotificationIconAreaController implements
Trace.beginSection("NotificationIconAreaController.updateNotificationIcons");
updateStatusBarIcons();
updateShelfIcons();
updateCenterIcon();
updateAodNotificationIcons();
applyNotificationIconsTint();
@@ -358,9 +324,7 @@ public class NotificationIconAreaController implements
false /* hideDismissed */,
false /* hideRepliedMessages */,
false /* hideCurrentMedia */,
false /* hide centered icon */,
false /* hidePulsing */,
false /* onlyShowCenteredIcon */);
false /* hidePulsing */);
}
public void updateStatusBarIcons() {
@@ -370,21 +334,7 @@ public class NotificationIconAreaController implements
true /* hideDismissed */,
true /* hideRepliedMessages */,
false /* hideCurrentMedia */,
true /* hide centered icon */,
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 */);
false /* hidePulsing */);
}
public void updateAodNotificationIcons() {
@@ -397,9 +347,7 @@ public class NotificationIconAreaController implements
true /* hideDismissed */,
true /* hideRepliedMessages */,
true /* hideCurrentMedia */,
true /* hide centered icon */,
mBypassController.getBypassEnabled() /* hidePulsing */,
false /* onlyShowCenteredIcon */);
mBypassController.getBypassEnabled() /* hidePulsing */);
}
@VisibleForTesting
@@ -421,15 +369,14 @@ public class NotificationIconAreaController implements
private void updateIconsForLayout(Function<NotificationEntry, StatusBarIconView> function,
NotificationIconContainer hostLayout, boolean showAmbient, boolean showLowPriority,
boolean hideDismissed, boolean hideRepliedMessages, boolean hideCurrentMedia,
boolean hideCenteredIcon, boolean hidePulsing, boolean onlyShowCenteredIcon) {
boolean hidePulsing) {
ArrayList<StatusBarIconView> toShow = new ArrayList<>(mNotificationEntries.size());
// Filter out ambient notifications and notification children.
for (int i = 0; i < mNotificationEntries.size(); i++) {
NotificationEntry entry = mNotificationEntries.get(i).getRepresentativeEntry();
if (entry != null && entry.getRow() != null) {
if (shouldShowNotificationIcon(entry, showAmbient, showLowPriority, hideDismissed,
hideRepliedMessages, hideCurrentMedia, hideCenteredIcon, hidePulsing,
onlyShowCenteredIcon)) {
hideRepliedMessages, hideCurrentMedia, hidePulsing)) {
StatusBarIconView iconView = function.apply(entry);
if (iconView != null) {
toShow.add(iconView);
@@ -523,7 +470,6 @@ public class NotificationIconAreaController implements
/**
* Applies {@link #mIconTint} to the notification icons.
* Applies {@link #mCenteredIconTint} to the center notification icon.
*/
private void applyNotificationIconsTint() {
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();
}
@@ -558,17 +495,6 @@ public class NotificationIconAreaController implements
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) {
mNotificationIcons.showIconIsolated(icon, animated);
}
@@ -603,7 +529,6 @@ public class NotificationIconAreaController implements
if (mAodIcons != null) {
mAodIcons.setAnimationsEnabled(mAnimationsEnabled && !inShade);
}
mCenteredIcon.setAnimationsEnabled(mAnimationsEnabled && inShade);
mNotificationIcons.setAnimationsEnabled(mAnimationsEnabled && inShade);
}

View File

@@ -50,8 +50,6 @@ public class PhoneStatusBarView extends FrameLayout {
private DarkReceiver mClock;
private int mRotationOrientation = -1;
@Nullable
private View mCenterIconSpace;
@Nullable
private View mCutoutSpace;
@Nullable
private DisplayCutout mDisplayCutout;
@@ -79,7 +77,6 @@ public class PhoneStatusBarView extends FrameLayout {
mBattery = findViewById(R.id.battery);
mClock = findViewById(R.id.clock);
mCutoutSpace = findViewById(R.id.cutout_space_view);
mCenterIconSpace = findViewById(R.id.centered_icon_area);
updateResources();
}
@@ -228,12 +225,10 @@ public class PhoneStatusBarView extends FrameLayout {
boolean hasCornerCutout = mContentInsetsProvider.currentRotationHasCornerCutout();
if (mDisplayCutout == null || mDisplayCutout.isEmpty() || hasCornerCutout) {
mCenterIconSpace.setVisibility(View.VISIBLE);
mCutoutSpace.setVisibility(View.GONE);
return;
}
mCenterIconSpace.setVisibility(View.GONE);
mCutoutSpace.setVisibility(View.VISIBLE);
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mCutoutSpace.getLayoutParams();

View File

@@ -95,7 +95,6 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
private View mClockView;
private View mOngoingCallChip;
private View mNotificationIconAreaInner;
private View mCenteredIconArea;
private int mDisabled1;
private int mDisabled2;
private DarkIconManager mDarkIconManager;
@@ -249,14 +248,6 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
}
notificationIconArea.addView(mNotificationIconAreaInner);
ViewGroup statusBarCenteredIconArea = mStatusBar.findViewById(R.id.centered_icon_area);
mCenteredIconArea = mNotificationIconAreaController.getCenteredNotificationAreaView();
if (mCenteredIconArea.getParent() != null) {
((ViewGroup) mCenteredIconArea.getParent())
.removeView(mCenteredIconArea);
}
statusBarCenteredIconArea.addView(mCenteredIconArea);
// #disable should have already been called, so use the disable values to set visibility.
updateNotificationIconAreaAndCallChip(mDisabled1, false);
}
@@ -441,12 +432,10 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
public void hideNotificationIconArea(boolean animate) {
animateHide(mNotificationIconAreaInner, animate);
animateHide(mCenteredIconArea, animate);
}
public void showNotificationIconArea(boolean animate) {
animateShow(mNotificationIconAreaInner, animate);
animateShow(mCenteredIconArea, animate);
}
public void hideOperatorName(boolean animate) {

View File

@@ -98,8 +98,7 @@ public class HeadsUpAppearanceControllerTest extends SysuiTestCase {
mPanelView,
mHeadsUpStatusBarView,
new View(mContext),
mOperatorNameView,
new View(mContext));
mOperatorNameView);
mHeadsUpAppearanceController.setAppearFraction(0.0f, 0.0f);
}
@@ -180,7 +179,6 @@ public class HeadsUpAppearanceControllerTest extends SysuiTestCase {
mPanelView,
mHeadsUpStatusBarView,
new View(mContext),
new View(mContext),
new View(mContext));
Assert.assertEquals(expandedHeight, newController.mExpandedHeight, 0.0f);

View File

@@ -348,17 +348,11 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest {
mMockNotificationAreaController = mock(NotificationIconAreaController.class);
mNotificationAreaInner = mock(View.class);
View centeredNotificationAreaView = mock(View.class);
when(mNotificationAreaInner.getLayoutParams()).thenReturn(
new FrameLayout.LayoutParams(100, 100));
when(centeredNotificationAreaView.getLayoutParams()).thenReturn(
new FrameLayout.LayoutParams(100, 100));
when(mNotificationAreaInner.animate()).thenReturn(mock(ViewPropertyAnimator.class));
when(centeredNotificationAreaView.animate()).thenReturn(mock(ViewPropertyAnimator.class));
when(mMockNotificationAreaController.getCenteredNotificationAreaView()).thenReturn(
centeredNotificationAreaView);
when(mMockNotificationAreaController.getNotificationInnerAreaView()).thenReturn(
mNotificationAreaInner);
}