1 // 2 // Copyright (C) 2015 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 #ifndef UPDATE_ENGINE_AOSP_HARDWARE_ANDROID_H_ 18 #define UPDATE_ENGINE_AOSP_HARDWARE_ANDROID_H_ 19 20 #include <string> 21 #include <string_view> 22 23 #include <base/macros.h> 24 #include <base/time/time.h> 25 26 #include "update_engine/common/error_code.h" 27 #include "update_engine/common/hardware.h" 28 #include "update_engine/common/hardware_interface.h" 29 30 namespace chromeos_update_engine { 31 32 // Implements the real interface with the hardware in the Android platform. 33 class HardwareAndroid : public HardwareInterface { 34 public: 35 HardwareAndroid() = default; 36 ~HardwareAndroid() override = default; 37 38 // HardwareInterface methods. 39 bool IsOfficialBuild() const override; 40 bool IsNormalBootMode() const override; 41 bool AreDevFeaturesEnabled() const override; 42 bool IsOOBEEnabled() const override; 43 bool IsOOBEComplete(base::Time* out_time_of_oobe) const override; 44 std::string GetHardwareClass() const override; 45 std::string GetDeviceRequisition() const override; 46 int GetMinKernelKeyVersion() const override; 47 int GetMinFirmwareKeyVersion() const override; 48 int GetMaxFirmwareKeyRollforward() const override; 49 bool SetMaxFirmwareKeyRollforward(int firmware_max_rollforward) override; 50 bool SetMaxKernelKeyRollforward(int kernel_max_rollforward) override; 51 int GetPowerwashCount() const override; 52 bool SchedulePowerwash(bool save_rollback_data) override; 53 bool CancelPowerwash() override; 54 bool GetNonVolatileDirectory(base::FilePath* path) const override; 55 bool GetPowerwashSafeDirectory(base::FilePath* path) const override; 56 int64_t GetBuildTimestamp() const override; 57 bool AllowDowngrade() const override; 58 bool GetFirstActiveOmahaPingSent() const override; 59 bool SetFirstActiveOmahaPingSent() override; 60 void SetWarmReset(bool warm_reset) override; 61 void SetVbmetaDigestForInactiveSlot(bool reset) override; 62 [[nodiscard]] std::string GetVersionForLogging( 63 const std::string& partition_name) const override; 64 [[nodiscard]] ErrorCode IsPartitionUpdateValid( 65 const std::string& partition_name, 66 const std::string& new_version) const override; 67 [[nodiscard]] const char* GetPartitionMountOptions( 68 const std::string& partition_name) const override; 69 70 private: 71 DISALLOW_COPY_AND_ASSIGN(HardwareAndroid); 72 }; 73 74 } // namespace chromeos_update_engine 75 76 #endif // UPDATE_ENGINE_AOSP_HARDWARE_ANDROID_H_ 77