1 /*
2  * Copyright (C) 2013 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #define LOG_NDEBUG 0
17 #define LOG_TAG "EmulatedCamera_HotplugThread"
18 #include <log/log.h>
19 
20 #include <fcntl.h>
21 #include <sys/stat.h>
22 #include <sys/types.h>
23 
24 #include "EmulatedCameraFactory.h"
25 #include "EmulatedCameraHotplugThread.h"
26 
27 #define SubscriberInfo EmulatedCameraHotplugThread::SubscriberInfo
28 
29 namespace android {
30 
EmulatedCameraHotplugThread(size_t)31 EmulatedCameraHotplugThread::EmulatedCameraHotplugThread(
32     size_t /*totalCameraCount*/)
33     : Thread(/*canCallJava*/ false) {}
34 
~EmulatedCameraHotplugThread()35 EmulatedCameraHotplugThread::~EmulatedCameraHotplugThread() {}
36 
requestExitAndWait()37 status_t EmulatedCameraHotplugThread::requestExitAndWait() {
38   ALOGE("%s: Not implemented. Use requestExit + join instead", __FUNCTION__);
39   return INVALID_OPERATION;
40 }
41 
requestExit()42 void EmulatedCameraHotplugThread::requestExit() {
43   ALOGV("%s: Requesting thread exit", __FUNCTION__);
44   mRunning = false;
45 }
46 
readyToRun()47 status_t EmulatedCameraHotplugThread::readyToRun() { return OK; }
48 
threadLoop()49 bool EmulatedCameraHotplugThread::threadLoop() {
50   // Thread is irrelevant right now; hoplug is not supported.
51   return false;
52 }
53 
getFilePath(int) const54 String8 EmulatedCameraHotplugThread::getFilePath(int /*cameraId*/) const {
55   return String8();
56 }
57 
createFileIfNotExists(int) const58 bool EmulatedCameraHotplugThread::createFileIfNotExists(
59     int /*cameraId*/) const {
60   return true;
61 }
62 
getCameraId(String8) const63 int EmulatedCameraHotplugThread::getCameraId(String8 /*filePath*/) const {
64   // Not used anywhere.
65   return NAME_NOT_FOUND;
66 }
67 
getCameraId(int) const68 int EmulatedCameraHotplugThread::getCameraId(int /*wd*/) const {
69   // Not used anywhere.
70   return NAME_NOT_FOUND;
71 }
72 
getSubscriberInfo(int)73 SubscriberInfo* EmulatedCameraHotplugThread::getSubscriberInfo(
74     int /*cameraId*/) {
75   // Not used anywhere.
76   return NULL;
77 }
78 
addWatch(int)79 bool EmulatedCameraHotplugThread::addWatch(int /*cameraId*/) { return true; }
80 
removeWatch(int)81 bool EmulatedCameraHotplugThread::removeWatch(int /*cameraId*/) { return true; }
82 
readFile(String8) const83 int EmulatedCameraHotplugThread::readFile(String8 /*filePath*/) const {
84   return 1;
85 }
86 
87 }  // namespace android
88