日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

android封装多肽,深度探索C++对象模型之(四)...-Android.animation cts fail-Rails helper_169IT.COM...

發(fā)布時(shí)間:2025/4/16 62 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android封装多肽,深度探索C++对象模型之(四)...-Android.animation cts fail-Rails helper_169IT.COM... 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

這兩天查cts 的fail, android.animation中有3個(gè)fail。

分別為testCurrentPlayTime,testCancel,testSetCurrentPlayTime,在此對著三個(gè)fail我的跟蹤解析情況做一說明。

1.??????testCancel:如前一封mail說的,是testCode本身有點(diǎn)問題,后來我改了testcode驗(yàn)證:按照4.1的寫法,我寫了腳本跑整個(gè)包10遍,測了兩遍腳本,相當(dāng)于20遍,未重現(xiàn)。注:按ICS的testcode,跑完10遍這個(gè)會fail2~3遍的。

2.??????testCurrentPlayTime:其測試用例如下:

public void testCurrentPlayTime()throws Throwable {

startAnimation(mValueAnimator);

Thread.sleep(200);

這里的值原來是100,我改成了200進(jìn)行測試,也是用剛才的腳本共跑了20遍未出錯(cuò)。

long currentPlayTime = mValueAnimator.getCurrentPlayTime();

assertTrue(currentPlayTime? >? 0);

}

我簡單說明為什么我把上面的100改成了200就ok了。因?yàn)閟tartAnimation(mValueAnimator);會在UI線程去調(diào)用\framework\base\core\java\android\animation\ValueAnimator.java中的start函數(shù),這個(gè)函數(shù)會進(jìn)行一系列的處理,包括發(fā)送消息出去等。

mValueAnimator.getCurrentPlayTime();這個(gè)函數(shù)如下:?? ?public long getCurrentPlayTime() {

if(!mInitialized) Log.d(TAG,"mInitialized is false!!!");

if(mPlayingState ==STOPPED) Log.d(TAG, "mPlayingState == STOPPED!!!");

if (!mInitialized || mPlayingState ==STOPPED) {

Log.d(TAG,"getCurrentPlayTime");

return 0;

}

longcurrentTime=AnimationUtils.currentAnimationTimeMillis();

Log.d(TAG,"getCurrentPlayTime,currentTime is "+currentTime);

return currentTime - mStartTime;

}

其中的mPlayingState如果是STOPPED的話,就會返回0.而這個(gè)mPlayingState的初始值是STOPPED,是在上面所說的start函數(shù)中會發(fā)消息出去,然后有handler去處理。如果在100ms內(nèi)處理的話,就不會fail,但是若getCurrentPlayTime在處理完之前調(diào)用,就會得到0,所以就fail。

錯(cuò)誤時(shí)打的log:(getCurrentPlayTime在handleMessage之前)

D/ValueAnimator( 3336): ?animationHandler.sendEmptyMessage(ANIMATION_START)

D/ValueAnimator( 3336): Start the animation playing

D/ValueAnimator( 3336): ?This sets the initial value of the animation, prior to actually starting it running

D/ValueAnimator( 3336): mInitialized is false!!!

D/ValueAnimator( 3336): mPlayingState == STOPPED!!!

D/ValueAnimator( 3336): getCurrentPlayTime

D/ValueAnimator( 3336): setCurrentPlayTime!!!currentTime is 4215917

D/ValueAnimator( 3336): before animationFrame-----------mStartTime is 4215917

D/ValueAnimator( 3336): after animationFrame-----------mStartTime is 4215917

D/ValueAnimator( 3336): ?onAnimationStart

D/ValueAnimator( 3336): ?animationHandler.sendEmptyMessage(ANIMATION_START)

I/TAG ? ? ( 1828): sync time from stream----------------------@@@

D/ValueAnimator( 3336): mPlayingState == STOPPED!!!

D/ValueAnimator( 3336): getCurrentPlayTime

D/ValueAnimator( 3336): handleMessage:ANIMATION_START

D/ValueAnimator( 3336): startAnimation----Called internally to start an animation by adding it to the active animations list. Must be called on the UI thread

D/ValueAnimator( 3336): anim.startAnimation-----------

D/ValueAnimator( 3336): startAnimation----Called internally to start an animation by adding it to the active animations list. Must be called on the UI thread

D/ValueAnimator( 3336): anim.startAnimation-----------

D/ValueAnimator( 3336): handleMessage:ANIMATION_START

正確時(shí)打的log:(getCurrentPlayTime在handleMessage之后)

D/ValueAnimator( 3305): ?animationHandler.sendEmptyMessage(ANIMATION_START)

D/ValueAnimator( 3305): Start the animation playing

D/ValueAnimator( 3305): ?This sets the initial value of the animation, prior to actually starting it running

D/ValueAnimator( 3305): mInitialized is false!!!

D/ValueAnimator( 3305): mPlayingState == STOPPED!!!

D/ValueAnimator( 3305): getCurrentPlayTime

D/ValueAnimator( 3305): setCurrentPlayTime!!!currentTime is 4213321

D/ValueAnimator( 3305): before animationFrame-----------mStartTime is 4213321

D/ValueAnimator( 3305): after animationFrame-----------mStartTime is 4213321

D/ValueAnimator( 3305): ?onAnimationStart

D/ValueAnimator( 3305): ?animationHandler.sendEmptyMessage(ANIMATION_START)

D/ValueAnimator( 3305): handleMessage:ANIMATION_START

D/ValueAnimator( 3305): startAnimation----Called internally to start an animation by adding it to the active animations list. Must be called on the UI thread

D/ValueAnimator( 3305): anim.startAnimation-----------

D/ValueAnimator( 3305): startAnimation----Called internally to start an animation by adding it to the active animations list. Must be called on the UI thread

D/ValueAnimator( 3305): anim.startAnimation-----------

D/ValueAnimator( 3305): handleMessage:ANIMATION_S

總結(jié)

以上是生活随笔為你收集整理的android封装多肽,深度探索C++对象模型之(四)...-Android.animation cts fail-Rails helper_169IT.COM...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。