samsung: hidl: light: use StringPrintf
authorJan Altensen <info@stricted.net>
Mon, 3 Feb 2020 17:57:34 +0000 (18:57 +0100)
committerJan Altensen <info@stricted.net>
Mon, 3 Feb 2020 18:08:20 +0000 (19:08 +0100)
Change-Id: I3f36a92f04b254770a768623a2d957729fa87150

hidl/light/Light.cpp

index 3e9b17f82fb91295e5132bde99c48205d5061e62..6516dd4a32550bbf4160445e49ba55b01e1a5a6f 100644 (file)
@@ -15,6 +15,7 @@
  */
 #define LOG_TAG "android.hardware.light@2.0-service.samsung"
 
+#include <android-base/stringprintf.h>
 #include <iomanip>
 
 #include "Light.h"
@@ -155,10 +156,8 @@ void Light::setNotificationLED() {
     }
 
     state.color = calibrateColor(state.color & COLOR_MASK, adjusted_brightness);
-    std::stringstream ss;
-    ss << std::hex << "0x" << std::setfill('0') << std::setw(8) << state.color << std::dec
-       << " " << state.flashOnMs << " " << state.flashOffMs;
-    set(LED_BLINK_NODE, ss.str());
+    set(LED_BLINK_NODE, android::base::StringPrintf("0x%08x %d %d", state.color, state.flashOnMs,
+                                                    state.flashOffMs));
 
 #ifdef LED_BLN_NODE
     if (bln) {