Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 1 | /* |
Greg Hartman | 595768c | 2018-01-04 19:33:58 -0800 | [diff] [blame] | 2 | * Copyright (C) 2013 The Android Open Source Project |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 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" |
Colin Cross | 30fcffc | 2018-09-06 14:08:55 -0700 | [diff] [blame] | 18 | #include <log/log.h> |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 19 | |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 20 | #include <fcntl.h> |
Greg Hartman | 0ec0c3b | 2018-01-04 19:32:38 -0800 | [diff] [blame] | 21 | #include <sys/stat.h> |
| 22 | #include <sys/types.h> |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 23 | |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 24 | #include "EmulatedCameraFactory.h" |
Greg Hartman | 0ec0c3b | 2018-01-04 19:32:38 -0800 | [diff] [blame] | 25 | #include "EmulatedCameraHotplugThread.h" |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 26 | |
| 27 | #define SubscriberInfo EmulatedCameraHotplugThread::SubscriberInfo |
| 28 | |
| 29 | namespace android { |
| 30 | |
| 31 | EmulatedCameraHotplugThread::EmulatedCameraHotplugThread( |
Greg Hartman | 595768c | 2018-01-04 19:33:58 -0800 | [diff] [blame] | 32 | size_t /*totalCameraCount*/) |
Greg Hartman | 0ec0c3b | 2018-01-04 19:32:38 -0800 | [diff] [blame] | 33 | : Thread(/*canCallJava*/ false) {} |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 34 | |
| 35 | EmulatedCameraHotplugThread::~EmulatedCameraHotplugThread() {} |
| 36 | |
| 37 | status_t EmulatedCameraHotplugThread::requestExitAndWait() { |
Greg Hartman | 0ec0c3b | 2018-01-04 19:32:38 -0800 | [diff] [blame] | 38 | ALOGE("%s: Not implemented. Use requestExit + join instead", __FUNCTION__); |
| 39 | return INVALID_OPERATION; |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | void EmulatedCameraHotplugThread::requestExit() { |
Greg Hartman | 0ec0c3b | 2018-01-04 19:32:38 -0800 | [diff] [blame] | 43 | ALOGV("%s: Requesting thread exit", __FUNCTION__); |
| 44 | mRunning = false; |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 45 | } |
| 46 | |
Greg Hartman | 0ec0c3b | 2018-01-04 19:32:38 -0800 | [diff] [blame] | 47 | status_t EmulatedCameraHotplugThread::readyToRun() { return OK; } |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 48 | |
| 49 | bool EmulatedCameraHotplugThread::threadLoop() { |
Greg Hartman | 0ec0c3b | 2018-01-04 19:32:38 -0800 | [diff] [blame] | 50 | // Thread is irrelevant right now; hoplug is not supported. |
| 51 | return false; |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 52 | } |
| 53 | |
Greg Hartman | 595768c | 2018-01-04 19:33:58 -0800 | [diff] [blame] | 54 | String8 EmulatedCameraHotplugThread::getFilePath(int /*cameraId*/) const { |
Greg Hartman | 0ec0c3b | 2018-01-04 19:32:38 -0800 | [diff] [blame] | 55 | return String8(); |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 56 | } |
| 57 | |
Greg Hartman | 595768c | 2018-01-04 19:33:58 -0800 | [diff] [blame] | 58 | bool EmulatedCameraHotplugThread::createFileIfNotExists( |
| 59 | int /*cameraId*/) const { |
Greg Hartman | 0ec0c3b | 2018-01-04 19:32:38 -0800 | [diff] [blame] | 60 | return true; |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 61 | } |
| 62 | |
Greg Hartman | 595768c | 2018-01-04 19:33:58 -0800 | [diff] [blame] | 63 | int EmulatedCameraHotplugThread::getCameraId(String8 /*filePath*/) const { |
Greg Hartman | 0ec0c3b | 2018-01-04 19:32:38 -0800 | [diff] [blame] | 64 | // Not used anywhere. |
| 65 | return NAME_NOT_FOUND; |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 66 | } |
| 67 | |
Greg Hartman | 595768c | 2018-01-04 19:33:58 -0800 | [diff] [blame] | 68 | int EmulatedCameraHotplugThread::getCameraId(int /*wd*/) const { |
Greg Hartman | 0ec0c3b | 2018-01-04 19:32:38 -0800 | [diff] [blame] | 69 | // Not used anywhere. |
| 70 | return NAME_NOT_FOUND; |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 71 | } |
| 72 | |
Greg Hartman | 595768c | 2018-01-04 19:33:58 -0800 | [diff] [blame] | 73 | SubscriberInfo* EmulatedCameraHotplugThread::getSubscriberInfo( |
| 74 | int /*cameraId*/) { |
Greg Hartman | 0ec0c3b | 2018-01-04 19:32:38 -0800 | [diff] [blame] | 75 | // Not used anywhere. |
| 76 | return NULL; |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 77 | } |
| 78 | |
Greg Hartman | 595768c | 2018-01-04 19:33:58 -0800 | [diff] [blame] | 79 | bool EmulatedCameraHotplugThread::addWatch(int /*cameraId*/) { return true; } |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 80 | |
Greg Hartman | 595768c | 2018-01-04 19:33:58 -0800 | [diff] [blame] | 81 | bool EmulatedCameraHotplugThread::removeWatch(int /*cameraId*/) { return true; } |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 82 | |
Greg Hartman | 595768c | 2018-01-04 19:33:58 -0800 | [diff] [blame] | 83 | int EmulatedCameraHotplugThread::readFile(String8 /*filePath*/) const { |
| 84 | return 1; |
| 85 | } |
Tomasz Wiszkowski | 5f73a25 | 2017-09-22 11:29:30 -0700 | [diff] [blame] | 86 | |
Greg Hartman | 0ec0c3b | 2018-01-04 19:32:38 -0800 | [diff] [blame] | 87 | } // namespace android |