Merge "Use notification counts (instead of assuming all 1)" into ub-launcher3-dorval
diff --git a/res/drawable/ic_instant_app.xml b/res/drawable/ic_instant_app.xml
deleted file mode 100644
index be5a3e0..0000000
--- a/res/drawable/ic_instant_app.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="@dimen/badge_size"
-    android:height="@dimen/badge_size"
-    android:viewportWidth="18"
-    android:viewportHeight="18">
-
-    <path
-        android:fillColor="@android:color/black"
-        android:fillType="evenOdd"
-        android:strokeWidth="1"
-        android:pathData="M 9 0 C 13.9705627485 0 18 4.02943725152 18 9 C 18 13.9705627485 13.9705627485 18 9 18 C 4.02943725152 18 0 13.9705627485 0 9 C 0 4.02943725152 4.02943725152 0 9 0 Z" />
-    <path
-        android:fillColor="@android:color/white"
-        android:fillType="evenOdd"
-        android:strokeWidth="1"
-        android:pathData="M 9 0 C 13.9705627485 0 18 4.02943725152 18 9 C 18 13.9705627485 13.9705627485 18 9 18 C 4.02943725152 18 0 13.9705627485 0 9 C 0 4.02943725152 4.02943725152 0 9 0 Z" />
-    <path
-        android:fillColor="@android:color/white"
-        android:fillType="evenOdd"
-        android:strokeWidth="1"
-        android:pathData="M 9 0 C 13.9705627485 0 18 4.02943725152 18 9 C 18 13.9705627485 13.9705627485 18 9 18 C 4.02943725152 18 0 13.9705627485 0 9 C 0 4.02943725152 4.02943725152 0 9 0 Z" />
-    <path
-        android:fillColor="@android:color/black"
-        android:fillAlpha="0.87"
-        android:fillType="evenOdd"
-        android:strokeWidth="1"
-        android:pathData="M 6 10.4123279 L 8.63934949 10.4123279 L 8.63934949 15.6 L 12.5577168 7.84517705 L 9.94547194 7.84517705 L 9.94547194 2 Z" />
-</vector>
diff --git a/res/layout/all_apps_discovery_item.xml b/res/layout/all_apps_discovery_item.xml
index 2b21ef5..1a7eaa7 100644
--- a/res/layout/all_apps_discovery_item.xml
+++ b/res/layout/all_apps_discovery_item.xml
@@ -27,18 +27,6 @@
         android:padding="8dp"
         android:scaleType="fitCenter"/>
 
-    <ImageView
-        android:id="@+id/badge"
-        android:layout_width="16dp"
-        android:layout_height="16dp"
-        android:scaleType="fitCenter"
-        android:src="@drawable/ic_instant_app"
-        android:layout_marginRight="6dp"
-        android:layout_marginBottom="6dp"
-        android:layout_alignRight="@+id/image"
-        android:layout_alignBottom="@+id/image"
-        android:clickable="false"/>
-
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
diff --git a/src/com/android/launcher3/AppInfo.java b/src/com/android/launcher3/AppInfo.java
index 2a62037..9ec26e2 100644
--- a/src/com/android/launcher3/AppInfo.java
+++ b/src/com/android/launcher3/AppInfo.java
@@ -56,11 +56,10 @@
      * Must not hold the Context.
      */
     public AppInfo(Context context, LauncherActivityInfo info, UserHandle user) {
-        this(context, info, user, UserManagerCompat.getInstance(context).isQuietModeEnabled(user));
+        this(info, user, UserManagerCompat.getInstance(context).isQuietModeEnabled(user));
     }
 
-    public AppInfo(Context context, LauncherActivityInfo info, UserHandle user,
-            boolean quietModeEnabled) {
+    public AppInfo(LauncherActivityInfo info, UserHandle user, boolean quietModeEnabled) {
         this.componentName = info.getComponentName();
         this.container = ItemInfo.NO_ID;
         this.user = user;
@@ -71,7 +70,7 @@
             isDisabled |= ShortcutInfo.FLAG_DISABLED_QUIET_USER;
         }
 
-        intent = makeLaunchIntent(context, info, user);
+        intent = makeLaunchIntent(info);
     }
 
     public AppInfo(AppInfo info) {
@@ -95,14 +94,11 @@
         return new ComponentKey(componentName, user);
     }
 
