diff options
| author | Ethan Chen <intervigil@gmail.com> | 2018-06-14 22:50:47 -0700 |
|---|---|---|
| committer | Ethan Chen <intervigil@gmail.com> | 2018-06-14 22:57:05 -0700 |
| commit | cfd7b999dd3f3566ae5b728d4e83af9b058e7b92 (patch) | |
| tree | 898e5f2fe62a39bf95c2be973dc96d16fd66a553 | |
| parent | d6be15d1b13b647f7f9b4ff91ab2685afa7d1846 (diff) | |
| download | android_hardware_lineage_interfaces-cfd7b999dd3f3566ae5b728d4e83af9b058e7b92.tar.gz android_hardware_lineage_interfaces-cfd7b999dd3f3566ae5b728d4e83af9b058e7b92.tar.bz2 android_hardware_lineage_interfaces-cfd7b999dd3f3566ae5b728d4e83af9b058e7b92.zip | |
livedisplay: Don't use a singleton for Color service
* There's really no need for this here, the service only ever creates
one instance ever.
Change-Id: Iea24bddd51138d9dc729cfeb3acb0204b1098464
| -rw-r--r-- | livedisplay/1.0/default/include/Color.h | 5 | ||||
| -rw-r--r-- | livedisplay/1.0/default/service.cpp | 3 | ||||
| -rw-r--r-- | livedisplay/1.0/default/src/Color.cpp | 9 |
3 files changed, 2 insertions, 15 deletions
diff --git a/livedisplay/1.0/default/include/Color.h b/livedisplay/1.0/default/include/Color.h index e6fca65..91d2ca2 100644 --- a/livedisplay/1.0/default/include/Color.h +++ b/livedisplay/1.0/default/include/Color.h @@ -40,7 +40,7 @@ class ColorBackend; class Color : public IColor { public: - static android::sp<Color> getInstance(); + Color(); Return<Features> getSupportedFeatures() override; @@ -75,9 +75,6 @@ class Color : public IColor { bool connect(); void reset(); - Color(); - static android::sp<Color> sInstance; - uint32_t mFeatures; bool mConnected; diff --git a/livedisplay/1.0/default/service.cpp b/livedisplay/1.0/default/service.cpp index b8f5cb5..4370545 100644 --- a/livedisplay/1.0/default/service.cpp +++ b/livedisplay/1.0/default/service.cpp @@ -39,14 +39,13 @@ using ::vendor::lineage::livedisplay::V1_0::implementation::Color; int main() { status_t status; - android::sp<IColor> service = nullptr; LOG(INFO) << "LiveDisplay HAL service is starting."; // The LiveDisplay HAL may communicate to other vendor components via /dev/vndbinder android::ProcessState::initWithDriver("/dev/vndbinder"); - service = Color::getInstance(); + android::sp<IColor> service = new Color(); if (service == nullptr) { LOG(ERROR) << "Can not create an instance of LiveDisplay HAL Iface, exiting."; goto shutdown; diff --git a/livedisplay/1.0/default/src/Color.cpp b/livedisplay/1.0/default/src/Color.cpp index accd1d3..b586e39 100644 --- a/livedisplay/1.0/default/src/Color.cpp +++ b/livedisplay/1.0/default/src/Color.cpp @@ -60,8 +60,6 @@ using ::android::OK; using ::android::sp; using ::android::status_t; -sp<Color> Color::sInstance = nullptr; - Color::Color() : mConnected(false), mBackend(nullptr) { #if defined(COLOR_BACKEND_SDM) mBackend = std::make_unique<SDM>(); @@ -118,13 +116,6 @@ bool Color::connect() { return mFeatures > 0; } -sp<Color> Color::getInstance() { - if (sInstance == nullptr) { - sInstance = new Color(); - } - return sInstance; -} - Return<Features> Color::getSupportedFeatures() { connect(); return mFeatures; |
