Fix issue where clings didn't appear after set up wizard (issue 13077829)

-> Also removed the db-created as a criteria for showing the clings
   (this was a bit problematic in some cases and going forward)
-> Instead, we use database upgrade as a signal to not show the clings.
   This is used instead of the above criteria (to prevent old users from
   seeing the migration cling and losing their data.)
-> Stripped some old code related to custom clings that's no longer used.

Change-Id: Ib5e5285e5ddbc60e69eb998ee9fd092ae879150d
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index a69f423..b952729 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -71,7 +71,7 @@
 
     private static final String DATABASE_NAME = "launcher.db";
 
-    private static final int DATABASE_VERSION = 16;
+    private static final int DATABASE_VERSION = 17;
 
     static final String OLD_AUTHORITY = "com.android.launcher2.settings";
     static final String AUTHORITY = ProviderConfig.AUTHORITY;
@@ -769,6 +769,16 @@
                 }
             }
 
+            if (version < 17) {
+                // We use the db version upgrade here to identify users who may not have seen
+                // clings yet (because they weren't available), but for whom the clings are now
+                // available (tablet users). Because one of the possible cling flows (migration)
+                // is very destructive (wipes out workspaces), we want to prevent this from showing
+                // until clear data. We do so by marking that the clings have been shown.
+                LauncherClings.synchonouslyMarkFirstRunClingDismissed(mContext);
+                version = 17;
+            }
+
             if (version != DATABASE_VERSION) {
                 Log.w(TAG, "Destroying all old data.");
                 db.execSQL("DROP TABLE IF EXISTS " + TABLE_FAVORITES);