Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java +11 −1 Original line number Original line Diff line number Diff line Loading @@ -95,6 +95,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange private boolean mWasPulsingOnThisFrame; private boolean mWasPulsingOnThisFrame; private boolean mWakeAndUnlockRunning; private boolean mWakeAndUnlockRunning; private boolean mKeyguardShowing; private boolean mKeyguardShowing; private boolean mShowingLaunchAffordance; private final KeyguardMonitor.Callback mKeyguardMonitorCallback = private final KeyguardMonitor.Callback mKeyguardMonitorCallback = new KeyguardMonitor.Callback() { new KeyguardMonitor.Callback() { Loading Loading @@ -299,7 +300,8 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange } } boolean onAodNotPulsingOrDocked = mDozing && (!mPulsing || mDocked); boolean onAodNotPulsingOrDocked = mDozing && (!mPulsing || mDocked); boolean invisible = onAodNotPulsingOrDocked || mWakeAndUnlockRunning; boolean invisible = onAodNotPulsingOrDocked || mWakeAndUnlockRunning || mShowingLaunchAffordance; setVisibility(invisible ? INVISIBLE : VISIBLE); setVisibility(invisible ? INVISIBLE : VISIBLE); updateClickability(); updateClickability(); } } Loading Loading @@ -484,6 +486,14 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange update(); update(); } } /** * When we're launching an affordance, like double pressing power to open camera. */ public void onShowingLaunchAffordanceChanged(boolean showing) { mShowingLaunchAffordance = showing; update(); } /** /** * Called whenever the scrims become opaque, transparent or semi-transparent. * Called whenever the scrims become opaque, transparent or semi-transparent. */ */ Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +14 −1 Original line number Original line Diff line number Diff line Loading @@ -151,7 +151,8 @@ public class NotificationPanelView extends PanelView implements private final NotificationWakeUpCoordinator mWakeUpCoordinator; private final NotificationWakeUpCoordinator mWakeUpCoordinator; private final PulseExpansionHandler mPulseExpansionHandler; private final PulseExpansionHandler mPulseExpansionHandler; private KeyguardAffordanceHelper mAffordanceHelper; @VisibleForTesting protected KeyguardAffordanceHelper mAffordanceHelper; private KeyguardUserSwitcher mKeyguardUserSwitcher; private KeyguardUserSwitcher mKeyguardUserSwitcher; @VisibleForTesting @VisibleForTesting protected KeyguardStatusBarView mKeyguardStatusBar; protected KeyguardStatusBarView mKeyguardStatusBar; Loading Loading @@ -340,6 +341,7 @@ public class NotificationPanelView extends PanelView implements */ */ private int mThemeResId; private int mThemeResId; private KeyguardIndicationController mKeyguardIndicationController; private KeyguardIndicationController mKeyguardIndicationController; private Consumer<Boolean> mAffordanceLaunchListener; @Inject @Inject public NotificationPanelView(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs, public NotificationPanelView(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs, Loading Loading @@ -447,6 +449,14 @@ public class NotificationPanelView extends PanelView implements R.dimen.qs_notification_padding); R.dimen.qs_notification_padding); } } /** * @see #launchCamera(boolean, int) * @see #setLaunchingAffordance(boolean) */ public void setLaunchAffordanceListener(Consumer<Boolean> listener) { mAffordanceLaunchListener = listener; } public void updateResources() { public void updateResources() { Resources res = getResources(); Resources res = getResources(); int qsWidth = res.getDimensionPixelSize(R.dimen.qs_panel_width); int qsWidth = res.getDimensionPixelSize(R.dimen.qs_panel_width); Loading Loading @@ -2743,6 +2753,9 @@ public class NotificationPanelView extends PanelView implements private void setLaunchingAffordance(boolean launchingAffordance) { private void setLaunchingAffordance(boolean launchingAffordance) { getLeftIcon().setLaunchingAffordance(launchingAffordance); getLeftIcon().setLaunchingAffordance(launchingAffordance); getRightIcon().setLaunchingAffordance(launchingAffordance); getRightIcon().setLaunchingAffordance(launchingAffordance); if (mAffordanceLaunchListener != null) { mAffordanceLaunchListener.accept(launchingAffordance); } } } /** /** Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -951,6 +951,9 @@ public class StatusBar extends SystemUI implements DemoMode, createUserSwitcher(); createUserSwitcher(); } } mNotificationPanel.setLaunchAffordanceListener( mStatusBarWindow::onShowingLaunchAffordanceChanged); // Set up the quick settings tile panel // Set up the quick settings tile panel View container = mStatusBarWindow.findViewById(R.id.qs_frame); View container = mStatusBarWindow.findViewById(R.id.qs_frame); if (container != null) { if (container != null) { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +9 −0 Original line number Original line Diff line number Diff line Loading @@ -510,6 +510,15 @@ public class StatusBarWindowView extends FrameLayout { } } } } /** * When we're launching an affordance, like double pressing power to open camera. */ public void onShowingLaunchAffordanceChanged(boolean showing) { if (mLockIcon != null) { mLockIcon.onShowingLaunchAffordanceChanged(showing); } } public class LayoutParams extends FrameLayout.LayoutParams { public class LayoutParams extends FrameLayout.LayoutParams { public boolean ignoreRightInset; public boolean ignoreRightInset; Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +24 −0 Original line number Original line Diff line number Diff line Loading @@ -21,9 +21,11 @@ import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.mockito.Mockito.when; import android.app.StatusBarManager; import android.testing.AndroidTestingRunner; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.testing.TestableLooper; import android.view.MotionEvent; import android.view.MotionEvent; Loading @@ -36,6 +38,7 @@ import com.android.systemui.SystemUIFactory; import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.AmbientPulseManager; import com.android.systemui.statusbar.AmbientPulseManager; import com.android.systemui.statusbar.KeyguardAffordanceView; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.PulseExpansionHandler; import com.android.systemui.statusbar.PulseExpansionHandler; Loading @@ -55,6 +58,8 @@ import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations; import java.util.function.Consumer; @SmallTest @SmallTest @RunWith(AndroidTestingRunner.class) @RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper @TestableLooper.RunWithLooper Loading Loading @@ -90,6 +95,8 @@ public class NotificationPanelViewTest extends SysuiTestCase { private HeadsUpTouchHelper.Callback mHeadsUpCallback; private HeadsUpTouchHelper.Callback mHeadsUpCallback; @Mock @Mock private PanelBar mPanelBar; private PanelBar mPanelBar; @Mock private KeyguardAffordanceHelper mAffordanceHelper; private NotificationPanelView mNotificationPanelView; private NotificationPanelView mNotificationPanelView; @Before @Before Loading @@ -112,6 +119,9 @@ public class NotificationPanelViewTest extends SysuiTestCase { mNotificationPanelView = new TestableNotificationPanelView(coordinator, expansionHandler); mNotificationPanelView = new TestableNotificationPanelView(coordinator, expansionHandler); mNotificationPanelView.setHeadsUpManager(mHeadsUpManager); mNotificationPanelView.setHeadsUpManager(mHeadsUpManager); mNotificationPanelView.setBar(mPanelBar); mNotificationPanelView.setBar(mPanelBar); when(mKeyguardBottomArea.getLeftView()).thenReturn(mock(KeyguardAffordanceView.class)); when(mKeyguardBottomArea.getRightView()).thenReturn(mock(KeyguardAffordanceView.class)); } } @Test @Test Loading @@ -128,6 +138,19 @@ public class NotificationPanelViewTest extends SysuiTestCase { assertThat((int) mNotificationPanelView.getExpandedHeight()).isEqualTo(200); assertThat((int) mNotificationPanelView.getExpandedHeight()).isEqualTo(200); } } @Test public void testAffordanceLaunchingListener() { Consumer<Boolean> listener = spy((showing) -> { }); mNotificationPanelView.setExpandedFraction(1f); mNotificationPanelView.setLaunchAffordanceListener(listener); mNotificationPanelView.launchCamera(false /* animate */, StatusBarManager.CAMERA_LAUNCH_SOURCE_POWER_DOUBLE_TAP); verify(listener).accept(eq(true)); mNotificationPanelView.onAffordanceLaunchEnded(); verify(listener).accept(eq(false)); } @Test @Test public void testOnTouchEvent_expansionCanBeBlocked() { public void testOnTouchEvent_expansionCanBeBlocked() { mNotificationPanelView.onTouchEvent(MotionEvent.obtain(0L /* downTime */, mNotificationPanelView.onTouchEvent(MotionEvent.obtain(0L /* downTime */, Loading Loading @@ -166,6 +189,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { mKeyguardBottomArea = NotificationPanelViewTest.this.mKeyguardBottomArea; mKeyguardBottomArea = NotificationPanelViewTest.this.mKeyguardBottomArea; mBigClockContainer = NotificationPanelViewTest.this.mBigClockContainer; mBigClockContainer = NotificationPanelViewTest.this.mBigClockContainer; mQsFrame = NotificationPanelViewTest.this.mQsFrame; mQsFrame = NotificationPanelViewTest.this.mQsFrame; mAffordanceHelper = NotificationPanelViewTest.this.mAffordanceHelper; initDependencies(NotificationPanelViewTest.this.mStatusBar, initDependencies(NotificationPanelViewTest.this.mStatusBar, NotificationPanelViewTest.this.mGroupManager, NotificationPanelViewTest.this.mGroupManager, NotificationPanelViewTest.this.mNotificationShelf, NotificationPanelViewTest.this.mNotificationShelf, Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java +11 −1 Original line number Original line Diff line number Diff line Loading @@ -95,6 +95,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange private boolean mWasPulsingOnThisFrame; private boolean mWasPulsingOnThisFrame; private boolean mWakeAndUnlockRunning; private boolean mWakeAndUnlockRunning; private boolean mKeyguardShowing; private boolean mKeyguardShowing; private boolean mShowingLaunchAffordance; private final KeyguardMonitor.Callback mKeyguardMonitorCallback = private final KeyguardMonitor.Callback mKeyguardMonitorCallback = new KeyguardMonitor.Callback() { new KeyguardMonitor.Callback() { Loading Loading @@ -299,7 +300,8 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange } } boolean onAodNotPulsingOrDocked = mDozing && (!mPulsing || mDocked); boolean onAodNotPulsingOrDocked = mDozing && (!mPulsing || mDocked); boolean invisible = onAodNotPulsingOrDocked || mWakeAndUnlockRunning; boolean invisible = onAodNotPulsingOrDocked || mWakeAndUnlockRunning || mShowingLaunchAffordance; setVisibility(invisible ? INVISIBLE : VISIBLE); setVisibility(invisible ? INVISIBLE : VISIBLE); updateClickability(); updateClickability(); } } Loading Loading @@ -484,6 +486,14 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange update(); update(); } } /** * When we're launching an affordance, like double pressing power to open camera. */ public void onShowingLaunchAffordanceChanged(boolean showing) { mShowingLaunchAffordance = showing; update(); } /** /** * Called whenever the scrims become opaque, transparent or semi-transparent. * Called whenever the scrims become opaque, transparent or semi-transparent. */ */ Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +14 −1 Original line number Original line Diff line number Diff line Loading @@ -151,7 +151,8 @@ public class NotificationPanelView extends PanelView implements private final NotificationWakeUpCoordinator mWakeUpCoordinator; private final NotificationWakeUpCoordinator mWakeUpCoordinator; private final PulseExpansionHandler mPulseExpansionHandler; private final PulseExpansionHandler mPulseExpansionHandler; private KeyguardAffordanceHelper mAffordanceHelper; @VisibleForTesting protected KeyguardAffordanceHelper mAffordanceHelper; private KeyguardUserSwitcher mKeyguardUserSwitcher; private KeyguardUserSwitcher mKeyguardUserSwitcher; @VisibleForTesting @VisibleForTesting protected KeyguardStatusBarView mKeyguardStatusBar; protected KeyguardStatusBarView mKeyguardStatusBar; Loading Loading @@ -340,6 +341,7 @@ public class NotificationPanelView extends PanelView implements */ */ private int mThemeResId; private int mThemeResId; private KeyguardIndicationController mKeyguardIndicationController; private KeyguardIndicationController mKeyguardIndicationController; private Consumer<Boolean> mAffordanceLaunchListener; @Inject @Inject public NotificationPanelView(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs, public NotificationPanelView(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs, Loading Loading @@ -447,6 +449,14 @@ public class NotificationPanelView extends PanelView implements R.dimen.qs_notification_padding); R.dimen.qs_notification_padding); } } /** * @see #launchCamera(boolean, int) * @see #setLaunchingAffordance(boolean) */ public void setLaunchAffordanceListener(Consumer<Boolean> listener) { mAffordanceLaunchListener = listener; } public void updateResources() { public void updateResources() { Resources res = getResources(); Resources res = getResources(); int qsWidth = res.getDimensionPixelSize(R.dimen.qs_panel_width); int qsWidth = res.getDimensionPixelSize(R.dimen.qs_panel_width); Loading Loading @@ -2743,6 +2753,9 @@ public class NotificationPanelView extends PanelView implements private void setLaunchingAffordance(boolean launchingAffordance) { private void setLaunchingAffordance(boolean launchingAffordance) { getLeftIcon().setLaunchingAffordance(launchingAffordance); getLeftIcon().setLaunchingAffordance(launchingAffordance); getRightIcon().setLaunchingAffordance(launchingAffordance); getRightIcon().setLaunchingAffordance(launchingAffordance); if (mAffordanceLaunchListener != null) { mAffordanceLaunchListener.accept(launchingAffordance); } } } /** /** Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -951,6 +951,9 @@ public class StatusBar extends SystemUI implements DemoMode, createUserSwitcher(); createUserSwitcher(); } } mNotificationPanel.setLaunchAffordanceListener( mStatusBarWindow::onShowingLaunchAffordanceChanged); // Set up the quick settings tile panel // Set up the quick settings tile panel View container = mStatusBarWindow.findViewById(R.id.qs_frame); View container = mStatusBarWindow.findViewById(R.id.qs_frame); if (container != null) { if (container != null) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +9 −0 Original line number Original line Diff line number Diff line Loading @@ -510,6 +510,15 @@ public class StatusBarWindowView extends FrameLayout { } } } } /** * When we're launching an affordance, like double pressing power to open camera. */ public void onShowingLaunchAffordanceChanged(boolean showing) { if (mLockIcon != null) { mLockIcon.onShowingLaunchAffordanceChanged(showing); } } public class LayoutParams extends FrameLayout.LayoutParams { public class LayoutParams extends FrameLayout.LayoutParams { public boolean ignoreRightInset; public boolean ignoreRightInset; Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +24 −0 Original line number Original line Diff line number Diff line Loading @@ -21,9 +21,11 @@ import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.mockito.Mockito.when; import android.app.StatusBarManager; import android.testing.AndroidTestingRunner; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.testing.TestableLooper; import android.view.MotionEvent; import android.view.MotionEvent; Loading @@ -36,6 +38,7 @@ import com.android.systemui.SystemUIFactory; import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.AmbientPulseManager; import com.android.systemui.statusbar.AmbientPulseManager; import com.android.systemui.statusbar.KeyguardAffordanceView; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.PulseExpansionHandler; import com.android.systemui.statusbar.PulseExpansionHandler; Loading @@ -55,6 +58,8 @@ import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations; import java.util.function.Consumer; @SmallTest @SmallTest @RunWith(AndroidTestingRunner.class) @RunWith(AndroidTestingRunner.class) @TestableLooper.RunWithLooper @TestableLooper.RunWithLooper Loading Loading @@ -90,6 +95,8 @@ public class NotificationPanelViewTest extends SysuiTestCase { private HeadsUpTouchHelper.Callback mHeadsUpCallback; private HeadsUpTouchHelper.Callback mHeadsUpCallback; @Mock @Mock private PanelBar mPanelBar; private PanelBar mPanelBar; @Mock private KeyguardAffordanceHelper mAffordanceHelper; private NotificationPanelView mNotificationPanelView; private NotificationPanelView mNotificationPanelView; @Before @Before Loading @@ -112,6 +119,9 @@ public class NotificationPanelViewTest extends SysuiTestCase { mNotificationPanelView = new TestableNotificationPanelView(coordinator, expansionHandler); mNotificationPanelView = new TestableNotificationPanelView(coordinator, expansionHandler); mNotificationPanelView.setHeadsUpManager(mHeadsUpManager); mNotificationPanelView.setHeadsUpManager(mHeadsUpManager); mNotificationPanelView.setBar(mPanelBar); mNotificationPanelView.setBar(mPanelBar); when(mKeyguardBottomArea.getLeftView()).thenReturn(mock(KeyguardAffordanceView.class)); when(mKeyguardBottomArea.getRightView()).thenReturn(mock(KeyguardAffordanceView.class)); } } @Test @Test Loading @@ -128,6 +138,19 @@ public class NotificationPanelViewTest extends SysuiTestCase { assertThat((int) mNotificationPanelView.getExpandedHeight()).isEqualTo(200); assertThat((int) mNotificationPanelView.getExpandedHeight()).isEqualTo(200); } } @Test public void testAffordanceLaunchingListener() { Consumer<Boolean> listener = spy((showing) -> { }); mNotificationPanelView.setExpandedFraction(1f); mNotificationPanelView.setLaunchAffordanceListener(listener); mNotificationPanelView.launchCamera(false /* animate */, StatusBarManager.CAMERA_LAUNCH_SOURCE_POWER_DOUBLE_TAP); verify(listener).accept(eq(true)); mNotificationPanelView.onAffordanceLaunchEnded(); verify(listener).accept(eq(false)); } @Test @Test public void testOnTouchEvent_expansionCanBeBlocked() { public void testOnTouchEvent_expansionCanBeBlocked() { mNotificationPanelView.onTouchEvent(MotionEvent.obtain(0L /* downTime */, mNotificationPanelView.onTouchEvent(MotionEvent.obtain(0L /* downTime */, Loading Loading @@ -166,6 +189,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { mKeyguardBottomArea = NotificationPanelViewTest.this.mKeyguardBottomArea; mKeyguardBottomArea = NotificationPanelViewTest.this.mKeyguardBottomArea; mBigClockContainer = NotificationPanelViewTest.this.mBigClockContainer; mBigClockContainer = NotificationPanelViewTest.this.mBigClockContainer; mQsFrame = NotificationPanelViewTest.this.mQsFrame; mQsFrame = NotificationPanelViewTest.this.mQsFrame; mAffordanceHelper = NotificationPanelViewTest.this.mAffordanceHelper; initDependencies(NotificationPanelViewTest.this.mStatusBar, initDependencies(NotificationPanelViewTest.this.mStatusBar, NotificationPanelViewTest.this.mGroupManager, NotificationPanelViewTest.this.mGroupManager, NotificationPanelViewTest.this.mNotificationShelf, NotificationPanelViewTest.this.mNotificationShelf, Loading