Android Internet of Vehicles - Introduction to CarPowerManager (8)

        CarPowerManager mainly provides API interfaces to the outside world and relies on CarPowerManagementService for function implementation.

1. Introduction to power management

1. Basic introduction

        Different from other services in CarService, in addition to providing the Java class interface CarPowerManager, CarPowerManagementService also has a corresponding C++ class interface, and the class name is also called CarPowerManager. The source code locations of these two are located at:

packages/services/Car/car-lib/src/android/car/hardware/power/CarPowerManager.java

packages/services/Car/car-lib/native/CarPowerManager/CarPowerManager.cpp

        The main purpose of adding the C++ class interface is to provide CarPowerManager-related functions to some services written in C++ to help them manage the power status. In terms of interface definition and function, both Java and C++ CarPowerManager are the same, and they all correspond to the same CarPowerManagementService.

2. Common interfaces

        CarPowerManager provides the function of notifying power status changes and adjusting power status. The following public methods are mainly provided.

Power status monitoring

public void setListener(CarPowerStateListener listener) {
    synchronized (mLock) {
        if (mListener != null || m

Guess you like

Origin blog.csdn.net/c19344881x/article/details/135380931