Android 系统 MediaServer

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;
    */
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值