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

Commit 61a21618 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add binder native side code for BatteryPropertiesListener"

parents 7e8745ef 0bd44d15
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