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

Commit ec62f12a authored by Jaikumar Ganesh's avatar Jaikumar Ganesh Committed by Android (Google) Code Review
Browse files

Merge "Change the fd to be blocking for health profile."

parents 30cca7ec 82477b5e
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -1645,6 +1645,25 @@ static jobject getChannelFdNative(JNIEnv *env, jobject object, jstring channelPa
        fd = dbus_returns_unixfd(env, reply);
        if (fd == -1) return NULL;

        int flags = fcntl(fd, F_GETFL);
        if (flags < 0) {
           LOGE("Can't get flags with fcntl(): %s (%d)",
                                strerror(errno), errno);
           releaseChannelFdNative(env, object, channelPath);
           close(fd);
           return NULL;
        }

        flags &= ~O_NONBLOCK;
        int status = fcntl(fd, F_SETFL, flags);
        if (status < 0) {
           LOGE("Can't set flags with fcntl(): %s (%d)",
               strerror(errno), errno);
           releaseChannelFdNative(env, object, channelPath);
           close(fd);
           return NULL;
        }

        // Create FileDescriptor object
        jobject fileDesc = jniCreateFileDescriptor(env, fd);
        if (fileDesc == NULL) {