Merge "Stop enabling the Boot Aware Launcher prefs code during Tests after running LauncherPref unit tests." into tm-qpr-dev am: acaecb6511 am: e78b57101d am: 1e45b3b949
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/22163308 Change-Id: I4c529a6f5ef2441109c8721e7c9df0043b7d54df Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -36,6 +36,8 @@ import com.android.launcher3.util.Themes
|
|||||||
* Use same context for shared preferences, so that we use a single cached instance
|
* Use same context for shared preferences, so that we use a single cached instance
|
||||||
*
|
*
|
||||||
* TODO(b/262721340): Replace all direct SharedPreference refs with LauncherPrefs / Item methods.
|
* TODO(b/262721340): Replace all direct SharedPreference refs with LauncherPrefs / Item methods.
|
||||||
|
* TODO(b/274501660): Fix ReorderWidgets#simpleReorder test before enabling
|
||||||
|
* isBootAwareStartupDataEnabled
|
||||||
*/
|
*/
|
||||||
class LauncherPrefs(private val encryptedContext: Context) {
|
class LauncherPrefs(private val encryptedContext: Context) {
|
||||||
private val deviceProtectedStorageContext =
|
private val deviceProtectedStorageContext =
|
||||||
@@ -228,7 +230,7 @@ class LauncherPrefs(private val encryptedContext: Context) {
|
|||||||
* files.
|
* files.
|
||||||
*
|
*
|
||||||
* @return a list of editors with all transactions added so that the caller can determine to use
|
* @return a list of editors with all transactions added so that the caller can determine to use
|
||||||
* .apply() or .commit()
|
* .apply() or .commit()
|
||||||
*/
|
*/
|
||||||
private fun prepareToRemove(items: Array<out Item>): List<SharedPreferences.Editor> {
|
private fun prepareToRemove(items: Array<out Item>): List<SharedPreferences.Editor> {
|
||||||
val itemsPerFile = items.groupBy { it.encryptedPrefs }.toMutableMap()
|
val itemsPerFile = items.groupBy { it.encryptedPrefs }.toMutableMap()
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import com.android.launcher3.LauncherPrefs.Companion.BOOT_AWARE_PREFS_KEY
|
|||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import java.util.concurrent.CountDownLatch
|
import java.util.concurrent.CountDownLatch
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
import org.junit.AfterClass
|
||||||
|
import org.junit.BeforeClass
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
@@ -45,8 +47,18 @@ class LauncherPrefsTest {
|
|||||||
private val context by lazy { InstrumentationRegistry.getInstrumentation().targetContext }
|
private val context by lazy { InstrumentationRegistry.getInstrumentation().targetContext }
|
||||||
private val launcherPrefs by lazy { LauncherPrefs.get(context) }
|
private val launcherPrefs by lazy { LauncherPrefs.get(context) }
|
||||||
|
|
||||||
init {
|
companion object {
|
||||||
isBootAwareStartupDataEnabled = true
|
@BeforeClass
|
||||||
|
@JvmStatic
|
||||||
|
fun setup() {
|
||||||
|
isBootAwareStartupDataEnabled = true
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
@JvmStatic
|
||||||
|
fun teardown() {
|
||||||
|
isBootAwareStartupDataEnabled = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user