Search in sources :

Example 1 with ShortcutConfigActivityInfoVO

use of com.android.launcher3.compat.ShortcutConfigActivityInfo.ShortcutConfigActivityInfoVO in project Neo-Launcher by NeoApplications.

the class LauncherAppsCompatVO method getCustomShortcutActivityList.

@Override
public List<ShortcutConfigActivityInfo> getCustomShortcutActivityList(@Nullable PackageUserKey packageUser) {
    List<ShortcutConfigActivityInfo> result = new ArrayList<>();
    UserHandle myUser = Process.myUserHandle();
    final List<UserHandle> users;
    final String packageName;
    if (packageUser == null) {
        users = UserManagerCompat.getInstance(mContext).getUserProfiles();
        packageName = null;
    } else {
        users = new ArrayList<>(1);
        users.add(packageUser.mUser);
        packageName = packageUser.mPackageName;
    }
    for (UserHandle user : users) {
        boolean ignoreTargetSdk = myUser.equals(user);
        List<LauncherActivityInfo> activities = mLauncherApps.getShortcutConfigActivityList(packageName, user);
        for (LauncherActivityInfo activityInfo : activities) {
            if (ignoreTargetSdk || activityInfo.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.O) {
                result.add(new ShortcutConfigActivityInfoVO(activityInfo));
            }
        }
    }
    return result;
}
Also used : UserHandle(android.os.UserHandle) ArrayList(java.util.ArrayList) LauncherActivityInfo(android.content.pm.LauncherActivityInfo) ShortcutConfigActivityInfoVO(com.android.launcher3.compat.ShortcutConfigActivityInfo.ShortcutConfigActivityInfoVO)

Aggregations

LauncherActivityInfo (android.content.pm.LauncherActivityInfo)1 UserHandle (android.os.UserHandle)1 ShortcutConfigActivityInfoVO (com.android.launcher3.compat.ShortcutConfigActivityInfo.ShortcutConfigActivityInfoVO)1 ArrayList (java.util.ArrayList)1