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

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

Merge "Removing unused constructors" into ub-launcher3-master

parents 79f40bec 2fd9bf60
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
package com.android.launcher3.shortcuts;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.UserHandle;

@@ -18,8 +17,8 @@ public class ShortcutKey extends ComponentKey {
        super(new ComponentName(packageName, id), user);
    }

    public ShortcutKey(Context context, String componentKeyStr) {
        super(context, componentKeyStr);
    public ShortcutKey(ComponentName componentName, UserHandle user) {
        super(componentName, user);
    }

    public String getId() {
+0 −27
Original line number Diff line number Diff line
@@ -17,12 +17,8 @@ package com.android.launcher3.util;
 */

import android.content.ComponentName;
import android.content.Context;
import android.os.Process;
import android.os.UserHandle;

import com.android.launcher3.compat.UserManagerCompat;

import java.util.Arrays;

public class ComponentKey {
@@ -41,29 +37,6 @@ public class ComponentKey {

    }

    /**
     * Creates a new component key from an encoded component key string in the form of
     * [flattenedComponentString#userId].  If the userId is not present, then it defaults
     * to the current user.
     */
    public ComponentKey(Context context, String componentKeyStr) {
        int userDelimiterIndex = componentKeyStr.indexOf("#");
        if (userDelimiterIndex != -1) {
            String componentStr = componentKeyStr.substring(0, userDelimiterIndex);
            Long componentUser = Long.valueOf(componentKeyStr.substring(userDelimiterIndex + 1));
            componentName = ComponentName.unflattenFromString(componentStr);
            user = UserManagerCompat.getInstance(context)
                    .getUserForSerialNumber(componentUser.longValue());
        } else {
            // No user provided, default to the current user
            componentName = ComponentName.unflattenFromString(componentKeyStr);
            user = Process.myUserHandle();
        }
        Preconditions.assertNotNull(componentName);
        Preconditions.assertNotNull(user);
        mHashCode = Arrays.hashCode(new Object[] {componentName, user});
    }

    @Override
    public int hashCode() {
        return mHashCode;