Skip to content

Commit

Permalink
Clean up of startOrResumeApp
Browse files Browse the repository at this point in the history
* No behavior changes in this commit, just clean up
* inContext -> activity - As we are requiring an Activity, not just any Context
* Early retrun for launchIntent null check.
* Better comment of why launchIntent has a null check
  • Loading branch information
jkasten2 committed Feb 5, 2021
1 parent b27ac14 commit 14c340f
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2169,16 +2169,16 @@ static void applicationOpenedByNotification(@Nullable final String notificationI
sessionManager.onDirectInfluenceFromNotificationOpen(appEntryState, notificationId);
}

static boolean startOrResumeApp(Activity inContext) {
Intent launchIntent = inContext.getPackageManager().getLaunchIntentForPackage(inContext.getPackageName());
logger.debug("startOrResumeApp from context: " + inContext + " isRoot: " + inContext.isTaskRoot() + " with launchIntent: " + launchIntent);
// Make sure we have a launcher intent.
if (launchIntent != null) {
inContext.startActivity(launchIntent);
return true;
}
static boolean startOrResumeApp(Activity activity) {
Intent launchIntent = activity.getPackageManager().getLaunchIntentForPackage(activity.getPackageName());
logger.debug("startOrResumeApp from context: " + activity + " isRoot: " + activity.isTaskRoot() + " with launchIntent: " + launchIntent);

return false;
// Not all apps have a launcher intent, such as one that only provides a homescreen widget
if (launchIntent == null)
return false;

activity.startActivity(launchIntent);
return true;
}

/**
Expand Down

0 comments on commit 14c340f

Please sign in to comment.