blob: 2378dc072b9875cd3669106e3729a570413baad3 [file] [log] [blame]
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -07001/*
Greg Hartman595768c2018-01-04 19:33:58 -08002 * Copyright (C) 2013 The Android Open Source Project
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -07003 *
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"
Colin Cross30fcffc2018-09-06 14:08:55 -070018#include <log/log.h>
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070019
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070020#include <fcntl.h>
Greg Hartman0ec0c3b2018-01-04 19:32:38 -080021#include <sys/stat.h>
22#include <sys/types.h>
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070023
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070024#include "EmulatedCameraFactory.h"
Greg Hartman0ec0c3b2018-01-04 19:32:38 -080025#include "EmulatedCameraHotplugThread.h"
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070026
27#define SubscriberInfo EmulatedCameraHotplugThread::SubscriberInfo
28
29namespace android {
30
31EmulatedCameraHotplugThread::EmulatedCameraHotplugThread(
Greg Hartman595768c2018-01-04 19:33:58 -080032 size_t /*totalCameraCount*/)
Greg Hartman0ec0c3b2018-01-04 19:32:38 -080033 : Thread(/*canCallJava*/ false) {}
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070034
35EmulatedCameraHotplugThread::~EmulatedCameraHotplugThread() {}
36
37status_t EmulatedCameraHotplugThread::requestExitAndWait() {
Greg Hartman0ec0c3b2018-01-04 19:32:38 -080038 ALOGE("%s: Not implemented. Use requestExit + join instead", __FUNCTION__);
39 return INVALID_OPERATION;
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070040}
41
42void EmulatedCameraHotplugThread::requestExit() {
Greg Hartman0ec0c3b2018-01-04 19:32:38 -080043 ALOGV("%s: Requesting thread exit", __FUNCTION__);
44 mRunning = false;
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070045}
46
Greg Hartman0ec0c3b2018-01-04 19:32:38 -080047status_t EmulatedCameraHotplugThread::readyToRun() { return OK; }
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070048
49bool EmulatedCameraHotplugThread::threadLoop() {
Greg Hartman0ec0c3b2018-01-04 19:32:38 -080050 // Thread is irrelevant right now; hoplug is not supported.
51 return false;
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070052}
53
Greg Hartman595768c2018-01-04 19:33:58 -080054String8 EmulatedCameraHotplugThread::getFilePath(int /*cameraId*/) const {
Greg Hartman0ec0c3b2018-01-04 19:32:38 -080055 return String8();
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070056}
57
Greg Hartman595768c2018-01-04 19:33:58 -080058bool EmulatedCameraHotplugThread::createFileIfNotExists(
59 int /*cameraId*/) const {
Greg Hartman0ec0c3b2018-01-04 19:32:38 -080060 return true;
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070061}
62
Greg Hartman595768c2018-01-04 19:33:58 -080063int EmulatedCameraHotplugThread::getCameraId(String8 /*filePath*/) const {
Greg Hartman0ec0c3b2018-01-04 19:32:38 -080064 // Not used anywhere.
65 return NAME_NOT_FOUND;
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070066}
67
Greg Hartman595768c2018-01-04 19:33:58 -080068int EmulatedCameraHotplugThread::getCameraId(int /*wd*/) const {
Greg Hartman0ec0c3b2018-01-04 19:32:38 -080069 // Not used anywhere.
70 return NAME_NOT_FOUND;
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070071}
72
Greg Hartman595768c2018-01-04 19:33:58 -080073SubscriberInfo* EmulatedCameraHotplugThread::getSubscriberInfo(
74 int /*cameraId*/) {
Greg Hartman0ec0c3b2018-01-04 19:32:38 -080075 // Not used anywhere.
76 return NULL;
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070077}
78
Greg Hartman595768c2018-01-04 19:33:58 -080079bool EmulatedCameraHotplugThread::addWatch(int /*cameraId*/) { return true; }
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070080
Greg Hartman595768c2018-01-04 19:33:58 -080081bool EmulatedCameraHotplugThread::removeWatch(int /*cameraId*/) { return true; }
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070082
Greg Hartman595768c2018-01-04 19:33:58 -080083int EmulatedCameraHotplugThread::readFile(String8 /*filePath*/) const {
84 return 1;
85}
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070086
Greg Hartman0ec0c3b2018-01-04 19:32:38 -080087} // namespace android