Commit Graph

111 Commits

Author SHA1 Message Date
Dave Mankoff
9b5ae1a3aa Dependency.get(BG_HANDLER) is dead. Long live @BgHandler.
Bug: 9755874
Test: atest SystemUITests
Change-Id: I3fd4f9e72e7917041786a4c823fe5824fa49916b
2019-11-19 17:43:12 -05:00
Evan Laird
181de6242c Remove NotificationData
Ye olde NotificationData class was responsible for a few general things:
- Keep a list of visible `NotificationEntry`s
- Filter / sort the visible entries
- Keep a sorted / filtered list of those entries
- Answer lots of questions about the entries themselves (rank,
isAmbient, list of entries for current user, etc.)
- Keep track of the current RankingMap
- Set priority buckets on entries
- Tell the group manager when things changed

The basic idea here is to remove NotificationData in favor of 3 other
changes:

1. Any place which needed to query NotificationData for info about the
entry (in particular its ranking) can just ask the entry for it now.
Entries all keep a reference to their rank

2. NotificationEntryManager now just maintains its own list of visible
notifications. It was already the point of contact to get a handle to
NotificationData so this makes call sites simpler.

3. Create a simpler NotificationRankingManager (maybe delete this
eventually) to encapsulate the sorting logic and hang on to the latest
RankingMap

Test: atest SystemUITests
Change-Id: I14073e103c6d50da37207ca8fd86828da0aaaff9
2019-11-13 15:46:06 -05:00
Evan Rosky
69cace4057 Give SystemUI a chance to participate in display rotation
This adds support for registering a single DisplayRotationController
to WMS. It gives a chance for the controller to suggest some
task changes to be executed along with a display rotation. There
is only one because it's a 2-way communication and there is only
intended to be one client for now.

This allows us to move Split and PiP presentation/layout logic out
of WM into systemui because WM no-longer needs to be the one
calculating the new bounds of everything during rotation.

This uses the windowcontainer transaction because all the
configuration changes and the display rotation need to happen
synchronously; otherwise, relayouts can occur after the display
is rotated, but before the configuration changes are applied.
When this happens, apps get incorrect bounds/insets which can
trigger erroneous lifecycle events in the app.

The flow is like this:
1. DisplayContent/Rotation freezes screen
2. DisplayRotationController is notified of a rotation and provided a
   callback.
3. The Controller then evaluates/queues some task changes in
   a transaction and, when done, fires the provided callback.
4. The callback applies the config change transaction and continues
   the rest of the rotation synchronously.

The DisplayWindowController is sys-ui piece that serves as an
interface between system-ui components and display-related wm
logic. For now it just facilitates the rotation calculation, but
in the future it will have more general utility for display logic
like inset/bounds calculation.

Bug: 124011688
Bug: 133381284
Test: Added some wmtests and coretests.
Change-Id: If10695f44fa076725ba17746842f6fbd64da5d20
2019-11-11 18:10:08 -08:00
Dave Mankoff
6c64d1f206 Final calls to getComponent(Recents.class) removed.
Had to reformat a block of code because linter was complaining.
Bug: 143972303
Test: atest SystemUITests
Change-Id: I96c163b09217671fcbd3f20133c3a13b696afc75
2019-11-11 12:47:59 -05:00
Dave Mankoff
4dd47fa597 Remove all calls to getComponent(StatusBar.class)
Bug: 143224715
Test: atest SystemUITests && manual
Change-Id: I349836eed9c1e988205681b93f86e967156f90a9
2019-11-11 11:04:51 -05:00
Dave Mankoff
bcaca8a6cd Remove all calls to getComponent(CommandQueue.class).
Makes AuthController, GlobalActionsComponent, InstantAppNotifier,
SizeCompatModeActivityController, and TvStatusBar all injectable.

Prior to this CL, CommandQueue contained within it a SystemUI object
that it used to start itself up and add itself to components. With
this change, the SystemUI object is no longer necessary, as Dagger
will ensure that a CommandQueue is available to those who need it.

Bug: 143702229
Test: atest SystemUITests

Change-Id: I2763a6d918b41fe27a2370fdd820da476654e14f
2019-11-01 14:59:11 -04:00
Dave Mankoff
f473681480 Move DI related coded into new dagger package.
This adds new Dagger qualifiers for BgHandler, BgLooper, MainHandler,
MainLooper, and MainResources, replacing the use of @Named for them.

