-
Notifications
You must be signed in to change notification settings - Fork 0
/
image_properties.h
96 lines (76 loc) · 3.37 KB
/
image_properties.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//
// Copyright (C) 2015 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// This module abstracts the properties tied to the current running image. These
// properties are meant to be constant during the life of this daemon, but can
// be modified in dev-move or non-official builds.
#ifndef UPDATE_ENGINE_IMAGE_PROPERTIES_H_
#define UPDATE_ENGINE_IMAGE_PROPERTIES_H_
#include <string>
namespace chromeos_update_engine {
class SystemState;
// The read-only system properties of the running image.
struct ImageProperties {
// The product id of the image used for all channels, except canary.
std::string product_id;
// The canary-channel product id.
std::string canary_product_id;
// The system id for the Android Things SoM, empty for Chrome OS.
std::string system_id;
// The product version of this image.
std::string version;
// The system version of this image.
std::string system_version;
// A unique string that identifies this build. Normally a combination of the
// the version, signing keys and build target.
std::string build_fingerprint;
// The Android build type, should be either 'user', 'userdebug' or 'eng'.
// It's empty string on other platform.
std::string build_type;
// The board name this image was built for.
std::string board;
// The release channel this image was obtained from.
std::string current_channel;
// The Omaha URL this image should get updates from.
std::string omaha_url;
};
// The mutable image properties are read-write image properties, initialized
// with values from the image but can be modified by storing them in the
// stateful partition.
struct MutableImageProperties {
// The release channel we are tracking.
std::string target_channel;
// Whether powerwash is allowed when downloading an update for the selected
// target_channel.
bool is_powerwash_allowed{false};
};
// Loads all the image properties from the running system. In case of error
// loading any of these properties from the read-only system image a default
// value may be returned instead.
ImageProperties LoadImageProperties(SystemState* system_state);
// Loads the mutable image properties from the stateful partition if found or the
// system image otherwise.
MutableImageProperties LoadMutableImageProperties(SystemState* system_state);
// Stores the mutable image properties in the stateful partition. Returns
// whether the operation succeeded.
bool StoreMutableImageProperties(SystemState* system_state,
const MutableImageProperties& properties);
// Sets the root_prefix used to load files from during unittests to
// |test_root_prefix|. Passing a nullptr value resets it to the default.
namespace test {
void SetImagePropertiesRootPrefix(const char* test_root_prefix);
} // namespace test
} // namespace chromeos_update_engine
#endif // UPDATE_ENGINE_IMAGE_PROPERTIES_H_