Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 2efc5dc7 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

Lazily inject NotifPresenter & NotifActivStarter into CentralSurfaces.

This is needed to not crash after completing the partial screen sharing
dialog in a secondary user.

When the partial screen sharing dialog is launched from an application
that is *not* in the primary user (e.g. it's launched from work
profile), that dialog is started in a *secondary* SysUI process. This
secondary SysUI process has a separate Dagger graph, and most of the
Dagger graph is not instantiated on startup because it's not referenced,
because only the CoreStartables labelled with `@PerUser` are started
(and almost all of our CoreStartables are *not* per user). Once this
very small Dagger graph is instantiated, InitController runs any post
init tasks (of which there are none).

Later, once the user completes the partial screen sharing dialog,
MediaProjectionPermissionActivity launches an activity using
ActivityStarterImpl. That class eventually triggers
OpaEnabledDispatcher#dispatchUnchecked. That method requests
CentralSurfaces, which means the CentralSurfaces part of the Dagger
graph suddently gets instantiated after initial process startup.
StatusBarNotificationPresenter is injected into CentralSurfaces, so the
notification presenter is created. On the presenter's creation, it
adds some post init tasks, but those tasks have been completed long ago,
leading to the crash.

This change updates the notif presenter to be injected *lazily* into
CentralSurfaces, so that creating CentralSurfaces doesn't also create
the notif presenter. Because this dialog doesn't use any notif presenter
code directly, the presenter is never created and never requests post
init tasks after init has finished. This change also makes the
NotificationActivityStarter lazily injected because the activity starter
also injects the presenter.

Bug: 298099682
Test: Launch partial screen share dialog from work profile -> complete
dialog -> verify no crash and verify via logging that
StatusBarNotificationPresenter is never instantiated

Change-Id: I3647d583623d6c4a6ddef60301d4a3da8dd9207a
parent bf3c622e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment