Merge "Update to use new android.system.suspend.control AIDL interface" am: 307c8e8d53
am: 55d8f268a9
Original change: https://android-review.googlesource.com/c/platform/hardware/libhardware_legacy/+/1480617 Change-Id: If27d8017873ad3e802b3a57b3d9c5e1069341470
This commit is contained in:
commit
2e4633d238
2 changed files with 9 additions and 9 deletions
|
@ -36,8 +36,8 @@ cc_test {
|
||||||
srcs: ["power_test.cpp"],
|
srcs: ["power_test.cpp"],
|
||||||
static_libs: ["libpower"],
|
static_libs: ["libpower"],
|
||||||
shared_libs: [
|
shared_libs: [
|
||||||
|
"android.system.suspend.control.internal-cpp",
|
||||||
"android.system.suspend@1.0",
|
"android.system.suspend@1.0",
|
||||||
"suspend_control_aidl_interface-cpp",
|
|
||||||
],
|
],
|
||||||
test_suites: ["device-tests"],
|
test_suites: ["device-tests"],
|
||||||
require_root: true,
|
require_root: true,
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <android/system/suspend/ISuspendControlService.h>
|
#include <android/system/suspend/internal/ISuspendControlServiceInternal.h>
|
||||||
#include <binder/IServiceManager.h>
|
#include <binder/IServiceManager.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <hardware_legacy/power.h>
|
#include <hardware_legacy/power.h>
|
||||||
|
@ -27,8 +27,8 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
using android::sp;
|
using android::sp;
|
||||||
using android::system::suspend::ISuspendControlService;
|
using android::system::suspend::internal::ISuspendControlServiceInternal;
|
||||||
using android::system::suspend::WakeLockInfo;
|
using android::system::suspend::internal::WakeLockInfo;
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
@ -94,13 +94,13 @@ class WakeLockTest : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
virtual void SetUp() override {
|
virtual void SetUp() override {
|
||||||
sp<IBinder> control =
|
sp<IBinder> control =
|
||||||
android::defaultServiceManager()->getService(android::String16("suspend_control"));
|
android::defaultServiceManager()->getService(android::String16("suspend_control_internal"));
|
||||||
ASSERT_NE(control, nullptr) << "failed to get the suspend control service";
|
ASSERT_NE(control, nullptr) << "failed to get the internal suspend control service";
|
||||||
controlService = interface_cast<ISuspendControlService>(control);
|
controlService = interface_cast<ISuspendControlServiceInternal>(control);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true iff found.
|
// Returns true iff found.
|
||||||
bool findWakeLockInfoByName(const sp<ISuspendControlService>& service, const std::string& name,
|
bool findWakeLockInfoByName(const sp<ISuspendControlServiceInternal>& service, const std::string& name,
|
||||||
WakeLockInfo* info) {
|
WakeLockInfo* info) {
|
||||||
std::vector<WakeLockInfo> wlStats;
|
std::vector<WakeLockInfo> wlStats;
|
||||||
service->getWakeLockStats(&wlStats);
|
service->getWakeLockStats(&wlStats);
|
||||||
|
@ -114,7 +114,7 @@ class WakeLockTest : public ::testing::Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
// All userspace wake locks are registered with system suspend.
|
// All userspace wake locks are registered with system suspend.
|
||||||
sp<ISuspendControlService> controlService;
|
sp<ISuspendControlServiceInternal> controlService;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Test RAII properties of WakeLock destructor.
|
// Test RAII properties of WakeLock destructor.
|
||||||
|
|
Loading…
Reference in a new issue