1 #pragma once 2 3 #ifndef COM_ANDROID_SERVER_BACKUP 4 #define COM_ANDROID_SERVER_BACKUP(FLAG) COM_ANDROID_SERVER_BACKUP_##FLAG 5 #endif 6 7 #ifndef COM_ANDROID_SERVER_BACKUP_ENABLE_CLEAR_PIPE_AFTER_RESTORE_FILE 8 #define COM_ANDROID_SERVER_BACKUP_ENABLE_CLEAR_PIPE_AFTER_RESTORE_FILE true 9 #endif 10 #ifndef COM_ANDROID_SERVER_BACKUP_ENABLE_INCREASE_DATATYPES_FOR_AGENT_LOGGING 11 #define COM_ANDROID_SERVER_BACKUP_ENABLE_INCREASE_DATATYPES_FOR_AGENT_LOGGING true 12 #endif 13 #ifndef COM_ANDROID_SERVER_BACKUP_ENABLE_INCREASED_BMM_LOGGING_FOR_RESTORE_AT_INSTALL 14 #define COM_ANDROID_SERVER_BACKUP_ENABLE_INCREASED_BMM_LOGGING_FOR_RESTORE_AT_INSTALL false 15 #endif 16 #ifndef COM_ANDROID_SERVER_BACKUP_ENABLE_MAX_SIZE_WRITES_TO_PIPES 17 #define COM_ANDROID_SERVER_BACKUP_ENABLE_MAX_SIZE_WRITES_TO_PIPES true 18 #endif 19 #ifndef COM_ANDROID_SERVER_BACKUP_ENABLE_METRICS_SETTINGS_BACKUP_AGENTS 20 #define COM_ANDROID_SERVER_BACKUP_ENABLE_METRICS_SETTINGS_BACKUP_AGENTS false 21 #endif 22 #ifndef COM_ANDROID_SERVER_BACKUP_ENABLE_METRICS_SYSTEM_BACKUP_AGENTS 23 #define COM_ANDROID_SERVER_BACKUP_ENABLE_METRICS_SYSTEM_BACKUP_AGENTS true 24 #endif 25 #ifndef COM_ANDROID_SERVER_BACKUP_ENABLE_RESTRICTED_MODE_CHANGES 26 #define COM_ANDROID_SERVER_BACKUP_ENABLE_RESTRICTED_MODE_CHANGES false 27 #endif 28 #ifndef COM_ANDROID_SERVER_BACKUP_ENABLE_SKIPPING_RESTORE_LAUNCHED_APPS 29 #define COM_ANDROID_SERVER_BACKUP_ENABLE_SKIPPING_RESTORE_LAUNCHED_APPS false 30 #endif 31 #ifndef COM_ANDROID_SERVER_BACKUP_ENABLE_V_TO_U_RESTORE_FOR_SYSTEM_COMPONENTS_IN_ALLOWLIST 32 #define COM_ANDROID_SERVER_BACKUP_ENABLE_V_TO_U_RESTORE_FOR_SYSTEM_COMPONENTS_IN_ALLOWLIST false 33 #endif 34 35 #ifdef __cplusplus 36 37 #include <memory> 38 39 namespace com::android::server::backup { 40 41 class flag_provider_interface { 42 public: 43 virtual ~flag_provider_interface() = default; 44 virtual bool enable_clear_pipe_after_restore_file() = 0; 45 virtual bool enable_increase_datatypes_for_agent_logging() = 0; 46 virtual bool enable_increased_bmm_logging_for_restore_at_install() = 0; 47 virtual bool enable_max_size_writes_to_pipes() = 0; 48 virtual bool enable_metrics_settings_backup_agents() = 0; 49 virtual bool enable_metrics_system_backup_agents() = 0; 50 virtual bool enable_read_all_external_storage_files() = 0; 51 virtual bool enable_restricted_mode_changes() = 0; 52 virtual bool enable_skipping_restore_launched_apps() = 0; 53 virtual bool enable_v_to_u_restore_for_system_components_in_allowlist() = 0; 54 }; 55 56 extern std::unique_ptr<flag_provider_interface> provider_; 57 58 enable_clear_pipe_after_restore_file()59inline bool enable_clear_pipe_after_restore_file() { 60 return COM_ANDROID_SERVER_BACKUP_ENABLE_CLEAR_PIPE_AFTER_RESTORE_FILE; 61 } enable_increase_datatypes_for_agent_logging()62inline bool enable_increase_datatypes_for_agent_logging() { 63 return COM_ANDROID_SERVER_BACKUP_ENABLE_INCREASE_DATATYPES_FOR_AGENT_LOGGING; 64 } enable_increased_bmm_logging_for_restore_at_install()65inline bool enable_increased_bmm_logging_for_restore_at_install() { 66 return COM_ANDROID_SERVER_BACKUP_ENABLE_INCREASED_BMM_LOGGING_FOR_RESTORE_AT_INSTALL; 67 } enable_max_size_writes_to_pipes()68inline bool enable_max_size_writes_to_pipes() { 69 return COM_ANDROID_SERVER_BACKUP_ENABLE_MAX_SIZE_WRITES_TO_PIPES; 70 } enable_metrics_settings_backup_agents()71inline bool enable_metrics_settings_backup_agents() { 72 return COM_ANDROID_SERVER_BACKUP_ENABLE_METRICS_SETTINGS_BACKUP_AGENTS; 73 } enable_metrics_system_backup_agents()74inline bool enable_metrics_system_backup_agents() { 75 return COM_ANDROID_SERVER_BACKUP_ENABLE_METRICS_SYSTEM_BACKUP_AGENTS; 76 } enable_read_all_external_storage_files()77inline bool enable_read_all_external_storage_files() { 78 return false; 79 } enable_restricted_mode_changes()80inline bool enable_restricted_mode_changes() { 81 return COM_ANDROID_SERVER_BACKUP_ENABLE_RESTRICTED_MODE_CHANGES; 82 } enable_skipping_restore_launched_apps()83inline bool enable_skipping_restore_launched_apps() { 84 return COM_ANDROID_SERVER_BACKUP_ENABLE_SKIPPING_RESTORE_LAUNCHED_APPS; 85 } enable_v_to_u_restore_for_system_components_in_allowlist()86inline bool enable_v_to_u_restore_for_system_components_in_allowlist() { 87 return COM_ANDROID_SERVER_BACKUP_ENABLE_V_TO_U_RESTORE_FOR_SYSTEM_COMPONENTS_IN_ALLOWLIST; 88 } 89 90 } 91 92 extern "C" { 93 #endif // __cplusplus 94 95 96 bool com_android_server_backup_enable_clear_pipe_after_restore_file(); 97 bool com_android_server_backup_enable_increase_datatypes_for_agent_logging(); 98 bool com_android_server_backup_enable_increased_bmm_logging_for_restore_at_install(); 99 bool com_android_server_backup_enable_max_size_writes_to_pipes(); 100 bool com_android_server_backup_enable_metrics_settings_backup_agents(); 101 bool com_android_server_backup_enable_metrics_system_backup_agents(); 102 bool com_android_server_backup_enable_read_all_external_storage_files(); 103 bool com_android_server_backup_enable_restricted_mode_changes(); 104 bool com_android_server_backup_enable_skipping_restore_launched_apps(); 105 bool com_android_server_backup_enable_v_to_u_restore_for_system_components_in_allowlist(); 106 107 #ifdef __cplusplus 108 } // extern "C" 109 #endif 110 111