Skip to content

Commit 09e4b41

Browse files
authored
chore: remove manage all file permission (#745)
* Remove custom data folder setting * Show resolved path in error screen * Remove MANAGE_EXTERNAL_STORAGE permission * Remove package file_picker and permission_handler * Remove FLUTTER_CACHE_FOLDER and FLUTTER_DATA_FOLDER
1 parent ab738d9 commit 09e4b41

17 files changed

+25
-396
lines changed

docs/custom-tasks.md

-18
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,6 @@ Data directory can be changed in settings, except for iOS, and its possible loca
5555
You can specify the full path, which will not depend on the data folder.
5656
Absolute path is only available for the task config path. All local resources in the task config must point to the data folder.
5757

58-
## Overriding default folders
59-
60-
You can change the data folder without using graphical interface.
61-
62-
Use `--dart-define=FLUTTER_DATA_FOLDER=<value>` to specify the folder you want to use.
63-
It will still be possible to choose a different folder via UI but the app will use specified folder by default.
64-
65-
If you build the app using makefile commands, use `FLUTTER_DATA_FOLDER` environment variable. For example: `make flutter/test/integration FLUTTER_CACHE_FOLDER=/my/folder/path`
66-
67-
You can also override app cache folder.
68-
Use `--dart-define=FLUTTER_CACHE_FOLDER=<value>` for manual build or `FLUTTER_CACHE_FOLDER` env for makefile script.
69-
Note that it's impossible to change the cache folder from the UI.
70-
71-
These options are intended for CI use, and possibly for internal testing.
72-
Never use them for any public builds.
73-
74-
These options are not available on iOS.
75-
7658
## Using external resources on an iPhone
7759

7860
On iOS an application resource folder can be found in `On My iPhone` -> `<app name>`.

flutter/android/android-docker.mk

-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ flutter_common_docker_flags= \
4646
--env FIREBASE_CRASHLYTICS_ENABLED=${FIREBASE_CRASHLYTICS_ENABLED} \
4747
--env FLUTTER_BUILD_NUMBER=${FLUTTER_BUILD_NUMBER} \
4848
--env FLUTTER_FORCE_PUB_GET=1 \
49-
--env FLUTTER_DATA_FOLDER=${FLUTTER_DATA_FOLDER} \
50-
--env FLUTTER_CACHE_FOLDER=${FLUTTER_CACHE_FOLDER} \
5149
${proxy_docker_args} \
5250
${backend_qti_flutter_docker_args} \
5351
${backend_samsung_docker_args} \

flutter/android/android.mk

+2-4
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,15 @@ flutter/android/apk:
7474
cd flutter && ${_start_args} flutter --no-version-check build apk \
7575
${flutter_official_build_arg} \
7676
${flutter_firebase_crashlytics_arg} \
77-
${flutter_build_number_arg} \
78-
${flutter_folder_args}
77+
${flutter_build_number_arg}
7978
cp -f flutter/build/app/outputs/flutter-apk/app-release.apk ${flutter_android_apk_release_path}.apk
8079
.PHONY: flutter/android/appbundle
8180
flutter/android/appbundle:
8281
mkdir -p $$(dirname ${flutter_android_apk_release_path})
8382
cd flutter && ${_start_args} flutter --no-version-check build appbundle \
8483
${flutter_official_build_arg} \
8584
${flutter_firebase_crashlytics_arg} \
86-
${flutter_build_number_arg} \
87-
${flutter_folder_args}
85+
${flutter_build_number_arg}
8886
cp -f flutter/build/app/outputs/bundle/release/app-release.aab ${flutter_android_apk_release_path}.aab
8987

9088
FLUTTER_ANDROID_APK_TEST_MAIN?=test-main.apk

flutter/android/app/src/main/AndroidManifest.xml

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<uses-permission android:name="android.permission.INTERNET"/>
66
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
77
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
8-
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
98
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
109
android:maxSdkVersion="32"/>
1110
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"

flutter/flutter.mk

+1-15
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,6 @@ flutter/check/build-number:
5151
@[ -n "$$FLUTTER_BUILD_NUMBER" ] \
5252
|| (echo FLUTTER_BUILD_NUMBER env must be explicitly set; exit 1)
5353

54-
ifneq (${FLUTTER_DATA_FOLDER},)
55-
flutter_data_folder_arg="--dart-define=FLUTTER_DATA_FOLDER=${FLUTTER_DATA_FOLDER}"
56-
else
57-
flutter_data_folder_arg=
58-
endif
59-
ifneq (${FLUTTER_CACHE_FOLDER},)
60-
flutter_cache_folder_arg="--dart-define=FLUTTER_CACHE_FOLDER=${FLUTTER_CACHE_FOLDER}"
61-
else
62-
flutter_cache_folder_arg=
63-
endif
64-
flutter_folder_args=${flutter_data_folder_arg} ${flutter_cache_folder_arg}
65-
6654
FIREBASE_CRASHLYTICS_ENABLED?=false
6755
flutter_firebase_crashlytics_arg="--dart-define=FIREBASE_CRASHLYTICS_ENABLED=${FIREBASE_CRASHLYTICS_ENABLED}"
6856

@@ -180,15 +168,13 @@ flutter/test/integration:
180168
${flutter_test_device_arg} \
181169
${flutter_official_build_arg} \
182170
${flutter_firebase_crashlytics_arg} \
183-
${flutter_perf_test_arg} \
184-
${flutter_folder_args}
171+
${flutter_perf_test_arg}
185172

186173
.PHONY: flutter/run
187174
flutter/run:
188175
cd flutter && ${_start_args} \
189176
flutter --no-version-check \
190177
run \
191-
${flutter_folder_args} \
192178
${flutter_test_device_arg} \
193179
${flutter_official_build_arg} \
194180
${flutter_firebase_crashlytics_arg}

flutter/ios/Podfile.lock

-12
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ PODS:
77
- Flutter
88
- device_info_plus (0.0.1):
99
- Flutter
10-
- file_picker (0.0.1):
11-
- Flutter
1210
- Firebase/Auth (10.25.0):
1311
- Firebase/CoreOnly
1412
- FirebaseAuth (~> 10.25.0)
@@ -147,8 +145,6 @@ PODS:
147145
- path_provider_foundation (0.0.1):
148146
- Flutter
149147
- FlutterMacOS
150-
- permission_handler_apple (9.1.1):
151-
- Flutter
152148
- PromisesObjC (2.4.0)
153149
- PromisesSwift (2.4.0):
154150
- PromisesObjC (= 2.4.0)
@@ -168,7 +164,6 @@ PODS:
168164
DEPENDENCIES:
169165
- desktop_webview_auth (from `.symlinks/plugins/desktop_webview_auth/ios`)
170166
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
171-
- file_picker (from `.symlinks/plugins/file_picker/ios`)
172167
- firebase_app_check (from `.symlinks/plugins/firebase_app_check/ios`)
173168
- firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)
174169
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
@@ -179,7 +174,6 @@ DEPENDENCIES:
179174
- integration_test (from `.symlinks/plugins/integration_test/ios`)
180175
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
181176
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
182-
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
183177
- share (from `.symlinks/plugins/share/ios`)
184178
- share_plus (from `.symlinks/plugins/share_plus/ios`)
185179
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
@@ -216,8 +210,6 @@ EXTERNAL SOURCES:
216210
:path: ".symlinks/plugins/desktop_webview_auth/ios"
217211
device_info_plus:
218212
:path: ".symlinks/plugins/device_info_plus/ios"
219-
file_picker:
220-
:path: ".symlinks/plugins/file_picker/ios"
221213
firebase_app_check:
222214
:path: ".symlinks/plugins/firebase_app_check/ios"
223215
firebase_auth:
@@ -238,8 +230,6 @@ EXTERNAL SOURCES:
238230
:path: ".symlinks/plugins/package_info_plus/ios"
239231
path_provider_foundation:
240232
:path: ".symlinks/plugins/path_provider_foundation/darwin"
241-
permission_handler_apple:
242-
:path: ".symlinks/plugins/permission_handler_apple/ios"
243233
share:
244234
:path: ".symlinks/plugins/share/ios"
245235
share_plus:
@@ -255,7 +245,6 @@ SPEC CHECKSUMS:
255245
AppCheckCore: db04d539b37794558391bc56bc65e2440b01a195
256246
desktop_webview_auth: d645139460ef203d50bd0cdb33356785dd939cce
257247
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
258-
file_picker: 684373a825f14becb5556cf6c5b88610290914b2
259248
Firebase: 0312a2352584f782ea56f66d91606891d4607f06
260249
firebase_app_check: b67baa1ab3942b51fde8855f614f543d9d6b4dba
261250
firebase_auth: 76ea642e91a9e914b3af751a416046ce1a965cf4
@@ -284,7 +273,6 @@ SPEC CHECKSUMS:
284273
nanopb: 438bc412db1928dac798aa6fd75726007be04262
285274
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
286275
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
287-
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
288276
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
289277
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
290278
RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21

