Revert "Revert "Revert "Revert "Revert "Revert "Changing GridMigrationTask to use ModelDbController directly""""""
This reverts commit 09905cfa90.
Reason for revert: Fixed the crashing issue
Change-Id: Ibcfc28a89356d262e67e8842d6bae37e230a70f5
This commit is contained in:
1 parent
ba4fcb0171
commit
7bc6cdee56
19 files changed
+470
-506
No files matched your search
@@ -116,7 +116,7 @@ public class IconCacheTest {
|
||||
@Nullable ComponentName cn, @Nullable String badgeOverride) throws Exception {
|
||||
Builder builder = new Builder(context, "test-shortcut")
|
||||
.setIntent(new Intent(Intent.ACTION_VIEW))
|
||||
.setTitle("Test");
|
||||
.setShortLabel("Test");
|
||||
if (cn != null) {
|
||||
builder.setActivity(cn);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import androidx.test.platform.app.InstrumentationRegistry;
|
||||
|
||||
import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.pm.UserCache;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -222,7 +223,9 @@ public class DbDowngradeHelperTest {
|
||||
private class MyDatabaseHelper extends DatabaseHelper {
|
||||
|
||||
MyDatabaseHelper() {
|
||||
super(mContext, DB_FILE, false);
|
||||
super(mContext, DB_FILE,
|
||||
UserCache.INSTANCE.get(mContext)::getSerialNumberForUser,
|
||||
() -> { });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.android.launcher3.model
|
||||
|
||||
import android.content.ContentValues
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.database.Cursor
|
||||
@@ -23,6 +24,7 @@ import android.graphics.Point
|
||||
import android.os.Process
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.android.launcher3.InvariantDeviceProfile
|
||||
import com.android.launcher3.LauncherPrefs
|
||||
import com.android.launcher3.LauncherPrefs.Companion.WORKSPACE_SIZE
|
||||
@@ -32,7 +34,6 @@ import com.android.launcher3.model.GridSizeMigrationUtil.DbReader
|
||||
import com.android.launcher3.pm.UserCache
|
||||
import com.android.launcher3.provider.LauncherDbUtils
|
||||
import com.android.launcher3.util.LauncherModelHelper
|
||||
import com.android.launcher3.util.LauncherModelHelper.*
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
@@ -43,11 +44,13 @@ import org.junit.runner.RunWith
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class GridSizeMigrationUtilTest {
|
||||
|
||||
private lateinit var modelHelper: LauncherModelHelper
|
||||
private lateinit var context: Context
|
||||
private lateinit var db: SQLiteDatabase
|
||||
private lateinit var validPackages: Set<String>
|
||||
private lateinit var idp: InvariantDeviceProfile
|
||||
private lateinit var dbHelper: DatabaseHelper
|
||||
private lateinit var db: SQLiteDatabase
|
||||
private val testPackage1 = "com.android.launcher3.validpackage1"
|
||||
private val testPackage2 = "com.android.launcher3.validpackage2"
|
||||
private val testPackage3 = "com.android.launcher3.validpackage3"
|
||||
@@ -63,11 +66,16 @@ class GridSizeMigrationUtilTest {
|
||||
fun setUp() {
|
||||
modelHelper = LauncherModelHelper()
|
||||
context = modelHelper.sandboxContext
|
||||
db = modelHelper.provider.db
|
||||
dbHelper =
|
||||
DatabaseHelper(
|
||||
context,
|
||||
null,
|
||||
UserCache.INSTANCE.get(context)::getSerialNumberForUser
|
||||
) {}
|
||||
db = dbHelper.writableDatabase
|
||||
|
||||
validPackages =
|
||||
setOf(
|
||||
TEST_PACKAGE,
|
||||
testPackage1,
|
||||
testPackage2,
|
||||
testPackage3,
|
||||
@@ -99,26 +107,26 @@ class GridSizeMigrationUtilTest {
|
||||
@Throws(Exception::class)
|
||||
fun testMigration() {
|
||||
// Src Hotseat icons
|
||||
modelHelper.addItem(APP_ICON, 0, HOTSEAT, 0, 0, testPackage1, 1, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(SHORTCUT, 1, HOTSEAT, 0, 0, testPackage2, 2, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(SHORTCUT, 3, HOTSEAT, 0, 0, testPackage3, 3, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 4, HOTSEAT, 0, 0, testPackage4, 4, TMP_CONTENT_URI)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_HOTSEAT, 0, 0, testPackage1, 1, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_SHORTCUT, 1, CONTAINER_HOTSEAT, 0, 0, testPackage2, 2, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_SHORTCUT, 3, CONTAINER_HOTSEAT, 0, 0, testPackage3, 3, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 4, CONTAINER_HOTSEAT, 0, 0, testPackage4, 4, TMP_TABLE)
|
||||
// Src grid icons
|
||||
// _ _ _ _ _
|
||||
// _ _ _ _ 5
|
||||
// _ _ 6 _ 7
|
||||
// _ _ 8 _ 9
|
||||
// _ _ _ _ _
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 4, 1, testPackage5, 5, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 2, 2, testPackage6, 6, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 4, 2, testPackage7, 7, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 2, 3, testPackage8, 8, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 4, 3, testPackage9, 9, TMP_CONTENT_URI)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 4, 1, testPackage5, 5, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 2, 2, testPackage6, 6, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 4, 2, testPackage7, 7, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 2, 3, testPackage8, 8, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 4, 3, testPackage9, 9, TMP_TABLE)
|
||||
|
||||
// Dest hotseat icons
|
||||
modelHelper.addItem(SHORTCUT, 1, HOTSEAT, 0, 0, testPackage2)
|
||||
addItem(ITEM_TYPE_SHORTCUT, 1, CONTAINER_HOTSEAT, 0, 0, testPackage2)
|
||||
// Dest grid icons
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 2, 2, testPackage10)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 2, 2, testPackage10)
|
||||
|
||||
idp.numDatabaseHotseatIcons = 4
|
||||
idp.numColumns = 4
|
||||
@@ -126,8 +134,7 @@ class GridSizeMigrationUtilTest {
|
||||
val srcReader = DbReader(db, TMP_TABLE, context, validPackages)
|
||||
val destReader = DbReader(db, TABLE_NAME, context, validPackages)
|
||||
GridSizeMigrationUtil.migrate(
|
||||
context,
|
||||
db,
|
||||
dbHelper,
|
||||
srcReader,
|
||||
destReader,
|
||||
idp.numDatabaseHotseatIcons,
|
||||
@@ -138,12 +145,13 @@ class GridSizeMigrationUtilTest {
|
||||
|
||||
// Check hotseat items
|
||||
var c =
|
||||
context.contentResolver.query(
|
||||
CONTENT_URI,
|
||||
db.query(
|
||||
TABLE_NAME,
|
||||
arrayOf(SCREEN, INTENT),
|
||||
"container=$CONTAINER_HOTSEAT",
|
||||
null,
|
||||
SCREEN,
|
||||
null,
|
||||
null
|
||||
)
|
||||
?: throw IllegalStateException()
|
||||
@@ -168,12 +176,13 @@ class GridSizeMigrationUtilTest {
|
||||
|
||||
// Check workspace items
|
||||
c =
|
||||
context.contentResolver.query(
|
||||
CONTENT_URI,
|
||||
db.query(
|
||||
TABLE_NAME,
|
||||
arrayOf(CELLX, CELLY, INTENT),
|
||||
"container=$CONTAINER_DESKTOP",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
)
|
||||
?: throw IllegalStateException()
|
||||
@@ -209,30 +218,30 @@ class GridSizeMigrationUtilTest {
|
||||
fun testMigrationBackAndForth() {
|
||||
// Hotseat items in grid A
|
||||
// 1 2 _ 3 4
|
||||
modelHelper.addItem(APP_ICON, 0, HOTSEAT, 0, 0, testPackage1, 1, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(SHORTCUT, 1, HOTSEAT, 0, 0, testPackage2, 2, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(SHORTCUT, 3, HOTSEAT, 0, 0, testPackage3, 3, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 4, HOTSEAT, 0, 0, testPackage4, 4, TMP_CONTENT_URI)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_HOTSEAT, 0, 0, testPackage1, 1, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_SHORTCUT, 1, CONTAINER_HOTSEAT, 0, 0, testPackage2, 2, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_SHORTCUT, 3, CONTAINER_HOTSEAT, 0, 0, testPackage3, 3, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 4, CONTAINER_HOTSEAT, 0, 0, testPackage4, 4, TMP_TABLE)
|
||||
// Workspace items in grid A
|
||||
// _ _ _ _ _
|
||||
// _ _ _ _ 5
|
||||
// _ _ 6 _ 7
|
||||
// _ _ 8 _ _
|
||||
// _ _ _ _ _
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 4, 1, testPackage5, 5, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 2, 2, testPackage6, 6, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 4, 2, testPackage7, 7, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 2, 3, testPackage8, 8, TMP_CONTENT_URI)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 4, 1, testPackage5, 5, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 2, 2, testPackage6, 6, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 4, 2, testPackage7, 7, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 2, 3, testPackage8, 8, TMP_TABLE)
|
||||
|
||||
// Hotseat items in grid B
|
||||
// 2 _ _ _
|
||||
modelHelper.addItem(SHORTCUT, 0, HOTSEAT, 0, 0, testPackage2)
|
||||
addItem(ITEM_TYPE_SHORTCUT, 0, CONTAINER_HOTSEAT, 0, 0, testPackage2)
|
||||
// Workspace items in grid B
|
||||
// _ _ _ _
|
||||
// _ _ _ 10
|
||||
// _ _ _ _
|
||||
// _ _ _ _
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 1, 3, testPackage10)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 1, 3, testPackage10)
|
||||
|
||||
idp.numDatabaseHotseatIcons = 4
|
||||
idp.numColumns = 4
|
||||
@@ -241,8 +250,7 @@ class GridSizeMigrationUtilTest {
|
||||
val readerGridB = DbReader(db, TABLE_NAME, context, validPackages)
|
||||
// migrate from A -> B
|
||||
GridSizeMigrationUtil.migrate(
|
||||
context,
|
||||
db,
|
||||
dbHelper,
|
||||
readerGridA,
|
||||
readerGridB,
|
||||
idp.numDatabaseHotseatIcons,
|
||||
@@ -253,12 +261,13 @@ class GridSizeMigrationUtilTest {
|
||||
|
||||
// Check hotseat items in grid B
|
||||
var c =
|
||||
context.contentResolver.query(
|
||||
CONTENT_URI,
|
||||
db.query(
|
||||
TABLE_NAME,
|
||||
arrayOf(SCREEN, INTENT),
|
||||
"container=$CONTAINER_HOTSEAT",
|
||||
null,
|
||||
SCREEN,
|
||||
null,
|
||||
null
|
||||
)
|
||||
?: throw IllegalStateException()
|
||||
@@ -272,12 +281,13 @@ class GridSizeMigrationUtilTest {
|
||||
|
||||
// Check workspace items in grid B
|
||||
c =
|
||||
context.contentResolver.query(
|
||||
CONTENT_URI,
|
||||
db.query(
|
||||
TABLE_NAME,
|
||||
arrayOf(SCREEN, CELLX, CELLY, INTENT),
|
||||
"container=$CONTAINER_DESKTOP",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
)
|
||||
?: throw IllegalStateException()
|
||||
@@ -294,12 +304,11 @@ class GridSizeMigrationUtilTest {
|
||||
assertThat(locMap[testPackage8]).isEqualTo(Triple(0, 3, 1))
|
||||
|
||||
// add item in B
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 0, 2, testPackage9)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 0, 2, testPackage9)
|
||||
|
||||
// migrate from B -> A
|
||||
GridSizeMigrationUtil.migrate(
|
||||
context,
|
||||
db,
|
||||
dbHelper,
|
||||
readerGridB,
|
||||
readerGridA,
|
||||
5,
|
||||
@@ -309,12 +318,13 @@ class GridSizeMigrationUtilTest {
|
||||
)
|
||||
// Check hotseat items in grid A
|
||||
c =
|
||||
context.contentResolver.query(
|
||||
TMP_CONTENT_URI,
|
||||
db.query(
|
||||
TMP_TABLE,
|
||||
arrayOf(SCREEN, INTENT),
|
||||
"container=$CONTAINER_HOTSEAT",
|
||||
null,
|
||||
SCREEN,
|
||||
null,
|
||||
null
|
||||
)
|
||||
?: throw IllegalStateException()
|
||||
@@ -328,12 +338,13 @@ class GridSizeMigrationUtilTest {
|
||||
|
||||
// Check workspace items in grid A
|
||||
c =
|
||||
context.contentResolver.query(
|
||||
TMP_CONTENT_URI,
|
||||
db.query(
|
||||
TMP_TABLE,
|
||||
arrayOf(SCREEN, CELLX, CELLY, INTENT),
|
||||
"container=$CONTAINER_DESKTOP",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
)
|
||||
?: throw IllegalStateException()
|
||||
@@ -354,12 +365,11 @@ class GridSizeMigrationUtilTest {
|
||||
assertThat(locMap[testPackage9]).isEqualTo(Triple(0, 0, 2))
|
||||
|
||||
// remove item from B
|
||||
modelHelper.deleteItem(7, TMP_TABLE)
|
||||
db.delete(TMP_TABLE, "$_ID=7", null)
|
||||
|
||||
// migrate from A -> B
|
||||
GridSizeMigrationUtil.migrate(
|
||||
context,
|
||||
db,
|
||||
dbHelper,
|
||||
readerGridA,
|
||||
readerGridB,
|
||||
idp.numDatabaseHotseatIcons,
|
||||
@@ -370,12 +380,13 @@ class GridSizeMigrationUtilTest {
|
||||
|
||||
// Check hotseat items in grid B
|
||||
c =
|
||||
context.contentResolver.query(
|
||||
CONTENT_URI,
|
||||
db.query(
|
||||
TABLE_NAME,
|
||||
arrayOf(SCREEN, INTENT),
|
||||
"container=$CONTAINER_HOTSEAT",
|
||||
null,
|
||||
SCREEN,
|
||||
null,
|
||||
null
|
||||
)
|
||||
?: throw IllegalStateException()
|
||||
@@ -389,12 +400,13 @@ class GridSizeMigrationUtilTest {
|
||||
|
||||
// Check workspace items in grid B
|
||||
c =
|
||||
context.contentResolver.query(
|
||||
CONTENT_URI,
|
||||
db.query(
|
||||
TABLE_NAME,
|
||||
arrayOf(SCREEN, CELLX, CELLY, INTENT),
|
||||
"container=$CONTAINER_DESKTOP",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
)
|
||||
?: throw IllegalStateException()
|
||||
@@ -443,10 +455,28 @@ class GridSizeMigrationUtilTest {
|
||||
fun migrateToLargerHotseat() {
|
||||
val srcHotseatItems =
|
||||
intArrayOf(
|
||||
modelHelper.addItem(APP_ICON, 0, HOTSEAT, 0, 0, testPackage1, 1, TMP_CONTENT_URI),
|
||||
modelHelper.addItem(SHORTCUT, 1, HOTSEAT, 0, 0, testPackage2, 2, TMP_CONTENT_URI),
|
||||
modelHelper.addItem(APP_ICON, 2, HOTSEAT, 0, 0, testPackage3, 3, TMP_CONTENT_URI),
|
||||
modelHelper.addItem(SHORTCUT, 3, HOTSEAT, 0, 0, testPackage4, 4, TMP_CONTENT_URI)
|
||||
addItem(
|
||||
ITEM_TYPE_APPLICATION,
|
||||
0,
|
||||
CONTAINER_HOTSEAT,
|
||||
0,
|
||||
0,
|
||||
testPackage1,
|
||||
1,
|
||||
TMP_TABLE
|
||||
),
|
||||
addItem(ITEM_TYPE_SHORTCUT, 1, CONTAINER_HOTSEAT, 0, 0, testPackage2, 2, TMP_TABLE),
|
||||
addItem(
|
||||
ITEM_TYPE_APPLICATION,
|
||||
2,
|
||||
CONTAINER_HOTSEAT,
|
||||
0,
|
||||
0,
|
||||
testPackage3,
|
||||
3,
|
||||
TMP_TABLE
|
||||
),
|
||||
addItem(ITEM_TYPE_SHORTCUT, 3, CONTAINER_HOTSEAT, 0, 0, testPackage4, 4, TMP_TABLE)
|
||||
)
|
||||
val numSrcDatabaseHotseatIcons = srcHotseatItems.size
|
||||
idp.numDatabaseHotseatIcons = 6
|
||||
@@ -455,8 +485,7 @@ class GridSizeMigrationUtilTest {
|
||||
val srcReader = DbReader(db, TMP_TABLE, context, validPackages)
|
||||
val destReader = DbReader(db, TABLE_NAME, context, validPackages)
|
||||
GridSizeMigrationUtil.migrate(
|
||||
context,
|
||||
db,
|
||||
dbHelper,
|
||||
srcReader,
|
||||
destReader,
|
||||
idp.numDatabaseHotseatIcons,
|
||||
@@ -467,12 +496,13 @@ class GridSizeMigrationUtilTest {
|
||||
|
||||
// Check hotseat items
|
||||
val c =
|
||||
context.contentResolver.query(
|
||||
CONTENT_URI,
|
||||
db.query(
|
||||
TABLE_NAME,
|
||||
arrayOf(SCREEN, INTENT),
|
||||
"container=$CONTAINER_HOTSEAT",
|
||||
null,
|
||||
SCREEN,
|
||||
null,
|
||||
null
|
||||
)
|
||||
?: throw IllegalStateException()
|
||||
@@ -501,11 +531,11 @@ class GridSizeMigrationUtilTest {
|
||||
|
||||
@Test
|
||||
fun migrateFromLargerHotseat() {
|
||||
modelHelper.addItem(APP_ICON, 0, HOTSEAT, 0, 0, testPackage1, 1, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(SHORTCUT, 2, HOTSEAT, 0, 0, testPackage2, 2, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 3, HOTSEAT, 0, 0, testPackage3, 3, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(SHORTCUT, 4, HOTSEAT, 0, 0, testPackage4, 4, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 5, HOTSEAT, 0, 0, testPackage5, 5, TMP_CONTENT_URI)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_HOTSEAT, 0, 0, testPackage1, 1, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_SHORTCUT, 2, CONTAINER_HOTSEAT, 0, 0, testPackage2, 2, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 3, CONTAINER_HOTSEAT, 0, 0, testPackage3, 3, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_SHORTCUT, 4, CONTAINER_HOTSEAT, 0, 0, testPackage4, 4, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 5, CONTAINER_HOTSEAT, 0, 0, testPackage5, 5, TMP_TABLE)
|
||||
|
||||
idp.numDatabaseHotseatIcons = 4
|
||||
idp.numColumns = 4
|
||||
@@ -513,8 +543,7 @@ class GridSizeMigrationUtilTest {
|
||||
val srcReader = DbReader(db, TMP_TABLE, context, validPackages)
|
||||
val destReader = DbReader(db, TABLE_NAME, context, validPackages)
|
||||
GridSizeMigrationUtil.migrate(
|
||||
context,
|
||||
db,
|
||||
dbHelper,
|
||||
srcReader,
|
||||
destReader,
|
||||
idp.numDatabaseHotseatIcons,
|
||||
@@ -525,12 +554,13 @@ class GridSizeMigrationUtilTest {
|
||||
|
||||
// Check hotseat items
|
||||
val c =
|
||||
context.contentResolver.query(
|
||||
CONTENT_URI,
|
||||
db.query(
|
||||
TABLE_NAME,
|
||||
arrayOf(SCREEN, INTENT),
|
||||
"container=$CONTAINER_HOTSEAT",
|
||||
null,
|
||||
SCREEN,
|
||||
null,
|
||||
null
|
||||
)
|
||||
?: throw IllegalStateException()
|
||||
@@ -568,11 +598,11 @@ class GridSizeMigrationUtilTest {
|
||||
enableNewMigrationLogic("4,4")
|
||||
|
||||
// Setup src grid
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 2, 2, testPackage1, 5, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 2, 3, testPackage2, 6, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 1, DESKTOP, 3, 1, testPackage3, 7, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 1, DESKTOP, 3, 2, testPackage4, 8, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 2, DESKTOP, 3, 3, testPackage5, 9, TMP_CONTENT_URI)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 2, 2, testPackage1, 5, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 2, 3, testPackage2, 6, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 1, CONTAINER_DESKTOP, 3, 1, testPackage3, 7, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 1, CONTAINER_DESKTOP, 3, 2, testPackage4, 8, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 2, CONTAINER_DESKTOP, 3, 3, testPackage5, 9, TMP_TABLE)
|
||||
|
||||
idp.numDatabaseHotseatIcons = 4
|
||||
idp.numColumns = 6
|
||||
@@ -581,8 +611,7 @@ class GridSizeMigrationUtilTest {
|
||||
val srcReader = DbReader(db, TMP_TABLE, context, validPackages)
|
||||
val destReader = DbReader(db, TABLE_NAME, context, validPackages)
|
||||
GridSizeMigrationUtil.migrate(
|
||||
context,
|
||||
db,
|
||||
dbHelper,
|
||||
srcReader,
|
||||
destReader,
|
||||
idp.numDatabaseHotseatIcons,
|
||||
@@ -593,12 +622,13 @@ class GridSizeMigrationUtilTest {
|
||||
|
||||
// Get workspace items
|
||||
val c =
|
||||
context.contentResolver.query(
|
||||
CONTENT_URI,
|
||||
db.query(
|
||||
TABLE_NAME,
|
||||
arrayOf(INTENT, SCREEN),
|
||||
"container=$CONTAINER_DESKTOP",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
)
|
||||
?: throw IllegalStateException()
|
||||
@@ -630,11 +660,11 @@ class GridSizeMigrationUtilTest {
|
||||
enableNewMigrationLogic("2,2")
|
||||
|
||||
// Setup src grid
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 0, 1, testPackage1, 5, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 1, 1, testPackage2, 6, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 1, DESKTOP, 0, 0, testPackage3, 7, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 1, DESKTOP, 1, 0, testPackage4, 8, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 2, DESKTOP, 0, 0, testPackage5, 9, TMP_CONTENT_URI)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 0, 1, testPackage1, 5, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 1, 1, testPackage2, 6, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 1, CONTAINER_DESKTOP, 0, 0, testPackage3, 7, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 1, CONTAINER_DESKTOP, 1, 0, testPackage4, 8, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 2, CONTAINER_DESKTOP, 0, 0, testPackage5, 9, TMP_TABLE)
|
||||
|
||||
idp.numDatabaseHotseatIcons = 4
|
||||
idp.numColumns = 5
|
||||
@@ -642,8 +672,7 @@ class GridSizeMigrationUtilTest {
|
||||
val srcReader = DbReader(db, TMP_TABLE, context, validPackages)
|
||||
val destReader = DbReader(db, TABLE_NAME, context, validPackages)
|
||||
GridSizeMigrationUtil.migrate(
|
||||
context,
|
||||
db,
|
||||
dbHelper,
|
||||
srcReader,
|
||||
destReader,
|
||||
idp.numDatabaseHotseatIcons,
|
||||
@@ -654,12 +683,13 @@ class GridSizeMigrationUtilTest {
|
||||
|
||||
// Get workspace items
|
||||
val c =
|
||||
context.contentResolver.query(
|
||||
CONTENT_URI,
|
||||
db.query(
|
||||
TABLE_NAME,
|
||||
arrayOf(INTENT, SCREEN),
|
||||
"container=$CONTAINER_DESKTOP",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
)
|
||||
?: throw IllegalStateException()
|
||||
@@ -691,11 +721,11 @@ class GridSizeMigrationUtilTest {
|
||||
enableNewMigrationLogic("5,5")
|
||||
|
||||
// Setup src grid
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 0, 1, testPackage1, 5, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 0, DESKTOP, 1, 1, testPackage2, 6, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 1, DESKTOP, 0, 0, testPackage3, 7, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 1, DESKTOP, 1, 0, testPackage4, 8, TMP_CONTENT_URI)
|
||||
modelHelper.addItem(APP_ICON, 2, DESKTOP, 0, 0, testPackage5, 9, TMP_CONTENT_URI)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 0, 1, testPackage1, 5, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 0, CONTAINER_DESKTOP, 1, 1, testPackage2, 6, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 1, CONTAINER_DESKTOP, 0, 0, testPackage3, 7, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 1, CONTAINER_DESKTOP, 1, 0, testPackage4, 8, TMP_TABLE)
|
||||
addItem(ITEM_TYPE_APPLICATION, 2, CONTAINER_DESKTOP, 0, 0, testPackage5, 9, TMP_TABLE)
|
||||
|
||||
idp.numDatabaseHotseatIcons = 4
|
||||
idp.numColumns = 4
|
||||
@@ -703,8 +733,7 @@ class GridSizeMigrationUtilTest {
|
||||
val srcReader = DbReader(db, TMP_TABLE, context, validPackages)
|
||||
val destReader = DbReader(db, TABLE_NAME, context, validPackages)
|
||||
GridSizeMigrationUtil.migrate(
|
||||
context,
|
||||
db,
|
||||
dbHelper,
|
||||
srcReader,
|
||||
destReader,
|
||||
idp.numDatabaseHotseatIcons,
|
||||
@@ -715,12 +744,13 @@ class GridSizeMigrationUtilTest {
|
||||
|
||||
// Get workspace items
|
||||
val c =
|
||||
context.contentResolver.query(
|
||||
CONTENT_URI,
|
||||
db.query(
|
||||
TABLE_NAME,
|
||||
arrayOf(INTENT, SCREEN),
|
||||
"container=$CONTAINER_DESKTOP",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
)
|
||||
?: throw IllegalStateException()
|
||||
@@ -747,4 +777,48 @@ class GridSizeMigrationUtilTest {
|
||||
private fun enableNewMigrationLogic(srcGridSize: String) {
|
||||
LauncherPrefs.get(context).putSync(WORKSPACE_SIZE.to(srcGridSize))
|
||||
}
|
||||
|
||||
private fun addItem(
|
||||
type: Int,
|
||||
screen: Int,
|
||||
container: Int,
|
||||
x: Int,
|
||||
y: Int,
|
||||
packageName: String?
|
||||
): Int {
|
||||
return addItem(
|
||||
type,
|
||||
screen,
|
||||
container,
|
||||
x,
|
||||
y,
|
||||
packageName,
|
||||
dbHelper.generateNewItemId(),
|
||||
TABLE_NAME
|
||||
)
|
||||
}
|
||||
|
||||
private fun addItem(
|
||||
type: Int,
|
||||
screen: Int,
|
||||
container: Int,
|
||||
x: Int,
|
||||
y: Int,
|
||||
packageName: String?,
|
||||
id: Int,
|
||||
tableName: String
|
||||
): Int {
|
||||
val values = ContentValues()
|
||||
values.put(_ID, id)
|
||||
values.put(CONTAINER, container)
|
||||
values.put(SCREEN, screen)
|
||||
values.put(CELLX, x)
|
||||
values.put(CELLY, y)
|
||||
values.put(SPANX, 1)
|
||||
values.put(SPANY, 1)
|
||||
values.put(ITEM_TYPE, type)
|
||||
values.put(INTENT, Intent(Intent.ACTION_MAIN).setPackage(packageName).toUri(0))
|
||||
db.insert(tableName, null, values)
|
||||
return id
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,6 @@ import androidx.test.filters.SmallTest;
|
||||
|
||||
import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.util.Executors;
|
||||
@@ -102,7 +101,7 @@ public class LoaderCursorTest {
|
||||
});
|
||||
|
||||
UserManagerState ums = new UserManagerState();
|
||||
mLoaderCursor = new LoaderCursor(mCursor, Favorites.CONTENT_URI, mApp, ums);
|
||||
mLoaderCursor = new LoaderCursor(mCursor, mApp, ums);
|
||||
ums.allUsers.put(0, Process.myUserHandle());
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.model.DatabaseHelper;
|
||||
import com.android.launcher3.model.DbDowngradeHelper;
|
||||
import com.android.launcher3.pm.UserCache;
|
||||
import com.android.launcher3.settings.SettingsActivity;
|
||||
import com.android.launcher3.shortcuts.ShortcutKey;
|
||||
import com.android.launcher3.util.IOUtils;
|
||||
@@ -128,7 +129,6 @@ public class LauncherDbUtilsTest {
|
||||
assertEquals(1, getFavoriteDataCount(db));
|
||||
ShortcutInfo info = mInfoArgumentCaptor.getValue();
|
||||
assertNotNull(info);
|
||||
assertEquals("Hello", info.getTitle());
|
||||
try (Cursor c = db.query(Favorites.TABLE_NAME, null, null, null, null, null, null)) {
|
||||
c.moveToNext();
|
||||
assertEquals(Favorites.ITEM_TYPE_DEEP_SHORTCUT, c.getInt(c.getColumnIndex(ITEM_TYPE)));
|
||||
@@ -165,12 +165,11 @@ public class LauncherDbUtilsTest {
|
||||
private class MyDatabaseHelper extends DatabaseHelper {
|
||||
|
||||
MyDatabaseHelper() {
|
||||
super(mContext, null, false);
|
||||
super(mContext, null, UserCache.INSTANCE.get(mContext)::getSerialNumberForUser,
|
||||
() -> { });
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleOneTimeDataUpgrade(SQLiteDatabase db) { }
|
||||
|
||||
protected void onEmptyDbCreated() { }
|
||||
}
|
||||
}
|
||||
@@ -45,8 +45,11 @@ import androidx.test.filters.SmallTest;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.model.DatabaseHelper;
|
||||
import com.android.launcher3.model.ModelDbController;
|
||||
import com.android.launcher3.util.LauncherModelHelper;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@@ -61,15 +64,29 @@ public class RestoreDbTaskTest {
|
||||
|
||||
private final UserHandle mWorkUser = UserHandle.getUserHandleForUid(PER_USER_RANGE);
|
||||
|
||||
private LauncherModelHelper mModelHelper;
|
||||
private Context mContext;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
mModelHelper = new LauncherModelHelper();
|
||||
mContext = mModelHelper.sandboxContext;
|
||||
}
|
||||
|
||||
@After
|
||||
public void teardown() {
|
||||
mModelHelper.destroy();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetProfileId() throws Exception {
|
||||
SQLiteDatabase db = new MyDatabaseHelper(23).getWritableDatabase();
|
||||
SQLiteDatabase db = new MyModelDbController(23).getDb();
|
||||
assertEquals(23, new RestoreDbTask().getDefaultProfileId(db));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMigrateProfileId() throws Exception {
|
||||
SQLiteDatabase db = new MyDatabaseHelper(42).getWritableDatabase();
|
||||
SQLiteDatabase db = new MyModelDbController(42).getDb();
|
||||
// Add some mock data
|
||||
for (int i = 0; i < 5; i++) {
|
||||
ContentValues values = new ContentValues();
|
||||
@@ -89,7 +106,7 @@ public class RestoreDbTaskTest {
|
||||
|
||||
@Test
|
||||
public void testChangeDefaultColumn() throws Exception {
|
||||
SQLiteDatabase db = new MyDatabaseHelper(42).getWritableDatabase();
|
||||
SQLiteDatabase db = new MyModelDbController(42).getDb();
|
||||
// Add some mock data
|
||||
for (int i = 0; i < 5; i++) {
|
||||
ContentValues values = new ContentValues();
|
||||
@@ -112,28 +129,27 @@ public class RestoreDbTaskTest {
|
||||
|
||||
@Test
|
||||
public void testSanitizeDB_bothProfiles() throws Exception {
|
||||
Context context = getInstrumentation().getTargetContext();
|
||||
UserHandle myUser = myUserHandle();
|
||||
long myProfileId = context.getSystemService(UserManager.class)
|
||||
long myProfileId = mContext.getSystemService(UserManager.class)
|
||||
.getSerialNumberForUser(myUser);
|
||||
long myProfileId_old = myProfileId + 1;
|
||||
long workProfileId = myProfileId + 2;
|
||||
long workProfileId_old = myProfileId + 3;
|
||||
|
||||
MyDatabaseHelper helper = new MyDatabaseHelper(myProfileId);
|
||||
SQLiteDatabase db = helper.getWritableDatabase();
|
||||
BackupManager bm = spy(new BackupManager(context));
|
||||
MyModelDbController controller = new MyModelDbController(myProfileId);
|
||||
SQLiteDatabase db = controller.getDb();
|
||||
BackupManager bm = spy(new BackupManager(mContext));
|
||||
doReturn(myUserHandle()).when(bm).getUserForAncestralSerialNumber(eq(myProfileId_old));
|
||||
doReturn(mWorkUser).when(bm).getUserForAncestralSerialNumber(eq(workProfileId_old));
|
||||
helper.users.put(workProfileId, mWorkUser);
|
||||
controller.users.put(workProfileId, mWorkUser);
|
||||
|
||||
addIconsBulk(helper, 10, 1, myProfileId_old);
|
||||
addIconsBulk(helper, 6, 2, workProfileId_old);
|
||||
addIconsBulk(controller, 10, 1, myProfileId_old);
|
||||
addIconsBulk(controller, 6, 2, workProfileId_old);
|
||||
assertEquals(10, getItemCountForProfile(db, myProfileId_old));
|
||||
assertEquals(6, getItemCountForProfile(db, workProfileId_old));
|
||||
|
||||
RestoreDbTask task = new RestoreDbTask();
|
||||
task.sanitizeDB(context, helper, helper.getWritableDatabase(), bm);
|
||||
task.sanitizeDB(mContext, controller, controller.getDb(), bm);
|
||||
|
||||
// All the data has been migrated to the new user ids
|
||||
assertEquals(0, getItemCountForProfile(db, myProfileId_old));
|
||||
@@ -144,27 +160,26 @@ public class RestoreDbTaskTest {
|
||||
|
||||
@Test
|
||||
public void testSanitizeDB_workItemsRemoved() throws Exception {
|
||||
Context context = getInstrumentation().getTargetContext();
|
||||
UserHandle myUser = myUserHandle();
|
||||
long myProfileId = context.getSystemService(UserManager.class)
|
||||
long myProfileId = mContext.getSystemService(UserManager.class)
|
||||
.getSerialNumberForUser(myUser);
|
||||
long myProfileId_old = myProfileId + 1;
|
||||
long workProfileId_old = myProfileId + 3;
|
||||
|
||||
MyDatabaseHelper helper = new MyDatabaseHelper(myProfileId);
|
||||
SQLiteDatabase db = helper.getWritableDatabase();
|
||||
BackupManager bm = spy(new BackupManager(context));
|
||||
MyModelDbController controller = new MyModelDbController(myProfileId);
|
||||
SQLiteDatabase db = controller.getDb();
|
||||
BackupManager bm = spy(new BackupManager(mContext));
|
||||
doReturn(myUserHandle()).when(bm).getUserForAncestralSerialNumber(eq(myProfileId_old));
|
||||
// Work profile is not migrated
|
||||
doReturn(null).when(bm).getUserForAncestralSerialNumber(eq(workProfileId_old));
|
||||
|
||||
addIconsBulk(helper, 10, 1, myProfileId_old);
|
||||
addIconsBulk(helper, 6, 2, workProfileId_old);
|
||||
addIconsBulk(controller, 10, 1, myProfileId_old);
|
||||
addIconsBulk(controller, 6, 2, workProfileId_old);
|
||||
assertEquals(10, getItemCountForProfile(db, myProfileId_old));
|
||||
assertEquals(6, getItemCountForProfile(db, workProfileId_old));
|
||||
|
||||
RestoreDbTask task = new RestoreDbTask();
|
||||
task.sanitizeDB(context, helper, helper.getWritableDatabase(), bm);
|
||||
task.sanitizeDB(mContext, controller, controller.getDb(), bm);
|
||||
|
||||
// All the data has been migrated to the new user ids
|
||||
assertEquals(0, getItemCountForProfile(db, myProfileId_old));
|
||||
@@ -173,12 +188,13 @@ public class RestoreDbTaskTest {
|
||||
assertEquals(10, getCount(db, "select * from favorites"));
|
||||
}
|
||||
|
||||
private void addIconsBulk(DatabaseHelper helper, int count, int screen, long profileId) {
|
||||
int columns = LauncherAppState.getIDP(getInstrumentation().getTargetContext()).numColumns;
|
||||
private void addIconsBulk(MyModelDbController controller,
|
||||
int count, int screen, long profileId) {
|
||||
int columns = LauncherAppState.getIDP(mContext).numColumns;
|
||||
String packageName = getInstrumentation().getContext().getPackageName();
|
||||
for (int i = 0; i < count; i++) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(LauncherSettings.Favorites._ID, helper.generateNewItemId());
|
||||
values.put(LauncherSettings.Favorites._ID, controller.generateNewItemId());
|
||||
values.put(LauncherSettings.Favorites.CONTAINER, CONTAINER_DESKTOP);
|
||||
values.put(LauncherSettings.Favorites.SCREEN, screen);
|
||||
values.put(LauncherSettings.Favorites.CELLX, i % columns);
|
||||
@@ -189,11 +205,11 @@ public class RestoreDbTaskTest {
|
||||
values.put(LauncherSettings.Favorites.ITEM_TYPE, ITEM_TYPE_APPLICATION);
|
||||
values.put(LauncherSettings.Favorites.INTENT,
|
||||
new Intent(Intent.ACTION_MAIN).setPackage(packageName).toUri(0));
|
||||
helper.getWritableDatabase().insert(TABLE_NAME, null, values);
|
||||
|
||||
controller.insert(TABLE_NAME, values);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRemoveScreenIdGaps_firstScreenEmpty() {
|
||||
runRemoveScreenIdGapsTest(
|
||||
@@ -216,7 +232,7 @@ public class RestoreDbTaskTest {
|
||||
}
|
||||
|
||||
private void runRemoveScreenIdGapsTest(int[] screenIds, int[] expectedScreenIds) {
|
||||
SQLiteDatabase db = new MyDatabaseHelper(42).getWritableDatabase();
|
||||
SQLiteDatabase db = new MyModelDbController(42).getDb();
|
||||
// Add some mock data
|
||||
for (int i = 0; i < screenIds.length; i++) {
|
||||
ContentValues values = new ContentValues();
|
||||
@@ -254,13 +270,12 @@ public class RestoreDbTaskTest {
|
||||
}
|
||||
}
|
||||
|
||||
private class MyDatabaseHelper extends DatabaseHelper {
|
||||
private class MyModelDbController extends ModelDbController {
|
||||
|
||||
public final LongSparseArray<UserHandle> users;
|
||||
public final LongSparseArray<UserHandle> users = new LongSparseArray<>();
|
||||
|
||||
MyDatabaseHelper(long profileId) {
|
||||
super(getInstrumentation().getTargetContext(), null, false);
|
||||
users = new LongSparseArray<>();
|
||||
MyModelDbController(long profileId) {
|
||||
super(mContext);
|
||||
users.put(profileId, myUserHandle());
|
||||
}
|
||||
|
||||
@@ -269,10 +284,5 @@ public class RestoreDbTaskTest {
|
||||
int index = users.indexOfValue(user);
|
||||
return index >= 0 ? users.keyAt(index) : -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleOneTimeDataUpgrade(SQLiteDatabase db) { }
|
||||
|
||||
protected void onEmptyDbCreated() { }
|
||||
}
|
||||
}
|
||||
@@ -363,12 +363,6 @@ public class LauncherModelHelper {
|
||||
sandboxContext.getContentResolver().insert(contentUri, values);
|
||||
}
|
||||
|
||||
public void deleteItem(int itemId, @NonNull final String tableName) {
|
||||
final Uri uri = Uri.parse("content://"
|
||||
+ LauncherProvider.AUTHORITY + "/" + tableName + "/" + itemId);
|
||||
sandboxContext.getContentResolver().delete(uri, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up a mock provider to load the provided layout by default, next time the layout loads
|
||||
*/
|
||||
@@ -426,7 +420,7 @@ public class LauncherModelHelper {
|
||||
}
|
||||
|
||||
public SQLiteDatabase getDb() {
|
||||
return getModelDbController().getDatabaseHelper().getWritableDatabase();
|
||||
return getModelDbController().getDb();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user