Merge "Adding tighter first run checks for migration clings. (Bug 12626290)" into jb-ub-now-kermit

This commit is contained in:
Winson Chung
2014-01-23 20:21:12 +00:00
committed by Android (Google) Code Review
2 changed files with 13 additions and 1 deletions
@@ -196,7 +196,8 @@ class LauncherClings {
SharedPreferences sharedPrefs = mLauncher.getSharedPrefs();
return areClingsEnabled() &&
!sharedPrefs.getBoolean(FIRST_RUN_CLING_DISMISSED_KEY, false) &&
!sharedPrefs.getBoolean(MIGRATION_CLING_DISMISSED_KEY, false);
!sharedPrefs.getBoolean(MIGRATION_CLING_DISMISSED_KEY, false) &&
LauncherAppState.getLauncherProvider().wasNewDbCreated();
}
public void removeFirstRunAndMigrationClings() {
@@ -108,6 +108,10 @@ public class LauncherProvider extends ContentProvider {
return true;
}
public boolean wasNewDbCreated() {
return mOpenHelper.wasNewDbCreated();
}
@Override
public String getType(Uri uri) {
SqlArguments args = new SqlArguments(uri, null, null);
@@ -343,6 +347,8 @@ public class LauncherProvider extends ContentProvider {
private long mMaxItemId = -1;
private long mMaxScreenId = -1;
private boolean mNewDbCreated = false;
DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
mContext = context;
@@ -358,6 +364,10 @@ public class LauncherProvider extends ContentProvider {
}
}
public boolean wasNewDbCreated() {
return mNewDbCreated;
}
/**
* Send notification that we've deleted the {@link AppWidgetHost},
* probably as part of the initial database creation. The receiver may
@@ -375,6 +385,7 @@ public class LauncherProvider extends ContentProvider {
mMaxItemId = 1;
mMaxScreenId = 0;
mNewDbCreated = true;
db.execSQL("CREATE TABLE favorites (" +
"_id INTEGER PRIMARY KEY," +