Bug: 142954072
Test: atest  SystemUITests
Change-Id: Ibbda8998e587474c26740ba8d49a8b3f90d89efa
2019-10-21 17:52:31 -04:00
Dave Mankoff
2aff6c3952 Make DozeParameters, DozeFactory, DozeService, and ImageWallpaper injectable.
This adds providers for some of the system level objects that we rely
on as well.

A handful of calls for Dependency.get() have been removed in this
cl, (though others are added where necessary).

Bug: 142536902
Test: atest SystemUITests && manual
Change-Id: Id9cb62deba5229895d487803124dd115b7288466
2019-10-16 11:11:03 -04:00
Dave Mankoff
f44b13ad17 Remove view inflation when getting the running KeyguardBouncer.needsFullscreenBouncer.
The view is just proxying to an underyling object. Query the object directly.
Bug: 140059518
Test: atest SystemUITests.

Change-Id: I797f7c6a3d8734795d8a34a3709eaeed2e571dfa
2019-10-03 18:06:55 -04:00
Lucas Dupin
c8f16e803e Single source of truth for auth state
Merging UnlockMethodCache and KeyguardMonitor into KeyguardStateController,
making it injectable and introducing KeyguardStateController#isUnlocked
in order to make it easier to keep track of the lock screen state.

Test: atest SystemUiTests
Test: unlock with face, lock again
Test: unlock with password, lock again
Bug: 139363827
Change-Id: I37ac8c7826101852c61382559be9868125c15fac
2019-09-23 14:55:43 -07:00
Dave Mankoff
4ec9d02f08 Merge "Provide the ability to inject into Activities." 2019-09-19 14:15:29 +00:00
Dave Mankoff
eb593ae3ee Provide the ability to inject into Activities.
Mocks out KeyguardUpdateMonitor in all tests, as our unit
tests shouldn't care about it (unless they're testing it directly).

Bug: 140430268
Test: atest SystemUITests
Change-Id: I6a2b5231c434d0f26319090340b9c2a0e903f4b6
2019-09-18 15:59:43 -04:00
Dave Mankoff
63a1282b03 Make DozeSensors, DozeTriggers use ProximitySensor
This CL takes the features used in DozeSensors and applies
them to the publicly available util.sensors.ProximitySensor class.

It introduces a RateLimiter class for temprorarily suspending the
ProximitySensor as requested.

It introduces a ProximityCheck class for a quick, one time test
of the proximity sensor.

There is some reshuffling of Sensor related code to its own package
as well.

Bug: 141122220
Test: atest SystemUITests
Change-Id: If126be9a56c6966c1678ee70fa6f4623e51361a7
2019-09-18 11:25:43 -04:00
Hyunyoung Song
8f9d34cb5f [DO NOT MERGE] qt-qpr1-sysui-dev @ build 5814791
Test: presubmit setup on source branch

Bug: 130289146 Create a Gradle build for SystemUI
Bug: 136279712 Daggerize FalsingManager
Bug: 137324767 "Unable to instantiate service com.android.systemui.doze.DozeService" exception breaks launcher tests
Bug: 137563419 Remove Bouncer reveal delay from bypass flow
Bug: 138787339 Allow Services and Activities to be injected into directly.
Bug: 139128921 [AS 3.5 RC2, SDK API 29 rev 2] Overload resolution ambiguity: while removing element from HashMap
Bug: 64712476 Import translations for dev branches


Change-Id: Ib7fd4706c070907fd556c3532957f3b1b046de6d
2019-09-01 00:31:47 -07:00
Dave Mankoff
e229469af3 Fix the looper that KeyguardUpdateMonitor is using.
Bug: 139051615
Test: atest SystemUITests && atest SystemUIGoogleTests
Change-Id: Ic4dd5978001c208504c137cee41f363d7e70b1b5
2019-08-31 12:29:46 -04:00
Vinit Nayak
59b114e633 Extract SysUi state management out of OverviewProxyService
Move all sysUi state flag handling into a
separate class.

fixes: 138601608
Test: atest SysUiStateFlagsContainerTest
Checked that callbacks were being sent in
OPS, EdgeHandler and in Launcher codebase via
debugger.

Change-Id: Ie8f7ef2e647db88d244af1062eb95dbb69a46919
2019-08-26 20:07:42 -07:00
Fabian Kozynski
42f86a08f1 Universal Broadcast Receiver for SystemUI
Implements a UBR for SystemUI. All classes subscribing to Context should
subscribe here instead to reduce number of IPC into SystemUI.

Test: atest
Bug: 134566046

