import android.view.Display; //导入方法依赖的package包/类
public void run() {
if (mCurrentState == STATE_PREPARED) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (mWaitForNewRate) {
View v = mWindow.getDecorView();
Display d = v.getDisplay();
float currentRefreshRate = d.getRefreshRate();
if (Math.abs(mRefreshRate - currentRefreshRate) > .1) {
if (DBG) Log.d(TAG, "current refresh rate is " + currentRefreshRate + " trying to switch to " + mRefreshRate);
mHandler.postDelayed(mRefreshRateCheckerAsync, 200);
return;
}
if (DBG) Log.d(TAG, "refresh rate before video start is " + currentRefreshRate);
}
}
mCurrentState = STATE_REFRESH_PREPARED;
if (mVideoWidth != 0 && mVideoH