Merge "Fixed an issue where groups could stay userlocked" into oc-dev
This commit is contained in:
@@ -813,11 +813,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
|
|
||||||
public void onDensityOrFontScaleChanged() {
|
public void onDensityOrFontScaleChanged() {
|
||||||
initDimens();
|
initDimens();
|
||||||
if (mIsSummaryWithChildren) {
|
// Let's update our childrencontainer. This is intentionally not guarded with
|
||||||
|
// mIsSummaryWithChildren since we might have had children but not anymore.
|
||||||
if (mChildrenContainer != null) {
|
if (mChildrenContainer != null) {
|
||||||
mChildrenContainer.reInflateViews(mExpandClickListener, mEntry.notification);
|
mChildrenContainer.reInflateViews(mExpandClickListener, mEntry.notification);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (mGuts != null) {
|
if (mGuts != null) {
|
||||||
View oldGuts = mGuts;
|
View oldGuts = mGuts;
|
||||||
int index = indexOfChild(oldGuts);
|
int index = indexOfChild(oldGuts);
|
||||||
@@ -1458,9 +1458,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
public void setUserLocked(boolean userLocked) {
|
public void setUserLocked(boolean userLocked) {
|
||||||
mUserLocked = userLocked;
|
mUserLocked = userLocked;
|
||||||
mPrivateLayout.setUserExpanding(userLocked);
|
mPrivateLayout.setUserExpanding(userLocked);
|
||||||
if (mIsSummaryWithChildren) {
|
// This is intentionally not guarded with mIsSummaryWithChildren since we might have had
|
||||||
|
// children but not anymore.
|
||||||
|
if (mChildrenContainer != null) {
|
||||||
mChildrenContainer.setUserLocked(userLocked);
|
mChildrenContainer.setUserLocked(userLocked);
|
||||||
if (userLocked || !isGroupExpanded()) {
|
if (mIsSummaryWithChildren && (userLocked || !isGroupExpanded())) {
|
||||||
updateBackgroundForGroupState();
|
updateBackgroundForGroupState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2189,4 +2191,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
protected void setChildrenContainer(NotificationChildrenContainer childrenContainer) {
|
||||||
|
mChildrenContainer = childrenContainer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.RemoteViews;
|
import android.widget.RemoteViews;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.statusbar.CrossFadeHelper;
|
import com.android.systemui.statusbar.CrossFadeHelper;
|
||||||
import com.android.systemui.statusbar.ExpandableNotificationRow;
|
import com.android.systemui.statusbar.ExpandableNotificationRow;
|
||||||
@@ -1223,4 +1224,9 @@ public class NotificationChildrenContainer extends ViewGroup {
|
|||||||
}
|
}
|
||||||
return getGroupExpandFraction();
|
return getGroupExpandFraction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
public boolean isUserLocked() {
|
||||||
|
return mUserLocked;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,9 @@
|
|||||||
|
|
||||||
package com.android.systemui.statusbar;
|
package com.android.systemui.statusbar;
|
||||||
|
|
||||||
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.test.InstrumentationRegistry;
|
import android.support.test.InstrumentationRegistry;
|
||||||
@@ -26,6 +28,8 @@ import android.support.test.filters.SmallTest;
|
|||||||
import android.support.test.runner.AndroidJUnit4;
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
import com.android.systemui.statusbar.stack.NotificationChildrenContainer;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
@@ -65,4 +69,25 @@ public class ExpandableNotificationRowTest {
|
|||||||
== View.VISIBLE);
|
== View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUserLockedResetEvenWhenNoChildren() {
|
||||||
|
mGroup.setUserLocked(true);
|
||||||
|
mGroup.removeAllChildren();
|
||||||
|
mGroup.setUserLocked(false);
|
||||||
|
Assert.assertFalse("The childrencontainer should not be userlocked but is, the state "
|
||||||
|
+ "seems out of sync.", mGroup.getChildrenContainer().isUserLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testReinflatedOnDensityChange() {
|
||||||
|
mGroup.setUserLocked(true);
|
||||||
|
mGroup.removeAllChildren();
|
||||||
|
mGroup.setUserLocked(false);
|
||||||
|
NotificationChildrenContainer mockContainer = mock(NotificationChildrenContainer.class);
|
||||||
|
mGroup.setChildrenContainer(mockContainer);
|
||||||
|
mGroup.onDensityOrFontScaleChanged();
|
||||||
|
verify(mockContainer).reInflateViews(any(), any());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user