From e9719bb22fe8c109b7b433e0132283aca2375c32 Mon Sep 17 00:00:00 2001 From: Helin Shiah Date: Mon, 11 Aug 2025 12:32:30 -0700 Subject: [PATCH 1/6] Add link to Android Studio versions --- .idea/compiler.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index b589d56e9f..b86273d942 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file From 63639b4b16d7cabb7ad287d634c292824716df75 Mon Sep 17 00:00:00 2001 From: Helin Shiah Date: Mon, 11 Aug 2025 12:33:22 -0700 Subject: [PATCH 2/6] Revert iml file change --- .idea/compiler.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index b86273d942..b589d56e9f 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file From 33e09ba5f65701bd1055501bb3ecc4ed831b7f25 Mon Sep 17 00:00:00 2001 From: Helin Shiah Date: Mon, 11 Aug 2025 14:18:58 -0700 Subject: [PATCH 3/6] Use PluginLogger for SdkFields class --- src/io/flutter/run/SdkFields.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/io/flutter/run/SdkFields.java b/src/io/flutter/run/SdkFields.java index d678126da7..d852cb0ec6 100644 --- a/src/io/flutter/run/SdkFields.java +++ b/src/io/flutter/run/SdkFields.java @@ -20,6 +20,7 @@ import com.jetbrains.lang.dart.sdk.DartSdk; import io.flutter.FlutterBundle; import io.flutter.dart.DartPlugin; +import io.flutter.logging.PluginLogger; import io.flutter.pub.PubRoot; import io.flutter.pub.PubRootCache; import io.flutter.run.common.RunMode; @@ -40,7 +41,7 @@ * Fields used when launching an app using the Flutter SDK (non-bazel). */ public class SdkFields { - private static final @NotNull Logger LOG = Logger.getInstance(SdkFields.class); + private static final @NotNull Logger LOG = PluginLogger.createLogger(SdkFields.class); private @Nullable String filePath; private @Nullable String buildFlavor; private @Nullable String additionalArgs; @@ -231,7 +232,11 @@ public GeneralCommandLine createFlutterSdkRunCommand( args = ArrayUtil.append(args, "--devtools-server-address=http://" + instance.host() + ":" + instance.port()); } catch (Exception e) { - LOG.info(e); + if (FlutterSettings.getInstance().isFilePathLoggingEnabled()) { + LOG.info(e); + } else { + LOG.info(e.toString()); + } } command = flutterSdk.flutterRun(root, main.getFile(), device, runMode, flutterLaunchMode, project, args); final GeneralCommandLine commandLine = command.createGeneralCommandLine(project); From 6148e1260bde3a0278b7808b5573334c639ac5c8 Mon Sep 17 00:00:00 2001 From: Helin Shiah Date: Mon, 11 Aug 2025 14:41:36 -0700 Subject: [PATCH 4/6] Use PluginLogger for LaunchState --- src/io/flutter/run/LaunchState.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/io/flutter/run/LaunchState.java b/src/io/flutter/run/LaunchState.java index 308836cf21..760177b56d 100644 --- a/src/io/flutter/run/LaunchState.java +++ b/src/io/flutter/run/LaunchState.java @@ -45,11 +45,13 @@ import io.flutter.FlutterConstants; import io.flutter.FlutterUtils; import io.flutter.dart.DartPlugin; +import io.flutter.logging.PluginLogger; import io.flutter.run.bazel.BazelRunConfig; import io.flutter.run.common.RunMode; import io.flutter.run.daemon.DaemonConsoleView; import io.flutter.run.daemon.DeviceService; import io.flutter.run.daemon.FlutterApp; +import io.flutter.settings.FlutterSettings; import io.flutter.toolwindow.ToolWindowBadgeUpdater; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -180,7 +182,11 @@ protected RunContentDescriptor launch(@NotNull ExecutionEnvironment env) throws } } catch (IllegalAccessException | InvocationTargetException | NoSuchFieldException | NoSuchMethodException e) { - LOG.info(e); + if (FlutterSettings.getInstance().isFilePathLoggingEnabled()) { + LOG.info(e); + } else { + LOG.info(e.toString()); + } } return descriptor; @@ -401,7 +407,11 @@ protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNul app.shutdownAsync().get(); } catch (InterruptedException | java.util.concurrent.ExecutionException e) { - FlutterUtils.warn(LOG, e); + if (FlutterSettings.getInstance().isFilePathLoggingEnabled()) { + LOG.warn(e); + } else { + LOG.warn(e.toString()); + } } return launchState.launch(env); } @@ -458,5 +468,5 @@ public static ProcessHandler getRunningAppProcess(@NotNull RunConfig config) { private static final Key FLUTTER_RUN_CONFIG_KEY = new Key<>("FLUTTER_RUN_CONFIG_KEY"); - private static final @NotNull Logger LOG = Logger.getInstance(LaunchState.class); + private static final @NotNull Logger LOG = PluginLogger.createLogger(LaunchState.class); } From 4fffae43ddbb9412cd8267cc57ceb6b8fb592e58 Mon Sep 17 00:00:00 2001 From: Helin Shiah Date: Tue, 12 Aug 2025 11:07:28 -0700 Subject: [PATCH 5/6] Add FlutterUtils methods to handle path erasing --- src/io/flutter/FlutterUtils.java | 30 +++++++++++++++++++++++++++++ src/io/flutter/run/LaunchState.java | 15 +++------------ src/io/flutter/run/SdkFields.java | 7 ++----- 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/io/flutter/FlutterUtils.java b/src/io/flutter/FlutterUtils.java index 71b3c9d281..e6753bede9 100644 --- a/src/io/flutter/FlutterUtils.java +++ b/src/io/flutter/FlutterUtils.java @@ -111,10 +111,36 @@ public static boolean isAndroidStudio() { } } + public static void info(@NotNull Logger logger, @NotNull Exception e) { + info(logger, e, false); + } + + public static void info(@NotNull Logger logger, @NotNull Exception e, boolean sanitizePaths) { + if (sanitizePaths && FlutterSettings.getInstance().isFilePathLoggingEnabled()) { + logger.info(e); + } else { + logger.info(e.toString()); + } + } + + public static void warn(@NotNull Logger logger, @NotNull Exception e) { + warn(logger, e, false); + } + + public static void warn(@NotNull Logger logger, @NotNull Exception e, boolean sanitizePaths) { + if (sanitizePaths && FlutterSettings.getInstance().isFilePathLoggingEnabled()) { + logger.warn(e); + } else { + logger.warn(e.toString()); + } + } + /** * Write a warning message to the IntelliJ log. *

* This is separate from LOG.warn() to allow us to decorate the behavior. + * + * This method is deprecated (as we are not decorating this behavior anywhere). */ public static void warn(@NotNull Logger logger, @NotNull Throwable t) { logger.warn(t); @@ -124,6 +150,8 @@ public static void warn(@NotNull Logger logger, @NotNull Throwable t) { * Write a warning message to the IntelliJ log. *

* This is separate from LOG.warn() to allow us to decorate the behavior. + * + * This method is deprecated (as we are not decorating this behavior anywhere). */ public static void warn(@NotNull Logger logger, @NotNull String message) { logger.warn(message); @@ -133,6 +161,8 @@ public static void warn(@NotNull Logger logger, @NotNull String message) { * Write a warning message to the IntelliJ log. *

* This is separate from LOG.warn() to allow us to decorate the behavior. + * + * This method is deprecated (as we are not decorating this behavior anywhere). */ public static void warn(@NotNull Logger logger, @NotNull String message, @NotNull Throwable t) { logger.warn(message, t); diff --git a/src/io/flutter/run/LaunchState.java b/src/io/flutter/run/LaunchState.java index 760177b56d..0b353dc515 100644 --- a/src/io/flutter/run/LaunchState.java +++ b/src/io/flutter/run/LaunchState.java @@ -51,7 +51,6 @@ import io.flutter.run.daemon.DaemonConsoleView; import io.flutter.run.daemon.DeviceService; import io.flutter.run.daemon.FlutterApp; -import io.flutter.settings.FlutterSettings; import io.flutter.toolwindow.ToolWindowBadgeUpdater; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -173,7 +172,7 @@ protected RunContentDescriptor launch(@NotNull ExecutionEnvironment env) throws try { // There is no public way to set display name so we resort to reflection. - final Field f = descriptor.getClass().getDeclaredField("myDisplayNameView"); + final Field f = descriptor.getClass().getDeclaredField("myDisplayNameView_INVALID"); f.setAccessible(true); Object viewInstance = f.get(descriptor); if (viewInstance != null) { @@ -182,11 +181,7 @@ protected RunContentDescriptor launch(@NotNull ExecutionEnvironment env) throws } } catch (IllegalAccessException | InvocationTargetException | NoSuchFieldException | NoSuchMethodException e) { - if (FlutterSettings.getInstance().isFilePathLoggingEnabled()) { - LOG.info(e); - } else { - LOG.info(e.toString()); - } + FlutterUtils.info(LOG, e, true); } return descriptor; @@ -407,11 +402,7 @@ protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNul app.shutdownAsync().get(); } catch (InterruptedException | java.util.concurrent.ExecutionException e) { - if (FlutterSettings.getInstance().isFilePathLoggingEnabled()) { - LOG.warn(e); - } else { - LOG.warn(e.toString()); - } + FlutterUtils.warn(LOG, e, true); } return launchState.launch(env); } diff --git a/src/io/flutter/run/SdkFields.java b/src/io/flutter/run/SdkFields.java index d852cb0ec6..d7465402f4 100644 --- a/src/io/flutter/run/SdkFields.java +++ b/src/io/flutter/run/SdkFields.java @@ -19,6 +19,7 @@ import com.jetbrains.lang.dart.sdk.DartConfigurable; import com.jetbrains.lang.dart.sdk.DartSdk; import io.flutter.FlutterBundle; +import io.flutter.FlutterUtils; import io.flutter.dart.DartPlugin; import io.flutter.logging.PluginLogger; import io.flutter.pub.PubRoot; @@ -232,11 +233,7 @@ public GeneralCommandLine createFlutterSdkRunCommand( args = ArrayUtil.append(args, "--devtools-server-address=http://" + instance.host() + ":" + instance.port()); } catch (Exception e) { - if (FlutterSettings.getInstance().isFilePathLoggingEnabled()) { - LOG.info(e); - } else { - LOG.info(e.toString()); - } + FlutterUtils.warn(LOG, e, true); } command = flutterSdk.flutterRun(root, main.getFile(), device, runMode, flutterLaunchMode, project, args); final GeneralCommandLine commandLine = command.createGeneralCommandLine(project); From 5cb46c027ecd9718a811fd5c8cb5d9b7246515f6 Mon Sep 17 00:00:00 2001 From: Helin Shiah Date: Tue, 12 Aug 2025 11:08:08 -0700 Subject: [PATCH 6/6] Revert test exception --- src/io/flutter/run/LaunchState.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/io/flutter/run/LaunchState.java b/src/io/flutter/run/LaunchState.java index 0b353dc515..e94766035e 100644 --- a/src/io/flutter/run/LaunchState.java +++ b/src/io/flutter/run/LaunchState.java @@ -172,7 +172,7 @@ protected RunContentDescriptor launch(@NotNull ExecutionEnvironment env) throws try { // There is no public way to set display name so we resort to reflection. - final Field f = descriptor.getClass().getDeclaredField("myDisplayNameView_INVALID"); + final Field f = descriptor.getClass().getDeclaredField("myDisplayNameView"); f.setAccessible(true); Object viewInstance = f.get(descriptor); if (viewInstance != null) {