Loading packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +7 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.os.Bundle; import android.os.Handler; import android.service.notification.StatusBarNotification; import android.support.annotation.NonNull; import android.support.annotation.VisibleForTesting; import android.util.AttributeSet; import android.util.FloatProperty; import android.util.Log; Loading Loading @@ -3543,6 +3544,7 @@ public class NotificationStackScrollLayout extends ViewGroup * See {@link AmbientState#setDimmed}. */ public void setDimmed(boolean dimmed, boolean animate) { dimmed &= onKeyguard(); mAmbientState.setDimmed(dimmed); if (animate && mAnimationsEnabled) { mDimmedNeedsAnimation = true; Loading @@ -3554,6 +3556,11 @@ public class NotificationStackScrollLayout extends ViewGroup requestChildrenUpdate(); } @VisibleForTesting boolean isDimmed() { return mAmbientState.isDimmed(); } private void setDimAmount(float dimAmount) { mDimAmount = dimAmount; updateBackgroundDimming(); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayoutTest.java 0 → 100644 +64 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 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.stack; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import android.annotation.UiThread; import android.support.test.annotation.UiThreadTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.view.NotificationHeaderView; import android.view.View; import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.NotificationTestHelper; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.phone.StatusBar; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @SmallTest @RunWith(AndroidJUnit4.class) public class NotificationStackScrollLayoutTest extends SysuiTestCase { private NotificationStackScrollLayout mStackScroller; private StatusBar mBar; @Before @UiThreadTest public void setUp() throws Exception { mStackScroller = new NotificationStackScrollLayout(getContext()); mBar = mock(StatusBar.class); mStackScroller.setStatusBar(mBar); mStackScroller.setScrimController(mock(ScrimController.class)); } @Test public void testNotDimmedOnKeyguard() { when(mBar.getBarState()).thenReturn(StatusBarState.SHADE); mStackScroller.setDimmed(true /* dimmed */, false /* animate */); mStackScroller.setDimmed(true /* dimmed */, true /* animate */); Assert.assertFalse(mStackScroller.isDimmed()); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +7 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.os.Bundle; import android.os.Handler; import android.service.notification.StatusBarNotification; import android.support.annotation.NonNull; import android.support.annotation.VisibleForTesting; import android.util.AttributeSet; import android.util.FloatProperty; import android.util.Log; Loading Loading @@ -3543,6 +3544,7 @@ public class NotificationStackScrollLayout extends ViewGroup * See {@link AmbientState#setDimmed}. */ public void setDimmed(boolean dimmed, boolean animate) { dimmed &= onKeyguard(); mAmbientState.setDimmed(dimmed); if (animate && mAnimationsEnabled) { mDimmedNeedsAnimation = true; Loading @@ -3554,6 +3556,11 @@ public class NotificationStackScrollLayout extends ViewGroup requestChildrenUpdate(); } @VisibleForTesting boolean isDimmed() { return mAmbientState.isDimmed(); } private void setDimAmount(float dimAmount) { mDimAmount = dimAmount; updateBackgroundDimming(); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayoutTest.java 0 → 100644 +64 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 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.stack; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import android.annotation.UiThread; import android.support.test.annotation.UiThreadTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.view.NotificationHeaderView; import android.view.View; import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.NotificationTestHelper; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.phone.StatusBar; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @SmallTest @RunWith(AndroidJUnit4.class) public class NotificationStackScrollLayoutTest extends SysuiTestCase { private NotificationStackScrollLayout mStackScroller; private StatusBar mBar; @Before @UiThreadTest public void setUp() throws Exception { mStackScroller = new NotificationStackScrollLayout(getContext()); mBar = mock(StatusBar.class); mStackScroller.setStatusBar(mBar); mStackScroller.setScrimController(mock(ScrimController.class)); } @Test public void testNotDimmedOnKeyguard() { when(mBar.getBarState()).thenReturn(StatusBarState.SHADE); mStackScroller.setDimmed(true /* dimmed */, false /* animate */); mStackScroller.setDimmed(true /* dimmed */, true /* animate */); Assert.assertFalse(mStackScroller.isDimmed()); } }