Commit Graph

90 Commits

Author SHA1 Message Date
Dave Mankoff
c195ea80ae Pass FalsingManager down through more classes.
This is the first step in getting the code to inject FalsingManager
into more places via Dagger.

This removes FalsingManagerFactory, replacing it with
calls to Depedency.get() and pushes those calls further
up the stack in hopes that the FalsingManager can be directly
injected where it's needed in the future.

Contains a few random lint cleanups.

Bug: 136279712
Test: atest SystemUITests
Change-Id: Ie24acd33b0d81ae2112aead0c0d5a8658e04994e
2019-07-08 10:21:36 -04:00
Dave Mankoff
468d4f6f79 Add support for FalsingPlugin to supply a replacement FalsingManager.
Bug: 130256776
Test: Manual
Change-Id: Icdf150e6e23d216f04a9243fe57919aa622706d5
2019-05-10 12:14:27 -04:00
Dave Mankoff
dde5ee6953 Change FalsingManager to an interface for easier swapping.
This is a refactor. It touches a lot of files, but zero functionality.
The primary change is changing FalsingManager.getInstance() into
FalsingManagerFactory.getInstance(); chaning FalsingManager into an
interface, and then turning the existing FalsingManager into
FalsingManagerImpl, an implementation of that interface. Other changes
are merely references to those classes.

Bug: 130256776
Test: atest SystemUITests
Change-Id: I5d64a7673e4efc554105dd841b27807361ed3828
2019-05-03 10:13:39 -04:00
Evan Laird
e55c60104a Expose notification guts on menu shown
This change adds a few methods to NotificationMenuRowPlugin so that a
menu row can tell the stack scroller to expose the notification guts
when the menu is fully exposed.

TODO: fix the menu close animation so it happens after the guts open,
and if you close the guts by swiping you can trigger a flicker.

Also there are some things to make lint happy and lots of null checks.

Bug: 127998765
Test: swipe RTL on any notification
Change-Id: I46f7c7dc90032a1914f7b5513bc57e089887c722
(cherry picked from commit 9272fd2f57)
2019-04-04 18:04:44 +00:00
Mady Mellor
8bdeca006e Use fling animation utils for snapChild
Test: manual - swipe open and close the menu beneath the notification shade
      ensure the motion follows finger
Bug: 124097982

