Add xcprivacy privacy manifest to iOS framework (flutter/engine#48951)

Create a `PrivacyInfo.xcprivacy` (this name is required) plist and move it to the top-level of the iOS framework bundle.  `NSPrivacyTracking*` and `NSPrivacyCollectedDataTypes` keys are required, but the values are blank.

Apple [now requires](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files) that third-party frameworks must include this manifest to document usage of particular APIs and [how they are used](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api).

> Starting in fall 2023, when you upload a new app or app update to App Store Connect that uses an API (including from third-party SDKs) that requires a reason, you’ll receive a notice if you haven’t provided an approved reason in your app’s privacy manifest. And starting in spring 2024, in order to upload your new app or app update to App Store Connect, you’ll be required to include an approved reason in the app’s privacy manifest which accurately reflects how your app uses the API.

https://developer.apple.com/news/?id=z6fu1dcu

@stuartmorgan [audited](https://github.com/flutter/flutter/issues/131494#issuecomment-1852718759) the engine and third_party:

> * File timestamps:
>   
>   * `C617.1` for app state restoration in `FlutterAppDelegate.mm`.
>   * `0A2A.1` for implementation of the relevant `File` wrappers.
> * System boot time:
>   
>   * `35F9.1` for various event timing and elapsed time calculations.

Note macOS frameworks do not need to declare `NSPrivacyAccessedAPITypes`.
I don't think this will require recipe or conductor codesign changes since this is a file copied as a resource into the framework, just as the modulemap and Info.plist aren't referenced anywhere.

I'm not quite sure how to test this other than letting it build and generate a `Generate Privacy Report` in a Flutter app in Xcode.  There's no where we check that, say, the Info.plist is copied to the right place in Flutter.framework (even in flutter/flutter).  When this rolls into the framework I will add a check to [ios_content_validation_test.dart](3da9bc1698/dev/devicelab/bin/tasks/ios_content_validation_test.dart)

On this PR the `PrivacyInfo.xcprivacy` was written to the expected location in the Flutter.framework:
d45cd08094/516/tree

Fixes https://github.com/flutter/flutter/issues/131494

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
Jenn Magder
2023-12-13 17:37:59 -08:00
committed by GitHub
parent 1538923d6e
commit 85abc44624
3 changed files with 46 additions and 0 deletions

View File

@@ -9343,6 +9343,7 @@ FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterPlugin
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Info.plist
FILE: ../../../flutter/shell/platform/darwin/ios/framework/PrivacyInfo.xcprivacy
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate_Test.h

View File

@@ -373,6 +373,15 @@ copy("copy_framework_module_map") {
outputs = [ "$_flutter_framework_dir/Modules/module.modulemap" ]
}
# Copy privacy manifest. This file is required by Apple for third-party SDKs,
# and documents engine and third_party usage of timestamps and boot time APIs.
# 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 = [ ":*" ]
@@ -415,6 +424,7 @@ shared_library("copy_and_verify_framework_module") {
":copy_framework_headers",
":copy_framework_info_plist",
":copy_framework_module_map",
":copy_framework_privacy_manifest",
]
if (darwin_extension_safe) {
@@ -437,6 +447,7 @@ group("universal_flutter_framework") {
":copy_framework_icu",
":copy_framework_info_plist",
":copy_framework_module_map",
":copy_framework_privacy_manifest",
":copy_license",
]

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTracking</key>
<false/>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict/>
</array>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>0A2A.1</string>
<string>C617.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
</array>
</dict>
</plist>