From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <sattard@slack-corp.com>
Date: Mon, 4 Mar 2019 14:51:45 -0800
Subject: fix_disable_usage_of_setapplicationisdaemon_and.patch

Disable usage of SetApplicationIsDaemon and
_LSSetApplicationLaunchServicesServerConnectionStatus in MAS builds

diff --git a/sandbox/mac/system_services.cc b/sandbox/mac/system_services.cc
index 9f5261425162791668c2d15b7ffba091f831d652..dbeb65bad93120dca0d102f733ed8b3981a503eb 100644
--- a/sandbox/mac/system_services.cc
+++ b/sandbox/mac/system_services.cc
@@ -9,6 +9,7 @@
 
 #include "base/mac/mac_logging.h"
 
+#if !defined(MAS_BUILD)
 extern "C" {
 OSStatus SetApplicationIsDaemon(Boolean isDaemon);
 void _LSSetApplicationLaunchServicesServerConnectionStatus(
@@ -19,10 +20,12 @@ void _LSSetApplicationLaunchServicesServerConnectionStatus(
 // https://github.com/WebKit/webkit/commit/8da694b0b3febcc262653d01a45e946ce91845ed.
 void _CSCheckFixDisable() API_AVAILABLE(macosx(10.15));
 }  // extern "C"
+#endif
 
 namespace sandbox {
 
 void DisableLaunchServices() {
+  #if !defined(MAS_BUILD)
   // Allow the process to continue without a LaunchServices ASN. The
   // INIT_Process function in HIServices will abort if it cannot connect to
   // launchservicesd to get an ASN. By setting this flag, HIServices skips
@@ -36,12 +39,15 @@ void DisableLaunchServices() {
       0, ^bool(CFDictionaryRef options) {
         return false;
       });
+  #endif
 }
 
 void DisableCoreServicesCheckFix() {
+  #if !defined(MAS_BUILD)
   if (__builtin_available(macOS 10.15, *)) {
     _CSCheckFixDisable();
   }
+  #endif
 }
 
 }  // namespace sandbox
