stagefright: remove Miracast sender code
This has been deprecated for some time. Remove this from codebase
to avoid introducing new HAL for HDCP. Log warning and return NULL
when remote display is requested.
bug: 62213914
Change-Id: I3560b60fe83a01c51df0f2e715a8f2c760e57bf8
diff --git a/media/libmediaplayerservice/Android.mk b/media/libmediaplayerservice/Android.mk
index 1fc74a9..614a942 100644
--- a/media/libmediaplayerservice/Android.mk
+++ b/media/libmediaplayerservice/Android.mk
@@ -8,12 +8,10 @@
LOCAL_SRC_FILES:= \
ActivityManager.cpp \
- HDCP.cpp \
MediaPlayerFactory.cpp \
MediaPlayerService.cpp \
MediaRecorderClient.cpp \
MetadataRetrieverClient.cpp \
- RemoteDisplay.cpp \
StagefrightRecorder.cpp \
TestPlayerStub.cpp \
@@ -35,7 +33,6 @@
libstagefright_foundation \
libstagefright_httplive \
libstagefright_omx \
- libstagefright_wfd \
libutils \
libnativewindow \
libhidlbase \
@@ -51,7 +48,6 @@
LOCAL_C_INCLUDES := \
frameworks/av/media/libstagefright/include \
frameworks/av/media/libstagefright/rtsp \
- frameworks/av/media/libstagefright/wifi-display \
frameworks/av/media/libstagefright/webm \
$(LOCAL_PATH)/include/media \
frameworks/av/include/camera \
diff --git a/media/libmediaplayerservice/HDCP.cpp b/media/libmediaplayerservice/HDCP.cpp
deleted file mode 100644
index afe3936..0000000
--- a/media/libmediaplayerservice/HDCP.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * 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.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "HDCP"
-#include <utils/Log.h>
-
-#include "HDCP.h"
-
-#include <media/stagefright/foundation/ADebug.h>
-
-#include <dlfcn.h>
-
-namespace android {
-
-HDCP::HDCP(bool createEncryptionModule)
- : mIsEncryptionModule(createEncryptionModule),
- mLibHandle(NULL),
- mHDCPModule(NULL) {
- mLibHandle = dlopen("libstagefright_hdcp.so", RTLD_NOW);
-
- if (mLibHandle == NULL) {
- ALOGE("Unable to locate libstagefright_hdcp.so");
- return;
- }
-
- typedef HDCPModule *(*CreateHDCPModuleFunc)(
- void *, HDCPModule::ObserverFunc);
-
- CreateHDCPModuleFunc createHDCPModule =
- mIsEncryptionModule
- ? (CreateHDCPModuleFunc)dlsym(mLibHandle, "createHDCPModule")
- : (CreateHDCPModuleFunc)dlsym(
- mLibHandle, "createHDCPModuleForDecryption");
-
- if (createHDCPModule == NULL) {
- ALOGE("Unable to find symbol 'createHDCPModule'.");
- } else if ((mHDCPModule = createHDCPModule(
- this, &HDCP::ObserveWrapper)) == NULL) {
- ALOGE("createHDCPModule failed.");
- }
-}
-
-HDCP::~HDCP() {
- Mutex::Autolock autoLock(mLock);
-
- if (mHDCPModule != NULL) {
- delete mHDCPModule;
- mHDCPModule = NULL;
- }
-
- if (mLibHandle != NULL) {
- dlclose(mLibHandle);
- mLibHandle = NULL;
- }
-}
-
-status_t HDCP::setObserver(const sp<IHDCPObserver> &observer) {
- Mutex::Autolock autoLock(mLock);
-
- if (mHDCPModule == NULL) {
- return NO_INIT;
- }
-
- mObserver = observer;
-
- return OK;
-}
-
-status_t HDCP::initAsync(const char *host, unsigned port) {
- Mutex::Autolock autoLock(mLock);
-
- if (mHDCPModule == NULL) {
- return NO_INIT;
- }
-
- return mHDCPModule->initAsync(host, port);
-}
-
-status_t HDCP::shutdownAsync() {
- Mutex::Autolock autoLock(mLock);
-
- if (mHDCPModule == NULL) {
- return NO_INIT;
- }
-
- return mHDCPModule->shutdownAsync();
-}
-
-uint32_t HDCP::getCaps() {
- Mutex::Autolock autoLock(mLock);
-
- if (mHDCPModule == NULL) {
- return NO_INIT;
- }
-
- return mHDCPModule->getCaps();
-}
-
-status_t HDCP::encrypt(
- const void *inData, size_t size, uint32_t streamCTR,
- uint64_t *outInputCTR, void *outData) {
- Mutex::Autolock autoLock(mLock);
-
- CHECK(mIsEncryptionModule);
-
- if (mHDCPModule == NULL) {
- *outInputCTR = 0;
-
- return NO_INIT;
- }
-
- return mHDCPModule->encrypt(inData, size, streamCTR, outInputCTR, outData);
-}
-
-status_t HDCP::encryptNative(
- const sp<GraphicBuffer> &graphicBuffer,
- size_t offset, size_t size, uint32_t streamCTR,
- uint64_t *outInputCTR, void *outData) {
- Mutex::Autolock autoLock(mLock);
-
- CHECK(mIsEncryptionModule);
-
- if (mHDCPModule == NULL) {
- *outInputCTR = 0;
-
- return NO_INIT;
- }
-
- return mHDCPModule->encryptNative(graphicBuffer->handle,
- offset, size, streamCTR, outInputCTR, outData);
-}
-
-status_t HDCP::decrypt(
- const void *inData, size_t size,
- uint32_t streamCTR, uint64_t outInputCTR, void *outData) {
- Mutex::Autolock autoLock(mLock);
-
- CHECK(!mIsEncryptionModule);
-
- if (mHDCPModule == NULL) {
- return NO_INIT;
- }
-
- return mHDCPModule->decrypt(inData, size, streamCTR, outInputCTR, outData);
-}
-
-// static
-void HDCP::ObserveWrapper(void *me, int msg, int ext1, int ext2) {
- static_cast<HDCP *>(me)->observe(msg, ext1, ext2);
-}
-
-void HDCP::observe(int msg, int ext1, int ext2) {
- Mutex::Autolock autoLock(mLock);
-
- if (mObserver != NULL) {
- mObserver->notify(msg, ext1, ext2, NULL /* obj */);
- }
-}
-
-} // namespace android
-
diff --git a/media/libmediaplayerservice/HDCP.h b/media/libmediaplayerservice/HDCP.h
deleted file mode 100644
index 83c61b5..0000000
--- a/media/libmediaplayerservice/HDCP.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * 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 HDCP_H_
-
-#define HDCP_H_
-
-#include <media/IHDCP.h>
-#include <utils/Mutex.h>
-
-namespace android {
-
-struct HDCP : public BnHDCP {
- explicit HDCP(bool createEncryptionModule);
- virtual ~HDCP();
-
- virtual status_t setObserver(const sp<IHDCPObserver> &observer);
- virtual status_t initAsync(const char *host, unsigned port);
- virtual status_t shutdownAsync();
- virtual uint32_t getCaps();
-
- virtual status_t encrypt(
- const void *inData, size_t size, uint32_t streamCTR,
- uint64_t *outInputCTR, void *outData);
-
- virtual status_t encryptNative(
- const sp<GraphicBuffer> &graphicBuffer,
- size_t offset, size_t size, uint32_t streamCTR,
- uint64_t *outInputCTR, void *outData);
-
- virtual status_t decrypt(
- const void *inData, size_t size,
- uint32_t streamCTR, uint64_t outInputCTR, void *outData);
-
-private:
- Mutex mLock;
-
- bool mIsEncryptionModule;
-
- void *mLibHandle;
- HDCPModule *mHDCPModule;
- sp<IHDCPObserver> mObserver;
-
- static void ObserveWrapper(void *me, int msg, int ext1, int ext2);
- void observe(int msg, int ext1, int ext2);
-
- DISALLOW_EVIL_CONSTRUCTORS(HDCP);
-};
-
-} // namespace android
-
-#endif // HDCP_H_
-
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index ba98f18..059254c 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -79,9 +79,7 @@
#include <media/stagefright/omx/OMX.h>
-#include "HDCP.h"
#include "HTTPBase.h"
-#include "RemoteDisplay.h"
static const int kDumpLockRetries = 50;
static const int kDumpLockSleepUs = 20000;
@@ -349,18 +347,13 @@
return mOMX;
}
-sp<IHDCP> MediaPlayerService::makeHDCP(bool createEncryptionModule) {
- return new HDCP(createEncryptionModule);
-}
-
sp<IRemoteDisplay> MediaPlayerService::listenForRemoteDisplay(
- const String16 &opPackageName,
- const sp<IRemoteDisplayClient>& client, const String8& iface) {
- if (!checkPermission("android.permission.CONTROL_WIFI_DISPLAY")) {
- return NULL;
- }
+ const String16 &/*opPackageName*/,
+ const sp<IRemoteDisplayClient>& /*client*/,
+ const String8& /*iface*/) {
+ ALOGE("listenForRemoteDisplay is no longer supported!");
- return new RemoteDisplay(opPackageName, client, iface.string());
+ return NULL;
}
status_t MediaPlayerService::AudioOutput::dump(int fd, const Vector<String16>& args) const
diff --git a/media/libmediaplayerservice/MediaPlayerService.h b/media/libmediaplayerservice/MediaPlayerService.h
index 25691f9..36c6eb2 100644
--- a/media/libmediaplayerservice/MediaPlayerService.h
+++ b/media/libmediaplayerservice/MediaPlayerService.h
@@ -229,7 +229,6 @@
virtual sp<IMediaCodecList> getCodecList() const;
virtual sp<IOMX> getOMX();
- virtual sp<IHDCP> makeHDCP(bool createEncryptionModule);
virtual sp<IRemoteDisplay> listenForRemoteDisplay(const String16 &opPackageName,
const sp<IRemoteDisplayClient>& client, const String8& iface);
diff --git a/media/libmediaplayerservice/RemoteDisplay.cpp b/media/libmediaplayerservice/RemoteDisplay.cpp
deleted file mode 100644
index 0eb4b5d..0000000
--- a/media/libmediaplayerservice/RemoteDisplay.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2012, The Android Open Source Project
- *
- * 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 "RemoteDisplay.h"
-
-#include "source/WifiDisplaySource.h"
-
-#include <media/IRemoteDisplayClient.h>
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/foundation/AMessage.h>
-#include <media/stagefright/foundation/ANetworkSession.h>
-
-namespace android {
-
-RemoteDisplay::RemoteDisplay(
- const String16 &opPackageName,
- const sp<IRemoteDisplayClient> &client,
- const char *iface)
- : mLooper(new ALooper),
- mNetSession(new ANetworkSession) {
- mLooper->setName("wfd_looper");
-
- mSource = new WifiDisplaySource(opPackageName, mNetSession, client);
- mLooper->registerHandler(mSource);
-
- mNetSession->start();
- mLooper->start();
-
- mSource->start(iface);
-}
-
-RemoteDisplay::~RemoteDisplay() {
-}
-
-status_t RemoteDisplay::pause() {
- return mSource->pause();
-}
-
-status_t RemoteDisplay::resume() {
- return mSource->resume();
-}
-
-status_t RemoteDisplay::dispose() {
- mSource->stop();
- mSource.clear();
-
- mLooper->stop();
- mNetSession->stop();
-
- return OK;
-}
-
-} // namespace android
diff --git a/media/libmediaplayerservice/RemoteDisplay.h b/media/libmediaplayerservice/RemoteDisplay.h
deleted file mode 100644
index d4573e9..0000000
--- a/media/libmediaplayerservice/RemoteDisplay.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2012, The Android Open Source Project
- *
- * 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 REMOTE_DISPLAY_H_
-
-#define REMOTE_DISPLAY_H_
-
-#include <media/IMediaPlayerService.h>
-#include <media/IRemoteDisplay.h>
-#include <media/stagefright/foundation/ABase.h>
-#include <utils/Errors.h>
-#include <utils/RefBase.h>
-
-namespace android {
-
-struct ALooper;
-struct ANetworkSession;
-class IRemoteDisplayClient;
-struct WifiDisplaySource;
-
-struct RemoteDisplay : public BnRemoteDisplay {
- RemoteDisplay(
- const String16 &opPackageName,
- const sp<IRemoteDisplayClient> &client,
- const char *iface);
-
- virtual status_t pause();
- virtual status_t resume();
- virtual status_t dispose();
-
-protected:
- virtual ~RemoteDisplay();
-
-private:
- sp<ALooper> mNetLooper;
- sp<ALooper> mLooper;
- sp<ANetworkSession> mNetSession;
- sp<WifiDisplaySource> mSource;
-
- DISALLOW_EVIL_CONSTRUCTORS(RemoteDisplay);
-};
-
-} // namespace android
-
-#endif // REMOTE_DISPLAY_H_
-