真机测试音乐播放器,语音控制bug

使用真我手机语音助手测试自己开发的音乐app,语音控制上一曲,下一曲,歌曲会发生改变,但界面没有改变。
目前就是,播放的歌曲,和界面显示的歌词不一样。
实现:语音切歌,歌词画面随着改变
报错:W/System.err: java.lang.NoSuchFieldException: No field sDurationScale in class Landroid/animation/ValueAnimator; (declaration of 'android.animation.ValueAnimator' appears in /system/framework/framework.jar)

img

LrcUtils.java代码:

     /**
     * 重置动画缩放时长
     */
    public static void resetDurationScale() {

        try {
            // Field mField = ValueAnimator.class.getDeclaredField("sDurationScale");
            @SuppressLint("SoonBlockedPrivateApi") Field mField = ValueAnimator.class.getDeclaredField("sDurationScale");
            mField.setAccessible(true);
            mField.setFloat(null, 1);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

LyricView,java

    /**
     * 滑动到指定的行
     */
    private void smoothScrollTo(int line, int duration) {
//        if (!isShowTimeline) {
//        mCurrentLine = line;
//        }
        float offset = getOffset(line);
        endAnimation();

        mAnimator = ValueAnimator.ofFloat(mOffset, offset);
        mAnimator.setDuration(duration);
        mAnimator.setInterpolator(new LinearInterpolator());
        mAnimator.addUpdateListener(animation -> {
            mOffset = (float) animation.getAnimatedValue();
            invalidate();
        });
        LrcUtils.resetDurationScale();
        mAnimator.start();
    }

    /**
     * 传入时间刷新歌词
     */
    public void updateTime(long time) {
        if (!lrcNotEmpty()) {
            return;
        }

        runOnUi(() -> {
            int line = findShowLine(time);
            if (line != mCurrentLine) {
                mCurrentLine = line;
                if (!isShowTimeline) {
                    smoothScrollTo(line, ANIMATION_DURATION);
                } else {
                    invalidate();
                }
            }
        });
    }

    /**
     * 主线程中运行
     */
    private void runOnUi(Runnable r) {
        if (Looper.getMainLooper() == Looper.myLooper()) {
            r.run();
        } else {
            post(r);
        }
    }

应该是反射失败了,估计是源码中修改了这个文件