• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 #pragma once
15 
16 #include <stdbool.h>
17 
18 typedef enum {
19 #define FEATURE_CONTROL_ITEM(item) kFeature_##item,
20 #include "FeatureControlDefHost.h"
21 #include "FeatureControlDefGuest.h"
22 #undef FEATURE_CONTROL_ITEM
23     kFeature_n_items
24 } Feature;
25 
26 // Call this function first to initialize the feature control.
27 void feature_initialize();
28 
29 // Get the access rules given by |name| if they exist, otherwise returns NULL
30 bool feature_is_enabled(Feature feature);
31 void feature_set_enabled_override(Feature feature, bool isEnabled);
32 void feature_reset_enabled_to_default(Feature feature);
33 
34 // Set the feature if it is not user-overriden.
35 void feature_set_if_not_overridden(Feature feature, bool enable);
36 
37 // Set the feature if it is not user-overriden or disabled from the guest.
38 void feature_set_if_not_overridden_or_guest_disabled(Feature feature, bool enable);
39 
40 // Runs applyCachedServerFeaturePatterns then
41 // asyncUpdateServerFeaturePatterns. See FeatureControl.h
42 // for more info. To be called only once on startup.
43 void feature_update_from_server();
44