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

Commit 33a237e4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix ConcurrentModificationException in OmniInvokerTest" into main

parents ea4373c0 ee4877f6
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -26,19 +26,21 @@ import android.provider.DeviceConfig.Properties
import androidx.annotation.WorkerThread
import androidx.annotation.WorkerThread
import com.android.launcher3.BuildConfig
import com.android.launcher3.BuildConfig
import com.android.launcher3.util.Executors
import com.android.launcher3.util.Executors
import java.util.concurrent.CopyOnWriteArrayList


/** Utility class to manage a set of device configurations */
/** Utility class to manage a set of device configurations */
class DeviceConfigHelper<ConfigType>(private val factory: (PropReader) -> ConfigType) {
class DeviceConfigHelper<ConfigType>(private val factory: (PropReader) -> ConfigType) {


    var config: ConfigType
    var config: ConfigType
        private set
        private set

    private val allKeys: Set<String>
    private val allKeys: Set<String>
    private val propertiesListener = OnPropertiesChangedListener { onDevicePropsChanges(it) }
    private val propertiesListener = OnPropertiesChangedListener { onDevicePropsChanges(it) }
    private val sharedPrefChangeListener = OnSharedPreferenceChangeListener { _, _ ->
    private val sharedPrefChangeListener = OnSharedPreferenceChangeListener { _, _ ->
        recreateConfig()
        recreateConfig()
    }
    }


    private val changeListeners = mutableListOf<Runnable>()
    private val changeListeners = CopyOnWriteArrayList<Runnable>()


    init {
    init {
        // Initialize the default config once.
        // Initialize the default config once.