-    public static Intent makeLaunchIntent(Context context, LauncherActivityInfo info,
-            UserHandle user) {
-        long serialNumber = UserManagerCompat.getInstance(context).getSerialNumberForUser(user);
+    public static Intent makeLaunchIntent(LauncherActivityInfo info) {
         return new Intent(Intent.ACTION_MAIN)
             .addCategory(Intent.CATEGORY_LAUNCHER)
             .setComponent(info.getComponentName())
-            .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED)
-            .putExtra(EXTRA_PROFILE, serialNumber);
+            .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
     }
 
     @Override
diff --git a/src/com/android/launcher3/InstallShortcutReceiver.java b/src/com/android/launcher3/InstallShortcutReceiver.java
index 80dec16..ce85570 100644
--- a/src/com/android/launcher3/InstallShortcutReceiver.java
+++ b/src/com/android/launcher3/InstallShortcutReceiver.java
@@ -328,7 +328,7 @@
             user = info.getUser();
             mContext = context;
 
-            launchIntent = AppInfo.makeLaunchIntent(context, info, user);
+            launchIntent = AppInfo.makeLaunchIntent(info);
             label = info.getLabel().toString();
         }
 
@@ -344,7 +344,7 @@
             mContext = context;
             user = info.getUserHandle();
 
-            launchIntent = info.makeIntent(context);
+            launchIntent = info.makeIntent();
             label = info.getShortLabel().toString();
         }
 
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 2dd3198..9e214d1 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -29,7 +29,6 @@
 
 import com.android.launcher3.config.FeatureFlags;
 import com.android.launcher3.config.ProviderConfig;
-import com.android.launcher3.logging.FileLog;
 import com.android.launcher3.util.Thunk;
 
 import org.xmlpull.v1.XmlPullParser;
@@ -188,23 +187,6 @@
         }
     }
 
