Skip to content

Commit

Permalink
Restyled by google-java-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and lazarkov committed Jul 9, 2024
1 parent 518d083 commit 1365db5
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public ContentAppEndpointManagerImpl(Context context) {
}

private boolean isForegroundCommand(long clusterId, long commandId) {
switch ((int)clusterId) {
switch ((int) clusterId) {
case Clusters.ContentLauncher.Id:
return commandId == Clusters.ContentLauncher.Commands.LaunchContent.ID ||
commandId == Clusters.ContentLauncher.Commands.LaunchURL.ID;
return commandId == Clusters.ContentLauncher.Commands.LaunchContent.ID
|| commandId == Clusters.ContentLauncher.Commands.LaunchURL.ID;
case Clusters.TargetNavigator.Id:
return commandId == Clusters.TargetNavigator.Commands.NavigateTarget.ID;
default:
Expand All @@ -35,14 +35,15 @@ private boolean isForegroundCommand(long clusterId, long commandId) {
}

private boolean isAppInForeground(String contentAppPackageName) {
ActivityManager activityManager =
(ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> tasks = activityManager.getRunningTasks(1);
if (tasks != null && !tasks.isEmpty()) {
ActivityManager.RunningTaskInfo taskInfo = tasks.get(0);
String packageName = taskInfo.topActivity != null ? taskInfo.topActivity.getPackageName() : "";
return packageName.equals(contentAppPackageName);
}
ActivityManager activityManager =
(ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> tasks = activityManager.getRunningTasks(1);
if (tasks != null && !tasks.isEmpty()) {
ActivityManager.RunningTaskInfo taskInfo = tasks.get(0);
String packageName =
taskInfo.topActivity != null ? taskInfo.topActivity.getPackageName() : "";
return packageName.equals(contentAppPackageName);
}
return false;
}

Expand Down

0 comments on commit 1365db5

Please sign in to comment.