Fixed a few issues around notifications and density changes
Because density and font size changes would actually be delivered by Dependency, the SystemUI could actually get the onDensityChanged after the onDensityOrFontScaleChanged. Let's make sure all configuration changes now go through the same listener. This also ensures that the caching of the icon offsets is done correctly, since the statusbar layout may actually be laid out later then the shelf. Test: change density from small to large, observe normal layout Change-Id: I313b5334ccbb57f7929fe03dbd5119396123b137 Fixes: 35678628
This commit is contained in:
@@ -42,13 +42,6 @@ public class SystemBars extends SystemUI {
|
||||
createStatusBarFromConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onConfigurationChanged(Configuration newConfig) {
|
||||
if (mStatusBar != null) {
|
||||
mStatusBar.onConfigurationChanged(newConfig);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
if (mStatusBar != null) {
|
||||
|
||||
@@ -41,7 +41,8 @@ import com.android.systemui.statusbar.stack.ViewState;
|
||||
* A notification shelf view that is placed inside the notification scroller. It manages the
|
||||
* overflow icons that don't fit into the regular list anymore.
|
||||
*/
|
||||
public class NotificationShelf extends ActivatableNotificationView {
|
||||
public class NotificationShelf extends ActivatableNotificationView implements
|
||||
View.OnLayoutChangeListener {
|
||||
|
||||
public static final boolean SHOW_AMBIENT_ICONS = true;
|
||||
private static final boolean USE_ANIMATIONS_WHEN_OPENING =
|
||||
@@ -494,6 +495,10 @@ public class NotificationShelf extends ActivatableNotificationView {
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
updateRelativeOffset();
|
||||
}
|
||||
|
||||
private void updateRelativeOffset() {
|
||||
mCollapsedIcons.getLocationOnScreen(mTmp);
|
||||
mRelativeOffset = mTmp[0];
|
||||
getLocationOnScreen(mTmp);
|
||||
@@ -560,6 +565,7 @@ public class NotificationShelf extends ActivatableNotificationView {
|
||||
|
||||
public void setCollapsedIcons(NotificationIconContainer collapsedIcons) {
|
||||
mCollapsedIcons = collapsedIcons;
|
||||
mCollapsedIcons.addOnLayoutChangeListener(this);
|
||||
}
|
||||
|
||||
public void setStatusBarState(int statusBarState) {
|
||||
@@ -595,6 +601,12 @@ public class NotificationShelf extends ActivatableNotificationView {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft,
|
||||
int oldTop, int oldRight, int oldBottom) {
|
||||
updateRelativeOffset();
|
||||
}
|
||||
|
||||
private class ShelfState extends ExpandableViewState {
|
||||
private float openedAmount;
|
||||
private boolean hasItemsInStableShelf;
|
||||
|
||||
@@ -612,8 +612,10 @@ public class StatusBarIconView extends AnimatedImageView {
|
||||
}
|
||||
|
||||
public void setIconAppearAmount(float iconAppearAmount) {
|
||||
mIconAppearAmount = iconAppearAmount;
|
||||
invalidate();
|
||||
if (mIconAppearAmount != iconAppearAmount) {
|
||||
mIconAppearAmount = iconAppearAmount;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public float getIconAppearAmount() {
|
||||
@@ -625,8 +627,10 @@ public class StatusBarIconView extends AnimatedImageView {
|
||||
}
|
||||
|
||||
public void setDotAppearAmount(float dotAppearAmount) {
|
||||
mDotAppearAmount = dotAppearAmount;
|
||||
invalidate();
|
||||
if (mDotAppearAmount != dotAppearAmount) {
|
||||
mDotAppearAmount = dotAppearAmount;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -79,7 +79,9 @@ public class NotificationIconAreaController implements DarkReceiver {
|
||||
for (int i = 0; i < mNotificationIcons.getChildCount(); i++) {
|
||||
View child = mNotificationIcons.getChildAt(i);
|
||||
child.setLayoutParams(params);
|
||||
child = mShelfIcons.getChildAt(i);
|
||||
}
|
||||
for (int i = 0; i < mShelfIcons.getChildCount(); i++) {
|
||||
View child = mShelfIcons.getChildAt(i);
|
||||
child.setLayoutParams(params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,6 @@ import com.android.systemui.statusbar.ScrimView;
|
||||
import com.android.systemui.statusbar.SignalClusterView;
|
||||
import com.android.systemui.statusbar.StatusBarState;
|
||||
import com.android.systemui.statusbar.notification.InflationException;
|
||||
import com.android.systemui.statusbar.notification.NotificationInflater;
|
||||
import com.android.systemui.statusbar.notification.VisualStabilityManager;
|
||||
import com.android.systemui.statusbar.phone.StatusBarIconController.IconManager;
|
||||
import com.android.systemui.statusbar.phone.UnlockMethodCache.OnUnlockMethodChangedListener;
|
||||
@@ -717,7 +716,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
private LogMaker mStatusBarStateLog;
|
||||
private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
|
||||
private NotificationIconAreaController mNotificationIconAreaController;
|
||||
private ConfigurationListener mDensityChangeListener;
|
||||
private ConfigurationListener mConfigurationListener;
|
||||
private InflationExceptionHandler mInflationExceptionHandler = this::handleInflationException;
|
||||
|
||||
private void recycleAllVisibilityObjects(ArraySet<NotificationVisibility> array) {
|
||||
@@ -945,13 +944,18 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
|
||||
Dependency.get(ActivityStarterDelegate.class).setActivityStarterImpl(this);
|
||||
|
||||
mDensityChangeListener = new ConfigurationListener() {
|
||||
mConfigurationListener = new ConfigurationListener() {
|
||||
@Override
|
||||
public void onConfigChanged(Configuration newConfig) {
|
||||
StatusBar.this.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDensityOrFontScaleChanged() {
|
||||
StatusBar.this.onDensityOrFontScaleChanged();
|
||||
}
|
||||
};
|
||||
Dependency.get(ConfigurationController.class).addCallback(mDensityChangeListener);
|
||||
Dependency.get(ConfigurationController.class).addCallback(mConfigurationListener);
|
||||
}
|
||||
|
||||
protected void createIconController() {
|
||||
@@ -3910,7 +3914,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
}
|
||||
Dependency.get(ActivityStarterDelegate.class).setActivityStarterImpl(null);
|
||||
mDeviceProvisionedController.removeCallback(mUserSetupObserver);
|
||||
Dependency.get(ConfigurationController.class).removeCallback(mDensityChangeListener);
|
||||
Dependency.get(ConfigurationController.class).removeCallback(mConfigurationListener);
|
||||
}
|
||||
|
||||
private boolean mDemoModeAllowed;
|
||||
|
||||
Reference in New Issue
Block a user