Skip to content

Commit 30a7aa0

Browse files
jmagman2ZeroSix
authored andcommitted
Add xcprivacy privacy manifest to iOS framework (flutter#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](flutter/flutter#131494 (comment)) 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](https://github.com/flutter/flutter/blob/3da9bc169837d223496439b6d5f6b7e1a82d4318/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: https://cas-viewer.appspot.com/projects/chromium-swarm/instances/default_instance/blobs/d45cd0809420f08145c7b78ea96cba6e7ea48d8ecfdc8fd2411f82fa65444714/516/tree Fixes flutter/flutter#131494 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
1 parent bd34a38 commit 30a7aa0

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2543,6 +2543,7 @@ FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterPlugin
25432543
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h
25442544
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h
25452545
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Info.plist
2546+
FILE: ../../../flutter/shell/platform/darwin/ios/framework/PrivacyInfo.xcprivacy
25462547
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm
25472548
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm
25482549
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate_Test.h

shell/platform/darwin/ios/BUILD.gn

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,15 @@ copy("copy_framework_module_map") {
348348
outputs = [ "$_flutter_framework_dir/Modules/module.modulemap" ]
349349
}
350350

351+
# Copy privacy manifest. This file is required by Apple for third-party SDKs,
352+
# and documents engine and third_party usage of timestamps and boot time APIs.
353+
# See https://developer.apple.com/documentation/bundleresources/privacy_manifest_files
354+
copy("copy_framework_privacy_manifest") {
355+
visibility = [ ":*" ]
356+
sources = [ "framework/PrivacyInfo.xcprivacy" ]
357+
outputs = [ "$_flutter_framework_dir/PrivacyInfo.xcprivacy" ]
358+
}
359+
351360
action("copy_framework_headers") {
352361
script = "//flutter/sky/tools/install_framework_headers.py"
353362
visibility = [ ":*" ]
@@ -387,6 +396,7 @@ shared_library("copy_and_verify_framework_module") {
387396
":copy_framework_headers",
388397
":copy_framework_info_plist",
389398
":copy_framework_module_map",
399+
":copy_framework_privacy_manifest",
390400
]
391401
}
392402

@@ -398,6 +408,7 @@ group("universal_flutter_framework") {
398408
":copy_framework_icu",
399409
":copy_framework_info_plist",
400410
":copy_framework_module_map",
411+
":copy_framework_privacy_manifest",
401412
":copy_license",
402413
]
403414

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>NSPrivacyTracking</key>
6+
<false/>
7+
<key>NSPrivacyTrackingDomains</key>
8+
<array/>
9+
<key>NSPrivacyCollectedDataTypes</key>
10+
<array>
11+
<dict/>
12+
</array>
13+
<key>NSPrivacyAccessedAPITypes</key>
14+
<array>
15+
<dict>
16+
<key>NSPrivacyAccessedAPIType</key>
17+
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
18+
<key>NSPrivacyAccessedAPITypeReasons</key>
19+
<array>
20+
<string>0A2A.1</string>
21+
<string>C617.1</string>
22+
</array>
23+
</dict>
24+
<dict>
25+
<key>NSPrivacyAccessedAPIType</key>
26+
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
27+
<key>NSPrivacyAccessedAPITypeReasons</key>
28+
<array>
29+
<string>35F9.1</string>
30+
</array>
31+
</dict>
32+
</array>
33+
</dict>
34+
</plist>

0 commit comments

Comments
 (0)