flutter/lib/app_constants.dart

-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ class DartDefine {
77
bool.fromEnvironment('FIREBASE_CRASHLYTICS_ENABLED', defaultValue: false);
88
static const isFastMode =
99
bool.fromEnvironment('FAST_MODE', defaultValue: false);
10-
static const defaultCacheFolder =
11-
String.fromEnvironment('FLUTTER_CACHE_FOLDER');
12-
static const defaultDataFolder =
13-
String.fromEnvironment('FLUTTER_DATA_FOLDER');
1410
}
1511

1612
class WidgetKeys {

flutter/lib/l10n/app_en.arb

+1-13
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,6 @@
7777
"settingsTaskConfigLocalResource": "local",
7878
"settingsTaskConfigError": "Path to config is invalid:",
7979
"settingsTaskDataFolderTitle": "Data folder",
80-
"settingsTaskDataFolderDesc": "Task config may contain non-downloadable files that must be managed manually.",
81-
"settingsTaskDataFolderDefault": "Default",
82-
"settingsTaskDataFolderApp": "Application folder",
83-
"settingsTaskDataFolderCustom": "Custom folder",
84-
"settingsTaskDataFolderSelected": "Selected data folder",
85-
"settingsTaskDataFolderWarning": "Folder <path> does not exist or is not accessible",
86-
"settingsTaskDataFolderPermissionRequired": "Access all file permission",
87-
"settingsTaskDataFolderPermissionNotGranted": "Access all file permission is required to use custom folder but not granted. Tap here to grant the permission.",
88-
"settingsTaskDataFolderPermissionGranted": "Access all file permission is required to use custom folder and already granted.",
89-
"settingsTaskCacheFolderTitle": "Cache folder",
90-
"settingsTaskCacheFolderDesc": "Cache folder contains downloadable data.\nThis folder can only be changed during build.",
91-
"settingsTaskCacheFolderDefault": "Default",
9280
"settingsClearCache": "Clear cache",
9381
"settingsClearCacheConfirm": "All loaded resources will be deleted and downloaded again. Continue?",
9482
"settingsUnableSpecifyConfiguration": "Could not specify until benchmarks is running or content is loading",
@@ -100,7 +88,7 @@
10088
"dialogCancel": "Cancel",
10189
"dialogTitleConfirm": "Confirm?",
10290
"dialogContentOfflineWarning": "Offline mode is enabled but following internet resources are defined in the configuration. Do you want to continue?",
103-
"dialogContentMissingFiles": "Selected datasets directory does not contain files for following benchmarks:",
91+
"dialogContentMissingFiles": "The following files don't exist:",
10492
"dialogContentChecksumError": "The following files failed checksum validation:",
10593
"dialogContentNoSelectedBenchmarkError": "Please select at least one benchmark.",
10694

flutter/lib/resources/resource_manager.dart

+8-20
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ import 'package:flutter/foundation.dart';
55
import 'package:crypto/crypto.dart';
66
import 'package:path_provider/path_provider.dart';
77

8-
import 'package:mlperfbench/app_constants.dart';
98
import 'package:mlperfbench/resources/cache_manager.dart';
109
import 'package:mlperfbench/resources/resource.dart';
1110
import 'package:mlperfbench/resources/result_manager.dart';
1211
import 'package:mlperfbench/resources/utils.dart';
1312
import 'package:mlperfbench/store.dart';
14-
import 'package:mlperfbench/ui/settings/data_folder_type.dart';
1513

1614
class ResourceManager {
1715
static const _dataPrefix = 'local://';
@@ -60,18 +58,11 @@ class ResourceManager {
6058
}
6159

6260
String getDataFolder() {
63-
switch (parseDataFolderType(store.dataFolderType)) {
64-
case DataFolderType.default_:
65-
if (DartDefine.defaultDataFolder.isNotEmpty) {
66-
return DartDefine.defaultDataFolder;
67-
} else {
68-
return applicationDirectory;
69-
}
70-
case DataFolderType.appFolder:
71-
return applicationDirectory;
72-
case DataFolderType.custom:
73-
return store.customDataFolder;
74-
}
61+
return applicationDirectory;
62+
}
63+
64+
String getDataPrefix() {
65+
return _dataPrefix;
7566
}
7667

7768
Future<bool> isResourceExist(String? uri) async {
@@ -152,11 +143,7 @@ class ResourceManager {
152143
Future<void> initSystemPaths() async {
153144
applicationDirectory = await getApplicationDirectory();
154145
await Directory(applicationDirectory).create(recursive: true);
155-
if (DartDefine.defaultCacheFolder.isNotEmpty) {
156-
_loadedResourcesDir = DartDefine.defaultCacheFolder;
157-
} else {
158-
_loadedResourcesDir = '$applicationDirectory/$_loadedResourcesDirName';
159-
}
146+
_loadedResourcesDir = '$applicationDirectory/$_loadedResourcesDirName';
160147
await Directory(_loadedResourcesDir).create();
161148

162149
cacheManager = CacheManager(_loadedResourcesDir);
@@ -167,7 +154,8 @@ class ResourceManager {
167154
final missingResources = <String>[];
168155
for (var r in resources) {
169156
if (!await isResourceExist(r.path)) {
170-
missingResources.add(r.path);
157+
final resolvedPath = get(r.path);
158+
missingResources.add(resolvedPath);
171159
}
172160
}
173161
return missingResources;

flutter/lib/store.dart

-16
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,6 @@ class Store extends ChangeNotifier {
106106
notifyListeners();
107107
}
108108

109-
String get dataFolderType => _getString(StoreConstants.dataFolderType);
110-
111-
set dataFolderType(String value) {
112-
_storeFromDisk.setString(StoreConstants.dataFolderType, value);
113-
notifyListeners();
114-
}
115-
116-
String get customDataFolder => _getString(StoreConstants.customDataFolder);
117-
118-
set customDataFolder(String value) {
119-
_storeFromDisk.setString(StoreConstants.customDataFolder, value);
120-
notifyListeners();
121-
}
122-
123109
String get taskSelection => _getString(StoreConstants.taskSelection);
124110

125111
set taskSelection(String value) {
@@ -152,8 +138,6 @@ class StoreConstants {
152138
static const previousExtendedResult = 'previous extended result';
153139
static const previousAppVersion = 'previous app version';
154140
static const keepLogs = 'keep_logs';
155-
static const dataFolderType = 'data folder type';
156-
static const customDataFolder = 'custom data folder';
157141
static const taskSelection = 'disabled_tasks';
158142
static const testMinDuration = 'test min duration';
159143
static const testCooldownDuration = 'test cooldown duration';

flutter/lib/ui/settings/data_folder_type.dart

-17
This file was deleted.

0 commit comments

Comments
 (0)