Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 475d9b28 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "HIDL: C++ Java parity"

parents 3436fd48 afe95a99
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -282,4 +282,13 @@ cc_library_shared {
        // GraphicsJNI.h includes hwui headers
        // GraphicsJNI.h includes hwui headers
        "libhwui",
        "libhwui",
    ],
    ],

    product_variables: {
        debuggable: {
            cflags: ["-D__ANDROID_DEBUGGABLE__"]
        },
        treble: {
            cflags: ["-D__ANDROID_TREBLE__"]
        },
    },
}
}
+15 −2
Original line number Original line Diff line number Diff line
@@ -23,6 +23,8 @@
#include "android_os_HwParcel.h"
#include "android_os_HwParcel.h"
#include "android_os_HwRemoteBinder.h"
#include "android_os_HwRemoteBinder.h"


#include <cstring>

#include <JNIHelp.h>
#include <JNIHelp.h>
#include <android/hidl/manager/1.0/IServiceManager.h>
#include <android/hidl/manager/1.0/IServiceManager.h>
#include <android/hidl/base/1.0/IBase.h>
#include <android/hidl/base/1.0/IBase.h>
@@ -329,8 +331,19 @@ static jobject JHwBinder_native_getService(


    IServiceManager::Transport transport = transportRet;
    IServiceManager::Transport transport = transportRet;


    if (   transport != IServiceManager::Transport::EMPTY
#ifdef __ANDROID_TREBLE__
        && transport != IServiceManager::Transport::HWBINDER) {
#ifdef __ANDROID_DEBUGGABLE__
    const char* testingOverride = std::getenv("TREBLE_TESTING_OVERRIDE");
    const bool vintfLegacy = (transport == IServiceManager::Transport::EMPTY)
            && testingOverride && !strcmp(testingOverride, "true");
#else // __ANDROID_TREBLE__ but not __ANDROID_DEBUGGABLE__
    const bool vintfLegacy = false;
#endif // __ANDROID_DEBUGGABLE__
#else // not __ANDROID_TREBLE__
    const bool vintfLegacy = (transport == IServiceManager::Transport::EMPTY);
#endif // __ANDROID_TREBLE__";

    if (transport != IServiceManager::Transport::HWBINDER && !vintfLegacy) {
        LOG(ERROR) << "service " << ifaceName << " declares transport method "
        LOG(ERROR) << "service " << ifaceName << " declares transport method "
                   << toString(transport) << " but framework expects hwbinder.";
                   << toString(transport) << " but framework expects hwbinder.";
        signalExceptionForError(env, UNKNOWN_ERROR, true /* canThrowRemoteException */);
        signalExceptionForError(env, UNKNOWN_ERROR, true /* canThrowRemoteException */);