Merge "healthd: BatteryPropertiesRegistrar binder service ref count fixup"
am: 36ba2fad01
* commit '36ba2fad014a1a0734a6e704e30677ee88640d3b':
healthd: BatteryPropertiesRegistrar binder service ref count fixup
diff --git a/healthd/BatteryPropertiesRegistrar.cpp b/healthd/BatteryPropertiesRegistrar.cpp
index 09667a1..d3a89d7 100644
--- a/healthd/BatteryPropertiesRegistrar.cpp
+++ b/healthd/BatteryPropertiesRegistrar.cpp
@@ -30,8 +30,9 @@
namespace android {
-void BatteryPropertiesRegistrar::publish() {
- defaultServiceManager()->addService(String16("batteryproperties"), this);
+void BatteryPropertiesRegistrar::publish(
+ const sp<BatteryPropertiesRegistrar>& service) {
+ defaultServiceManager()->addService(String16("batteryproperties"), service);
}
void BatteryPropertiesRegistrar::notifyListeners(struct BatteryProperties props) {
diff --git a/healthd/BatteryPropertiesRegistrar.h b/healthd/BatteryPropertiesRegistrar.h
index 8853874..d17e4a3 100644
--- a/healthd/BatteryPropertiesRegistrar.h
+++ b/healthd/BatteryPropertiesRegistrar.h
@@ -30,7 +30,7 @@
class BatteryPropertiesRegistrar : public BnBatteryPropertiesRegistrar,
public IBinder::DeathRecipient {
public:
- void publish();
+ void publish(const sp<BatteryPropertiesRegistrar>& service);
void notifyListeners(struct BatteryProperties props);
private:
diff --git a/healthd/healthd_mode_android.cpp b/healthd/healthd_mode_android.cpp
index fd153a2..0a64099 100644
--- a/healthd/healthd_mode_android.cpp
+++ b/healthd/healthd_mode_android.cpp
@@ -58,5 +58,5 @@
}
gBatteryPropertiesRegistrar = new BatteryPropertiesRegistrar();
- gBatteryPropertiesRegistrar->publish();
+ gBatteryPropertiesRegistrar->publish(gBatteryPropertiesRegistrar);
}