@Override public void doLaunch(Context context, View v) { try { if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { LauncherApps launcher = (LauncherApps) context.getSystemService(Context.LAUNCHER_APPS_SERVICE); assert launcher != null; launcher.startMainActivity(className, appPojo.userHandle.getRealHandle(), v.getClipBounds(), null); } else { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setComponent(className); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { intent.setSourceBounds(v.getClipBounds()); } context.startActivity(intent); } } catch (ActivityNotFoundException | NullPointerException e) { // Application was just removed? // (null pointer exception can be thrown on Lollipop+ when app is missing) Toast.makeText(context, R.string.application_not_found, Toast.LENGTH_LONG).show(); } } }
@Override public void startActivityForProfile(ComponentName component, UserHandle user, Rect sourceBounds, Bundle opts) { mLauncherApps.startMainActivity(component, user, sourceBounds, opts); }
public void startActivityForProfile(ComponentName component, UserHandleCompat user, Rect sourceBounds, Bundle opts) { mLauncherApps.startMainActivity(component, user.getUser(), sourceBounds, opts); }
public void startActivityForProfile(ComponentName component, UserHandleCompat user, Rect sourceBounds, Bundle opts) { mLauncherApps.startMainActivity(component, user.getUser(), sourceBounds, opts); }
public void startActivityForProfile(ComponentName component, UserHandleCompat user, Rect sourceBounds, Bundle opts) { mLauncherApps.startMainActivity(component, user.getUser(), sourceBounds, opts); }
public void startActivityForProfile(ComponentName component, UserHandleCompat user, Rect sourceBounds, Bundle opts) { mLauncherApps.startMainActivity(component, user.getUser(), sourceBounds, opts); }