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

Commit 0b560dda authored by Winson Chung's avatar Winson Chung
Browse files

Adding tighter first run checks for migration clings. (Bug 12626290)

Change-Id: I09fc95c9a3d50ce57f9140e89da2ff4856807f92
parent e6e0af03
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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() {
+11 −0
Original line number Diff line number Diff line
@@ -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," +