Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0bd44d15 authored by Jin Qian's avatar Jin Qian
Browse files

Add binder native side code for BatteryPropertiesListener

Test: build flash boot
Change-Id: Ic689797708e15eb6cdf5976130e5f91429210c0d
parent 983fa288
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -40,6 +40,12 @@ public:

// ----------------------------------------------------------------------------

class BnBatteryPropertiesListener: public BnInterface<IBatteryPropertiesListener> {
public:
    virtual status_t onTransact(uint32_t code, const Parcel& data,
                                Parcel* reply, uint32_t flags = 0);
};

}; // namespace android

#endif // ANDROID_IBATTERYPROPERTIESLISTENER_H
+18 −0
Original line number Diff line number Diff line
@@ -43,4 +43,22 @@ IMPLEMENT_META_INTERFACE(BatteryPropertiesListener, "android.os.IBatteryProperti

// ----------------------------------------------------------------------------

status_t BnBatteryPropertiesListener::onTransact(uint32_t code, const Parcel& data,
                                                 Parcel* reply, uint32_t flags)
{
    switch(code) {
        case TRANSACT_BATTERYPROPERTIESCHANGED: {
            CHECK_INTERFACE(IBatteryPropertiesListener, data, reply);
            struct BatteryProperties props = {};
            if (data.readInt32() != 0) {
                props.readFromParcel((Parcel*)&data);
            }
            batteryPropertiesChanged(props);
            return NO_ERROR;
        }
        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
};

}; // namespace android