Merge "Status Bar - Wrap visible content in containers" into tm-qpr-dev am: 59bf347867
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19195270 Change-Id: I65b7a6b2a45fb3501eebf417887b6c005135a993 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -60,9 +60,8 @@
|
|||||||
</com.android.systemui.statusbar.phone.userswitcher.StatusBarUserSwitcherContainer>
|
</com.android.systemui.statusbar.phone.userswitcher.StatusBarUserSwitcherContainer>
|
||||||
|
|
||||||
<FrameLayout android:id="@+id/system_icons_container"
|
<FrameLayout android:id="@+id/system_icons_container"
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginEnd="@dimen/status_bar_padding_end"
|
android:layout_marginEnd="@dimen/status_bar_padding_end"
|
||||||
android:gravity="center_vertical|end">
|
android:gravity="center_vertical|end">
|
||||||
<include layout="@layout/system_icons" />
|
<include layout="@layout/system_icons" />
|
||||||
|
|||||||
@@ -14,18 +14,9 @@
|
|||||||
~ See the License for the specific language governing permissions and
|
~ See the License for the specific language governing permissions and
|
||||||
~ limitations under the License
|
~ limitations under the License
|
||||||
-->
|
-->
|
||||||
<com.android.keyguard.AlphaOptimizedLinearLayout
|
<com.android.systemui.statusbar.phone.NotificationIconContainer
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/notification_icon_area_inner"
|
android:id="@+id/notificationIcons"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clipChildren="false">
|
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:clipChildren="false"/>
|
|
||||||
</com.android.keyguard.AlphaOptimizedLinearLayout>
|
|
||||||
@@ -47,52 +47,63 @@
|
|||||||
android:paddingStart="@dimen/status_bar_padding_start"
|
android:paddingStart="@dimen/status_bar_padding_start"
|
||||||
android:paddingEnd="@dimen/status_bar_padding_end"
|
android:paddingEnd="@dimen/status_bar_padding_end"
|
||||||
android:paddingTop="@dimen/status_bar_padding_top"
|
android:paddingTop="@dimen/status_bar_padding_top"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal">
|
||||||
>
|
|
||||||
|
<!-- Container for the entire start half of the status bar. It will always use the same
|
||||||
|
width, independent of the number of visible children and sub-children. -->
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
android:id="@+id/status_bar_start_side_container"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1">
|
android:layout_weight="1">
|
||||||
|
|
||||||
<include layout="@layout/heads_up_status_bar_layout" />
|
<!-- Container that is wrapped around the views on the start half of the status bar.
|
||||||
|
Its width will change with the number of visible children and sub-children.
|
||||||
|
It is useful when we want to know the visible bounds of the content. -->
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/status_bar_start_side_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clipChildren="false">
|
||||||
|
|
||||||
<!-- The alpha of the left side is controlled by PhoneStatusBarTransitions, and the
|
<include layout="@layout/heads_up_status_bar_layout" />
|
||||||
individual views are controlled by StatusBarManager disable flags DISABLE_CLOCK and
|
|
||||||
DISABLE_NOTIFICATION_ICONS, respectively -->
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/status_bar_left_side"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:clipChildren="false"
|
|
||||||
>
|
|
||||||
<ViewStub
|
|
||||||
android:id="@+id/operator_name"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout="@layout/operator_name" />
|
|
||||||
|
|
||||||
<com.android.systemui.statusbar.policy.Clock
|
<!-- The alpha of the start side is controlled by PhoneStatusBarTransitions, and the
|
||||||
android:id="@+id/clock"
|
individual views are controlled by StatusBarManager disable flags DISABLE_CLOCK
|
||||||
android:layout_width="wrap_content"
|
and DISABLE_NOTIFICATION_ICONS, respectively -->
|
||||||
android:layout_height="match_parent"
|
<LinearLayout
|
||||||
android:textAppearance="@style/TextAppearance.StatusBar.Clock"
|
android:id="@+id/status_bar_start_side_except_heads_up"
|
||||||
android:singleLine="true"
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="@dimen/status_bar_left_clock_starting_padding"
|
android:layout_width="match_parent"
|
||||||
android:paddingEnd="@dimen/status_bar_left_clock_end_padding"
|
android:clipChildren="false">
|
||||||
android:gravity="center_vertical|start"
|
<ViewStub
|
||||||
/>
|
android:id="@+id/operator_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout="@layout/operator_name" />
|
||||||
|
|
||||||
<include layout="@layout/ongoing_call_chip" />
|
<com.android.systemui.statusbar.policy.Clock
|
||||||
|
android:id="@+id/clock"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:textAppearance="@style/TextAppearance.StatusBar.Clock"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:paddingStart="@dimen/status_bar_left_clock_starting_padding"
|
||||||
|
android:paddingEnd="@dimen/status_bar_left_clock_end_padding"
|
||||||
|
android:gravity="center_vertical|start"
|
||||||
|
/>
|
||||||
|
|
||||||
<com.android.systemui.statusbar.AlphaOptimizedFrameLayout
|
<include layout="@layout/ongoing_call_chip" />
|
||||||
android:id="@+id/notification_icon_area"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:clipChildren="false"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
<com.android.systemui.statusbar.AlphaOptimizedFrameLayout
|
||||||
|
android:id="@+id/notification_icon_area"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:clipChildren="false"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</FrameLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<!-- Space should cover the notch (if it exists) and let other views lay out around it -->
|
<!-- Space should cover the notch (if it exists) and let other views lay out around it -->
|
||||||
@@ -103,42 +114,57 @@
|
|||||||
android:gravity="center_horizontal|center_vertical"
|
android:gravity="center_horizontal|center_vertical"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<com.android.keyguard.AlphaOptimizedLinearLayout android:id="@+id/system_icon_area"
|
<!-- Container for the entire end half of the status bar. It will always use the same
|
||||||
|
width, independent of the number of visible children and sub-children. -->
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/status_bar_end_side_container"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal"
|
android:clipChildren="false">
|
||||||
android:gravity="center_vertical|end"
|
|
||||||
>
|
|
||||||
|
|
||||||
<com.android.systemui.statusbar.phone.userswitcher.StatusBarUserSwitcherContainer
|
<!-- Container that is wrapped around the views on the end half of the
|
||||||
android:id="@+id/user_switcher_container"
|
status bar. Its width will change with the number of visible children and
|
||||||
|
sub-children.
|
||||||
|
It is useful when we want know the visible bounds of the content.-->
|
||||||
|
<com.android.keyguard.AlphaOptimizedLinearLayout
|
||||||
|
android:id="@+id/status_bar_end_side_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center"
|
android:layout_gravity="end"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingTop="4dp"
|
android:gravity="center_vertical|end"
|
||||||
android:paddingBottom="4dp"
|
android:clipChildren="false">
|
||||||
android:paddingStart="8dp"
|
|
||||||
android:paddingEnd="8dp"
|
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
android:background="@drawable/status_bar_user_chip_bg"
|
|
||||||
android:visibility="visible" >
|
|
||||||
<ImageView android:id="@+id/current_user_avatar"
|
|
||||||
android:layout_width="@dimen/multi_user_avatar_keyguard_size"
|
|
||||||
android:layout_height="@dimen/multi_user_avatar_keyguard_size"
|
|
||||||
android:scaleType="centerInside"
|
|
||||||
android:paddingEnd="4dp" />
|
|
||||||
|
|
||||||
<TextView android:id="@+id/current_user_name"
|
<com.android.systemui.statusbar.phone.userswitcher.StatusBarUserSwitcherContainer
|
||||||
|
android:id="@+id/user_switcher_container"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="@style/TextAppearance.StatusBar.Clock"
|
android:gravity="center"
|
||||||
/>
|
android:orientation="horizontal"
|
||||||
</com.android.systemui.statusbar.phone.userswitcher.StatusBarUserSwitcherContainer>
|
android:paddingTop="4dp"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
|
android:paddingStart="8dp"
|
||||||
|
android:paddingEnd="8dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:background="@drawable/status_bar_user_chip_bg"
|
||||||
|
android:visibility="visible" >
|
||||||
|
<ImageView android:id="@+id/current_user_avatar"
|
||||||
|
android:layout_width="@dimen/multi_user_avatar_keyguard_size"
|
||||||
|
android:layout_height="@dimen/multi_user_avatar_keyguard_size"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
android:paddingEnd="4dp" />
|
||||||
|
|
||||||
<include layout="@layout/system_icons" />
|
<TextView android:id="@+id/current_user_name"
|
||||||
</com.android.keyguard.AlphaOptimizedLinearLayout>
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="@style/TextAppearance.StatusBar.Clock"
|
||||||
|
/>
|
||||||
|
</com.android.systemui.statusbar.phone.userswitcher.StatusBarUserSwitcherContainer>
|
||||||
|
|
||||||
|
<include layout="@layout/system_icons" />
|
||||||
|
</com.android.keyguard.AlphaOptimizedLinearLayout>
|
||||||
|
</FrameLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ViewStub
|
<ViewStub
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License
|
* limitations under the License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.systemui.statusbar.phone;
|
package com.android.systemui.statusbar.phone;
|
||||||
|
|
||||||
import static com.android.systemui.statusbar.phone.HeadsUpAppearanceController.CONTENT_FADE_DELAY;
|
import static com.android.systemui.statusbar.phone.HeadsUpAppearanceController.CONTENT_FADE_DELAY;
|
||||||
@@ -31,6 +30,7 @@ import android.util.MathUtils;
|
|||||||
import android.util.Property;
|
import android.util.Property;
|
||||||
import android.view.ContextThemeWrapper;
|
import android.view.ContextThemeWrapper;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
@@ -40,7 +40,6 @@ import com.android.internal.statusbar.StatusBarIcon;
|
|||||||
import com.android.settingslib.Utils;
|
import com.android.settingslib.Utils;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.animation.Interpolators;
|
import com.android.systemui.animation.Interpolators;
|
||||||
import com.android.systemui.statusbar.AlphaOptimizedFrameLayout;
|
|
||||||
import com.android.systemui.statusbar.StatusBarIconView;
|
import com.android.systemui.statusbar.StatusBarIconView;
|
||||||
import com.android.systemui.statusbar.notification.stack.AnimationFilter;
|
import com.android.systemui.statusbar.notification.stack.AnimationFilter;
|
||||||
import com.android.systemui.statusbar.notification.stack.AnimationProperties;
|
import com.android.systemui.statusbar.notification.stack.AnimationProperties;
|
||||||
@@ -54,7 +53,7 @@ import java.util.function.Consumer;
|
|||||||
* A container for notification icons. It handles overflowing icons properly and positions them
|
* A container for notification icons. It handles overflowing icons properly and positions them
|
||||||
* correctly on the screen.
|
* correctly on the screen.
|
||||||
*/
|
*/
|
||||||
public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
|
public class NotificationIconContainer extends ViewGroup {
|
||||||
/**
|
/**
|
||||||
* A float value indicating how much before the overflow start the icons should transform into
|
* A float value indicating how much before the overflow start the icons should transform into
|
||||||
* a dot. A value of 0 means that they are exactly at the end and a value of 1 means it starts
|
* a dot. A value of 0 means that they are exactly at the end and a value of 1 means it starts
|
||||||
@@ -231,6 +230,31 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
|
|||||||
initDimens();
|
initDimens();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasOverlappingRendering() {
|
||||||
|
// Does the same as "AlphaOptimizedFrameLayout".
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
final int childCount = getChildCount();
|
||||||
|
final int maxVisibleIcons = getMaxVisibleIcons(childCount);
|
||||||
|
final int width = MeasureSpec.getSize(widthMeasureSpec);
|
||||||
|
final int childWidthSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.UNSPECIFIED);
|
||||||
|
int totalWidth = (int) (getActualPaddingStart() + getActualPaddingEnd());
|
||||||
|
for (int i = 0; i < childCount; i++) {
|
||||||
|
View child = getChildAt(i);
|
||||||
|
measureChild(child, childWidthSpec, heightMeasureSpec);
|
||||||
|
if (i <= maxVisibleIcons) {
|
||||||
|
totalWidth += child.getMeasuredWidth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final int measuredWidth = resolveSize(totalWidth, widthMeasureSpec);
|
||||||
|
final int measuredHeight = MeasureSpec.getSize(heightMeasureSpec);
|
||||||
|
setMeasuredDimension(measuredWidth, measuredHeight);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||||
float centerY = getHeight() / 2.0f;
|
float centerY = getHeight() / 2.0f;
|
||||||
@@ -408,8 +432,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
|
|||||||
float translationX = getActualPaddingStart();
|
float translationX = getActualPaddingStart();
|
||||||
int firstOverflowIndex = -1;
|
int firstOverflowIndex = -1;
|
||||||
int childCount = getChildCount();
|
int childCount = getChildCount();
|
||||||
int maxVisibleIcons = mOnLockScreen ? MAX_ICONS_ON_AOD :
|
int maxVisibleIcons = getMaxVisibleIcons(childCount);
|
||||||
mIsStaticLayout ? MAX_STATIC_ICONS : childCount;
|
|
||||||
float layoutEnd = getLayoutEnd();
|
float layoutEnd = getLayoutEnd();
|
||||||
mVisualOverflowStart = 0;
|
mVisualOverflowStart = 0;
|
||||||
mFirstVisibleIconState = null;
|
mFirstVisibleIconState = null;
|
||||||
@@ -493,6 +516,11 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getMaxVisibleIcons(int childCount) {
|
||||||
|
return mOnLockScreen ? MAX_ICONS_ON_AOD :
|
||||||
|
mIsStaticLayout ? MAX_STATIC_ICONS : childCount;
|
||||||
|
}
|
||||||
|
|
||||||
private float getLayoutEnd() {
|
private float getLayoutEnd() {
|
||||||
return getActualWidth() - getActualPaddingEnd();
|
return getActualWidth() - getActualPaddingEnd();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public final class PhoneStatusBarTransitions extends BarTransitions {
|
|||||||
|
|
||||||
private final float mIconAlphaWhenOpaque;
|
private final float mIconAlphaWhenOpaque;
|
||||||
|
|
||||||
private View mLeftSide, mStatusIcons, mBattery;
|
private View mStartSide, mStatusIcons, mBattery;
|
||||||
private Animator mCurrentAnimation;
|
private Animator mCurrentAnimation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,7 +41,7 @@ public final class PhoneStatusBarTransitions extends BarTransitions {
|
|||||||
super(backgroundView, R.drawable.status_background);
|
super(backgroundView, R.drawable.status_background);
|
||||||
final Resources res = statusBarView.getContext().getResources();
|
final Resources res = statusBarView.getContext().getResources();
|
||||||
mIconAlphaWhenOpaque = res.getFraction(R.dimen.status_bar_icon_drawing_alpha, 1, 1);
|
mIconAlphaWhenOpaque = res.getFraction(R.dimen.status_bar_icon_drawing_alpha, 1, 1);
|
||||||
mLeftSide = statusBarView.findViewById(R.id.status_bar_left_side);
|
mStartSide = statusBarView.findViewById(R.id.status_bar_start_side_except_heads_up);
|
||||||
mStatusIcons = statusBarView.findViewById(R.id.statusIcons);
|
mStatusIcons = statusBarView.findViewById(R.id.statusIcons);
|
||||||
mBattery = statusBarView.findViewById(R.id.battery);
|
mBattery = statusBarView.findViewById(R.id.battery);
|
||||||
applyModeBackground(-1, getMode(), false /*animate*/);
|
applyModeBackground(-1, getMode(), false /*animate*/);
|
||||||
@@ -75,7 +75,7 @@ public final class PhoneStatusBarTransitions extends BarTransitions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void applyMode(int mode, boolean animate) {
|
private void applyMode(int mode, boolean animate) {
|
||||||
if (mLeftSide == null) return; // pre-init
|
if (mStartSide == null) return; // pre-init
|
||||||
float newAlpha = getNonBatteryClockAlphaFor(mode);
|
float newAlpha = getNonBatteryClockAlphaFor(mode);
|
||||||
float newAlphaBC = getBatteryClockAlpha(mode);
|
float newAlphaBC = getBatteryClockAlpha(mode);
|
||||||
if (mCurrentAnimation != null) {
|
if (mCurrentAnimation != null) {
|
||||||
@@ -84,7 +84,7 @@ public final class PhoneStatusBarTransitions extends BarTransitions {
|
|||||||
if (animate) {
|
if (animate) {
|
||||||
AnimatorSet anims = new AnimatorSet();
|
AnimatorSet anims = new AnimatorSet();
|
||||||
anims.playTogether(
|
anims.playTogether(
|
||||||
animateTransitionTo(mLeftSide, newAlpha),
|
animateTransitionTo(mStartSide, newAlpha),
|
||||||
animateTransitionTo(mStatusIcons, newAlpha),
|
animateTransitionTo(mStatusIcons, newAlpha),
|
||||||
animateTransitionTo(mBattery, newAlphaBC)
|
animateTransitionTo(mBattery, newAlphaBC)
|
||||||
);
|
);
|
||||||
@@ -94,7 +94,7 @@ public final class PhoneStatusBarTransitions extends BarTransitions {
|
|||||||
anims.start();
|
anims.start();
|
||||||
mCurrentAnimation = anims;
|
mCurrentAnimation = anims;
|
||||||
} else {
|
} else {
|
||||||
mLeftSide.setAlpha(newAlpha);
|
mStartSide.setAlpha(newAlpha);
|
||||||
mStatusIcons.setAlpha(newAlpha);
|
mStatusIcons.setAlpha(newAlpha);
|
||||||
mBattery.setAlpha(newAlphaBC);
|
mBattery.setAlpha(newAlphaBC);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import android.view.MotionEvent
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.ViewTreeObserver
|
import android.view.ViewTreeObserver
|
||||||
|
|
||||||
import com.android.systemui.R
|
import com.android.systemui.R
|
||||||
import com.android.systemui.shared.animation.UnfoldMoveFromCenterAnimator
|
import com.android.systemui.shared.animation.UnfoldMoveFromCenterAnimator
|
||||||
import com.android.systemui.statusbar.phone.userswitcher.StatusBarUserSwitcherController
|
import com.android.systemui.statusbar.phone.userswitcher.StatusBarUserSwitcherController
|
||||||
@@ -32,9 +31,7 @@ import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider
|
|||||||
import com.android.systemui.util.ViewController
|
import com.android.systemui.util.ViewController
|
||||||
import com.android.systemui.util.kotlin.getOrNull
|
import com.android.systemui.util.kotlin.getOrNull
|
||||||
import com.android.systemui.util.view.ViewUtil
|
import com.android.systemui.util.view.ViewUtil
|
||||||
|
|
||||||
import java.util.Optional
|
import java.util.Optional
|
||||||
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Named
|
import javax.inject.Named
|
||||||
|
|
||||||
@@ -58,8 +55,8 @@ class PhoneStatusBarViewController private constructor(
|
|||||||
override fun onViewAttached() {
|
override fun onViewAttached() {
|
||||||
if (moveFromCenterAnimationController == null) return
|
if (moveFromCenterAnimationController == null) return
|
||||||
|
|
||||||
val statusBarLeftSide: View = mView.findViewById(R.id.status_bar_left_side)
|
val statusBarLeftSide: View = mView.findViewById(R.id.status_bar_start_side_except_heads_up)
|
||||||
val systemIconArea: ViewGroup = mView.findViewById(R.id.system_icon_area)
|
val systemIconArea: ViewGroup = mView.findViewById(R.id.status_bar_end_side_content)
|
||||||
|
|
||||||
val viewsToAnimate = arrayOf(
|
val viewsToAnimate = arrayOf(
|
||||||
statusBarLeftSide,
|
statusBarLeftSide,
|
||||||
@@ -126,11 +123,11 @@ class PhoneStatusBarViewController private constructor(
|
|||||||
class StatusBarViewsCenterProvider : UnfoldMoveFromCenterAnimator.ViewCenterProvider {
|
class StatusBarViewsCenterProvider : UnfoldMoveFromCenterAnimator.ViewCenterProvider {
|
||||||
override fun getViewCenter(view: View, outPoint: Point) =
|
override fun getViewCenter(view: View, outPoint: Point) =
|
||||||
when (view.id) {
|
when (view.id) {
|
||||||
R.id.status_bar_left_side -> {
|
R.id.status_bar_start_side_except_heads_up -> {
|
||||||
// items aligned to the start, return start center point
|
// items aligned to the start, return start center point
|
||||||
getViewEdgeCenter(view, outPoint, isStart = true)
|
getViewEdgeCenter(view, outPoint, isStart = true)
|
||||||
}
|
}
|
||||||
R.id.system_icon_area -> {
|
R.id.status_bar_end_side_content -> {
|
||||||
// items aligned to the end, return end center point
|
// items aligned to the end, return end center point
|
||||||
getViewEdgeCenter(view, outPoint, isStart = false)
|
getViewEdgeCenter(view, outPoint, isStart = false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
|
|||||||
private final KeyguardStateController mKeyguardStateController;
|
private final KeyguardStateController mKeyguardStateController;
|
||||||
private final NotificationPanelViewController mNotificationPanelViewController;
|
private final NotificationPanelViewController mNotificationPanelViewController;
|
||||||
private final NetworkController mNetworkController;
|
private final NetworkController mNetworkController;
|
||||||
private LinearLayout mSystemIconArea;
|
private LinearLayout mEndSideContent;
|
||||||
private View mClockView;
|
private View mClockView;
|
||||||
private View mOngoingCallChip;
|
private View mOngoingCallChip;
|
||||||
private View mNotificationIconAreaInner;
|
private View mNotificationIconAreaInner;
|
||||||
@@ -232,16 +232,16 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
|
|||||||
mDarkIconManager.setShouldLog(true);
|
mDarkIconManager.setShouldLog(true);
|
||||||
updateBlockedIcons();
|
updateBlockedIcons();
|
||||||
mStatusBarIconController.addIconGroup(mDarkIconManager);
|
mStatusBarIconController.addIconGroup(mDarkIconManager);
|
||||||
mSystemIconArea = mStatusBar.findViewById(R.id.system_icon_area);
|
mEndSideContent = mStatusBar.findViewById(R.id.status_bar_end_side_content);
|
||||||
mClockView = mStatusBar.findViewById(R.id.clock);
|
mClockView = mStatusBar.findViewById(R.id.clock);
|
||||||
mOngoingCallChip = mStatusBar.findViewById(R.id.ongoing_call_chip);
|
mOngoingCallChip = mStatusBar.findViewById(R.id.ongoing_call_chip);
|
||||||
showSystemIconArea(false);
|
showEndSideContent(false);
|
||||||
showClock(false);
|
showClock(false);
|
||||||
initEmergencyCryptkeeperText();
|
initEmergencyCryptkeeperText();
|
||||||
initOperatorName();
|
initOperatorName();
|
||||||
initNotificationIconArea();
|
initNotificationIconArea();
|
||||||
mSystemEventAnimator =
|
mSystemEventAnimator =
|
||||||
new StatusBarSystemEventAnimator(mSystemIconArea, getResources());
|
new StatusBarSystemEventAnimator(mEndSideContent, getResources());
|
||||||
mCarrierConfigTracker.addCallback(mCarrierConfigCallback);
|
mCarrierConfigTracker.addCallback(mCarrierConfigCallback);
|
||||||
mCarrierConfigTracker.addDefaultDataSubscriptionChangedListener(mDefaultDataListener);
|
mCarrierConfigTracker.addDefaultDataSubscriptionChangedListener(mDefaultDataListener);
|
||||||
}
|
}
|
||||||
@@ -370,10 +370,10 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
|
|||||||
mDisabled2 = state2;
|
mDisabled2 = state2;
|
||||||
if ((diff1 & DISABLE_SYSTEM_INFO) != 0 || ((diff2 & DISABLE2_SYSTEM_ICONS) != 0)) {
|
if ((diff1 & DISABLE_SYSTEM_INFO) != 0 || ((diff2 & DISABLE2_SYSTEM_ICONS) != 0)) {
|
||||||
if ((state1 & DISABLE_SYSTEM_INFO) != 0 || ((state2 & DISABLE2_SYSTEM_ICONS) != 0)) {
|
if ((state1 & DISABLE_SYSTEM_INFO) != 0 || ((state2 & DISABLE2_SYSTEM_ICONS) != 0)) {
|
||||||
hideSystemIconArea(animate);
|
hideEndSideContent(animate);
|
||||||
hideOperatorName(animate);
|
hideOperatorName(animate);
|
||||||
} else {
|
} else {
|
||||||
showSystemIconArea(animate);
|
showEndSideContent(animate);
|
||||||
showOperatorName(animate);
|
showOperatorName(animate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -474,15 +474,15 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
|
|||||||
return mStatusBarHideIconsForBouncerManager.getShouldHideStatusBarIconsForBouncer();
|
return mStatusBarHideIconsForBouncerManager.getShouldHideStatusBarIconsForBouncer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideSystemIconArea(boolean animate) {
|
private void hideEndSideContent(boolean animate) {
|
||||||
animateHide(mSystemIconArea, animate);
|
animateHide(mEndSideContent, animate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showSystemIconArea(boolean animate) {
|
private void showEndSideContent(boolean animate) {
|
||||||
// Only show the system icon area if we are not currently animating
|
// Only show the system icon area if we are not currently animating
|
||||||
int state = mAnimationScheduler.getAnimationState();
|
int state = mAnimationScheduler.getAnimationState();
|
||||||
if (state == IDLE || state == SHOWING_PERSISTENT_DOT) {
|
if (state == IDLE || state == SHOWING_PERSISTENT_DOT) {
|
||||||
animateShow(mSystemIconArea, animate);
|
animateShow(mEndSideContent, animate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest {
|
|||||||
|
|
||||||
fragment.disable(DEFAULT_DISPLAY, 0, 0, false);
|
fragment.disable(DEFAULT_DISPLAY, 0, 0, false);
|
||||||
|
|
||||||
assertEquals(View.VISIBLE, getSystemIconAreaView().getVisibility());
|
assertEquals(View.VISIBLE, getEndSideContentView().getVisibility());
|
||||||
assertEquals(View.VISIBLE, getClockView().getVisibility());
|
assertEquals(View.VISIBLE, getClockView().getVisibility());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,11 +134,11 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest {
|
|||||||
|
|
||||||
fragment.disable(DEFAULT_DISPLAY, StatusBarManager.DISABLE_SYSTEM_INFO, 0, false);
|
fragment.disable(DEFAULT_DISPLAY, StatusBarManager.DISABLE_SYSTEM_INFO, 0, false);
|
||||||
|
|
||||||
assertEquals(View.INVISIBLE, getSystemIconAreaView().getVisibility());
|
assertEquals(View.INVISIBLE, getEndSideContentView().getVisibility());
|
||||||
|
|
||||||
fragment.disable(DEFAULT_DISPLAY, 0, 0, false);
|
fragment.disable(DEFAULT_DISPLAY, 0, 0, false);
|
||||||
|
|
||||||
assertEquals(View.VISIBLE, getSystemIconAreaView().getVisibility());
|
assertEquals(View.VISIBLE, getEndSideContentView().getVisibility());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -234,7 +234,7 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest {
|
|||||||
|
|
||||||
fragment.disable(DEFAULT_DISPLAY, 0, 0, false);
|
fragment.disable(DEFAULT_DISPLAY, 0, 0, false);
|
||||||
|
|
||||||
assertEquals(View.VISIBLE, getSystemIconAreaView().getVisibility());
|
assertEquals(View.VISIBLE, getEndSideContentView().getVisibility());
|
||||||
assertEquals(View.VISIBLE, getClockView().getVisibility());
|
assertEquals(View.VISIBLE, getClockView().getVisibility());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,7 +246,7 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest {
|
|||||||
|
|
||||||
fragment.disable(DEFAULT_DISPLAY, 0, 0, false);
|
fragment.disable(DEFAULT_DISPLAY, 0, 0, false);
|
||||||
|
|
||||||
assertEquals(View.VISIBLE, getSystemIconAreaView().getVisibility());
|
assertEquals(View.VISIBLE, getEndSideContentView().getVisibility());
|
||||||
assertEquals(View.VISIBLE, getClockView().getVisibility());
|
assertEquals(View.VISIBLE, getClockView().getVisibility());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,12 +257,12 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest {
|
|||||||
when(mNotificationPanelViewController.hasCustomClock()).thenReturn(true);
|
when(mNotificationPanelViewController.hasCustomClock()).thenReturn(true);
|
||||||
|
|
||||||
// Make sure they start out as visible
|
// Make sure they start out as visible
|
||||||
assertEquals(View.VISIBLE, getSystemIconAreaView().getVisibility());
|
assertEquals(View.VISIBLE, getEndSideContentView().getVisibility());
|
||||||
assertEquals(View.VISIBLE, getClockView().getVisibility());
|
assertEquals(View.VISIBLE, getClockView().getVisibility());
|
||||||
|
|
||||||
fragment.disable(DEFAULT_DISPLAY, 0, 0, false);
|
fragment.disable(DEFAULT_DISPLAY, 0, 0, false);
|
||||||
|
|
||||||
assertEquals(View.INVISIBLE, getSystemIconAreaView().getVisibility());
|
assertEquals(View.INVISIBLE, getEndSideContentView().getVisibility());
|
||||||
assertEquals(View.GONE, getClockView().getVisibility());
|
assertEquals(View.GONE, getClockView().getVisibility());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,14 +273,14 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest {
|
|||||||
when(mNotificationPanelViewController.hasCustomClock()).thenReturn(true);
|
when(mNotificationPanelViewController.hasCustomClock()).thenReturn(true);
|
||||||
|
|
||||||
// Make sure they start out as visible
|
// Make sure they start out as visible
|
||||||
assertEquals(View.VISIBLE, getSystemIconAreaView().getVisibility());
|
assertEquals(View.VISIBLE, getEndSideContentView().getVisibility());
|
||||||
assertEquals(View.VISIBLE, getClockView().getVisibility());
|
assertEquals(View.VISIBLE, getClockView().getVisibility());
|
||||||
|
|
||||||
fragment.onDozingChanged(true);
|
fragment.onDozingChanged(true);
|
||||||
|
|
||||||
// When this callback is triggered, we want to make sure the clock and system info
|
// When this callback is triggered, we want to make sure the clock and system info
|
||||||
// visibilities are recalculated. Since dozing=true, they shouldn't be visible.
|
// visibilities are recalculated. Since dozing=true, they shouldn't be visible.
|
||||||
assertEquals(View.INVISIBLE, getSystemIconAreaView().getVisibility());
|
assertEquals(View.INVISIBLE, getEndSideContentView().getVisibility());
|
||||||
assertEquals(View.GONE, getClockView().getVisibility());
|
assertEquals(View.GONE, getClockView().getVisibility());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest {
|
|||||||
return mFragment.getView().findViewById(R.id.clock);
|
return mFragment.getView().findViewById(R.id.clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
private View getSystemIconAreaView() {
|
private View getEndSideContentView() {
|
||||||
return mFragment.getView().findViewById(R.id.system_icon_area);
|
return mFragment.getView().findViewById(R.id.status_bar_end_side_content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user