Do not throw exception when Spa environment is set, ignore the latter one.
Bug: 252671269 Test: m RunSettingsRoboTests Change-Id: Ibf2721e2bb8d94a50f79e1d86d28490f298d0aad
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user