Change-Id: I6be24f62bd9b9b3a49a4efdf712e2e73c0d8d0ac
2019-08-13 13:38:39 -04:00
Selim Cinek
c3fec68900 Removed the AmbientPulseManager
We only want a single pulse manager since notifications
need to dynamically switch from pulsing to heads up
in the future.

Bug: 130327302
Change-Id: I0cbf23a69f33850776df81c4616932409670fe67
2019-06-11 13:58:02 -07:00
Fabian Kozynski
53ceaf677a DO NOT MERGE Revert "DO NOT MERGE Remove Privacy Indicators"
This reverts commit ec3e0ecaca.

Reason for revert: Re-enable Privacy Indicators in qt-r1-dev
Bug: 133257910

Change-Id: I7c778dd76c0aff3f483cf06f1dd96fd067145c12
2019-06-04 16:37:21 +00:00
Fabian Kozynski
9a560e068d DO NOT MERGE Remove Privacy Indicators
Bug: 133257910
Test: build and check that behavior is as P
Change-Id: I24bfc3806e2d12f6a1cc968d6979107e7002a3c4
2019-05-31 20:43:21 +00: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
Evan Laird
47dc4546ec Create notification channel interstitial shelf
From NotificationGuts, tapping "Turn off notifications" will now present
a half-shelf allowing the user to directly block up to 4 channels (the
one given from the notification guts + up to 3 other channels from
that app) or the app itself.

Test: visual (for now)
Bug: 130307442
Fixes: 131432719
Change-Id: I7e82928dfd56b9e25e5bef02607eede55b11d9e3
2019-05-09 11:13:19 -04:00
Lucas Dupin
d7221351c6 Do not show padlock when charging
Also migrated DockManager to dagger

Bug: 123606744
Test: visual
Change-Id: I4061638fd0239fbd0b0b13da199dda4e6f7d166d
2019-04-30 09:42:23 -07:00
Winson Chung
1aa24b9b5e Ensure we get the right nav bar mode for the current user in sysui
- Load resources from the current user's context to ensure the right
  overlays are read
- Create a controller in sysui to dispatch mode change to prevent callers
  from calling with the wrong user's context
- Clean up the quickstep contract to prevent launcher from calling methods
  using the baked in fw resource ids

Bug: 130185871
Test: Switch to secondary user, ensure the mode is read correctly
Change-Id: I00d9276185777e340b3e758345a00d2e9b3e3e64
2019-04-24 16:51:26 -07:00
Winson Chung
e8e4bdba18 Add ability to dump specific dependency controller
Bug: 130804868
Test: adb shell dumpsys activity service SystemUIService Dependency OverviewProxyService
Change-Id: Ie88f62d0d0b17ded6f8ff5d3d850f1f444eed444
2019-04-18 17:13:52 +00:00
Fabian Kozynski
d67cffdba0 Adds a DumpController to SystemUI Dependencies
The DumpController allows any SystemUI Dumpable class to subscribe to it
and be dumped during dumpsys of Dependency.

