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

Commit 337c1a8c authored by Zekan Qian's avatar Zekan Qian
Browse files

Do not throw exception when Spa environment is set, ignore the latter one.

Bug: 252671269
Test: m RunSettingsRoboTests
Change-Id: Ibf2721e2bb8d94a50f79e1d86d28490f298d0aad
parent 5e8d4040
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -17,6 +17,9 @@
package com.android.settingslib.spa.framework.common

import android.app.Activity
import android.util.Log

private const val TAG = "SpaEnvironment"

object SpaEnvironmentFactory {
    private var spaEnvironment: SpaEnvironment? = null
@@ -28,8 +31,10 @@ object SpaEnvironmentFactory {
            return spaEnvironment!!
        }
        set(env: SpaEnvironment) {
            if (spaEnvironment != null)
                throw UnsupportedOperationException("Spa environment is already set")
            if (spaEnvironment != null) {
                Log.w(TAG, "Spa environment is already set, ignore the latter one.")
                return
            }
            spaEnvironment = env
        }
}