Change-Id: I446932d52ccd0d0055d0e37641d9c40c1bd61bd2
2019-02-21 14:11:33 -08:00
Gus Prevas
c4e68d466b Applies friction to non-dismiss drag only after the snap point.
This change modifies SwipeHelper such that the friction applied to a
constrained gesture (i.e. one that won't dismiss the swiped object) is
only applied once the object has been dragged past a threshold defined
by the callback object.  The callback provided by
NotificationStackScrollLayout is modified to set this threshold at the
snap point of the active menu row.

Change-Id: Ide9261682963d3cfaeb470e08393c182d6fa06c6
Fixes: 123021652
Test: atest SystemUITests, manual
2019-01-17 15:45:21 -05:00
Aaron Heuckroth
9dc9d4fbec Fix regression where drag down could start during swipe.
Test: Automated tests pass, manual testing for swipe behavior on lockscreen.

Change-Id: Id9c9b9ccb9102bbdaa9a9ebe76b96beb4060933b
Fixes: 118786971
2018-11-15 11:12:20 -05:00
Dave Mankoff
9c9c28bb5a Merge "Create a way to turn off unlocking on a phone." 2018-11-07 18:53:51 +00:00
Gus Prevas
37d67e207f Disables dismissing notification on leftward swipe.
This change modifies SwipeHelper to pass the direction of a swipe to the
provided callback when determining whether the swipe represents a valid
dismiss gesture, and modifies the callback defined by
NotificationStackScrollLayout to allow dismiss gestures only to the
right.

Test: manually
Change-Id: I7ff1e8f92e7da9ed36520195d823f9a62f9a64ba
2018-11-07 14:29:04 +00:00
Dave Mankoff
c88d6224db Create a way to turn off unlocking on a phone.
This helps collect "True Falsing" data on phones to know
when they should not be unlocked.

Bug: 117600098
Change-Id: I07ecc00e2189300eff48c599572f7fa3f9dccdd7
Test: manual testing.
2018-10-26 13:22:14 -04:00
Aaron Heuckroth
cd944dc665 Clean up interfaces for StackScrollLayout.
Test: Automated tests should pass.
Change-Id: Ibf2718bfaacff0adcfca7ef8ca2f3eb2b867debf
2018-10-18 14:14:58 -04:00
Aaron Heuckroth
45d20bed1d Extract NotificationSwipeHelper and related state from NSSL.
Change-Id: Ic0a1178e4f3d6f2addd9bae1c31ec57dffee8eba
Test: Automated tests should pass. Manual testing should also show that notifications behave the same as before (swiping, tapping, dismissing, snapping/unsnapping menu, etc.)
2018-09-27 15:25:42 -04:00
Rohan Shah
20790b89c7 Organize notification classes in row/stack
No functional changes. Reorganized logic under either row, stack,
logging, or row/wrapper. Haven't moved all classes over since there's
some classes that create conflicts due to weird use of
package-private/protected (primarily waiting for HUN and shelf classes).

Test: built, ran, used notifications
Bug: 110802404
Change-Id: Ia2152603bdbeb12c522360193511946c843b9266
2018-07-18 11:20:32 -07:00
yoshiki iguchi
355692b0da Add canChildBeDraggable() method to SwipeHelper's callback
This callback checks the given child is actually draggable or not.
This method is need for ARC, since a child may not be draggable in
some cases.

FYI: ag/3244118 is the CL for NYC ARC.

Bug: 63874929
Bug: 62602530
Test: Compile and ran 'runtest systemui'
Change-Id: I085f1c1c72240529a19e0dcb1f543e7cb36899f0
2018-01-15 19:45:10 +09:00
Geoffrey Pitsch
409db2766b Handle Keyboard long-presses and Talkback shortcut on notifications
An incremental improvement to keyboard support on the status bar.
SwipeHelper calls a method on ExpandableNotificationRow, which it then
manually invokes from keydown/ups and the AccessibilityAction shortcut.

Regular clicks on the lockscreen still do not activate the notification.

Bug: 34840327
Test: manual
Change-Id: I5b59dec26c5e20237c4136820fff902ff8221371
2017-10-11 11:10:31 -04:00
Selim Cinek
464d0d9b1d Revert "Support keyboard long-press on notifications"
This reverts commit 2ca798932e.

Fixes: 65061056
Change-Id: I88bcb549b9e76958d280625a96796791b6f29060
2017-08-25 22:38:56 +00:00
Geoffrey Pitsch
2ca798932e Support keyboard long-press on notifications
ExpandableNotificationRow now handles long-clicks for keyboard support.
SwipeHelper calls performLongClick to trigger the listener on the row.
Now that the View listens to long clicks, SwipeHelper cancels
long-presses on the View when it see touch down events, so the event
doesn't get duped in the touch case.

Bug: 34840327
Test: manual
Change-Id: Ibeb93507781443d6b2dac209afd889b1d8d54aeb
2017-08-24 13:22:20 -04:00
Selim Cinek
b2e0f33ea4 Fixed a bug where a removed notification would stick around
Because we going back to the keyguard, the translation was
reset and the callback would not be called, leaving us with
a stuck notification.

Test: have only 1 notification in shade locked an swipe it away after doing a half-swipe first
Change-Id: Iea2db4ff7efa2e84aa36cd13cfa8cfa1859d6892
Fixes: 64762751
2017-08-18 12:24:38 -07:00
Winson Chung
d8a52f237c Fixing typo in swipe helper causing views not to be faded when swiped.
Bug: 63516235
Test: Enable flag to fade when swiped and verify it fades
Change-Id: I49e7840d5423d018c1f88a02e8b272c80d0143a2
2017-08-10 14:28:06 -07:00
Rajeev Kumar
7c8bc0f931 1. Replace use of java.util.HashMap with android.util.ArrayMap in
SwipeHelper class
2. Make few instance variables final

ArrayMap is more memory efficient than a traditional HashMap, see: https://developer.android.com/reference/android/util/ArrayMap.html

Change-Id: I8bb2a4f5386d0c9dd6a802ee87e3adf8c3a59805
2017-06-22 11:52:31 -07:00
Mady Mellor
4ab2820e6c Updates to NotificationMenuRowPlugin so that long press may be captured
This will allow the NotificationMenuRow plugin to do something else
rather than showing a menu when the view is long pressed.

- Allow menu to intercept touch events
- If the menu item provided to long press is null, don’t show it
- Also passes the status bar notification when the menu is created
  or updated

Bug: 62534409
Test: manual, have no plugin and long press -> see notification info
      have a plugin that returns null for long press -> nothing happens
Change-Id: I384c5217d5343e990f4c3506eb2477b015705e5c
2017-06-12 18:08:19 +00:00
Mady Mellor
cbff978fb4 Merge "Check for false touches when determining if the notif menu should be shown" into oc-dev am: 70739fb812
am: 2cd3e9c500

Change-Id: I393a87e48487ec51fc563cc1cb9f50d604970dc0
2017-05-26 15:13:59 +00:00
Mady Mellor
bd707492a2 Check for false touches when determining if the notif menu should be shown
If it's a false touch don't show the menu.

Test: manual: try swiping things away on the lockscreen (fast + long)
     try showing notification menu on the lockscreen
Bug: 38208094

Change-Id: I16ceedd90a5fbc80156a9495d6cfd6fa02771886
2017-05-25 13:26:53 -07:00
Mady Mellor
f4b82e38fd Merge "Improve swipe to show notification menu gesture" into oc-dev am: aa94a61c56
am: b4809f27e7

Change-Id: Iab5388ffe09840d66aea0f4914582466cac44000
2017-04-27 17:19:34 +00:00
Mady Mellor
aa94a61c56 Merge "Improve swipe to show notification menu gesture" into oc-dev 2017-04-27 17:01:30 +00:00
Anthony Chen
7acbb778c4 Allow notifications to be smaller in width than its container.
Add a width dimension that the children of the
NotificationStackScrollLayout can use to make a separate MeasureSpec for
its children.

Also, adjust the translation of the row so that the row can be swiped
off screen without any clipping if the width is smaller than the
notification panel itself.

Test: booted on phone and Android Auto headunit
Bug: 36692077
Change-Id: Ic8bb8a707c4d91f4e38d5ee3461b406bf14d0042
2017-04-20 15:41:58 -07:00
Mady Mellor
7a5b2b6d38 Fix issue where the notification could snap to the menu while its invisible
1) If the snap back animation is cancelled, the menu shouldn't be reset
   because it hasn't actually been snapped back -- this could happen when
   the menu was being shown and then the icon alpha would get set to 0
   resulting in notification snapped to menu but no menu visible
2) Cancel the callback to fade the menu in on dismiss to match original
   behavior before refactor of NMR

Test: manual - no clear repro steps for this, I could get it by
      violently moving a notification back and forth, with this patch
      I haven't been able to repro it.
Bug: 37320279
Change-Id: I4eea37e3c454e7324d0e295b0ec2fe022d219253
2017-04-17 13:41:52 -07:00
Mady Mellor
5574425c32 Improve swipe to show notification menu gesture
- Increases minimum velocity for dismiss (100->500 dp/sec)
- Increases minimum distance for dismiss (40->60% of notification width)
- Alters logic when menu was already showing and notification
  gets moved (if it doesn't move enough sticks to menu, else it looks
  for dismiss or snap back into position)
- Changes swipe helper so that the dismiss direction takes the
  translation into account

Test: manual / had some people play with the gesture
Bug: 28693375
Change-Id: Ibe4c51627a78b9c3b7d889cf7e06a63da7113072
2017-04-14 14:14:49 -07:00
Mady Mellor
95d743c38c Add plugin interfaces to control notification menu / swipe behavior
1) Updates the notification menu plugin to do more:
- The plugin can now supply the view it wants to display behind a
  notification as the menu
- Touch interaction (i.e. notification translating on top) is piped
  through to the plugin so it can update the view behind the notification

2) Makes NotificationMenuRow an implementor of the plugin which moves
   a bunch of that logic out of NotificationStackScroller

Test: runtest systemui
Change-Id: I8723b96c195ff7311317d5523418cfcbe2a79b52
2017-03-22 19:04:50 -07:00
Mady Mellor
04d7a0fca0 Add snooze to notification menu row
Moves the snooze plugin code into system UI.
Does not include assistant suggestions.

Test: manual
Change-Id: Ie2c51d65381530c9a72cd8a871efdbf0d63da490
2017-01-25 13:43:09 -08:00
Mady Mellor
761cde1173 Rename notification settings icon row / gear to notification menu row
Test: manual
Change-Id: I3a84c5ea180bd1e53495c5a44a93fa1982056174
2017-01-25 12:23:36 -08:00
Mady Mellor
43c2cd1a40 Create + implement plugin for NotificationSettingsIconRow
This will allow plugins to supply additional menu options to the
menu "behind" a notification.

This CL does not include behavior for when one of these new menu
items is tapped, this will be added in a separate CL.

Test: manual
Change-Id: I322f9f39d33b043bd23dcbede5dd15e6afa73fc1
2017-01-25 12:23:29 -08:00
Mady Mellor
904a39ca92 Merge "Fix gear being covered on notification update" into nyc-dev 2016-04-25 19:06:17 +00:00
Winson
bde852dbf5 Making the dismiss animation feel smoother.
Bug: 27154882
Change-Id: Idbabfe396bc75b598861fd12b78c846f08243a90
2016-04-18 18:20:32 -07:00
Mady Mellor
86889c2d21 Fix gear being covered on notification update
If a notification is updated to be non clearable but is in the middle of
being dismissed then it is snapped back into place. Part of the ways to
check if it was being dismissed is by checking the translation of the
notification.

In the case that the notification was translated to display the gear, then
when it was updated it would be snapped back over the gear. This CL fixes
this issue by snapping back to the gear instead of 0 in this situation.

Bug: 28019486
Change-Id: Ic6c4c29b0adee15d7b358fcdbc8446e8a4cd9f82
2016-04-18 16:37:06 -07:00
Mady Mellor
9c2c49634f Fix dismiss all clipping for tablet / landscape
Shouldn't animate the whole view, use the translatable views so that
they get clipped on tablet / landscape.

Additionally this changes the behavior in the case where the gear
might be showing, previously that would hide prior to the dismiss
all animation, UX prefers this to just have the notification cover
the gear and slide away or the gear fade away depending on the side
it's showing.

Bug: 28006639
Change-Id: I43027cb29410496de5b6e09c4a0c57a69484295c
2016-04-06 14:05:42 -07:00
Mady Mellor
5ba429c40a Merge "Fix slow dismiss animation" into nyc-dev 2016-04-04 23:29:07 +00:00
Mady Mellor
dc6c97df48 Fix slow dismiss animation
An accelerated interpolator is used for dismissing when the
the velocity = 0 which can occur with dismiss all or if the
noti is swiped far enough but not fast enough.

There is no duration specified when the noti is swiped far
enough, and the velocity passed in is 0 so the default
duration is used without taking into account the velocity.

This CL alters the code to pass in the velocity so that a
duration is calculated.

Bug: 27864379
Change-Id: Ifac04bb8d1b714c040102fef035d55737c844157
2016-04-04 12:53:49 -07:00
Selim Cinek
197823da52 Fixed a bug where longpress was not possible in landscape
The clause used there was using a reused value of a motion event
and therefore not trigger, even if it should have.
Also added a clause which this was actually used for to remove
the long press callback when using the inline settings slider.

Bug: 27352426
Change-Id: I9c432eeb354d7d5e72b375cfc5ead9e04a4e6c81
2016-03-25 15:26:42 +00:00
dongwan0605.kim
30637e41c9 Fix to snap notification view back when not clearable while updating
When a notification is being removed by swiping action,
actual removing will be performed after the swiping animation ends.
And also, it is same when removing notifications with <Clear all> button.
The actual removing will be performed after collapsing of status bar.
But before actual removing, the notification flags can be updated
to not clearable, and then the notification view can be remain
out of display by X-translation animation.

Therefore, fix to snap the notification view back when updating
if it is not clearable and need to be come back.

