summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Chen <intervigil@gmail.com>2018-04-28 15:49:48 -0700
committerEthan Chen <intervigil@gmail.com>2018-04-29 23:00:35 +0200
commit0d115317b922f67970fb04af459edc0975a360a7 (patch)
tree9a8df085a474e25cd3016591313f1da924e891d0
parent724ca6d4068c1d7da8735cd7462d94ee1366c0e0 (diff)
downloadandroid_hardware_lineage_interfaces-0d115317b922f67970fb04af459edc0975a360a7.tar.gz
android_hardware_lineage_interfaces-0d115317b922f67970fb04af459edc0975a360a7.tar.bz2
android_hardware_lineage_interfaces-0d115317b922f67970fb04af459edc0975a360a7.zip
livedisplay: Make ColorBackend a regular object
* There's no need to make this inherit from RefBase if the only use of that is as a smart pointer. Make it a regular object and use a unique_ptr to refer to it instead. Change-Id: If633c19ebaa35f4213181bcfeb46a84cb5595d10
-rw-r--r--livedisplay/1.0/default/include/Color.h2
-rw-r--r--livedisplay/1.0/default/include/ColorBackend.h2
-rw-r--r--livedisplay/1.0/default/src/Color.cpp4
3 files changed, 4 insertions, 4 deletions
diff --git a/livedisplay/1.0/default/include/Color.h b/livedisplay/1.0/default/include/Color.h
index 75d53cc..1d74850 100644
--- a/livedisplay/1.0/default/include/Color.h
+++ b/livedisplay/1.0/default/include/Color.h
@@ -92,7 +92,7 @@ class Color : public IColor {
mFeatures |= (uint32_t)f;
};
- sp<ColorBackend> mBackend;
+ std::unique_ptr<ColorBackend> mBackend;
Mutex mLock;
};
diff --git a/livedisplay/1.0/default/include/ColorBackend.h b/livedisplay/1.0/default/include/ColorBackend.h
index 77769c1..027d722 100644
--- a/livedisplay/1.0/default/include/ColorBackend.h
+++ b/livedisplay/1.0/default/include/ColorBackend.h
@@ -30,7 +30,7 @@ namespace implementation {
using ::android::sp;
using ::android::status_t;
-class ColorBackend : public android::RefBase {
+class ColorBackend {
public:
virtual status_t setAdaptiveBacklightEnabled(bool enabled) = 0;
virtual bool isAdaptiveBacklightEnabled() = 0;
diff --git a/livedisplay/1.0/default/src/Color.cpp b/livedisplay/1.0/default/src/Color.cpp
index a6080ba..703d290 100644
--- a/livedisplay/1.0/default/src/Color.cpp
+++ b/livedisplay/1.0/default/src/Color.cpp
@@ -39,7 +39,7 @@ sp<Color> Color::sInstance = nullptr;
Color::Color() : mConnected(false), mBackend(nullptr) {
#ifdef COLOR_BACKEND_SDM
- mBackend = new SDM();
+ mBackend = std::make_unique<SDM>();
#endif
LOG(DEBUG) << "Loaded LiveDisplay native interface";
}
@@ -71,7 +71,7 @@ bool Color::connect() {
mFeatures = 0;
- if (mBackend == NULL) {
+ if (mBackend == nullptr) {
return false;
}