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