-    public void dumpDisplayInfo(Context context) {
-        WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
-        Display display = wm.getDefaultDisplay();
-        DisplayMetrics dm = new DisplayMetrics();
-        display.getMetrics(dm);
-
-        Point smallestSize = new Point();
-        Point largestSize = new Point();
-        display.getCurrentSizeRange(smallestSize, largestSize);
-
-        FileLog.e("DisplayInfo", "Default Density: " + DisplayMetrics.DENSITY_DEFAULT);
-        FileLog.e("DisplayInfo", "Density: " + dm.densityDpi);
-        FileLog.e("DisplayInfo", "Smallest size: " + smallestSize);
-        FileLog.e("DisplayInfo", "Largest size: " + largestSize);
-        FileLog.e("DisplayInfo", "minWidth/Height DPS: " + minWidthDps + ", " + minHeightDps);
-    }
-
     ArrayList<InvariantDeviceProfile> getPredefinedDeviceProfiles(Context context) {
         ArrayList<InvariantDeviceProfile> profiles = new ArrayList<>();
         try (XmlResourceParser parser = context.getResources().getXml(R.xml.device_profiles)) {
diff --git a/src/com/android/launcher3/ItemInfo.java b/src/com/android/launcher3/ItemInfo.java
index aec6c7d..0779a3d 100644
--- a/src/com/android/launcher3/ItemInfo.java
+++ b/src/com/android/launcher3/ItemInfo.java
@@ -29,11 +29,6 @@
  */
 public class ItemInfo {
 
-    /**
-     * Intent extra to store the profile. Format: UserHandle
-     */
-    public static final String EXTRA_PROFILE = "profile";
-
     public static final int NO_ID = -1;
 
     /**
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 308bb63..2dba83d 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2706,11 +2706,7 @@
                 !intent.hasExtra(INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION);
         Bundle optsBundle = useLaunchAnimation ? getActivityLaunchOptions(v) : null;
 
-        UserHandle user = null;
-        if (intent.hasExtra(AppInfo.EXTRA_PROFILE)) {
-            long serialNumber = intent.getLongExtra(AppInfo.EXTRA_PROFILE, -1);
-            user = UserManagerCompat.getInstance(this).getUserForSerialNumber(serialNumber);
-        }
+        UserHandle user = item == null ? null : item.user;
 
         // Prepare intent
         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java
index 2e75579..180c202 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -28,7 +28,6 @@
 import com.android.launcher3.compat.UserManagerCompat;
 import com.android.launcher3.config.ProviderConfig;
 import com.android.launcher3.dynamicui.ExtractionUtils;
-import com.android.launcher3.model.GridSizeMigrationTask;
 import com.android.launcher3.util.ConfigMonitor;
 import com.android.launcher3.util.Preconditions;
 import com.android.launcher3.util.TestingUtils;
@@ -54,8 +53,6 @@
         if (INSTANCE == null) {
             if (Looper.myLooper() == Looper.getMainLooper()) {
                 INSTANCE = new LauncherAppState(context.getApplicationContext());
-                GridSizeMigrationTask.logDeviceProfileIfChanged(
-                        INSTANCE.getInvariantDeviceProfile(), context);
             } else {
                 try {
                     return new MainThreadExecutor().submit(new Callable<LauncherAppState>() {
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index dc668e6..5a41eeb 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -1069,9 +1069,6 @@
                                     info.rank = c.getInt(rankIndex);
                                     info.spanX = 1;
                                     info.spanY = 1;
-                                    // TODO: Remove this extra. Instead we should be using
-                                    // itemInfo#user.
-                                    info.intent.putExtra(ItemInfo.EXTRA_PROFILE, c.serialNumber);
                                     info.isDisabled |= disabledState;
                                     if (isSafeMode && !Utilities.isSystemApp(context, intent)) {
                                         info.isDisabled |= ShortcutInfo.FLAG_DISABLED_SAFEMODE;
@@ -1685,7 +1682,7 @@
                 for (int i = 0; i < apps.size(); i++) {
                     LauncherActivityInfo app = apps.get(i);
                     // This builds the icon bitmaps.
-                    mBgAllAppsList.add(new AppInfo(mContext, app, user, quietMode), app);
+                    mBgAllAppsList.add(new AppInfo(app, user, quietMode), app);
                 }
 
                 final ManagedProfileHeuristic heuristic = ManagedProfileHeuristic.get(mContext, user);
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index e250b3f..a750406 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -72,7 +72,7 @@
     private static final String TAG = "LauncherProvider";
     private static final boolean LOGD = false;
 
-    private static final int DATABASE_VERSION = 27;
+    private static final int DATABASE_VERSION = 28;
 
     public static final String AUTHORITY = ProviderConfig.AUTHORITY;
 
@@ -791,6 +791,26 @@
                         break;
                     }
                 case 27: {
+                    // Remove "profile extra"
+                    db.beginTransaction();
+                    try {
+                        UserManagerCompat um = UserManagerCompat.getInstance(mContext);
+                        for (UserHandle user : um.getUserProfiles()) {
+                            long serial = um.getSerialNumberForUser(user);
+                            String sql = "update favorites set intent = replace(intent, "
+                                    + "';l.profile=" + serial + ";', ';') where itemType = 0;";
+                            db.execSQL(sql);
+                        }
+                        db.setTransactionSuccessful();
+                    } catch (SQLException ex) {
+                        Log.e(TAG, ex.getMessage(), ex);
+                        // Old version remains, which means we wipe old data
+                        break;
+                    } finally {
+                        db.endTransaction();
+                    }
+                }
+                case 28: {
                     // DB Upgraded successfully
                     return;
                 }
diff --git a/src/com/android/launcher3/SessionCommitReceiver.java b/src/com/android/launcher3/SessionCommitReceiver.java
index e8bf0a5..203bc25 100644
--- a/src/com/android/launcher3/SessionCommitReceiver.java
+++ b/src/com/android/launcher3/SessionCommitReceiver.java
@@ -19,14 +19,17 @@
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
+import android.content.SharedPreferences;
 import android.content.pm.LauncherActivityInfo;
 import android.content.pm.PackageInstaller;
 import android.content.pm.PackageInstaller.SessionInfo;
 import android.os.Process;
 import android.os.UserHandle;
 import android.text.TextUtils;
+import android.util.Log;
 
 import com.android.launcher3.compat.LauncherAppsCompat;
+import com.android.launcher3.compat.UserManagerCompat;
 
 import java.util.List;
 
@@ -35,9 +38,13 @@
  */
 public class SessionCommitReceiver extends BroadcastReceiver {
 
+    private static final long SESSION_IGNORE_DURATION = 3 * 60 * 60 * 1000; // 3 hours
+
     // Preference key for automatically adding icon to homescreen.
     public static final String ADD_ICON_PREFERENCE_KEY = "pref_add_icon_to_home";
 
+    private static final String KEY_FIRST_TIME = "first_session_broadcast_time";
+
     @Override
     public void onReceive(Context context, Intent intent) {
         if (!isEnabled(context)) {
@@ -57,6 +64,17 @@
             return;
         }
 
+        // STOPSHIP: Remove this workaround when we start getting proper install reason
+        SharedPreferences prefs = context
+                .getSharedPreferences(LauncherFiles.DEVICE_PREFERENCES_KEY, 0);
+        long now = System.currentTimeMillis();
+        long firstTime = prefs.getLong(KEY_FIRST_TIME, now);
+        prefs.edit().putLong(KEY_FIRST_TIME, firstTime).apply();
+        if ((now - firstTime) < SESSION_IGNORE_DURATION) {
+            Log.d("SessionCommitReceiver", "Temporarily ignoring session broadcast");
+            return;
+        }
+
         List<LauncherActivityInfo> activities = LauncherAppsCompat.getInstance(context)
                 .getActivityList(info.getAppPackageName(), user);
         if (activities == null || activities.isEmpty()) {
diff --git a/src/com/android/launcher3/ShortcutInfo.java b/src/com/android/launcher3/ShortcutInfo.java
index f0bb1c0..6f0417c 100644
--- a/src/com/android/launcher3/ShortcutInfo.java
+++ b/src/com/android/launcher3/ShortcutInfo.java
@@ -199,7 +199,7 @@
 
     public void updateFromDeepShortcutInfo(ShortcutInfoCompat shortcutInfo, Context context) {
         // {@link ShortcutInfoCompat#getActivity} can change during an update. Recreate the intent
-        intent = shortcutInfo.makeIntent(context);
+        intent = shortcutInfo.makeIntent();
         title = shortcutInfo.getShortLabel();
 
         CharSequence label = shortcutInfo.getLongLabel();
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index abc5367..207a7d4 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -468,13 +468,8 @@
                 && TextUtils.isEmpty(launchIntent.getDataString())) {
             // An app target can either have no extra or have ItemInfo.EXTRA_PROFILE.
             Bundle extras = launchIntent.getExtras();
-            if (extras == null) {
-                return true;
-            } else {
-                Set<String> keys = extras.keySet();
-                return keys.size() == 1 && keys.contains(ItemInfo.EXTRA_PROFILE);
-            }
-        };
+            return extras == null || extras.keySet().isEmpty();
+        }
         return false;
     }
 
diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
index f228470..f5cf7ef 100644
--- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
+++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
@@ -292,7 +292,7 @@
                 mDiscoveredApps.clear();
                 break;
             case UPDATE:
-                mDiscoveredApps.add(new AppDiscoveryAppInfo(app, mLauncher));
+                mDiscoveredApps.add(new AppDiscoveryAppInfo(app));
                 break;
         }
         updateAdapterItems();
@@ -494,10 +494,13 @@
         if (hasFilter()) {
             if (isAppDiscoveryRunning() || mDiscoveredApps.size() > 0) {
                 mAdapterItems.add(AdapterItem.asLoadingDivider(position++));
-
                 // Append all app discovery results
                 for (int i = 0; i < mDiscoveredApps.size(); i++) {
                     AppDiscoveryAppInfo appDiscoveryAppInfo = mDiscoveredApps.get(i);
+                    if (appDiscoveryAppInfo.isRecent) {
+                        // already handled in getFilteredAppInfos()
+                        continue;
+                    }
                     AdapterItem item = AdapterItem.asDiscoveryItem(position++,
                             "", appDiscoveryAppInfo, appIndex++);
                     mAdapterItems.add(item);
@@ -589,6 +592,17 @@
                 result.add(match);
             }
         }
+
+        // adding recently used instant apps
+        if (mDiscoveredApps.size() > 0) {
+            for (int i = 0; i < mDiscoveredApps.size(); i++) {
+                AppDiscoveryAppInfo discoveryAppInfo = mDiscoveredApps.get(i);
+                if (discoveryAppInfo.isRecent) {
+                    result.add(discoveryAppInfo);
+                }
+            }
+            Collections.sort(result, mAppNameComparator);
+        }
         return result;
     }
 
diff --git a/src/com/android/launcher3/discovery/AppDiscoveryAppInfo.java b/src/com/android/launcher3/discovery/AppDiscoveryAppInfo.java
index 50e979a..06493b2 100644
--- a/src/com/android/launcher3/discovery/AppDiscoveryAppInfo.java
+++ b/src/com/android/launcher3/discovery/AppDiscoveryAppInfo.java
@@ -18,24 +18,18 @@
 
 import android.content.ComponentName;
 import android.content.Intent;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.drawable.Drawable;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 
 import com.android.launcher3.AppInfo;
-import com.android.launcher3.Launcher;
 import com.android.launcher3.LauncherSettings;
-import com.android.launcher3.R;
 import com.android.launcher3.ShortcutInfo;
 
 public class AppDiscoveryAppInfo extends AppInfo {
 
-    private final @NonNull Launcher mLauncher;
-
     public final boolean showAsDiscoveryItem;
     public final boolean isInstantApp;
+    public final boolean isRecent;
     public final float rating;
     public final long reviewCount;
     public final @NonNull String publisher;
@@ -43,14 +37,14 @@
     public final @NonNull Intent launchIntent;
     public final @Nullable String priceFormatted;
 
-    public AppDiscoveryAppInfo(AppDiscoveryItem item, Launcher launcher) {
-        this.mLauncher = launcher;
+    public AppDiscoveryAppInfo(AppDiscoveryItem item) {
         this.intent = item.isInstantApp ? item.launchIntent : item.installIntent;
         this.title = item.title;
         this.iconBitmap = item.bitmap;
         this.isDisabled = ShortcutInfo.DEFAULT;
         this.usingLowResIcon = false;
         this.isInstantApp = item.isInstantApp;
+        this.isRecent = item.isRecent;
         this.rating = item.starRating;
         this.showAsDiscoveryItem = true;
         this.publisher = item.publisher != null ? item.publisher : "";
@@ -67,18 +61,7 @@
         if (!isDragAndDropSupported()) {
             throw new RuntimeException("DnD is currently not supported for discovered store apps");
         }
-        ShortcutInfo shortcutInfo = super.makeShortcut();
-        if (isInstantApp) {
-            int iconSize = iconBitmap.getWidth();
-            int badgeSize = mLauncher.getResources().getDimensionPixelOffset(R.dimen.badge_size);
-            Bitmap icon = Bitmap.createBitmap(iconBitmap);
-            Drawable badgeDrawable = mLauncher.getDrawable(R.drawable.ic_instant_app);
-            badgeDrawable.setBounds(iconSize - badgeSize, iconSize - badgeSize, iconSize, iconSize);
-            Canvas canvas = new Canvas(icon);
-            badgeDrawable.draw(canvas);
-            shortcutInfo.iconBitmap = icon;
-        }
-        return shortcutInfo;
+        return super.makeShortcut();
     }
 
     public boolean isDragAndDropSupported() {
diff --git a/src/com/android/launcher3/discovery/AppDiscoveryItem.java b/src/com/android/launcher3/discovery/AppDiscoveryItem.java
index 7c10371..09c91ac 100644
--- a/src/com/android/launcher3/discovery/AppDiscoveryItem.java
+++ b/src/com/android/launcher3/discovery/AppDiscoveryItem.java
@@ -28,6 +28,7 @@
 
     public final String packageName;
     public final boolean isInstantApp;
+    public final boolean isRecent;
     public final float starRating;
     public final long reviewCount;
     public final Intent launchIntent;
@@ -39,6 +40,7 @@
 
     public AppDiscoveryItem(String packageName,
                             boolean isInstantApp,
+                            boolean isRecent,
                             float starRating,
                             long reviewCount,
                             CharSequence title,
@@ -49,6 +51,7 @@
                             Intent installIntent) {
         this.packageName = packageName;
         this.isInstantApp = isInstantApp;
+        this.isRecent = isRecent;
         this.starRating = starRating;
         this.reviewCount = reviewCount;
         this.launchIntent = launchIntent;
diff --git a/src/com/android/launcher3/discovery/AppDiscoveryItemView.java b/src/com/android/launcher3/discovery/AppDiscoveryItemView.java
index 6faad87..9bb3b10 100644
--- a/src/com/android/launcher3/discovery/AppDiscoveryItemView.java
+++ b/src/com/android/launcher3/discovery/AppDiscoveryItemView.java
@@ -34,7 +34,6 @@
     private static boolean SHOW_REVIEW_COUNT = false;
 
     private ImageView mImage;
-    private ImageView mBadge;
     private TextView mTitle;
     private TextView mRatingText;
     private RatingView mRatingView;
@@ -58,7 +57,6 @@
     protected void onFinishInflate() {
         super.onFinishInflate();
         this.mImage = (ImageView) findViewById(R.id.image);
-        this.mBadge = (ImageView) findViewById(R.id.badge);
         this.mTitle = (TextView) findViewById(R.id.title);
         this.mRatingText = (TextView) findViewById(R.id.rating);
         this.mRatingView = (RatingView) findViewById(R.id.rating_view);
@@ -80,7 +78,6 @@
         mImage.setTag(info);
         mImage.setImageBitmap(info.iconBitmap);
         mImage.setOnLongClickListener(info.isDragAndDropSupported() ? mOnLongClickListener : null);
-        mBadge.setVisibility(info.isInstantApp ? View.VISIBLE : View.GONE);
         mTitle.setText(info.title);
         mPrice.setText(info.priceFormatted != null ? info.priceFormatted : "");
         mReviewCount.setVisibility(SHOW_REVIEW_COUNT ? View.VISIBLE : View.GONE);
diff --git a/src/com/android/launcher3/model/GridSizeMigrationTask.java b/src/com/android/launcher3/model/GridSizeMigrationTask.java
index e50b912..221798b 100644
--- a/src/com/android/launcher3/model/GridSizeMigrationTask.java
+++ b/src/com/android/launcher3/model/GridSizeMigrationTask.java
@@ -27,7 +27,6 @@
 import com.android.launcher3.compat.AppWidgetManagerCompat;
 import com.android.launcher3.compat.PackageInstallerCompat;
 import com.android.launcher3.config.FeatureFlags;
-import com.android.launcher3.logging.FileLog;
 import com.android.launcher3.util.GridOccupancy;
 import com.android.launcher3.util.LongArrayMap;
 
@@ -890,23 +889,6 @@
                 .apply();
     }
 
-    public static void logDeviceProfileIfChanged(InvariantDeviceProfile idp, Context context) {
-        SharedPreferences prefs = Utilities.getPrefs(context);
-        String gridSizeString = getPointString(idp.numColumns, idp.numRows);
-
-        int oldHotseatCount = prefs.getInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, idp.numHotseatIcons);
-        String oldSize = prefs.getString(KEY_MIGRATION_SRC_WORKSPACE_SIZE, gridSizeString);
-        if (gridSizeString.equals(oldSize) && idp.numHotseatIcons == oldHotseatCount) {
-            // Skip if workspace and hotseat sizes have not changed.
-            return;
-        }
-
-        FileLog.e(TAG, "Grid size changed" + gridSizeString);
-        FileLog.e(TAG, "   oldSize: " + oldSize + "  , hotseat: " + oldHotseatCount);
-        FileLog.e(TAG, "   newSize: " + gridSizeString + "  , hotseat: " + idp.numHotseatIcons);
-        idp.dumpDisplayInfo(context);
-    }
-
     /**
      * Migrates the workspace and hotseat in case their sizes changed.
      * @return false if the migration failed.
diff --git a/src/com/android/launcher3/shortcuts/ShortcutInfoCompat.java b/src/com/android/launcher3/shortcuts/ShortcutInfoCompat.java
index dac2160..37047bb 100644
--- a/src/com/android/launcher3/shortcuts/ShortcutInfoCompat.java
+++ b/src/com/android/launcher3/shortcuts/ShortcutInfoCompat.java
@@ -44,15 +44,12 @@
     }
 
     @TargetApi(Build.VERSION_CODES.N)
-    public Intent makeIntent(Context context) {
-        long serialNumber = UserManagerCompat.getInstance(context)
-                .getSerialNumberForUser(getUserHandle());
+    public Intent makeIntent() {
         return new Intent(Intent.ACTION_MAIN)
                 .addCategory(INTENT_CATEGORY)
                 .setComponent(getActivity())
                 .setPackage(getPackage())
                 .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED)
-                .putExtra(ItemInfo.EXTRA_PROFILE, serialNumber)
                 .putExtra(EXTRA_SHORTCUT_ID, getId());
     }
 
diff --git a/src/com/android/launcher3/util/ManagedProfileHeuristic.java b/src/com/android/launcher3/util/ManagedProfileHeuristic.java
index 85a000c..ce603c4 100644
--- a/src/com/android/launcher3/util/ManagedProfileHeuristic.java
+++ b/src/com/android/launcher3/util/ManagedProfileHeuristic.java
@@ -121,7 +121,7 @@
                     .isQuietModeEnabled(user);
             for (int i = 0; i < count; i++) {
                 LauncherActivityInstallInfo info = apps.get(i);
-                AppInfo appInfo = new AppInfo(mContext, info.info, user, quietModeEnabled);
+                AppInfo appInfo = new AppInfo(info.info, user, quietModeEnabled);
                 mIconCache.getTitleAndIcon(appInfo, info.info, false /* useLowResIcon */);
                 ShortcutInfo si = appInfo.makeShortcut();
                 ((info.installTime <= folderCreationTime) ? workFolderApps : homescreenApps).add(si);
diff --git a/src/com/android/launcher3/util/PackageManagerHelper.java b/src/com/android/launcher3/util/PackageManagerHelper.java
index 7629f78..e12b2d4 100644
--- a/src/com/android/launcher3/util/PackageManagerHelper.java
+++ b/src/com/android/launcher3/util/PackageManagerHelper.java
@@ -76,7 +76,7 @@
     public Intent getAppLaunchIntent(String pkg, UserHandle user) {
         List<LauncherActivityInfo> activities = mLauncherApps.getActivityList(pkg, user);
         return activities.isEmpty() ? null :
-                AppInfo.makeLaunchIntent(mContext, activities.get(0), user);
+                AppInfo.makeLaunchIntent(activities.get(0));
     }
 
     /**