d3b87ef196
> LauncherApps returns empty list when the user is locked. Not relying on LauncherApps in this case > When the user is locked, removing all dynamic shortcuts > Loading shortcuts from DB when the user is locked > Verifying the shortcuts again when the user is available Bug: 30411561 Change-Id: Ib6eb372c5b009cadb86a8f6e781f3f3cbf787ceb
39 lines
1.2 KiB
Java
39 lines
1.2 KiB
Java
package com.android.launcher3.shortcuts;
|
|
|
|
import android.content.ComponentName;
|
|
import android.content.Intent;
|
|
|
|
import com.android.launcher3.ItemInfo;
|
|
import com.android.launcher3.compat.UserHandleCompat;
|
|
import com.android.launcher3.util.ComponentKey;
|
|
|
|
/**
|
|
* A key that uniquely identifies a shortcut using its package, id, and user handle.
|
|
*/
|
|
public class ShortcutKey extends ComponentKey {
|
|
|
|
public ShortcutKey(String packageName, UserHandleCompat user, String id) {
|
|
// Use the id as the class name.
|
|
super(new ComponentName(packageName, id), user);
|
|
}
|
|
|
|
public String getId() {
|
|
return componentName.getClassName();
|
|
}
|
|
|
|
public static ShortcutKey fromInfo(ShortcutInfoCompat shortcutInfo) {
|
|
return new ShortcutKey(shortcutInfo.getPackage(), shortcutInfo.getUserHandle(),
|
|
shortcutInfo.getId());
|
|
}
|
|
|
|
public static ShortcutKey fromIntent(Intent intent, UserHandleCompat user) {
|
|
String shortcutId = intent.getStringExtra(
|
|
ShortcutInfoCompat.EXTRA_SHORTCUT_ID);
|
|
return new ShortcutKey(intent.getPackage(), user, shortcutId);
|
|
}
|
|
|
|
public static ShortcutKey fromItemInfo(ItemInfo info) {
|
|
return fromIntent(info.getIntent(), info.user);
|
|
}
|
|
}
|