1 #pragma once
2 
3 #ifndef COM_ANDROID_ACONFIG_NEW_STORAGE
4 #define COM_ANDROID_ACONFIG_NEW_STORAGE(FLAG) COM_ANDROID_ACONFIG_NEW_STORAGE_##FLAG
5 #endif
6 
7 #ifndef COM_ANDROID_ACONFIG_NEW_STORAGE_ENABLE_ACONFIG_STORAGE_DAEMON
8 #define COM_ANDROID_ACONFIG_NEW_STORAGE_ENABLE_ACONFIG_STORAGE_DAEMON false
9 #endif
10 #ifndef COM_ANDROID_ACONFIG_NEW_STORAGE_ENABLE_ACONFIGD_FROM_MAINLINE
11 #define COM_ANDROID_ACONFIG_NEW_STORAGE_ENABLE_ACONFIGD_FROM_MAINLINE false
12 #endif
13 #ifndef COM_ANDROID_ACONFIG_NEW_STORAGE_ENABLE_FULL_RUST_SYSTEM_ACONFIGD
14 #define COM_ANDROID_ACONFIG_NEW_STORAGE_ENABLE_FULL_RUST_SYSTEM_ACONFIGD false
15 #endif
16 
17 #ifdef __cplusplus
18 
19 #include <memory>
20 
21 namespace com::android::aconfig_new_storage {
22 
23 class flag_provider_interface {
24 public:
25     virtual ~flag_provider_interface() = default;
26     virtual bool enable_aconfig_storage_daemon() = 0;
27     virtual bool enable_aconfigd_from_mainline() = 0;
28     virtual bool enable_full_rust_system_aconfigd() = 0;
29     virtual bool support_clear_local_overrides_immediately() = 0;
30     virtual bool support_immediate_local_overrides() = 0;
31 };
32 
33 extern std::unique_ptr<flag_provider_interface> provider_;
34 
35 
enable_aconfig_storage_daemon()36 inline bool enable_aconfig_storage_daemon() {
37     return COM_ANDROID_ACONFIG_NEW_STORAGE_ENABLE_ACONFIG_STORAGE_DAEMON;
38 }
enable_aconfigd_from_mainline()39 inline bool enable_aconfigd_from_mainline() {
40     return COM_ANDROID_ACONFIG_NEW_STORAGE_ENABLE_ACONFIGD_FROM_MAINLINE;
41 }
enable_full_rust_system_aconfigd()42 inline bool enable_full_rust_system_aconfigd() {
43     return COM_ANDROID_ACONFIG_NEW_STORAGE_ENABLE_FULL_RUST_SYSTEM_ACONFIGD;
44 }
support_clear_local_overrides_immediately()45 inline bool support_clear_local_overrides_immediately() {
46     return false;
47 }
support_immediate_local_overrides()48 inline bool support_immediate_local_overrides() {
49     return false;
50 }
51 
52 }
53 
54 extern "C" {
55 #endif // __cplusplus
56 
57 
58 bool com_android_aconfig_new_storage_enable_aconfig_storage_daemon();
59 bool com_android_aconfig_new_storage_enable_aconfigd_from_mainline();
60 bool com_android_aconfig_new_storage_enable_full_rust_system_aconfigd();
61 bool com_android_aconfig_new_storage_support_clear_local_overrides_immediately();
62 bool com_android_aconfig_new_storage_support_immediate_local_overrides();
63 
64 #ifdef __cplusplus
65 } // extern "C"
66 #endif
67 
68