Test: manual (dumpsys Dependency shows "DumpController state)
Test: atest DumpControllerTest
Bug: 129544734
Change-Id: If8d3ec667d99a523e5ae25db84173d9b04b6829c
2019-04-10 17:28:31 -04:00
Michael Groover
a51ea81f44 Add Sensors Off QS tile and display status bar icon when active
This CL will replace the SensorPrivacyTile with a new tile that can be
enabled from the developer settings. When this new tile is enabled only
the camera, mic, and sensors controlled by the SensorManager will be
disabled; the location and airplane mode tiles will not be modified.
The user will be notified when this tile is enabled with the sensors
off icon in the status bar.

Fixes: 126618519
Test: Manually verified airplane and location are not modified when sensors
      off is enabled; also verified icon is displayed when mode is active.

Change-Id: Iabf099d0d76c015015ce9859edc0b225ec554020
2019-03-20 11:48:23 -07:00
Evan Laird
4a47aeea77 One fewer DependencyProvider
`grep -r "(class|interface) DependencyProvider" returns 3 separate
entities claming to be DependencyProvider, which is a little confusing
and unnecessary. Privatized and renamed Dependency.DependencyProvider to
Dependency.LazyDependencyCreator, since I think that's a little bit
closer to what it is

Test: build systemui; atest SystemUITests
Change-Id: I2eed5be889b6c75324c2cf5cfef5d55827dbd8c5
2019-03-06 17:00:58 -05:00
Gustav Sennton
5a4fc2122f Only show smart actions for whitelisted apps in lock task mode.
In lock task mode only apps from a specific whitelist can be started. To
avoid showing buttons that won't do anything when clicked we remove
smart actions linking to apps that are not whitelisted.

In this change we add several IPC calls during smart suggestions (in
notification) inflation - one in the common code flow, and several
others only for the case where lock task kiosk mode is enabled. This is
OK from a performance perspective because we inflate smart suggestions
on a background thread.

Bug: 117976013
Test: atest InflatedSmartRepliesTest
Test: start lock-task mode with 1. chrome whitelisted -> chrome actions
show up, 2. chrome not whitelisted -> chrome actions don't show up.
Test: ensure smart replies are still enabled in lock task mode.
Change-Id: I664ff2cdcfd1b212744d85d36d7a2b305bf4b3a9
2019-03-01 11:54:58 +00:00
Ned Burns
c586467ea5 Invert dependency between NEM and RowBinder
NotificationEntryManager needs a NotificationRowBinder to inflate views
and bind them. Previously, it did this by calling Dependency.get(), but
this resulted in a circular dependency.

We can't fully break the circularity, but we can make it more explicit.
This CL inverts the dependency -- now the NEM needs someone else to give
it a row binder before it can function properly. Among other things,
this makes testing easier.

This CL allows us to isolate the interface between the NEM and NRB; in
later CLs we can make explicit the async inflation callback between the
NEM and the NRB and finally rewrite most of the NEM tests.

Test: atest
Change-Id: Ibb6ca4416456021a3c0a3679d1d74248fca18af6
2019-02-21 21:15:01 -05:00
Beverly
8fdb533e08 Make StatusBarStateController available to plugins
Test: atest SystemUITests
Bug: 115322193
Change-Id: I46e4b23c9839720a3eb10e381d7aaf79a74c6b33
2019-02-07 14:44:54 -05:00
Christine Franks
71e003eb84 Replace ColorDisplayController references
with ColorDisplayManager, where possible

Bug: 123352608
Test: atest FrameworksServicesTests:ColorDisplayServiceTest

Change-Id: I4feb67197462d49002582931aee285abe85054e6
2019-02-04 14:28:55 -08:00
Fabian Kozynski
04f83eb5f0 Convert PrivacyItemController to Dependency
This makes sure that PIC is a Singleton and prevents memory leak.

Bug: 121388507
Test: atest PrivacyItemControllerTest

Change-Id: Ib5c2a8790157034e1937c8037650ac047478d005
2019-01-24 16:24:40 -05:00
Robert Snoeberger
15b4af1943 Move plugin and settings logic out of KeyguardClockSwitch.
This is in preparation for adding more logic related to docked state.

Bug: 122301289
Test: Used adb to switch between custom clock faces.
Change-Id: I0a13ef4e5894df1280a04c5a9df8bbed8054557b
2019-01-22 11:32:40 -05:00
Chris Wren
1acdb5e6bb remove status bar icon logs
partial revert of Ife5ce988

Bug: 122451213
Test: runtest systemui
Change-Id: I026217ea8e95ba0805b05e62a5d527c8c3a1d9ce
2019-01-11 10:53:51 -05:00
Ned Burns
f81c4c405f Extract NotificationData.Entry to top-level
NotificationData.Entry -> NotificationEntry

Both NotificationData and NotificationEntry moved
`notification.collection` package.

Test: atest
Change-Id: Ia7158eb732711ddb324e514edb9884d518edab87
2019-01-07 16:31:21 -05:00
TreeHugger Robot
bf435d53ac Merge changes from topic "foreground-service-controller-2"
* changes:
  Factors out notification listening from ForegroundServiceController.
  Collapses ForegroundServiceControllerImpl into interface.
2019-01-04 22:20:45 +00:00
Gus Prevas
eb4e2e1139 Factors out notification listening from ForegroundServiceController.
This change introduces the ForegroundServiceNotificationListener
component, which contains the logic formerly in
ForegroundServiceController for updating its state in response to
notification events.  ForegroundServiceNotificationListener adds a
standard NotificationEntryListener to the NotificationEntryManager,
allowing us to remove the explicit calls from NotificationEntryManager;
splitting this out to its own class prevents us from introducing a
circular dependency since NotificationEntryManager still needs to use
the query methods on ForegroundServiceController.

Test: atest SystemUITests, manual
Change-Id: Iec72aa3a9fd90e3f0079db3b2a3c4f1882e59731
2019-01-04 14:05:43 -05:00
Gus Prevas
59ec2ff443 Eliminates NotificationEntryManager.getNotificationLongClicker().
This method always returned NotificationGutsManager::openGuts, and only
existed so that CarSystemUI could override it to disable long presses.
In this change we accomplish this by making
NotificationStackScrollLayout injectable and providing a named flag for
whether to enable long presses or not as a dependency.  This means that
NotificationEntryManager is no longer involved in handling long presses,
and CarNotificationEntryManager no longer needs to exist.

Test: atest SystemUITests, manual
Change-Id: Iae78601fea498a37ed47ef9a114e50de1652b6a8
2019-01-04 10:57:20 -05:00
Charles Chen
68b5a35cec Merge changes from topic "commandQueue"
* changes:
  Introduce AutoHideController to centralize call to WMS (4/N)
  Make Some APIs in CommandQueue aware of multi-display (3/N)
2019-01-04 06:39:25 +00:00
TreeHugger Robot
709797647d Merge "Fix tuner crash from dependencies" 2019-01-03 23:18:54 +00:00
Jason Monk
c29c2020a0 Fix tuner crash from dependencies
Test: atest SystemUITests
Change-Id: I530ac3fa5d7dc2a044feab81de9587a21a3bcef7
Fixes: 122320435
2019-01-03 16:52:37 -05:00
Charles Chen
8c9a83fe54 Introduce AutoHideController to centralize call to WMS (4/N)
AutoHideController is a per-display controller and has following tasks:
1. Control all auto-hide logic in SystemUi
2. Update hide/unhide status to WMS

Bug: 117478341
Test: atest SystemUITests

Change-Id: I5066030c750f72e6e0b0d70cd377109458989c7d
2019-01-03 22:12:38 +08:00
Charles Chen
10ca70b075 Move all logic of navigation bar to NavigationBarController(2/N)
Since we don't have status bar on external displays, we need to saparate
the logic to make some animations or transitions just work on external
navigation bars. When we set System UI visibility on an external display,
we could make the flag only effect navigation bar. Also, it can simplify
StatusBar code by moving navigation bar related fields into
NavigationBarController.

Test: atest SystemUITests
Bug: 117478341

Change-Id: I1cdf61f6eeb2c377e04a073401efa0cdb45b65cd
2019-01-03 22:12:03 +08:00
Beverly
1be62f46ab Make DarkIconDispatcher visible to plugins
Test: manual
Bug: 115322193
Change-Id: I6204d771e476c504e9070ebc88dd8fd44b268635
2019-01-02 16:13:34 -05:00
Gus Prevas
b43dc65641 Combines NotificationEntryManager listener interfaces (part 2).
This change introduces the NotificationAlertingManager component, a
NotificationEntryListener which handles showing/hiding/updating alerts
(heads-up or ambient pulsing) in response to events from the
NotificationEntryManager.  All code in the new component was moved out
of NotificationEntryManager proper.

Test: atest SystemUITests, manual
Change-Id: I46a046da6caf39b1d314b357e21ac6b4755c5796
2018-12-27 09:24:50 -05:00
Jason Monk
7fc1f9bbd5 Remove Dependency#get from ExtensionControllerImpl
Also deprecate Dependency#get.

Test: Updated existing tests
Change-Id: Ibdca61a4971e786c21f5a8bab215bc7a0b8ce7cb
2018-12-21 09:02:18 -05:00
TreeHugger Robot
377749e2f1 Merge "Update SysUi dependency injection to allow for a null LocalBluetoothManager" 2018-12-20 23:29:21 +00:00
Brad Stenning
32cedc1907 Update SysUi dependency injection to allow for a null LocalBluetoothManager
Test: emulator with automotive target
Change-Id: I487b473fe8cca28ad05ed97e1d5bb7c4b29464f2
2018-12-20 11:25:06 -08:00
Gus Prevas
ec9e1f09c7 Extracts heads-up/pulsing logic from NotificationEntryManager.
This change introduces the NotificationInterruptionStateProvider
component, which contains all the logic around whether a notification
should heads-up or pulse previously contained in
NotificationEntryManager.

We also introduce the NotificationFilter component which extracts logic
about when to filter notifications from NotificationData, in order to
break a circular dependency that would otherwise be introduced.  As part
of this, some additional fields from the notification ranking map are
denormalized on to the NotificationData.Entry object.

Test: atest SystemUITests, manually
Change-Id: Ic61edca966a3c3e0b01f1a6a9e7ce79c8701da4e
2018-12-20 13:17:17 -05:00