Add Device.is_lost property

This commit is contained in:
Ole André Vadla Ravnås
2021-06-12 02:12:36 +02:00
parent a217308a9a
commit f3dc04cdc1
2 changed files with 18 additions and 0 deletions
+4
View File
@@ -89,6 +89,10 @@ class Device(object):
def __repr__(self):
return repr(self._impl)
@property
def is_lost(self):
return self._impl.is_lost()
@cancellable
def get_frontmost_application(self):
return self._impl.get_frontmost_application()
+14
View File
@@ -348,6 +348,7 @@ static int PyDevice_init (PyDevice * self, PyObject * args, PyObject * kw);
static void PyDevice_init_from_handle (PyDevice * self, FridaDevice * handle);
static void PyDevice_dealloc (PyDevice * self);
static PyObject * PyDevice_repr (PyDevice * self);
static PyObject * PyDevice_is_lost (PyDevice * self);
static PyObject * PyDevice_get_frontmost_application (PyDevice * self);
static PyObject * PyDevice_enumerate_applications (PyDevice * self);
static PyObject * PyDevice_enumerate_processes (PyDevice * self);
@@ -524,6 +525,7 @@ static PyMethodDef PyDeviceManager_methods[] =
static PyMethodDef PyDevice_methods[] =
{
{ "is_lost", (PyCFunction) PyDevice_is_lost, METH_NOARGS, "Query whether the device has been lost." },
{ "get_frontmost_application", (PyCFunction) PyDevice_get_frontmost_application, METH_NOARGS, "Get details about the frontmost application." },
{ "enumerate_applications", (PyCFunction) PyDevice_enumerate_applications, METH_NOARGS, "Enumerate applications." },
{ "enumerate_processes", (PyCFunction) PyDevice_enumerate_processes, METH_NOARGS, "Enumerate processes." },
@@ -2732,6 +2734,18 @@ PyDevice_repr (PyDevice * self)
self->type);
}
static PyObject *
PyDevice_is_lost (PyDevice * self)
{
gboolean is_lost;
Py_BEGIN_ALLOW_THREADS
is_lost = frida_device_is_lost (PY_GOBJECT_HANDLE (self));
Py_END_ALLOW_THREADS
return PyBool_FromLong (is_lost);
}
static PyObject *
PyDevice_get_frontmost_application (PyDevice * self)
{