Change-Id: I005a9a8ac82bb513a47b5b8afc430bbe4880b52e
2016-03-17 17:39:29 -07:00
Mady Mellor
3a5e8dd820 Revert "Revert "Improve interaction around showing / hiding the gear behind notifications""
This reverts commit 88eca2aa0e.

It additionally fixes an issue with notification scrolling after gear is displayed
by indicating that the user is no longer swiping by calling onDragCancelled

Change-Id: Ieba0cea35bba9c383d8b5fdca08cb5ff083666c3
2016-03-11 17:17:00 -08:00
Mady Mellor
45eef7dbca Merge "Revert "Improve interaction around showing / hiding the gear behind notifications"" into nyc-dev 2016-03-11 23:41:08 +00:00
Mady Mellor
88eca2aa0e Revert "Improve interaction around showing / hiding the gear behind notifications"
This reverts commit 273ed107f1.

Change-Id: I5f4d2c2dfa2bd965abd2ea2ec385639deb4511f9
2016-03-11 23:36:41 +00:00
Mady Mellor
e11936725e Merge "Improve interaction around showing / hiding the gear behind notifications" into nyc-dev 2016-03-11 17:03:58 +00:00
Mady Mellor
287963146c Use FlingAnimationUtils for dismissing a notification
Addressing comment in ag/877913 PS6

Adds FlingAnimationUtils to SwipeHelper for dismissing notification
so that it may better follow a user's finger. This is not used
when a dismiss all is called (i.e. useAcceleration is requested).

Additionally alters dismiss behavior to accelerate out if velocity
was 0.

Change-Id: Ia7dc15d64e8427d5cfbdee3f4e48ccd60f5b0b36
2016-03-10 18:24:32 -08:00
Mady Mellor
273ed107f1 Improve interaction around showing / hiding the gear behind notifications
If the gesture on the notification was not considered a dismiss gesture
the code always check if the notification had moved enough to display
the gear.

This causes some undesirable behavior:
- For unclearable notifications the gear would *always* be shown
- Even if the velocity of the gesture was enough to be a dismiss it
  may have failed other requirements and then the gear would be
  shown

This CL alters NotificationSwipeHelper to take into account the
velocity of the gesture, and if it was great enough to be a dismiss
but wasn't (unclearable, didn't meet other requirements) it'll just
snap the notification back into place.

Additionally this CL alters the behavior so that if the gear is
visible and the notification is swiped in the direction of the gear
it *won't* dismiss the notification but rather cover the gear. If
a dismiss gesture is made in the opposite direction of the gear, the
notification will still be dismissed.

Bug: 27378399
Bug: 27319053
Bug: 27335353

Change-Id: I0849eecc71f2c6722e811d284534c2ea29b1b8aa
2016-03-09 13:18:25 -08:00
Mady Mellor
34958fa272 Fix inline controls from being swipeable
Currently you can swipe / translate inline controls, this
should not be possible. This CL fixes that.

Bug: 22451710
Change-Id: I3e048dce7df6d44ce80ee79bd449973bde0bc222
2016-03-02 17:15:36 -08:00
Mady Mellor
4b80b1025f Initial implementation of dismiss gesture + inline settings icon
- Added a view to display / control the gear behind the noti
- Updated SwipeHelper to hide / show the gear based on the gesture
- Only one notification or notification group can show the gear
  at a time

Couple of things left to do that will come in a follow up CL:
- Animation (to / from inline controls, fading gear based on movement)
- For children in a group there needs to be a grey background

Bug: 22451710
Change-Id: I2f93edf48109a82bab0839c73cbaba1535caee9a
2016-02-19 10:04:27 -08:00
Winson
c0d7058b14 Referencing static interpolators.
Change-Id: I5d2292016e869ed533f5873e373a1eccce651fc5
2016-01-29 11:15:43 -08:00
Jorim Jaggi
9b0a2c921a Improve dismiss/scrolling handling in recents
Make sure to only enter dismiss mode if xDiff is bigger than yDiff,
and only start scrolling if yDiff is bigger than xDiff.

Change-Id: Id898752ff7a08df549e234678aed0dad074b202d
2016-01-27 13:46:39 -08:00