1. 注释 Init.rc
//service media /system/bin/mediaserver
// class main
// user media
// group audio camera inet net_bt net_bt_admin net_bw_acct drmrpc mediadrm qcom_diag
// ioprio rt 4 还有 // onrestart restart media
2.注释SystemServer.java
/* biao
if (!"0".equals(SystemProperties.get("system_init.startaudioservice"))) {
try {
Slog.i(TAG, "Audio Service");
ServiceManager.addService(Context.AUDIO_SERVICE, new AudioService(context));
} catch (Throwable e) {
reportWtf("starting Audio Service", e);
}
}
3.注释AudioManager.java
所有方法中 只要有( IAudioService service = getServer()) 就把这个方法里面的方法体全部注释。
4.注释 RingtonePlayer.java
public void start() {
mAsyncPlayer.setUsesWakeLock(mContext);
mAudioService = IAudioService.Stub.asInterface(
ServiceManager.getService(Context.AUDIO_SERVICE));
/*biao
try {
mAudioService.setRingtonePlayer(mCallback);
} catch (RemoteException e) {
Slog.e(TAG, "Problem registering RingtonePlayer: " + e);
}
*/
}
5 注释 AudioSystem.cpp
const sp<IAudioPolicyService>& AudioSystem::get_audio_policy_service()
{
return NULL;
/*biao
gLock.lock();
if (gAudioPolicyService == 0) {
sp<IServiceManager> sm = defaultServiceManager();
sp<IBinder> binder;
do {
binder = sm->getService(String16("media.audio_policy"));
if (binder != 0)
break;
ALOGW("AudioPolicyService not published, waiting...");
usleep(500000); // 0.5 s
} while (true);
if (gAudioPolicyServiceClient == NULL) {
gAudioPolicyServiceClient = new AudioPolicyServiceClient();
}
binder->linkToDeath(gAudioPolicyServiceClient);
gAudioPolicyService = interface_cast<IAudioPolicyService>(binder);
gLock.unlock();
} else {
gLock.unlock();
}
return gAudioPolicyService;
*/
}
// establish binder interface to AudioFlinger service
const sp<IAudioFlinger>& AudioSystem::get_audio_flinger()
{
return 0;
/*biao
Mutex::Autolock _l(gLock);
if (gAudioFlinger == 0) {
sp<IServiceManager> sm = defaultServiceManager();
sp<IBinder> binder;
do {
binder = sm->getService(String16("media.audio_flinger"));
if (binder != 0)
break;
ALOGW("AudioFlinger not published, waiting...");
usleep(500000); // 0.5 s
} while (true);
if (gAudioFlingerClient == NULL) {
gAudioFlingerClient = new AudioFlingerClient();
} else {
if (gAudioErrorCallback) {
gAudioErrorCallback(NO_ERROR);
}
}
binder->linkToDeath(gAudioFlingerClient);
gAudioFlinger = interface_cast<IAudioFlinger>(binder);
gAudioFlinger->registerClient(gAudioFlingerClient);
}
ALOGE_IF(gAudioFlinger==0, "no AudioFlinger!?");
return gAudioFlinger;
*/
}
6 注释MediaMetadataRetriever.cpp
const sp<IMediaPlayerService>& MediaMetadataRetriever::getService()
{
return 0;
/*biao
Mutex::Autolock lock(sServiceLock);
if (sService == 0) {
sp<IServiceManager> sm = defaultServiceManager();
sp<IBinder> binder;
do {
binder = sm->getService(String16("media.player"));
if (binder != 0) {
break;
}
ALOGW("MediaPlayerService not published, waiting...");
usleep(500000); // 0.5 s
} while (true);
if (sDeathNotifier == NULL) {
sDeathNotifier = new DeathNotifier();
}
binder->linkToDeath(sDeathNotifier);
sService = interface_cast<IMediaPlayerService>(binder);
}
ALOGE_IF(sService == 0, "no MediaPlayerService!?");
return sService;
*/
}
7注释 IMediaDeathNotifier.cpp
// establish binder interface to MediaPlayerService
/*static*/const sp<IMediaPlayerService>&
IMediaDeathNotifier::getMediaPlayerService()
{
return 0;
/*biao
ALOGV("getMediaPlayerService");
Mutex::Autolock _l(sServiceLock);
if (sMediaPlayerService == 0) {
sp<IServiceManager> sm = defaultServiceManager();
sp<IBinder> binder;
do {
binder = sm->getService(String16("media.player"));
if (binder != 0) {
break;
}
ALOGW("Media player service not published, waiting...");
usleep(500000); // 0.5 s
} while (true);
if (sDeathNotifier == NULL) {
sDeathNotifier = new DeathNotifier();
}
binder->linkToDeath(sDeathNotifier);
sMediaPlayerService = interface_cast<IMediaPlayerService>(binder);
}
ALOGE_IF(sMediaPlayerService == 0, "no media player service!?");
return sMediaPlayerService;
*/
}
8 注释 Sendcmd.cpp
extern "C" int initializeAtFwdService()
{
return -1;
/* biao
sp<IServiceManager> sm = defaultServiceManager();
sp<IBinder> binder;
int retryCnt = 1;
if(sm == 0) {
LOGE("Could not obtain IServiceManager \n");
return -1;
}
do {
binder = sm->getService(String16("AtCmdFwd"));
if (binder == 0) {
LOGW("AtCmdFwd service not published, waiting... retryCnt : %d", retryCnt);
sleep(retryCnt * ATFWD_RETRY_DELAY);
++retryCnt;
continue;
}
break;
} while(retryCnt <= ATFWD_MAX_RETRY_ATTEMPTS);
if (binder == 0) {
LOGI("AtCmdFwd service not ready - Exhausted retry attempts - :%d",retryCnt);
//property_set("ctl.stop", "atfwd");
return -1;
}
if (mDeathNotifier == NULL) {
mDeathNotifier = new DeathNotifier();
}
binder->linkToDeath(mDeathNotifier);
gAtCmdFwdService = interface_cast<IAtCmdFwdService>(binder);
if (gAtCmdFwdService == 0)
{
LOGE("Could not obtain AtCmdFwd service\n");
return -1;
}
// Start a Binder thread pool to receive Death notification callbacks
sp<ProcessState> proc(ProcessState::self());
ProcessState::self()->startThreadPool();
return 0;
*/
}