• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (C) 2014 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 #include "update_engine/update_manager/real_system_provider.h"
18 
19 #include <string.h>
20 #include <sys/stat.h>
21 #include <sys/types.h>
22 #include <unistd.h>
23 
24 #include <string>
25 #include <vector>
26 
27 #include <base/logging.h>
28 #include <base/strings/stringprintf.h>
29 #include <base/time/time.h>
30 
31 #include "update_engine/common/utils.h"
32 #include "update_engine/update_manager/generic_variables.h"
33 
34 using std::string;
35 
36 namespace chromeos_update_manager {
37 
Init()38 bool RealSystemProvider::Init() {
39   var_is_normal_boot_mode_.reset(
40       new ConstCopyVariable<bool>("is_normal_boot_mode",
41                                   hardware_->IsNormalBootMode()));
42 
43   var_is_official_build_.reset(
44       new ConstCopyVariable<bool>("is_official_build",
45                                   hardware_->IsOfficialBuild()));
46 
47   var_is_oobe_complete_.reset(
48       new CallCopyVariable<bool>(
49           "is_oobe_complete",
50           base::Bind(&chromeos_update_engine::HardwareInterface::IsOOBEComplete,
51                      base::Unretained(hardware_), nullptr)));
52 
53   var_num_slots_.reset(
54       new ConstCopyVariable<unsigned int>(
55           "num_slots", boot_control_->GetNumSlots()));
56 
57   return true;
58 }
59 
60 }  // namespace chromeos_update_manager
61