mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 08:16:49 +00:00
This CL does the following: - Creates a dir for multivalentTests - Creates symlinks for the dir to keep Android Studio happy - Moves many files to the multivalentTests dir - Adjusts gradle and soong build files to use the new dir as part of their source sets. Test: ./gradlew :NexusLauncher:testGoogleWithQuickstepDebugUnitTest Test: atest Launcher3RoboTests Fix: 316553886 Bug: 316553889 Flag: NA Change-Id: Iae28fd0c0191b3ecf9bd2950800875950cca2622
61 lines
1.6 KiB
Kotlin
61 lines
1.6 KiB
Kotlin
package com.android.launcher3.model
|
|
|
|
import android.content.Context
|
|
import android.database.Cursor
|
|
import android.database.sqlite.SQLiteDatabase
|
|
import androidx.test.platform.app.InstrumentationRegistry
|
|
import java.io.BufferedReader
|
|
import java.io.InputStreamReader
|
|
|
|
private val All_COLUMNS =
|
|
arrayOf(
|
|
"_id",
|
|
"title",
|
|
"intent",
|
|
"container",
|
|
"screen",
|
|
"cellX",
|
|
"cellY",
|
|
"spanX",
|
|
"spanY",
|
|
"itemType",
|
|
"appWidgetId",
|
|
"icon",
|
|
"appWidgetProvider",
|
|
"modified",
|
|
"restored",
|
|
"profileId",
|
|
"rank",
|
|
"options",
|
|
"appWidgetSource"
|
|
)
|
|
|
|
class FactitiousDbController(context: Context, insertFile: String) : ModelDbController(context) {
|
|
|
|
val inMemoryDb: SQLiteDatabase by lazy {
|
|
SQLiteDatabase.createInMemory(SQLiteDatabase.OpenParams.Builder().build()).also { db ->
|
|
BufferedReader(
|
|
InputStreamReader(
|
|
InstrumentationRegistry.getInstrumentation().context.assets.open(insertFile)
|
|
)
|
|
)
|
|
.lines()
|
|
.forEach { sqlStatement -> db.execSQL(sqlStatement) }
|
|
}
|
|
}
|
|
|
|
override fun query(
|
|
table: String,
|
|
projection: Array<out String>?,
|
|
selection: String?,
|
|
selectionArgs: Array<out String>?,
|
|
sortOrder: String?
|
|
): Cursor {
|
|
return inMemoryDb.query(table, All_COLUMNS, selection, selectionArgs, null, null, sortOrder)
|
|
}
|
|
|
|
override fun loadDefaultFavoritesIfNecessary() {
|
|
// No-Op
|
|
}
|
|
}
|