Merge "vibrator extension: use checked_interface_cast"
This commit is contained in:
commit
741347b49d
1 changed files with 2 additions and 2 deletions
|
@ -20,9 +20,9 @@
|
||||||
#include <binder/IServiceManager.h>
|
#include <binder/IServiceManager.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
using android::checked_interface_cast;
|
||||||
using android::IBinder;
|
using android::IBinder;
|
||||||
using android::IInterface;
|
using android::IInterface;
|
||||||
using android::interface_cast;
|
|
||||||
using android::OK;
|
using android::OK;
|
||||||
using android::sp;
|
using android::sp;
|
||||||
using android::waitForVintfService;
|
using android::waitForVintfService;
|
||||||
|
@ -44,7 +44,7 @@ TEST(Cpp, CallExtMethod) {
|
||||||
// getting the extension
|
// getting the extension
|
||||||
sp<IBinder> ext;
|
sp<IBinder> ext;
|
||||||
ASSERT_EQ(OK, IInterface::asBinder(vib)->getExtension(&ext));
|
ASSERT_EQ(OK, IInterface::asBinder(vib)->getExtension(&ext));
|
||||||
sp<ICustomVibrator> cvib = interface_cast<ICustomVibrator>(ext);
|
sp<ICustomVibrator> cvib = checked_interface_cast<ICustomVibrator>(ext);
|
||||||
ASSERT_NE(nullptr, cvib.get());
|
ASSERT_NE(nullptr, cvib.get());
|
||||||
|
|
||||||
// calling extension method
|
// calling extension method
|
||||||
|
|
Loading…
Reference in a new issue