From 20b464d745b7ae319a89d9c2b14c5dcf7364c250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Wed, 28 May 2014 16:34:44 +0200 Subject: eAndroid: Add appops service to 4.4. This is needed for the camera. Change-Id: I7c21e569842b97e316301ecaa58b3b0055a129e1 Reviewed-by: Eirik Aavitsland --- src/doppelganger/appops.cpp | 50 +++++++++++++++++++++++++++++++++++++++ src/doppelganger/appops.h | 29 +++++++++++++++++++++++ src/doppelganger/doppelganger.pro | 6 +++-- src/doppelganger/main.cpp | 2 ++ 4 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 src/doppelganger/appops.cpp create mode 100644 src/doppelganger/appops.h (limited to 'src') diff --git a/src/doppelganger/appops.cpp b/src/doppelganger/appops.cpp new file mode 100644 index 0000000..adeddcc --- /dev/null +++ b/src/doppelganger/appops.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** All rights reserved. +** For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of Qt Enterprise Embedded. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** the contact form at http://qt.digia.com/ +** +****************************************************************************/ + +#include "appops.h" + +#if Q_ANDROID_VERSION_MAJOR > 4 || (Q_ANDROID_VERSION_MAJOR == 4 && Q_ANDROID_VERSION_MINOR >= 4) +#include +#include + +class AppOpsPrivate : public android::BnAppOpsCallback +{ +public: + virtual void opChanged(int32_t, const android::String16&) + { + + } + + virtual android::status_t onTransact(uint32_t, + const android::Parcel&, + android::Parcel*, + uint32_t flags = 0) + { + (void)flags; + return android::OK; + } +}; +#endif + +void AppOps::instantiate() +{ +#if Q_ANDROID_VERSION_MAJOR > 4 || (Q_ANDROID_VERSION_MAJOR == 4 && Q_ANDROID_VERSION_MINOR >= 4) + android::defaultServiceManager()->addService(android::String16("appops"), new AppOpsPrivate); +#endif +} diff --git a/src/doppelganger/appops.h b/src/doppelganger/appops.h new file mode 100644 index 0000000..5e765a6 --- /dev/null +++ b/src/doppelganger/appops.h @@ -0,0 +1,29 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** All rights reserved. +** For any questions to Digia, please use the contact form at +** http://qt.digia.com/ +** +** This file is part of Qt Enterprise Embedded. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** the contact form at http://qt.digia.com/ +** +****************************************************************************/ + +#ifndef APPOPS_H +#define APPOPS_H + +class AppOps +{ +public: + static void instantiate(); +}; + +#endif // APPOPS_H diff --git a/src/doppelganger/doppelganger.pro b/src/doppelganger/doppelganger.pro index 40c7650..fa91169 100644 --- a/src/doppelganger/doppelganger.pro +++ b/src/doppelganger/doppelganger.pro @@ -10,11 +10,13 @@ TEMPLATE = app SOURCES += main.cpp \ permissioncontroller.cpp \ schedulingpolicyservice.cpp \ - powermanager.cpp + powermanager.cpp \ + appops.cpp HEADERS += \ permissioncontroller.h \ schedulingpolicyservice.h \ - powermanager.h + powermanager.h \ + appops.h load(qt_tool) diff --git a/src/doppelganger/main.cpp b/src/doppelganger/main.cpp index 6d81991..0fe5338 100644 --- a/src/doppelganger/main.cpp +++ b/src/doppelganger/main.cpp @@ -21,6 +21,7 @@ #include "permissioncontroller.h" #include "schedulingpolicyservice.h" #include "powermanager.h" +#include "appops.h" using namespace android; @@ -30,5 +31,6 @@ int main(int, char *[]) SchedulingPolicyService::instantiate(); PermissionController::instantiate(); PowerManager::instantiate(); + AppOps::instantiate(); IPCThreadState::self()->joinThreadPool(); } -- cgit v1.2.3