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

Commit 2eb0d3e6 authored by YoungJoon Yang's avatar YoungJoon Yang
Browse files

Add null checker for SmartspaceManager

SmartspaceManager could be null depending on config_defaultSmartspaceService.

Bug: 287139348
Test: manual test
Change-Id: Iee30728d0cb4fa3b904e68d0f27c99b8c3fd7195
parent 56e5b200
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -646,6 +646,7 @@ public class FrameworkServicesModule {

    @Provides
    @Singleton
    @Nullable
    static SmartspaceManager provideSmartspaceManager(Context context) {
        return context.getSystemService(SmartspaceManager.class);
    }
+4 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ import javax.inject.Named
@SysUISingleton
class DreamSmartspaceController @Inject constructor(
    private val context: Context,
    private val smartspaceManager: SmartspaceManager,
    private val smartspaceManager: SmartspaceManager?,
    private val execution: Execution,
    @Main private val uiExecutor: Executor,
    private val smartspaceViewComponentFactory: SmartspaceViewComponent.Factory,
@@ -184,6 +184,9 @@ class DreamSmartspaceController @Inject constructor(
    }

    private fun connectSession() {
        if (smartspaceManager == null) {
            return
        }
        if (plugin == null && weatherPlugin == null) {
            return
        }
+3 −3
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ class MediaDataManager(
    private val tunerService: TunerService,
    private val mediaFlags: MediaFlags,
    private val logger: MediaUiEventLogger,
    private val smartspaceManager: SmartspaceManager,
    private val smartspaceManager: SmartspaceManager?,
    private val keyguardUpdateMonitor: KeyguardUpdateMonitor,
) : Dumpable, BcSmartspaceDataPlugin.SmartspaceTargetListener {

@@ -260,7 +260,7 @@ class MediaDataManager(
        tunerService: TunerService,
        mediaFlags: MediaFlags,
        logger: MediaUiEventLogger,
        smartspaceManager: SmartspaceManager,
        smartspaceManager: SmartspaceManager?,
        keyguardUpdateMonitor: KeyguardUpdateMonitor,
    ) : this(
        context,
@@ -347,7 +347,7 @@ class MediaDataManager(
        // Register for Smartspace data updates.
        smartspaceMediaDataProvider.registerListener(this)
        smartspaceSession =
            smartspaceManager.createSmartspaceSession(
            smartspaceManager?.createSmartspaceSession(
                SmartspaceConfig.Builder(context, SMARTSPACE_UI_SURFACE_LABEL).build()
            )
        smartspaceSession?.let {
+2 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ class LockscreenSmartspaceController
constructor(
        private val context: Context,
        private val featureFlags: FeatureFlags,
        private val smartspaceManager: SmartspaceManager,
        private val smartspaceManager: SmartspaceManager?,
        private val activityStarter: ActivityStarter,
        private val falsingManager: FalsingManager,
        private val systemClock: SystemClock,
@@ -371,6 +371,7 @@ constructor(
    }

    private fun connectSession() {
        if (smartspaceManager == null) return
        if (datePlugin == null && weatherPlugin == null && plugin == null) return
        if (session != null || smartspaceViews.isEmpty()) {
            return