예제 #1
0
 android::sp<IDemo> IDemo::asInterface(const android::sp<android::IBinder>& obj) {
     android::sp<IDemo> intr;
     if (obj != NULL) {
         intr = static_cast<IDemo*>(obj->queryLocalInterface(IDemo::descriptor).get());
         if (intr == NULL) {
             intr = new BpDemo(obj);
         }
     }
     return intr;
 }
android::sp<ITestFramework> ITestFramework::asInterface(
           const android::sp<android::IBinder>& obj)
{
    android::sp<ITestFramework> intr;
    if (obj != NULL) {
        intr = static_cast<ITestFramework*>(
                obj->queryLocalInterface(ITestFramework::descriptor).get());
        if (intr == NULL) {
            intr = new BpTestFramework(obj);
        }
    }
    return intr;
}