zoukankan      html  css  js  c++  java
  • Android 手动按power键上锁,没有锁屏提示音,无法恢复【单机必现】

    測试步骤

    【測试版本号】T0606
    【模块版本号】
    NAVI锁屏:5.0.0.ck
    【測试步骤】
    1、手动按power键上锁,
    【測试结果】
    没有锁屏提示音,无法恢复【单机必现】
    【预期结果】
    有提示音
    【发生次数】
    单机必现

    从log能够找到

    4321 05-25 16:58:23.779 886 32501 W SoundPool: sample 1 not READY
    7641 05-25 16:58:33.879 886 32563 W SoundPool: sample 1 not READY
    10835 05-25 16:58:42.550 886 32619 W SoundPool: sample 1 not READY
    14300 05-25 16:58:53.021 886 32679 W SoundPool: sample 1 not READY
    17733 05-25 16:59:02.343 886 32737 W SoundPool: sample 1 not READY
    21173 05-25 16:59:12.912 886 332 W SoundPool: sample 1 not READY
    24266 05-25 16:59:19.413 886 397 W SoundPool: sample 1 not READY
    27374 05-25 16:59:25.650 886 456 W SoundPool: sample 1 not READY
    30833 05-25 16:59:32.635 886 557 W SoundPool: sample 1 not READY
    34121 05-25 16:59:41.375 886 616 W SoundPool: sample 1 not READY
    37447 05-25 16:59:49.593 886 787 W SoundPool: sample 1 not READY
    40340 05-25 16:59:58.792 886 888 W SoundPool: sample 1 not READY
    43666 05-25 17:00:05.802 886 1015 W SoundPool: sample 1 not READY
    播放失败的原因

    解决方式:

    改动文件:frameworks/av/media/libmedia/SoundPool.cpp

    int SoundPool::play(int sampleID, float leftVolume, float rightVolume,
            int priority, int loop, float rate)
    {
        ALOGV("play sampleID=%d, leftVolume=%f, rightVolume=%f, priority=%d, loop=%d, rate=%f",
                sampleID, leftVolume, rightVolume, priority, loop, rate);
        sp<Sample> sample;
        SoundChannel* channel;
        int channelID;
    
        Mutex::Autolock lock(&mLock);
    
        if (mQuit) {
            return 0;
        }
        // is sample ready?

    sample = findSample(sampleID); //2015.06.06 add for begin if(sample != 0){ int LoopCounter = 15; while(LoopCounter-- > 0 && (sample->state() != Sample::READY)){ ALOGD("wait for sample ready, sleep 150ms"); usleep(150 * 1000); } } //2015.06.06 add for end if ((sample == 0) || (sample->state() != Sample::READY)) { ALOGW(" sample %d not READY", sampleID); return 0; } dump(); // allocate a channel channel = allocateChannel_l(priority); // no channel allocated - return 0 if (!channel) { ALOGV("No channel allocated"); return 0; } channelID = ++mNextChannelID; ALOGV("play channel %p state = %d", channel, channel->state()); channel->play(sample, channelID, leftVolume, rightVolume, priority, loop, rate); return channelID; }

    假设载入线程还没有准备好sample->state() != Sample::READY。等待2.25s再去播放

  • 相关阅读:
    教你如何开发一个完败Miracast的投屏新功能
    深度评测--安卓免费的银行卡识别SDK,华为 HMS MLKit 和Card IO哪个好?
    别让算法和数据结构拖你职业生涯的后腿
    接入卡片类快服务你必须知道的事情
    手机智眼——智慧视觉
    解放双手的革命——智慧语音
    Android | 超简单集成HMS ML Kit实现最大脸微笑抓拍
    快服务常见TOP3审核雷区,再不过审就要崩溃啦!
    图标新纪元——服务直达
    集成机器学习服务上架华为应用市场指南
  • 原文地址:https://www.cnblogs.com/lcchuguo/p/5386929.html
Copyright © 2011-2022 走看看