Android 手動按power鍵上鎖,沒有鎖屏提示音,無法恢複【單機必現】

來源:互聯網
上載者:User

標籤:android

測試步驟

【測試版本】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再去播放

Android 手動按power鍵上鎖,沒有鎖屏提示音,無法恢複【單機必現】

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.