| Phil Burk | 2355edb | 2016-12-26 13:54:02 -0800 | [diff] [blame] | 1 | /* | 
 | 2 |  * Copyright (C) 2016 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 |  | 
 | 17 | #define LOG_TAG "OboeService" | 
 | 18 | //#define LOG_NDEBUG 0 | 
 | 19 | #include <utils/Log.h> | 
 | 20 |  | 
 | 21 | #include <stdint.h> | 
 | 22 | #include <math.h> | 
 | 23 |  | 
 | 24 | #include <utils/RefBase.h> | 
 | 25 | #include <binder/TextOutput.h> | 
 | 26 |  | 
 | 27 | #include <binder/IInterface.h> | 
 | 28 | #include <binder/IBinder.h> | 
 | 29 | #include <binder/ProcessState.h> | 
 | 30 | #include <binder/IServiceManager.h> | 
 | 31 | #include <binder/IPCThreadState.h> | 
 | 32 |  | 
 | 33 | #include <cutils/ashmem.h> | 
 | 34 | #include <sys/mman.h> | 
 | 35 |  | 
 | 36 | #include "OboeService.h" | 
 | 37 | #include "IOboeAudioService.h" | 
 | 38 | #include "OboeAudioService.h" | 
 | 39 |  | 
 | 40 | using namespace android; | 
 | 41 | using namespace oboe; | 
 | 42 |  | 
 | 43 | /** | 
 | 44 |  * This is used to test the OboeService as a standalone application. | 
 | 45 |  * It is not used when the OboeService is integrated with AudioFlinger. | 
 | 46 |  */ | 
 | 47 | int main(int argc, char **argv) { | 
 | 48 |     printf("Test OboeService %s\n", argv[1]); | 
 | 49 |     ALOGD("This is the OboeAudioService"); | 
 | 50 |  | 
 | 51 |     defaultServiceManager()->addService(String16("OboeAudioService"), new OboeAudioService()); | 
 | 52 |     android::ProcessState::self()->startThreadPool(); | 
 | 53 |     printf("OboeAudioService service is now ready\n"); | 
 | 54 |     IPCThreadState::self()->joinThreadPool(); | 
 | 55 |     printf("OboeAudioService service thread joined\n"); | 
 | 56 |  | 
 | 57 |     return 0; | 
 | 58 | } |