diff options
author | 2021-07-14 14:54:01 +0000 | |
---|---|---|
committer | 2021-07-14 14:54:01 +0000 | |
commit | 3947c9b56c2e79d76b6941fb5bdcdf25e359b0a4 (patch) | |
tree | 1e205bafc540ea4647681cb9132e2663f54a968a | |
parent | c3d0d780ca3e7b2c9896a3858cf7cfe13a223580 (diff) | |
parent | da314cd361fd7952136761d88fead547f873244d (diff) |
Merge "Adding more icons to split shade header" into sc-v2-dev am: 390ae0ce43 am: da314cd361
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15243871
Change-Id: Ieba292bf14d679d561a5fdc9162dfb7b934d28ce
11 files changed, 193 insertions, 47 deletions
diff --git a/packages/SystemUI/res/layout/quick_qs_status_icons.xml b/packages/SystemUI/res/layout/quick_qs_status_icons.xml index 5b9ca1b26158..74c39a335f4d 100644 --- a/packages/SystemUI/res/layout/quick_qs_status_icons.xml +++ b/packages/SystemUI/res/layout/quick_qs_status_icons.xml @@ -21,7 +21,7 @@ android:layout_height="@*android:dimen/quick_qs_offset_height" android:clipChildren="false" android:clipToPadding="false" - android:minHeight="48dp" + android:minHeight="@dimen/qs_header_row_min_height" android:clickable="false" android:focusable="true" android:theme="@style/Theme.SystemUI.QuickSettings.Header"> @@ -31,7 +31,7 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:minWidth="48dp" - android:minHeight="48dp" + android:minHeight="@dimen/qs_header_row_min_height" android:gravity="center_vertical|start" android:paddingStart="@dimen/status_bar_left_clock_starting_padding" android:paddingEnd="@dimen/status_bar_left_clock_end_padding" @@ -43,7 +43,7 @@ android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" - android:minHeight="48dp" + android:minHeight="@dimen/qs_header_row_min_height" android:minWidth="48dp" android:layout_marginStart="8dp" android:layout_gravity="end|center_vertical" diff --git a/packages/SystemUI/res/layout/split_shade_header.xml b/packages/SystemUI/res/layout/split_shade_header.xml new file mode 100644 index 000000000000..401dc1955dbd --- /dev/null +++ b/packages/SystemUI/res/layout/split_shade_header.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2021 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. +--> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:systemui="http://schemas.android.com/apk/res-auto" + android:id="@+id/split_shade_status_bar" + android:layout_width="match_parent" + android:layout_height="@dimen/split_shade_header_height" + android:minHeight="@dimen/split_shade_header_min_height" + android:clickable="false" + android:focusable="true" + android:paddingLeft="@dimen/qs_panel_padding" + android:paddingRight="@dimen/qs_panel_padding" + android:visibility="gone" + android:theme="@style/Theme.SystemUI.QuickSettings.Header"> + + <com.android.systemui.statusbar.policy.Clock + android:id="@+id/clock" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:minWidth="48dp" + android:minHeight="@dimen/split_shade_header_min_height" + android:gravity="start|center_vertical" + android:paddingStart="@dimen/status_bar_left_clock_starting_padding" + android:paddingEnd="@dimen/status_bar_left_clock_end_padding" + android:singleLine="true" + android:textAppearance="@style/TextAppearance.QS.Status" /> + + <com.android.systemui.statusbar.policy.DateView + android:id="@+id/date" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="start|center_vertical" + android:gravity="center_vertical" + android:singleLine="true" + android:textAppearance="@style/TextAppearance.QS.Status" + systemui:datePattern="@string/abbrev_wday_month_day_no_year_alarm" /> + + <FrameLayout + android:id="@+id/rightLayout" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" + android:gravity="end"> + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_gravity="end|center_vertical"> + + <include + android:id="@+id/carrier_group" + layout="@layout/qs_carrier_group" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_gravity="end|center_vertical" + android:layout_marginStart="8dp" + android:focusable="false" + android:minHeight="@dimen/split_shade_header_min_height" + android:minWidth="48dp" /> + + <com.android.systemui.statusbar.phone.StatusIconContainer + android:id="@+id/statusIcons" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:paddingEnd="@dimen/signal_cluster_battery_padding" /> + + <com.android.systemui.BatteryMeterView + android:id="@+id/batteryRemainingIcon" + android:layout_width="wrap_content" + android:layout_height="match_parent" + systemui:textAppearance="@style/TextAppearance.QS.Status" /> + </LinearLayout> + </FrameLayout> + +</LinearLayout> diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml index 7d8ff93d0fe4..cf91a2b3e588 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded.xml @@ -67,7 +67,7 @@ android:clipToPadding="false" android:clipChildren="false"> - <include layout="@layout/quick_qs_status_icons"/> + <include layout="@layout/split_shade_header"/> <include layout="@layout/keyguard_status_view" diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 6c4bea95aa16..22035f462c88 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -461,7 +461,8 @@ <dimen name="match_parent">-1px</dimen> <!-- Height of status bar in split shade mode - visible only on large screens --> - <dimen name="split_shade_status_bar_height">@*android:dimen/quick_qs_offset_height</dimen> + <dimen name="split_shade_header_height">@*android:dimen/quick_qs_offset_height</dimen> + <dimen name="split_shade_header_min_height">@dimen/qs_header_row_min_height</dimen> <!-- The top margin of the panel that holds the list of notifications. --> <dimen name="notification_panel_margin_top">0dp</dimen> @@ -631,6 +632,7 @@ <dimen name="qs_footer_icon_size">20dp</dimen> <dimen name="qs_header_top_padding">15dp</dimen> <dimen name="qs_header_bottom_padding">14dp</dimen> + <dimen name="qs_header_row_min_height">48dp</dimen> <dimen name="qs_footer_padding">20dp</dimen> <dimen name="qs_security_footer_height">88dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java index 54e78cf0ab74..6fc2e41782a0 100644 --- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java @@ -192,6 +192,7 @@ public class BatteryMeterView extends LinearLayout implements * 0 - No preference * 1 - Force on * 2 - Force off + * 3 - Estimate * @param mode desired mode (none, on, off) */ public void setPercentShowMode(@BatteryPercentMode int mode) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index 075ccf4cdff9..6c658153f7f3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -334,7 +334,7 @@ public class NotificationPanelViewController extends PanelViewController { private final int mMaxKeyguardNotifications; private final LockscreenShadeTransitionController mLockscreenShadeTransitionController; private final TapAgainViewController mTapAgainViewController; - private final SplitShadeStatusBarController mSplitShadeStatusBarController; + private final SplitShadeHeaderController mSplitShadeHeaderController; private boolean mShouldUseSplitNotificationShade; // The bottom padding reserved for elements of the keyguard measuring notifications private float mKeyguardNotificationBottomPadding; @@ -725,7 +725,7 @@ public class NotificationPanelViewController extends PanelViewController { QuickAccessWalletController quickAccessWalletController, @Main Executor uiExecutor, SecureSettings secureSettings, - SplitShadeStatusBarController splitShadeStatusBarController, + SplitShadeHeaderController splitShadeHeaderController, UnlockedScreenOffAnimationController unlockedScreenOffAnimationController, NotificationRemoteInputManager remoteInputManager) { super(view, falsingManager, dozeLog, keyguardStateController, @@ -759,7 +759,7 @@ public class NotificationPanelViewController extends PanelViewController { mShouldUseSplitNotificationShade = Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources); mView.setWillNotDraw(!DEBUG); - mSplitShadeStatusBarController = splitShadeStatusBarController; + mSplitShadeHeaderController = splitShadeHeaderController; mLayoutInflater = layoutInflater; mFalsingManager = falsingManager; mFalsingCollector = falsingCollector; @@ -1029,7 +1029,7 @@ public class NotificationPanelViewController extends PanelViewController { mQuickQsOffsetHeight = mResources.getDimensionPixelSize( com.android.internal.R.dimen.quick_qs_offset_height); mSplitShadeStatusBarHeight = - mResources.getDimensionPixelSize(R.dimen.split_shade_status_bar_height); + mResources.getDimensionPixelSize(R.dimen.split_shade_header_height); int qsWidth = mResources.getDimensionPixelSize(R.dimen.qs_panel_width); int panelWidth = mResources.getDimensionPixelSize(R.dimen.notification_panel_width); mShouldUseSplitNotificationShade = @@ -1041,7 +1041,7 @@ public class NotificationPanelViewController extends PanelViewController { int topMargin = mShouldUseSplitNotificationShade ? mSplitShadeStatusBarHeight : mResources.getDimensionPixelSize(R.dimen.notification_panel_margin_top); - mSplitShadeStatusBarController.setSplitShadeMode(mShouldUseSplitNotificationShade); + mSplitShadeHeaderController.setSplitShadeMode(mShouldUseSplitNotificationShade); // To change the constraints at runtime, all children of the ConstraintLayout must have ids ensureAllViewsHaveIds(mNotificationContainerParent); @@ -4474,7 +4474,7 @@ public class NotificationPanelViewController extends PanelViewController { maybeAnimateBottomAreaAlpha(); resetHorizontalPanelPosition(); updateQsState(); - mSplitShadeStatusBarController.setShadeExpanded( + mSplitShadeHeaderController.setShadeExpanded( mBarState == SHADE || mBarState == SHADE_LOCKED); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SplitShadeHeaderController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SplitShadeHeaderController.kt new file mode 100644 index 000000000000..d29107da7420 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SplitShadeHeaderController.kt @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2021 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. + */ + +package com.android.systemui.statusbar.phone + +import android.view.View +import com.android.systemui.BatteryMeterView +import com.android.systemui.R +import com.android.systemui.qs.carrier.QSCarrierGroupController +import com.android.systemui.statusbar.FeatureFlags +import com.android.systemui.statusbar.phone.dagger.StatusBarComponent.StatusBarScope +import com.android.systemui.statusbar.phone.dagger.StatusBarViewModule.SPLIT_SHADE_HEADER +import javax.inject.Inject +import javax.inject.Named + +@StatusBarScope +class SplitShadeHeaderController @Inject constructor( + @Named(SPLIT_SHADE_HEADER) private val statusBar: View, + private val statusBarIconController: StatusBarIconController, + qsCarrierGroupControllerBuilder: QSCarrierGroupController.Builder, + featureFlags: FeatureFlags +) { + + private val iconManager: StatusBarIconController.IconManager + private val qsCarrierGroupController: QSCarrierGroupController + private var visible = false + + var shadeExpanded = false + set(value) { + field = value + updateVisibility() + } + + var splitShadeMode = false + set(value) { + field = value + updateVisibility() + } + + init { + val batteryIcon: BatteryMeterView = statusBar.findViewById(R.id.batteryRemainingIcon) + // battery settings same as in QS icons + batteryIcon.setIgnoreTunerUpdates(true) + batteryIcon.setPercentShowMode(BatteryMeterView.MODE_ESTIMATE) + + val iconContainer: StatusIconContainer = statusBar.findViewById(R.id.statusIcons) + iconManager = StatusBarIconController.IconManager(iconContainer, featureFlags) + qsCarrierGroupController = qsCarrierGroupControllerBuilder + .setQSCarrierGroup(statusBar.findViewById(R.id.carrier_group)) + .build() + } + + private fun updateVisibility() { + val shouldBeVisible = shadeExpanded && splitShadeMode + if (visible != shouldBeVisible) { + visible = shouldBeVisible + statusBar.visibility = if (shouldBeVisible) View.VISIBLE else View.GONE + updateListeners(shouldBeVisible) + } + } + + private fun updateListeners(visible: Boolean) { + qsCarrierGroupController.setListening(visible) + if (visible) { + statusBarIconController.addIconGroup(iconManager) + } else { + statusBarIconController.removeIconGroup(iconManager) + } + } +}
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SplitShadeStatusBarController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SplitShadeStatusBarController.kt deleted file mode 100644 index 724d5e256475..000000000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SplitShadeStatusBarController.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.android.systemui.statusbar.phone - -import android.view.View -import com.android.systemui.statusbar.phone.dagger.StatusBarComponent.StatusBarScope -import com.android.systemui.statusbar.phone.dagger.StatusBarViewModule.SPLIT_SHADE_STATUS_BAR -import javax.inject.Inject -import javax.inject.Named - -@StatusBarScope -class SplitShadeStatusBarController @Inject constructor( - @Named(SPLIT_SHADE_STATUS_BAR) val view: View -) { - - var shadeExpanded = false - set(value) { - field = value - updateVisibility() - } - - var splitShadeMode = false - set(value) { - field = value - updateVisibility() - } - - private fun updateVisibility() { - view.visibility = if (shadeExpanded && splitShadeMode) View.VISIBLE else View.GONE - } -}
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarComponent.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarComponent.java index 028b6d9e615d..4e632c718091 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarComponent.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarComponent.java @@ -23,7 +23,7 @@ import com.android.systemui.biometrics.AuthRippleController; import com.android.systemui.statusbar.phone.NotificationPanelViewController; import com.android.systemui.statusbar.phone.NotificationShadeWindowView; import com.android.systemui.statusbar.phone.NotificationShadeWindowViewController; -import com.android.systemui.statusbar.phone.SplitShadeStatusBarController; +import com.android.systemui.statusbar.phone.SplitShadeHeaderController; import com.android.systemui.statusbar.phone.StatusBarWindowController; import java.lang.annotation.Documented; @@ -92,5 +92,5 @@ public interface StatusBarComponent { * Creates a SplitShadeStatusBarController. */ @StatusBarScope - SplitShadeStatusBarController getSplitShadeStatusBarController(); + SplitShadeHeaderController getSplitShadeStatusBarController(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java index 6fa369fe4938..d691dca1c898 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java @@ -34,7 +34,7 @@ import dagger.Provides; @Module public abstract class StatusBarViewModule { - public static final String SPLIT_SHADE_STATUS_BAR = "split_shade_status_bar"; + public static final String SPLIT_SHADE_HEADER = "split_shade_header"; /** */ @Provides @@ -63,11 +63,11 @@ public abstract class StatusBarViewModule { /** */ @Provides - @Named(SPLIT_SHADE_STATUS_BAR) + @Named(SPLIT_SHADE_HEADER) @StatusBarComponent.StatusBarScope public static View getSlitShadeStatusBarView( NotificationShadeWindowView notificationShadeWindowView) { - return notificationShadeWindowView.findViewById(R.id.quick_qs_status_icons); + return notificationShadeWindowView.findViewById(R.id.split_shade_status_bar); } /** */ diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java index e9c4c5e5659d..e8256ce05821 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java @@ -283,7 +283,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { @Mock private SecureSettings mSecureSettings; @Mock - private SplitShadeStatusBarController mSplitShadeStatusBarController; + private SplitShadeHeaderController mSplitShadeHeaderController; @Mock private ContentResolver mContentResolver; @Mock @@ -440,7 +440,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { mQuickAccessWalletController, new FakeExecutor(new FakeSystemClock()), mSecureSettings, - mSplitShadeStatusBarController, + mSplitShadeHeaderController, mUnlockedScreenOffAnimationController, mNotificationRemoteInputManager); mNotificationPanelViewController.initDependencies( |