Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +8 −0 Original line number Diff line number Diff line Loading @@ -6092,6 +6092,14 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable return mExpandHelperCallback; } float getAppearFraction() { return mLastSentAppear; } float getExpandedHeight() { return mLastSentExpandedHeight; } /** Enum for selecting some or all notification rows (does not included non-notif views). */ @Retention(SOURCE) @IntDef({ROWS_ALL, ROWS_HIGH_PRIORITY, ROWS_GENTLE}) Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +8 −0 Original line number Diff line number Diff line Loading @@ -858,6 +858,14 @@ public class NotificationStackScrollLayoutController { mView.setHeadsUpAppearanceController(controller); } public float getAppearFraction() { return mView.getAppearFraction(); } public float getExpandedHeight() { return mView.getExpandedHeight(); } public void requestLayout() { mView.requestLayout(); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java +19 −17 Original line number Diff line number Diff line Loading @@ -72,8 +72,6 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, @VisibleForTesting float mExpandedHeight; @VisibleForTesting boolean mIsExpanded; @VisibleForTesting float mAppearFraction; private ExpandableNotificationRow mTrackedChild; private boolean mShown; Loading Loading @@ -134,6 +132,15 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, mCenteredIconView = centeredIconView; headsUpStatusBarView.setOnDrawingRectChangedListener( () -> updateIsolatedIconLocation(true /* requireUpdate */)); // 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 // changes). We need to re-fetch these values since they're used to correctly display the // HUN during this shade expansion. mTrackedChild = notificationPanelViewController.getTrackedHeadsUpNotification(); mAppearFraction = stackScrollerController.getAppearFraction(); mExpandedHeight = stackScrollerController.getExpandedHeight(); mStackScrollerController = stackScrollerController; mNotificationPanelViewController = notificationPanelViewController; notificationPanelViewController.addTrackingHeadsUpListener(mSetTrackingHeadsUp); Loading Loading @@ -201,12 +208,12 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, // no heads up anymore, lets start the disappear animation setShown(false); animateIsolation = !mIsExpanded; animateIsolation = !isExpanded(); } else if (previousEntry == null) { // We now have a headsUp and didn't have one before. Let's start the disappear // animation setShown(true); animateIsolation = !mIsExpanded; animateIsolation = !isExpanded(); } updateIsolatedIconLocation(false /* requireUpdate */); mNotificationIconAreaController.showIconIsolated(newEntry == null ? null Loading Loading @@ -319,7 +326,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, */ public boolean shouldBeVisible() { boolean notificationsShown = !mWakeUpCoordinator.getNotificationsFullyHidden(); boolean canShow = !mIsExpanded && notificationsShown; boolean canShow = !isExpanded() && notificationsShown; if (mBypassController.getBypassEnabled() && (mStatusBarStateController.getState() == StatusBarState.KEYGUARD || mKeyguardStateController.isKeyguardGoingAway()) Loading @@ -337,17 +344,17 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, public void setAppearFraction(float expandedHeight, float appearFraction) { boolean changed = expandedHeight != mExpandedHeight; boolean oldIsExpanded = isExpanded(); mExpandedHeight = expandedHeight; mAppearFraction = appearFraction; boolean isExpanded = expandedHeight > 0; // We only notify if the expandedHeight changed and not on the appearFraction, since // otherwise we may run into an infinite loop where the panel and this are constantly // updating themselves over just a small fraction if (changed) { updateHeadsUpHeaders(); } if (isExpanded != mIsExpanded) { mIsExpanded = isExpanded; if (isExpanded() != oldIsExpanded) { updateTopEntry(); } } Loading @@ -367,6 +374,10 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, } } private boolean isExpanded() { return mExpandedHeight > 0; } private void updateHeadsUpHeaders() { mHeadsUpManager.getAllEntries().forEach(entry -> { updateHeader(entry); Loading @@ -392,15 +403,6 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, updateTopEntry(); } void readFrom(HeadsUpAppearanceController oldController) { if (oldController != null) { mTrackedChild = oldController.mTrackedChild; mExpandedHeight = oldController.mExpandedHeight; mIsExpanded = oldController.mIsExpanded; mAppearFraction = oldController.mAppearFraction; } } @Override public void onFullyHiddenChanged(boolean isFullyHidden) { updateTopEntry(); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +17 −6 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.FrameLayout; import androidx.annotation.Nullable; import androidx.constraintlayout.widget.ConstraintSet; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -451,9 +452,13 @@ public class NotificationPanelViewController extends PanelViewController { private boolean mUserSetupComplete; private boolean mHideIconsDuringLaunchAnimation = true; private int mStackScrollerMeasuringPass; private ArrayList<Consumer<ExpandableNotificationRow>> mTrackingHeadsUpListeners = new ArrayList<>(); /** * Non-null if there's a heads-up notification that we're currently tracking the position of. */ @Nullable private ExpandableNotificationRow mTrackedHeadsUpNotification; private final ArrayList<Consumer<ExpandableNotificationRow>> mTrackingHeadsUpListeners = new ArrayList<>(); private HeadsUpAppearanceController mHeadsUpAppearanceController; private int mPanelAlpha; Loading Loading @@ -3050,18 +3055,24 @@ public class NotificationPanelViewController extends PanelViewController { mQsExpandImmediate = false; mNotificationStackScrollLayoutController.setShouldShowShelfOnly(false); mTwoFingerQsExpandPossible = false; notifyListenersTrackingHeadsUp(null); updateTrackingHeadsUp(null); mExpandingFromHeadsUp = false; setPanelScrimMinFraction(0.0f); } private void notifyListenersTrackingHeadsUp(ExpandableNotificationRow pickedChild) { private void updateTrackingHeadsUp(@Nullable ExpandableNotificationRow pickedChild) { mTrackedHeadsUpNotification = pickedChild; for (int i = 0; i < mTrackingHeadsUpListeners.size(); i++) { Consumer<ExpandableNotificationRow> listener = mTrackingHeadsUpListeners.get(i); listener.accept(pickedChild); } } @Nullable public ExpandableNotificationRow getTrackedHeadsUpNotification() { return mTrackedHeadsUpNotification; } private void setListening(boolean listening) { mKeyguardStatusBarViewController.setBatteryListening(listening); if (mQs == null) return; Loading Loading @@ -3298,7 +3309,7 @@ public class NotificationPanelViewController extends PanelViewController { public void setTrackedHeadsUp(ExpandableNotificationRow pickedChild) { if (pickedChild != null) { notifyListenersTrackingHeadsUp(pickedChild); updateTrackingHeadsUp(pickedChild); mExpandingFromHeadsUp = true; } // otherwise we update the state when the expansion is finished Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +0 −4 Original line number Diff line number Diff line Loading @@ -1164,7 +1164,6 @@ public class StatusBar extends SystemUI implements mNotificationPanelViewController.updatePanelExpansionAndVisibility(); setBouncerShowingForStatusBarComponents(mBouncerShowing); HeadsUpAppearanceController oldController = mHeadsUpAppearanceController; if (mHeadsUpAppearanceController != null) { // This view is being recreated, let's destroy the old one // TODO(b/205609837): Automatically destroy the old controller so that this Loading @@ -1175,9 +1174,6 @@ public class StatusBar extends SystemUI implements // TODO(b/205609837): Migrate this to StatusBarFragmentComponent. mHeadsUpAppearanceController = statusBarFragmentComponent.getHeadsUpAppearanceController(); // TODO(b/205609837): Delete this readFrom method so that this class doesn't // need to hold a reference to the old controller. mHeadsUpAppearanceController.readFrom(oldController); mLightsOutNotifController.setLightsOutNotifView( mStatusBarView.findViewById(R.id.notification_lights_out)); Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +8 −0 Original line number Diff line number Diff line Loading @@ -6092,6 +6092,14 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable return mExpandHelperCallback; } float getAppearFraction() { return mLastSentAppear; } float getExpandedHeight() { return mLastSentExpandedHeight; } /** Enum for selecting some or all notification rows (does not included non-notif views). */ @Retention(SOURCE) @IntDef({ROWS_ALL, ROWS_HIGH_PRIORITY, ROWS_GENTLE}) Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +8 −0 Original line number Diff line number Diff line Loading @@ -858,6 +858,14 @@ public class NotificationStackScrollLayoutController { mView.setHeadsUpAppearanceController(controller); } public float getAppearFraction() { return mView.getAppearFraction(); } public float getExpandedHeight() { return mView.getExpandedHeight(); } public void requestLayout() { mView.requestLayout(); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java +19 −17 Original line number Diff line number Diff line Loading @@ -72,8 +72,6 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, @VisibleForTesting float mExpandedHeight; @VisibleForTesting boolean mIsExpanded; @VisibleForTesting float mAppearFraction; private ExpandableNotificationRow mTrackedChild; private boolean mShown; Loading Loading @@ -134,6 +132,15 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, mCenteredIconView = centeredIconView; headsUpStatusBarView.setOnDrawingRectChangedListener( () -> updateIsolatedIconLocation(true /* requireUpdate */)); // 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 // changes). We need to re-fetch these values since they're used to correctly display the // HUN during this shade expansion. mTrackedChild = notificationPanelViewController.getTrackedHeadsUpNotification(); mAppearFraction = stackScrollerController.getAppearFraction(); mExpandedHeight = stackScrollerController.getExpandedHeight(); mStackScrollerController = stackScrollerController; mNotificationPanelViewController = notificationPanelViewController; notificationPanelViewController.addTrackingHeadsUpListener(mSetTrackingHeadsUp); Loading Loading @@ -201,12 +208,12 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, // no heads up anymore, lets start the disappear animation setShown(false); animateIsolation = !mIsExpanded; animateIsolation = !isExpanded(); } else if (previousEntry == null) { // We now have a headsUp and didn't have one before. Let's start the disappear // animation setShown(true); animateIsolation = !mIsExpanded; animateIsolation = !isExpanded(); } updateIsolatedIconLocation(false /* requireUpdate */); mNotificationIconAreaController.showIconIsolated(newEntry == null ? null Loading Loading @@ -319,7 +326,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, */ public boolean shouldBeVisible() { boolean notificationsShown = !mWakeUpCoordinator.getNotificationsFullyHidden(); boolean canShow = !mIsExpanded && notificationsShown; boolean canShow = !isExpanded() && notificationsShown; if (mBypassController.getBypassEnabled() && (mStatusBarStateController.getState() == StatusBarState.KEYGUARD || mKeyguardStateController.isKeyguardGoingAway()) Loading @@ -337,17 +344,17 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, public void setAppearFraction(float expandedHeight, float appearFraction) { boolean changed = expandedHeight != mExpandedHeight; boolean oldIsExpanded = isExpanded(); mExpandedHeight = expandedHeight; mAppearFraction = appearFraction; boolean isExpanded = expandedHeight > 0; // We only notify if the expandedHeight changed and not on the appearFraction, since // otherwise we may run into an infinite loop where the panel and this are constantly // updating themselves over just a small fraction if (changed) { updateHeadsUpHeaders(); } if (isExpanded != mIsExpanded) { mIsExpanded = isExpanded; if (isExpanded() != oldIsExpanded) { updateTopEntry(); } } Loading @@ -367,6 +374,10 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, } } private boolean isExpanded() { return mExpandedHeight > 0; } private void updateHeadsUpHeaders() { mHeadsUpManager.getAllEntries().forEach(entry -> { updateHeader(entry); Loading @@ -392,15 +403,6 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, updateTopEntry(); } void readFrom(HeadsUpAppearanceController oldController) { if (oldController != null) { mTrackedChild = oldController.mTrackedChild; mExpandedHeight = oldController.mExpandedHeight; mIsExpanded = oldController.mIsExpanded; mAppearFraction = oldController.mAppearFraction; } } @Override public void onFullyHiddenChanged(boolean isFullyHidden) { updateTopEntry(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +17 −6 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.FrameLayout; import androidx.annotation.Nullable; import androidx.constraintlayout.widget.ConstraintSet; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -451,9 +452,13 @@ public class NotificationPanelViewController extends PanelViewController { private boolean mUserSetupComplete; private boolean mHideIconsDuringLaunchAnimation = true; private int mStackScrollerMeasuringPass; private ArrayList<Consumer<ExpandableNotificationRow>> mTrackingHeadsUpListeners = new ArrayList<>(); /** * Non-null if there's a heads-up notification that we're currently tracking the position of. */ @Nullable private ExpandableNotificationRow mTrackedHeadsUpNotification; private final ArrayList<Consumer<ExpandableNotificationRow>> mTrackingHeadsUpListeners = new ArrayList<>(); private HeadsUpAppearanceController mHeadsUpAppearanceController; private int mPanelAlpha; Loading Loading @@ -3050,18 +3055,24 @@ public class NotificationPanelViewController extends PanelViewController { mQsExpandImmediate = false; mNotificationStackScrollLayoutController.setShouldShowShelfOnly(false); mTwoFingerQsExpandPossible = false; notifyListenersTrackingHeadsUp(null); updateTrackingHeadsUp(null); mExpandingFromHeadsUp = false; setPanelScrimMinFraction(0.0f); } private void notifyListenersTrackingHeadsUp(ExpandableNotificationRow pickedChild) { private void updateTrackingHeadsUp(@Nullable ExpandableNotificationRow pickedChild) { mTrackedHeadsUpNotification = pickedChild; for (int i = 0; i < mTrackingHeadsUpListeners.size(); i++) { Consumer<ExpandableNotificationRow> listener = mTrackingHeadsUpListeners.get(i); listener.accept(pickedChild); } } @Nullable public ExpandableNotificationRow getTrackedHeadsUpNotification() { return mTrackedHeadsUpNotification; } private void setListening(boolean listening) { mKeyguardStatusBarViewController.setBatteryListening(listening); if (mQs == null) return; Loading Loading @@ -3298,7 +3309,7 @@ public class NotificationPanelViewController extends PanelViewController { public void setTrackedHeadsUp(ExpandableNotificationRow pickedChild) { if (pickedChild != null) { notifyListenersTrackingHeadsUp(pickedChild); updateTrackingHeadsUp(pickedChild); mExpandingFromHeadsUp = true; } // otherwise we update the state when the expansion is finished Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +0 −4 Original line number Diff line number Diff line Loading @@ -1164,7 +1164,6 @@ public class StatusBar extends SystemUI implements mNotificationPanelViewController.updatePanelExpansionAndVisibility(); setBouncerShowingForStatusBarComponents(mBouncerShowing); HeadsUpAppearanceController oldController = mHeadsUpAppearanceController; if (mHeadsUpAppearanceController != null) { // This view is being recreated, let's destroy the old one // TODO(b/205609837): Automatically destroy the old controller so that this Loading @@ -1175,9 +1174,6 @@ public class StatusBar extends SystemUI implements // TODO(b/205609837): Migrate this to StatusBarFragmentComponent. mHeadsUpAppearanceController = statusBarFragmentComponent.getHeadsUpAppearanceController(); // TODO(b/205609837): Delete this readFrom method so that this class doesn't // need to hold a reference to the old controller. mHeadsUpAppearanceController.readFrom(oldController); mLightsOutNotifController.setLightsOutNotifView( mStatusBarView.findViewById(R.id.notification_lights_out)); Loading