[vm/mac] Hide application icon from the dock.
TEST=Passing any value other than true as an argument brings the icon to the dock.
BUG=https://github.com/flutter/flutter/issues/170633
Change-Id: Ief117a0c95df3762cf1e54bc3facde8c92f7379b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437781
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
diff --git a/runtime/bin/platform_macos.cc b/runtime/bin/platform_macos.cc
index b5215ad..1ba2e47 100644
--- a/runtime/bin/platform_macos.cc
+++ b/runtime/bin/platform_macos.cc
@@ -349,7 +349,14 @@
_LSSetApplicationLaunchServicesServerConnectionStatus(0, nullptr);
- _LSApplicationCheckIn(-2, CFBundleGetInfoDictionary(CFBundleGetMainBundle()));
+ CFMutableDictionaryRef dictionary = CFDictionaryCreateMutableCopy(
+ kCFAllocatorDefault, /*capacity=*/0,
+ CFBundleGetInfoDictionary(CFBundleGetMainBundle()));
+ if (dictionary == nullptr) return;
+ ScopedCFStringRef _kLSUIElement("LSUIElement");
+ CFDictionarySetValue(dictionary, _kLSUIElement.get(), kCFBooleanTrue);
+ _LSApplicationCheckIn(-2, dictionary);
+ CFRelease(dictionary);
CFTypeRef asn;
asn = _LSGetCurrentApplicationASN();