Skip to content

🚸 Add device name for running processes #6774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions flutter-idea/src/io/flutter/run/LaunchState.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -148,12 +149,22 @@ protected RunContentDescriptor launch(@NotNull ExecutionEnvironment env) throws
}

final FlutterLaunchMode launchMode = FlutterLaunchMode.fromEnv(env);
final RunContentDescriptor descriptor;
if (launchMode.supportsDebugConnection()) {
return createDebugSession(env, app, result).getRunContentDescriptor();
descriptor = createDebugSession(env, app, result).getRunContentDescriptor();
}
else {
return new RunContentBuilder(result, env).showRunContent(env.getContentToReuse());
descriptor = new RunContentBuilder(result, env).showRunContent(env.getContentToReuse());
}
try {
final Field f = descriptor.getClass().getDeclaredField("myDisplayName");
f.setAccessible(true);
f.set(descriptor, descriptor.getDisplayName() + " (" + device.deviceName() + ")");
}
catch (IllegalAccessException | NoSuchFieldException e) {
LOG.info(e);
}
return descriptor;
}

private static Class classForName(String className) {
Expand Down