Merge "ledstatus: use internally stored state when checking if led is on"
diff --git a/sepolicy/ledservice.te b/sepolicy/ledservice.te
index 5770299..6afd94e 100644
--- a/sepolicy/ledservice.te
+++ b/sepolicy/ledservice.te
@@ -5,5 +5,6 @@
brillo_domain(ledservice)
allow_crash_reporter(ledservice)
+allow ledservice sysfs:dir r_dir_perms;
allow ledservice sysfs:file rw_file_perms;
allow ledservice sysfs:lnk_file read;
diff --git a/src/ledflasher/animation.cpp b/src/ledflasher/animation.cpp
index 0dfaad3..dbc891d 100644
--- a/src/ledflasher/animation.cpp
+++ b/src/ledflasher/animation.cpp
@@ -21,8 +21,9 @@
#include <base/bind.h>
#include <base/message_loop/message_loop.h>
-Animation::Animation(com::android::LEDService::ServiceProxy* service_proxy,
- const base::TimeDelta& step_duration)
+Animation::Animation(
+ com::android::LEDService::ServiceProxyInterface* service_proxy,
+ const base::TimeDelta& step_duration)
: service_proxy_{service_proxy}, step_duration_{step_duration} {
}
@@ -54,7 +55,7 @@
}
std::unique_ptr<Animation> Animation::Create(
- com::android::LEDService::ServiceProxy* service_proxy,
+ com::android::LEDService::ServiceProxyInterface* service_proxy,
const std::string& type,
const base::TimeDelta& duration) {
std::unique_ptr<Animation> animation;
diff --git a/src/ledflasher/animation.h b/src/ledflasher/animation.h
index 63cd209..6df53c1 100644
--- a/src/ledflasher/animation.h
+++ b/src/ledflasher/animation.h
@@ -27,7 +27,7 @@
class Animation {
public:
- Animation(com::android::LEDService::ServiceProxy* service_proxy,
+ Animation(com::android::LEDService::ServiceProxyInterface* service_proxy,
const base::TimeDelta& step_duration);
virtual ~Animation() = default;
@@ -35,7 +35,7 @@
void Stop();
static std::unique_ptr<Animation> Create(
- com::android::LEDService::ServiceProxy* service_proxy,
+ com::android::LEDService::ServiceProxyInterface* service_proxy,
const std::string& type,
const base::TimeDelta& duration);
@@ -49,7 +49,7 @@
void SetAllLEDs(bool on);
private:
- com::android::LEDService::ServiceProxy* service_proxy_;
+ com::android::LEDService::ServiceProxyInterface* service_proxy_;
base::TimeDelta step_duration_;
base::WeakPtrFactory<Animation> weak_ptr_factory_{this};
diff --git a/src/ledflasher/animation_blink.cpp b/src/ledflasher/animation_blink.cpp
index af0a736..5bf0978 100644
--- a/src/ledflasher/animation_blink.cpp
+++ b/src/ledflasher/animation_blink.cpp
@@ -17,7 +17,7 @@
#include "animation_blink.h"
AnimationBlink::AnimationBlink(
- com::android::LEDService::ServiceProxy* service_proxy,
+ com::android::LEDService::ServiceProxyInterface* service_proxy,
const base::TimeDelta& duration) : Animation{service_proxy, duration / 2} {
}
diff --git a/src/ledflasher/animation_blink.h b/src/ledflasher/animation_blink.h
index 1509f75..c7ee1b8 100644
--- a/src/ledflasher/animation_blink.h
+++ b/src/ledflasher/animation_blink.h
@@ -21,7 +21,7 @@
class AnimationBlink : public Animation {
public:
- AnimationBlink(com::android::LEDService::ServiceProxy* service_proxy,
+ AnimationBlink(com::android::LEDService::ServiceProxyInterface* service_proxy,
const base::TimeDelta& duration);
protected:
diff --git a/src/ledflasher/animation_marquee.cpp b/src/ledflasher/animation_marquee.cpp
index cfffe8d..b2ad1e1 100644
--- a/src/ledflasher/animation_marquee.cpp
+++ b/src/ledflasher/animation_marquee.cpp
@@ -17,7 +17,7 @@
#include "animation_marquee.h"
AnimationMarquee::AnimationMarquee(
- com::android::LEDService::ServiceProxy* service_proxy,
+ com::android::LEDService::ServiceProxyInterface* service_proxy,
const base::TimeDelta& duration,
Direction direction)
: Animation{service_proxy, duration / num_leds}, direction_{direction} {
diff --git a/src/ledflasher/animation_marquee.h b/src/ledflasher/animation_marquee.h
index ce49e7a..a31382b 100644
--- a/src/ledflasher/animation_marquee.h
+++ b/src/ledflasher/animation_marquee.h
@@ -23,9 +23,10 @@
public:
enum class Direction {Left, Right};
- AnimationMarquee(com::android::LEDService::ServiceProxy* service_proxy,
- const base::TimeDelta& duration,
- Direction direction);
+ AnimationMarquee(
+ com::android::LEDService::ServiceProxyInterface* service_proxy,
+ const base::TimeDelta& duration,
+ Direction direction);
protected:
void DoAnimationStep() override;
diff --git a/src/ledflasher/ledflasher.cpp b/src/ledflasher/ledflasher.cpp
index 5859647..e9bfa3c 100644
--- a/src/ledflasher/ledflasher.cpp
+++ b/src/ledflasher/ledflasher.cpp
@@ -27,7 +27,7 @@
#include "animation.h"
#include "ledservice/dbus-proxies.h"
-using com::android::LEDService::ServiceProxy;
+using com::android::LEDService::ServiceProxyInterface;
class Daemon final : public brillo::DBusDaemon {
public:
@@ -37,7 +37,7 @@
int OnInit() override;
private:
- void OnLEDServiceConnected(ServiceProxy* service);
+ void OnLEDServiceConnected(ServiceProxyInterface* service);
void OnLEDServiceDisconnected(const dbus::ObjectPath& object_path);
// Particular command handlers for various commands.
@@ -58,7 +58,7 @@
std::string status_{"idle"};
// LED service interface.
- ServiceProxy* led_service_{nullptr};
+ ServiceProxyInterface* led_service_{nullptr};
// Current animation;
std::unique_ptr<Animation> animation_;
@@ -93,7 +93,7 @@
return EX_OK;
}
-void Daemon::OnLEDServiceConnected(ServiceProxy* service) {
+void Daemon::OnLEDServiceConnected(ServiceProxyInterface* service) {
led_service_ = service;
UpdateDeviceState();
}