Home | History | Annotate | Download | only in update_engine
      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 #ifndef UPDATE_ENGINE_DAEMON_STATE_ANDROID_H_
     18 #define UPDATE_ENGINE_DAEMON_STATE_ANDROID_H_
     19 
     20 #include <memory>
     21 #include <set>
     22 
     23 #include "update_engine/certificate_checker.h"
     24 #include "update_engine/common/boot_control_interface.h"
     25 #include "update_engine/common/hardware_interface.h"
     26 #include "update_engine/common/prefs_interface.h"
     27 #include "update_engine/daemon_state_interface.h"
     28 #include "update_engine/service_delegate_android_interface.h"
     29 #include "update_engine/service_observer_interface.h"
     30 #include "update_engine/update_attempter_android.h"
     31 
     32 namespace chromeos_update_engine {
     33 
     34 class DaemonStateAndroid : public DaemonStateInterface {
     35  public:
     36   DaemonStateAndroid() = default;
     37   ~DaemonStateAndroid() override = default;
     38 
     39   bool Initialize();
     40 
     41   // DaemonStateInterface overrides.
     42   bool StartUpdater() override;
     43   void AddObserver(ServiceObserverInterface* observer) override;
     44   void RemoveObserver(ServiceObserverInterface* observer) override;
     45 
     46   const std::set<ServiceObserverInterface*>& service_observers() override {
     47     return service_observers_;
     48   }
     49 
     50   // Return a pointer to the service delegate.
     51   ServiceDelegateAndroidInterface* service_delegate();
     52 
     53  protected:
     54   std::set<ServiceObserverInterface*> service_observers_;
     55 
     56   // Interface for the boot control functions.
     57   std::unique_ptr<BootControlInterface> boot_control_;
     58 
     59   // Interface for the hardware functions.
     60   std::unique_ptr<HardwareInterface> hardware_;
     61 
     62   // Interface for persisted store.
     63   std::unique_ptr<PrefsInterface> prefs_;
     64 
     65   // The main class handling the updates.
     66   std::unique_ptr<UpdateAttempterAndroid> update_attempter_;
     67 
     68   // OpenSSLWrapper and CertificateChecker used for checking changes in SSL
     69   // certificates.
     70   OpenSSLWrapper openssl_wrapper_;
     71   std::unique_ptr<CertificateChecker> certificate_checker_;
     72 };
     73 
     74 }  // namespace chromeos_update_engine
     75 
     76 #endif  // UPDATE_ENGINE_DAEMON_STATE_ANDROID_H_
     77