libqservice: Add a client interface.
Add a client interface which interfaces with hwc. qservice upon receiving IPC, provides a callback notification to the qclient which does appropriate stuff in hwc. In future, qservice can safely be even made a separate process with no changes to exisiting code. This was not true earlier owing to the hwc pointer held by qservice forcing it to be in the same process that hwc is in. CRs-fixed: 452977 Change-Id: I05838c213f5d4606a6573693de1bacbc5876107e
This commit is contained in:
@@ -8,7 +8,7 @@ LOCAL_MODULE_TAGS := optional
|
|||||||
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
|
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
|
||||||
LOCAL_SHARED_LIBRARIES := $(common_libs) libEGL liboverlay libgenlock \
|
LOCAL_SHARED_LIBRARIES := $(common_libs) libEGL liboverlay libgenlock \
|
||||||
libexternal libqdutils libhardware_legacy \
|
libexternal libqdutils libhardware_legacy \
|
||||||
libdl libmemalloc libqservice libsync
|
libdl libmemalloc libqservice libsync libbinder
|
||||||
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdhwcomposer\"
|
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdhwcomposer\"
|
||||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
|
||||||
LOCAL_SRC_FILES := hwc.cpp \
|
LOCAL_SRC_FILES := hwc.cpp \
|
||||||
@@ -18,6 +18,7 @@ LOCAL_SRC_FILES := hwc.cpp \
|
|||||||
hwc_vsync.cpp \
|
hwc_vsync.cpp \
|
||||||
hwc_fbupdate.cpp \
|
hwc_fbupdate.cpp \
|
||||||
hwc_mdpcomp.cpp \
|
hwc_mdpcomp.cpp \
|
||||||
hwc_copybit.cpp
|
hwc_copybit.cpp \
|
||||||
|
hwc_qclient.cpp
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|||||||
83
libhwcomposer/hwc_qclient.cpp
Normal file
83
libhwcomposer/hwc_qclient.cpp
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, The Linux Foundation. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above
|
||||||
|
* copyright notice, this list of conditions and the following
|
||||||
|
* disclaimer in the documentation and/or other materials provided
|
||||||
|
* with the distribution.
|
||||||
|
* * Neither the name of The Linux Foundation nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||||
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR CLIENTS; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <hwc_qclient.h>
|
||||||
|
#include <IQService.h>
|
||||||
|
#include <hwc_utils.h>
|
||||||
|
|
||||||
|
#define QCLIENT_DEBUG 0
|
||||||
|
|
||||||
|
using namespace android;
|
||||||
|
using namespace qService;
|
||||||
|
|
||||||
|
namespace qClient {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
QClient::QClient(hwc_context_t *ctx) : mHwcContext(ctx)
|
||||||
|
{
|
||||||
|
ALOGD_IF(QCLIENT_DEBUG, "QClient Constructor invoked");
|
||||||
|
}
|
||||||
|
|
||||||
|
QClient::~QClient()
|
||||||
|
{
|
||||||
|
ALOGD_IF(QCLIENT_DEBUG,"QClient Destructor invoked");
|
||||||
|
}
|
||||||
|
|
||||||
|
void QClient::notifyCallback(uint32_t msg, uint32_t value) {
|
||||||
|
switch(msg) {
|
||||||
|
case IQService::SECURING:
|
||||||
|
securing(value);
|
||||||
|
break;
|
||||||
|
case IQService::UNSECURING:
|
||||||
|
unsecuring(value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QClient::securing(uint32_t startEnd) {
|
||||||
|
mHwcContext->mSecuring = startEnd;
|
||||||
|
//We're done securing
|
||||||
|
if(startEnd == IQService::END)
|
||||||
|
mHwcContext->mSecureMode = true;
|
||||||
|
if(mHwcContext->proc)
|
||||||
|
mHwcContext->proc->invalidate(mHwcContext->proc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QClient::unsecuring(uint32_t startEnd) {
|
||||||
|
mHwcContext->mSecuring = startEnd;
|
||||||
|
//We're done unsecuring
|
||||||
|
if(startEnd == IQService::END)
|
||||||
|
mHwcContext->mSecureMode = false;
|
||||||
|
if(mHwcContext->proc)
|
||||||
|
mHwcContext->proc->invalidate(mHwcContext->proc);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
55
libhwcomposer/hwc_qclient.h
Normal file
55
libhwcomposer/hwc_qclient.h
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013, The Linux Foundation. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above
|
||||||
|
* copyright notice, this list of conditions and the following
|
||||||
|
* disclaimer in the documentation and/or other materials provided
|
||||||
|
* with the distribution.
|
||||||
|
* * Neither the name of The Linux Foundation nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||||
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR CLIENTS; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ANDROID_QCLIENT_H
|
||||||
|
#define ANDROID_QCLIENT_H
|
||||||
|
|
||||||
|
#include <utils/Errors.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <cutils/log.h>
|
||||||
|
#include <binder/IServiceManager.h>
|
||||||
|
#include <IQClient.h>
|
||||||
|
|
||||||
|
struct hwc_context_t;
|
||||||
|
|
||||||
|
namespace qClient {
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class QClient : public BnQClient {
|
||||||
|
public:
|
||||||
|
QClient(hwc_context_t *ctx);
|
||||||
|
virtual ~QClient();
|
||||||
|
virtual void notifyCallback(uint32_t msg, uint32_t value);
|
||||||
|
private:
|
||||||
|
void securing(uint32_t startEnd);
|
||||||
|
void unsecuring(uint32_t startEnd);
|
||||||
|
hwc_context_t *mHwcContext;
|
||||||
|
};
|
||||||
|
}; // namespace qClient
|
||||||
|
#endif // ANDROID_QCLIENT_H
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
#define HWC_UTILS_DEBUG 0
|
#define HWC_UTILS_DEBUG 0
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <binder/IServiceManager.h>
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
#include <cutils/properties.h>
|
#include <cutils/properties.h>
|
||||||
#include <gralloc_priv.h>
|
#include <gralloc_priv.h>
|
||||||
@@ -30,8 +31,14 @@
|
|||||||
#include "mdp_version.h"
|
#include "mdp_version.h"
|
||||||
#include "hwc_copybit.h"
|
#include "hwc_copybit.h"
|
||||||
#include "external.h"
|
#include "external.h"
|
||||||
|
#include "hwc_qclient.h"
|
||||||
#include "QService.h"
|
#include "QService.h"
|
||||||
#include "comptype.h"
|
#include "comptype.h"
|
||||||
|
|
||||||
|
using namespace qClient;
|
||||||
|
using namespace qService;
|
||||||
|
using namespace android;
|
||||||
|
|
||||||
namespace qhwc {
|
namespace qhwc {
|
||||||
|
|
||||||
// Opens Framebuffer device
|
// Opens Framebuffer device
|
||||||
@@ -60,7 +67,6 @@ void initContext(hwc_context_t *ctx)
|
|||||||
openFramebufferDevice(ctx);
|
openFramebufferDevice(ctx);
|
||||||
overlay::Overlay::initOverlay();
|
overlay::Overlay::initOverlay();
|
||||||
ctx->mOverlay = overlay::Overlay::getInstance();
|
ctx->mOverlay = overlay::Overlay::getInstance();
|
||||||
ctx->mQService = qService::QService::getInstance(ctx);
|
|
||||||
ctx->mMDP.version = qdutils::MDPVersion::getInstance().getMDPVersion();
|
ctx->mMDP.version = qdutils::MDPVersion::getInstance().getMDPVersion();
|
||||||
ctx->mMDP.hasOverlay = qdutils::MDPVersion::getInstance().hasOverlay();
|
ctx->mMDP.hasOverlay = qdutils::MDPVersion::getInstance().hasOverlay();
|
||||||
ctx->mMDP.panel = qdutils::MDPVersion::getInstance().getPanelType();
|
ctx->mMDP.panel = qdutils::MDPVersion::getInstance().getPanelType();
|
||||||
@@ -93,6 +99,15 @@ void initContext(hwc_context_t *ctx)
|
|||||||
pthread_cond_init(&(ctx->vstate.cond), NULL);
|
pthread_cond_init(&(ctx->vstate.cond), NULL);
|
||||||
ctx->vstate.enable = false;
|
ctx->vstate.enable = false;
|
||||||
ctx->mExtDispConfiguring = false;
|
ctx->mExtDispConfiguring = false;
|
||||||
|
|
||||||
|
//Right now hwc starts the service but anybody could do it, or it could be
|
||||||
|
//independent process as well.
|
||||||
|
QService::init();
|
||||||
|
sp<IQClient> client = new QClient(ctx);
|
||||||
|
interface_cast<IQService>(
|
||||||
|
defaultServiceManager()->getService(
|
||||||
|
String16("display.qservice")))->connect(client);
|
||||||
|
|
||||||
ALOGI("Initializing Qualcomm Hardware Composer");
|
ALOGI("Initializing Qualcomm Hardware Composer");
|
||||||
ALOGI("MDP version: %d", ctx->mMDP.version);
|
ALOGI("MDP version: %d", ctx->mMDP.version);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,10 +40,6 @@
|
|||||||
struct hwc_context_t;
|
struct hwc_context_t;
|
||||||
struct framebuffer_device_t;
|
struct framebuffer_device_t;
|
||||||
|
|
||||||
namespace qService {
|
|
||||||
class QService;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace overlay {
|
namespace overlay {
|
||||||
class Overlay;
|
class Overlay;
|
||||||
}
|
}
|
||||||
@@ -229,8 +225,6 @@ struct hwc_context_t {
|
|||||||
|
|
||||||
//Overlay object - NULL for non overlay devices
|
//Overlay object - NULL for non overlay devices
|
||||||
overlay::Overlay *mOverlay;
|
overlay::Overlay *mOverlay;
|
||||||
//QService object
|
|
||||||
qService::QService *mQService;
|
|
||||||
|
|
||||||
//Primary and external FB updater
|
//Primary and external FB updater
|
||||||
qhwc::IFBUpdate *mFBUpdate[HWC_NUM_DISPLAY_TYPES];
|
qhwc::IFBUpdate *mFBUpdate[HWC_NUM_DISPLAY_TYPES];
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ LOCAL_SHARED_LIBRARIES := $(common_libs) libexternal libbinder
|
|||||||
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdqservice\"
|
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdqservice\"
|
||||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
|
||||||
LOCAL_SRC_FILES := QService.cpp \
|
LOCAL_SRC_FILES := QService.cpp \
|
||||||
IQService.cpp
|
IQService.cpp \
|
||||||
|
IQClient.cpp
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|||||||
73
libqservice/IQClient.cpp
Normal file
73
libqservice/IQClient.cpp
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2010 The Android Open Source Project
|
||||||
|
* Copyright (C) 2012-2013, The Linux Foundation. All rights reserved.
|
||||||
|
*
|
||||||
|
* Not a Contribution, Apache license notifications and license are
|
||||||
|
* retained for attribution purposes only.
|
||||||
|
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <binder/Parcel.h>
|
||||||
|
#include <binder/IBinder.h>
|
||||||
|
#include <binder/IInterface.h>
|
||||||
|
#include <utils/Errors.h>
|
||||||
|
#include <IQClient.h>
|
||||||
|
|
||||||
|
using namespace android;
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace qClient {
|
||||||
|
|
||||||
|
enum {
|
||||||
|
NOTIFY_CALLBACK = IBinder::FIRST_CALL_TRANSACTION,
|
||||||
|
};
|
||||||
|
|
||||||
|
class BpQClient : public BpInterface<IQClient>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BpQClient(const sp<IBinder>& impl)
|
||||||
|
: BpInterface<IQClient>(impl) {}
|
||||||
|
|
||||||
|
virtual void notifyCallback(uint32_t msg, uint32_t value) {
|
||||||
|
Parcel data, reply;
|
||||||
|
data.writeInterfaceToken(IQClient::getInterfaceDescriptor());
|
||||||
|
data.writeInt32(msg);
|
||||||
|
data.writeInt32(value);
|
||||||
|
remote()->transact(NOTIFY_CALLBACK, data, &reply);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
IMPLEMENT_META_INTERFACE(QClient, "android.display.IQClient");
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
status_t BnQClient::onTransact(
|
||||||
|
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
|
||||||
|
{
|
||||||
|
switch(code) {
|
||||||
|
case NOTIFY_CALLBACK: {
|
||||||
|
CHECK_INTERFACE(IQClient, data, reply);
|
||||||
|
uint32_t msg = data.readInt32();
|
||||||
|
uint32_t value = data.readInt32();
|
||||||
|
notifyCallback(msg, value);
|
||||||
|
return NO_ERROR;
|
||||||
|
} break;
|
||||||
|
default:
|
||||||
|
return BBinder::onTransact(code, data, reply, flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}; // namespace qClient
|
||||||
53
libqservice/IQClient.h
Normal file
53
libqservice/IQClient.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2010 The Android Open Source Project
|
||||||
|
* Copyright (C) 2012-2013, The Linux Foundation. All rights reserved.
|
||||||
|
*
|
||||||
|
* Not a Contribution, Apache license notifications and license are
|
||||||
|
* retained for attribution purposes only.
|
||||||
|
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ANDROID_IQCLIENT_H
|
||||||
|
#define ANDROID_IQCLIENT_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <utils/Errors.h>
|
||||||
|
#include <utils/RefBase.h>
|
||||||
|
#include <binder/IInterface.h>
|
||||||
|
|
||||||
|
namespace qClient {
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
class IQClient : public android::IInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_META_INTERFACE(QClient);
|
||||||
|
virtual void notifyCallback(uint32_t msg, uint32_t value) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class BnQClient : public android::BnInterface<IQClient>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual android::status_t onTransact( uint32_t code,
|
||||||
|
const android::Parcel& data,
|
||||||
|
android::Parcel* reply,
|
||||||
|
uint32_t flags = 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
}; // namespace qClient
|
||||||
|
|
||||||
|
#endif // ANDROID_IQCLIENT_H
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2010 The Android Open Source Project
|
* Copyright (C) 2010 The Android Open Source Project
|
||||||
* Copyright (C) 2012, The Linux Foundation. All rights reserved.
|
* Copyright (C) 2012-2013, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Not a Contribution, Apache license notifications and license are
|
* Not a Contribution, Apache license notifications and license are
|
||||||
* retained for attribution purposes only.
|
* retained for attribution purposes only.
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
#include <IQService.h>
|
#include <IQService.h>
|
||||||
|
|
||||||
using namespace android;
|
using namespace android;
|
||||||
|
using namespace qClient;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -55,6 +56,13 @@ public:
|
|||||||
data.writeInt32(startEnd);
|
data.writeInt32(startEnd);
|
||||||
remote()->transact(UNSECURING, data, &reply);
|
remote()->transact(UNSECURING, data, &reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void connect(const sp<IQClient>& client) {
|
||||||
|
Parcel data, reply;
|
||||||
|
data.writeInterfaceToken(IQService::getInterfaceDescriptor());
|
||||||
|
data.writeStrongBinder(client->asBinder());
|
||||||
|
remote()->transact(CONNECT, data, &reply);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_META_INTERFACE(QService, "android.display.IQService");
|
IMPLEMENT_META_INTERFACE(QService, "android.display.IQService");
|
||||||
@@ -100,6 +108,18 @@ status_t BnQService::onTransact(
|
|||||||
unsecuring(startEnd);
|
unsecuring(startEnd);
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
} break;
|
} break;
|
||||||
|
case CONNECT: {
|
||||||
|
CHECK_INTERFACE(IQService, data, reply);
|
||||||
|
if(callerUid != AID_GRAPHICS) {
|
||||||
|
ALOGE("display.qservice CONNECT access denied: pid=%d uid=%d process=%s",
|
||||||
|
callerPid, callerUid, callingProcName);
|
||||||
|
return PERMISSION_DENIED;
|
||||||
|
}
|
||||||
|
sp<IQClient> client =
|
||||||
|
interface_cast<IQClient>(data.readStrongBinder());
|
||||||
|
connect(client);
|
||||||
|
return NO_ERROR;
|
||||||
|
} break;
|
||||||
default:
|
default:
|
||||||
return BBinder::onTransact(code, data, reply, flags);
|
return BBinder::onTransact(code, data, reply, flags);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2010 The Android Open Source Project
|
* Copyright (C) 2010 The Android Open Source Project
|
||||||
* Copyright (C) 2012, The Linux Foundation. All rights reserved.
|
* Copyright (C) 2012-2013, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Not a Contribution, Apache license notifications and license are
|
* Not a Contribution, Apache license notifications and license are
|
||||||
* retained for attribution purposes only.
|
* retained for attribution purposes only.
|
||||||
@@ -26,6 +26,8 @@
|
|||||||
#include <utils/Errors.h>
|
#include <utils/Errors.h>
|
||||||
#include <utils/RefBase.h>
|
#include <utils/RefBase.h>
|
||||||
#include <binder/IInterface.h>
|
#include <binder/IInterface.h>
|
||||||
|
#include <binder/IBinder.h>
|
||||||
|
#include <IQClient.h>
|
||||||
|
|
||||||
namespace qService {
|
namespace qService {
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -34,8 +36,10 @@ class IQService : public android::IInterface
|
|||||||
public:
|
public:
|
||||||
DECLARE_META_INTERFACE(QService);
|
DECLARE_META_INTERFACE(QService);
|
||||||
enum {
|
enum {
|
||||||
SECURING = 0, // Hardware securing start/end notification
|
// Hardware securing start/end notification
|
||||||
|
SECURING = android::IBinder::FIRST_CALL_TRANSACTION,
|
||||||
UNSECURING, // Hardware unsecuring start/end notification
|
UNSECURING, // Hardware unsecuring start/end notification
|
||||||
|
CONNECT,
|
||||||
};
|
};
|
||||||
enum {
|
enum {
|
||||||
END = 0,
|
END = 0,
|
||||||
@@ -43,6 +47,7 @@ public:
|
|||||||
};
|
};
|
||||||
virtual void securing(uint32_t startEnd) = 0;
|
virtual void securing(uint32_t startEnd) = 0;
|
||||||
virtual void unsecuring(uint32_t startEnd) = 0;
|
virtual void unsecuring(uint32_t startEnd) = 0;
|
||||||
|
virtual void connect(const android::sp<qClient::IQClient>& client) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
@@ -28,7 +28,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QService.h>
|
#include <QService.h>
|
||||||
#include <hwc_utils.h>
|
|
||||||
|
|
||||||
#define QSERVICE_DEBUG 0
|
#define QSERVICE_DEBUG 0
|
||||||
|
|
||||||
@@ -38,7 +37,7 @@ namespace qService {
|
|||||||
|
|
||||||
QService* QService::sQService = NULL;
|
QService* QService::sQService = NULL;
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
QService::QService(hwc_context_t *ctx):mHwcContext(ctx)
|
QService::QService()
|
||||||
{
|
{
|
||||||
ALOGD_IF(QSERVICE_DEBUG, "QService Constructor invoked");
|
ALOGD_IF(QSERVICE_DEBUG, "QService Constructor invoked");
|
||||||
}
|
}
|
||||||
@@ -49,27 +48,25 @@ QService::~QService()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void QService::securing(uint32_t startEnd) {
|
void QService::securing(uint32_t startEnd) {
|
||||||
mHwcContext->mSecuring = startEnd;
|
if(mClient.get()) {
|
||||||
//We're done securing
|
mClient->notifyCallback(SECURING, startEnd);
|
||||||
if(startEnd == END)
|
}
|
||||||
mHwcContext->mSecureMode = true;
|
|
||||||
if(mHwcContext->proc)
|
|
||||||
mHwcContext->proc->invalidate(mHwcContext->proc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QService::unsecuring(uint32_t startEnd) {
|
void QService::unsecuring(uint32_t startEnd) {
|
||||||
mHwcContext->mSecuring = startEnd;
|
if(mClient.get()) {
|
||||||
//We're done unsecuring
|
mClient->notifyCallback(UNSECURING, startEnd);
|
||||||
if(startEnd == END)
|
}
|
||||||
mHwcContext->mSecureMode = false;
|
|
||||||
if(mHwcContext->proc)
|
|
||||||
mHwcContext->proc->invalidate(mHwcContext->proc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QService* QService::getInstance(hwc_context_t *ctx)
|
void QService::connect(const sp<qClient::IQClient>& client) {
|
||||||
|
mClient = client;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QService::init()
|
||||||
{
|
{
|
||||||
if(!sQService) {
|
if(!sQService) {
|
||||||
sQService = new QService(ctx);
|
sQService = new QService();
|
||||||
sp<IServiceManager> sm = defaultServiceManager();
|
sp<IServiceManager> sm = defaultServiceManager();
|
||||||
sm->addService(String16("display.qservice"), sQService);
|
sm->addService(String16("display.qservice"), sQService);
|
||||||
if(sm->checkService(String16("display.qservice")) != NULL)
|
if(sm->checkService(String16("display.qservice")) != NULL)
|
||||||
@@ -77,7 +74,6 @@ QService* QService::getInstance(hwc_context_t *ctx)
|
|||||||
else
|
else
|
||||||
ALOGD_IF(QSERVICE_DEBUG, "adding display.qservice failed");
|
ALOGD_IF(QSERVICE_DEBUG, "adding display.qservice failed");
|
||||||
}
|
}
|
||||||
return sQService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
#include <cutils/log.h>
|
#include <cutils/log.h>
|
||||||
#include <binder/IServiceManager.h>
|
#include <binder/IServiceManager.h>
|
||||||
#include <IQService.h>
|
#include <IQService.h>
|
||||||
|
#include <IQClient.h>
|
||||||
|
|
||||||
struct hwc_context_t;
|
struct hwc_context_t;
|
||||||
|
|
||||||
@@ -46,11 +47,12 @@ public:
|
|||||||
virtual ~QService();
|
virtual ~QService();
|
||||||
virtual void securing(uint32_t startEnd);
|
virtual void securing(uint32_t startEnd);
|
||||||
virtual void unsecuring(uint32_t startEnd);
|
virtual void unsecuring(uint32_t startEnd);
|
||||||
static QService* getInstance(hwc_context_t *ctx);
|
virtual void connect(const android::sp<qClient::IQClient>& client);
|
||||||
|
static void init();
|
||||||
private:
|
private:
|
||||||
QService(hwc_context_t *ctx);
|
QService();
|
||||||
|
android::sp<qClient::IQClient> mClient;
|
||||||
static QService *sQService;
|
static QService *sQService;
|
||||||
hwc_context_t *mHwcContext;
|
|
||||||
};
|
};
|
||||||
}; // namespace qService
|
}; // namespace qService
|
||||||
#endif // ANDROID_QSERVICE_H
|
#endif // ANDROID_QSERVICE_H
|
||||||
|
|||||||
Reference in New Issue
Block a user