From 8706638baf0dab2839e9acfbaaae3bce129cc0d5 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Fri, 13 Sep 2024 19:44:18 -0700 Subject: [PATCH] Add xcprivacy privacy manifest to macOS framework (flutter/engine#55078) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Create a `PrivacyInfo.xcprivacy` (this name is required) plist and move it to the top-level of the macOS framework bundle. `NSPrivacyTracking*` and `NSPrivacyCollectedDataTypes` keys are required, but the values are blank. macOS explicitly does not need the `NSPrivacyAccessedAPITypes` (see more info in https://github.com/flutter/flutter/issues/143381) You can see on this PR it's copied to the correct path in the framework https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8737163270670636097/+/u/Global_generators/Release-FlutterMacOS.framework/stdout: ``` adding: FlutterMacOS.xcframework/macos-arm64_x86_64/FlutterMacOS.framework/PrivacyInfo.xcprivacy (deflated 35%) ``` There's no way to test this except to submit a macOS app with this framework to TestFlight. I can't find a good spot in the engine to validate the structure of the framework output. I hereby pledge to add a macOS test to the framework post-roll https://github.com/flutter/flutter/pull/155189 ✋ iOS framework variant of this PR https://github.com/flutter/engine/pull/48951 Fixes https://github.com/flutter/flutter/issues/131494 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../src/flutter/ci/licenses_golden/licenses_flutter | 1 + .../src/flutter/shell/platform/darwin/macos/BUILD.gn | 9 +++++++++ .../darwin/macos/framework/PrivacyInfo.xcprivacy | 12 ++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 engine/src/flutter/shell/platform/darwin/macos/framework/PrivacyInfo.xcprivacy diff --git a/engine/src/flutter/ci/licenses_golden/licenses_flutter b/engine/src/flutter/ci/licenses_golden/licenses_flutter index 9c3e6867e3..08e12d8f5e 100644 --- a/engine/src/flutter/ci/licenses_golden/licenses_flutter +++ b/engine/src/flutter/ci/licenses_golden/licenses_flutter @@ -47286,6 +47286,7 @@ FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterPlug FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterPluginRegistrarMacOS.h FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterViewController.h FILE: ../../../flutter/shell/platform/darwin/macos/framework/Info.plist +FILE: ../../../flutter/shell/platform/darwin/macos/framework/PrivacyInfo.xcprivacy FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/AccessibilityBridgeMac.h FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/AccessibilityBridgeMac.mm FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/AccessibilityBridgeMacTest.mm diff --git a/engine/src/flutter/shell/platform/darwin/macos/BUILD.gn b/engine/src/flutter/shell/platform/darwin/macos/BUILD.gn index 401b63bc0b..1224e15e02 100644 --- a/engine/src/flutter/shell/platform/darwin/macos/BUILD.gn +++ b/engine/src/flutter/shell/platform/darwin/macos/BUILD.gn @@ -248,6 +248,14 @@ copy("copy_framework_module_map") { outputs = [ "$_flutter_framework_dir/Versions/A/Modules/module.modulemap" ] } +# Copy privacy manifest. This file is required by Apple for third-party SDKs. +# See https://developer.apple.com/documentation/bundleresources/privacy_manifest_files +copy("copy_framework_privacy_manifest") { + visibility = [ ":*" ] + sources = [ "framework/PrivacyInfo.xcprivacy" ] + outputs = [ "$_flutter_framework_dir/PrivacyInfo.xcprivacy" ] +} + action("copy_framework_headers") { script = "//flutter/sky/tools/install_framework_headers.py" visibility = [ ":*" ] @@ -304,6 +312,7 @@ action("_generate_symlinks") { ":copy_framework_icu", ":copy_framework_info_plist", ":copy_framework_module_map", + ":copy_framework_privacy_manifest", ":copy_license", ] metadata = { diff --git a/engine/src/flutter/shell/platform/darwin/macos/framework/PrivacyInfo.xcprivacy b/engine/src/flutter/shell/platform/darwin/macos/framework/PrivacyInfo.xcprivacy new file mode 100644 index 0000000000..4187dabc0f --- /dev/null +++ b/engine/src/flutter/shell/platform/darwin/macos/framework/PrivacyInfo.xcprivacy @@ -0,0 +1,12 @@ + + + + + NSPrivacyTracking + + NSPrivacyTrackingDomains + + NSPrivacyCollectedDataTypes + + +