Merge pull request #130 from mer-hybris/aidl-stability

Make stability field of local object configurable
This commit is contained in:
Slava Monich
2024-07-18 05:04:50 +03:00
committed by GitHub
6 changed files with 30 additions and 8 deletions

View File

@@ -61,6 +61,11 @@ GBinderLocalReply*
gbinder_local_object_new_reply(
GBinderLocalObject* obj);
void
gbinder_local_object_set_stability(
GBinderLocalObject* self,
GBINDER_STABILITY_LEVEL stability); /* Since 1.0.40 */
G_END_DECLS
#endif /* GBINDER_LOCAL_OBJECT_H */

View File

@@ -173,6 +173,13 @@ typedef enum gbinder_status {
GBINDER_STATUS_DEAD_OBJECT
} GBINDER_STATUS;
typedef enum gbinder_stability_level {
GBINDER_STABILITY_UNDECLARED = 0,
GBINDER_STABILITY_VENDOR = 0x03,
GBINDER_STABILITY_SYSTEM = 0x0c,
GBINDER_STABILITY_VINTF = 0x3f
} GBINDER_STABILITY_LEVEL;
#define GBINDER_FOURCC(c1,c2,c3,c4) \
(((c1) << 24) | ((c2) << 16) | ((c3) << 8) | (c4))

View File

@@ -442,6 +442,7 @@ gbinder_local_object_init_base(
self->ipc = gbinder_ipc_ref(ipc);
self->ifaces = (const char**)priv->ifaces;
self->stability = GBINDER_STABILITY_SYSTEM;
priv->txproc = txproc;
priv->user_data = user_data;
}
@@ -611,6 +612,16 @@ gbinder_local_object_handle_release(
gbinder_local_object_handle_later(self, gbinder_local_object_release_proc);
}
void
gbinder_local_object_set_stability(
GBinderLocalObject* self,
GBINDER_STABILITY_LEVEL stability)
{
if (G_LIKELY(self)) {
self->stability = stability;
}
}
/*==========================================================================*
* Internals
*==========================================================================*/

View File

@@ -59,6 +59,7 @@ struct gbinder_local_object {
const char* const* ifaces;
gint weak_refs;
gint strong_refs;
GBINDER_STABILITY_LEVEL stability;
};
typedef enum gbinder_local_transaction_support {

View File

@@ -35,6 +35,7 @@
#include "gbinder_writer.h"
#include "gbinder_config.h"
#include "gbinder_log.h"
#include "gbinder_local_object_p.h"
#define STRICT_MODE_PENALTY_GATHER (0x40 << 16)
#define BINDER_RPC_FLAGS (STRICT_MODE_PENALTY_GATHER)
@@ -218,7 +219,11 @@ gbinder_rpc_protocol_aidl3_finish_flatten_binder(
void* out,
GBinderLocalObject* obj)
{
*(guint32*)out = GBINDER_STABILITY_SYSTEM;
if (G_LIKELY(obj)) {
*(guint32*)out = obj->stability;
} else {
*(guint32*)out = GBINDER_STABILITY_UNDECLARED;
}
}
static const GBinderRpcProtocol gbinder_rpc_protocol_aidl3 = {

View File

@@ -77,13 +77,6 @@ typedef struct gbinder_ipc_sync_api GBinderIpcSyncApi;
/* As a special case, ServiceManager's handle is zero */
#define GBINDER_SERVICEMANAGER_HANDLE (0)
typedef enum gbinder_stability_level {
GBINDER_STABILITY_UNDECLARED = 0,
GBINDER_STABILITY_VENDOR = 0x03,
GBINDER_STABILITY_SYSTEM = 0x0c,
GBINDER_STABILITY_VINTF = 0x3f
} GBINDER_STABILITY_LEVEL;
#endif /* GBINDER_TYPES_PRIVATE_H */
/*