onNotificationExpansionChanged is called only when the expansion change...
is visible to users.

For example, if the notification is expanded in the background,
onNotificationExpansionChanged will be called only when the expanded
notification is visible to users.

Reason: we should only care about expansion change that is visible
to users, and at the moment that it is shown to user.
This also allows us to determine "has been visually expanded"
easily. With this change, our NotificationAssistantService can know
whether a notification has been visually expanded and calculate the CTR
of smart actions accordingly.

This should not break existing stuff in NMS.onNotificationExpansionChanged
because codes there checked isUserAction == True anyway,
which means the change must be also visible to users.

BUG: 120803809

Test: atest ExtServicesUnitTest
Test: atest ExpansionStateLoggerTest
Test: Manual test, try to expand and collapse notification.

Change-Id: Ibc6f939b2560b845de6a8a35b4557423b8a074f7
11 files changed