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

Commit 77ff9a43 authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

Merge "Removing the profile extra from intent and using the profile id from...

Merge "Removing the profile extra from intent and using the profile id from the profile column" into ub-launcher3-dorval
parents ed68728b 24bb66a1
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -56,11 +56,10 @@ public class AppInfo extends ItemInfoWithIcon {
     * 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 @@ public class AppInfo extends ItemInfoWithIcon {
            isDisabled |= ShortcutInfo.FLAG_DISABLED_QUIET_USER;
        }

        intent = makeLaunchIntent(context, info, user);
        intent = makeLaunchIntent(info);
    }

    public AppInfo(AppInfo info) {
@@ -95,14 +94,11 @@ public class AppInfo extends ItemInfoWithIcon {
        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
+2 −2
Original line number Diff line number Diff line
@@ -328,7 +328,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
            user = info.getUser();
            mContext = context;

            launchIntent = AppInfo.makeLaunchIntent(context, info, user);
            launchIntent = AppInfo.makeLaunchIntent(info);
            label = info.getLabel().toString();
        }

@@ -344,7 +344,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
            mContext = context;
            user = info.getUserHandle();

            launchIntent = info.makeIntent(context);
            launchIntent = info.makeIntent();
            label = info.getShortLabel().toString();
        }

+0 −5
Original line number Diff line number Diff line
@@ -29,11 +29,6 @@ import com.android.launcher3.util.ContentWriter;
 */
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;

    /**
+1 −5
Original line number Diff line number Diff line
@@ -2706,11 +2706,7 @@ public class Launcher extends BaseActivity
                !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);
+1 −4
Original line number Diff line number Diff line
@@ -1069,9 +1069,6 @@ public class LauncherModel extends BroadcastReceiver
                                    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 @@ public class LauncherModel extends BroadcastReceiver
                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);
Loading