Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QAndroidBinder Class Reference

\inheaderfile QtCore/private/qandroidextras_p.h \preliminary \inmodule QtCorePrivate More...

#include <qandroidextras_p.h>

+ Collaboration diagram for QAndroidBinder:

Public Types

enum class  CallType { Normal = 0 , OneWay = 1 }
 This enum is used with \l QAndroidBinder::transact() to describe the mode in which the IPC call is performed. More...
 

Public Member Functions

 QAndroidBinder ()
 Creates a new object which can be used to perform IPC.
 
 QAndroidBinder (const QJniObject &binder)
 Creates a new object from the binder Java object.
 
virtual ~QAndroidBinder ()
 
virtual bool onTransact (int code, const QAndroidParcel &data, const QAndroidParcel &reply, CallType flags)
 Default implementation is a stub that returns false.
 
bool transact (int code, const QAndroidParcel &data, QAndroidParcel *reply=nullptr, CallType flags=CallType::Normal) const
 Performs an IPC call.
 
QJniObject handle () const
 The return value is useful to call other Java API which are not covered by this wrapper.
 

Friends

class QAndroidBinderPrivate
 
class QAndroidParcelPrivate
 
class QAndroidServicePrivate
 

Detailed Description

\inheaderfile QtCore/private/qandroidextras_p.h \preliminary \inmodule QtCorePrivate

Wraps the most important methods of Android Binder class.

The QAndroidBinder is a convenience class that wraps the most important \l {https://developer.android.com/reference/android/os/Binder.html}{Android Binder} methods.

qtcoreprivate-usage

Since
6.2

Definition at line 37 of file qandroidextras_p.h.

Member Enumeration Documentation

◆ CallType

enum class QAndroidBinder::CallType
strong

This enum is used with \l QAndroidBinder::transact() to describe the mode in which the IPC call is performed.

\value Normal normal IPC, meaning that the caller waits the result from the callee \value OneWay one-way IPC, meaning that the caller returns immediately, without waiting for a result from the callee

Enumerator
Normal 
OneWay 

Definition at line 40 of file qandroidextras_p.h.

Constructor & Destructor Documentation

◆ QAndroidBinder() [1/2]

QAndroidBinder::QAndroidBinder ( )
explicit

Creates a new object which can be used to perform IPC.

See also
onTransact, transact

Definition at line 301 of file qandroidextras.cpp.

◆ QAndroidBinder() [2/2]

QAndroidBinder::QAndroidBinder ( const QJniObject & binder)

Creates a new object from the binder Java object.

See also
transact

Definition at line 311 of file qandroidextras.cpp.

◆ ~QAndroidBinder()

QAndroidBinder::~QAndroidBinder ( )
virtual

Definition at line 316 of file qandroidextras.cpp.

Member Function Documentation

◆ handle()

QJniObject QAndroidBinder::handle ( ) const

The return value is useful to call other Java API which are not covered by this wrapper.

Definition at line 369 of file qandroidextras.cpp.

◆ onTransact()

bool QAndroidBinder::onTransact ( int code,
const QAndroidParcel & data,
const QAndroidParcel & reply,
CallType flags )
virtual

Default implementation is a stub that returns false.

The user should override this method to get the transact data from the caller.

The code is the action to perform. The data is the marshaled data sent by the caller.\br The reply is the marshaled data to be sent to the caller.\br The flags are the additional operation flags.\br

Warning
This method is called from Binder's thread which is different from the thread that this object was created.
See also
transact

Definition at line 334 of file qandroidextras.cpp.

◆ transact()

bool QAndroidBinder::transact ( int code,
const QAndroidParcel & data,
QAndroidParcel * reply = nullptr,
CallType flags = CallType::Normal ) const

Performs an IPC call.

The code is the action to perform. Should be between \l {https://developer.android.com/reference/android/os/IBinder.html#FIRST_CALL_TRANSACTION} {FIRST_CALL_TRANSACTION} and \l {https://developer.android.com/reference/android/os/IBinder.html#LAST_CALL_TRANSACTION} {LAST_CALL_TRANSACTION}.\br The data is the marshaled data to send to the target.\br The reply (if specified) is the marshaled data to be received from the target. May be nullptr if you are not interested in the return value.\br The flags are the additional operation flags.\br

Returns
true on success

Definition at line 355 of file qandroidextras.cpp.

References reply.

Friends And Related Symbol Documentation

◆ QAndroidBinderPrivate

friend class QAndroidBinderPrivate
friend

Definition at line 59 of file qandroidextras_p.h.

◆ QAndroidParcelPrivate

friend class QAndroidParcelPrivate
friend

Definition at line 60 of file qandroidextras_p.h.

◆ QAndroidServicePrivate

friend class QAndroidServicePrivate
friend

Definition at line 61 of file qandroidextras_p.h.


The documentation for this class was generated from the following files: