70 lines
2.3 KiB
C++
Executable File
70 lines
2.3 KiB
C++
Executable File
/*
|
|
**
|
|
** Copyright 2008, 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_TAG "mediaserver"
|
|
//#define LOG_NDEBUG 0
|
|
|
|
#include <utils/Log.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
|
|
#include <cutils/properties.h>
|
|
|
|
int main(int argc __unused, char **argv __unused)
|
|
{
|
|
|
|
char value[PROPERTY_VALUE_MAX];
|
|
memset(value,0,sizeof(value));
|
|
int prefer64 = 0;
|
|
|
|
if(property_get("ro.vendor.mtk_prefer_64bit_proc", value, NULL)) {
|
|
prefer64 = atoi(value);
|
|
}
|
|
|
|
ALOGD("start mediaserver in 64-bit=%d", prefer64);
|
|
|
|
int ret = 0;
|
|
if(prefer64 == 1){
|
|
ret = execl("/system/bin/mediaserver64","/system/bin/mediaserver",NULL);
|
|
if(ret == -1){
|
|
ALOGD("start mediaserver fail ... %d:%s -- maybe 32bit only load -- we try to trigger 32 bit again",
|
|
errno, strerror(errno));
|
|
ret = execl("/system/bin/mediaserver32","/system/bin/mediaserver",NULL);
|
|
}
|
|
}else {
|
|
ret = execl("/system/bin/mediaserver32","/system/bin/mediaserver",NULL);
|
|
if(ret == -1){
|
|
ALOGD("start mediaserver fail ... %d:%s -- maybe 64bit only load -- we try to trigger 64 bit again",
|
|
errno, strerror(errno));
|
|
ret = execl("/system/bin/mediaserver64","/system/bin/mediaserver",NULL);
|
|
}
|
|
}
|
|
|
|
if(ret == -1){
|
|
ALOGD("start mediaserver fail ... %d:%s -- maybe not set TARGET_DYNAMIC_64_32_MEDIASERVER -- \
|
|
we try to trigger default mediaserver again", errno, strerror(errno));
|
|
|
|
ret = execl("/system/bin/mediaserver","/system/bin/mediaserver",NULL);
|
|
if(ret == -1) {
|
|
ALOGD("start mediaserver fail ... %d:%s", errno, strerror(errno));
|
|
}
|
|
}
|
|
}
|