奥迪(Audi卡塔尔(قطر‎o Debugging


Audio Debugging

This article describes some tips and tricks for debugging Android audio.


Tee Sink

The “tee sink” is an AudioFlinger debugging feature, available in custom
builds only, for retaining a short fragment of recent audio for later
analysis. This permits comparison between what was actually played or
recorded vs. what was expected.

For privacy the tee sink is disabled by default, at both compile-time
and run-time. To use the tee sink, you will need to enable it by
re-compiling, and also by setting a property. Be sure to disable this
feature after you are done debugging; the tee sink should not be left
enabled in production builds.

The instructions in the remainder of this section are for Android 5.0,
and may require changes for other versions.

主题:Analyzing Writing Processes Using Keystroke Logs

Compile-time setup

  1. cd frameworks/av/services/audioflinger
  2. Edit Configuration.h.
  3. Uncomment #define TEE_SINK.
  4. Re-build libaudioflinger.so.
  5. adb root
  6. adb remount
  7. Push or sync the new libaudioflinger.so to the device’s


Run-time setup

  1. adb shell getprop | grep ro.debuggable
    Confirm that the output is: [ro.debuggable]: [1]
  2. adb shell
  3. ls -ld /data/misc/media

    威尼斯官方网站,Confirm that the output is:

    drwx------ media media ... media
If the directory does not exist, create it as follows:

    mkdir /data/misc/media
    chown media:media /data/misc/media
  1. echo af.tee=# > /data/local.prop
    Where the af.tee value is a number described below.
  2. chmod 644 /data/local.prop
  3. reboot

目前越来越多的研究对数字化写作评估测验(digital writing
assessments)中的Keystroke Log信息进行分析,基于写作过程(writing
is a growing literature on the analytics and use of keystroke logs in
digital writing assessments. The results and feedback based upon writing
processes can not only enhance traditional score reports, which may
contain only a single score, but also provide the test users with much
targeted and rich information about the test takers. This workshop will
discuss the use the process features collected from keystroke logs in
understanding students’ English writing proficiency. To give an overview
of the state-of-the-art, this workshop will describe several completed
research studies including one on the effectiveness of using process
features in combination with product features (extracted from automated
scoring system) to predict writing performance.

Values for af.tee property

The value of af.tee is a number between 0 and 7, expressing the sum of
several bits, one per feature. See the code at
AudioFlinger::AudioFlinger() in AudioFlinger.cpp for an explanation
of each bit, but briefly:

  • 1 = input
  • 2 = FastMixer output
  • 4 = per-track AudioRecord and AudioTrack

There is no bit for deep buffer or normal mixer yet, but you can get
similar results using “4.”


Test and acquire data

  1. Run your audio test.
  2. adb shell dumpsys media.audio_flinger
  3. Look for a line in dumpsys output such as this:
    tee copied to /data/misc/media/20131010101147_2.wav
    This is a PCM .wav file.
  4. adb pull any /data/misc/media/*.wav files of interest; note that
    track-specific dump filenames do not appear in the dumpsys output,
    but are still saved to /data/misc/media upon track closure.
  5. Review the dump files for privacy concerns before sharing with

威尼斯官方网站 1


Try these ideas for more useful results:

  • Disable touch sounds and key clicks.
  • Maximize all volumes.
  • Disable apps that make sound or record from microphone, if they are
    not of interest to your test.
  • Track-specific dumps are only saved when the track is closed; you
    may need to force close an app in order to dump its track-specific
  • Do the dumpsys immediately after test; there is a limited amount
    of recording space available.
  • To make sure you don’t lose your dump files, upload them to your
    host periodically. Only a limited number of dump files are
    preserved; older dumps are removed after that limit is reached.



As noted above, the tee sink feature should not be left enabled. Restore
your build and device as follows:

  1. Revert the source code changes to Configuration.h.
  2. Re-build libaudioflinger.so.
  3. Push or sync the restored libaudioflinger.so to the device’s
  4. adb shell
  5. rm /data/local.prop
  6. rm /data/misc/media/*.wav
  7. reboot

Log信息分析英文写作过程讲座)至中心短期课程邮箱 xt_workshop@bnu.edu.cn


ALOGx macros

The standard Java language logging API in Android SDK is

The corresponding C language API in Android NDK is __android_log_print
declared in <android/log.h>.

Within the native portion of Android framework, we prefer macros named
ALOGE, ALOGW, ALOGI, ALOGV, etc. They are declared in
<utils/Log.h>, and for the purposes of this article we’ll collectively
refer to them as ALOGx.

All of these APIs are easy-to-use and well-understood, so they are
pervasive throughout the Android platform. In particular the
mediaserver process, which includes the AudioFlinger sound server,
uses ALOGx extensively.

Nevertheless, there are some limitations to ALOGx and friends:

  • They are susceptible to “log spam”: the log buffer is a shared
    resource so it can easily overflow due to unrelated log entries,
    resulting in missed information. The ALOGV variant is disabled at
    compile-time by default. But of course even it can result in log
    spam if it is enabled.
  • The underlying kernel system calls could block, possibly resulting
    in priority inversion and consequently measurement disturbances and
    inaccuracies. This is of special concern to time-critical threads
    such as FastMixer and FastCapture.
  • If a particular log is disabled to reduce log spam, then any
    information that would have been captured by that log is lost. It is
    not possible to enable a specific log retroactively, after it
    becomes clear that the log would have been interesting.


电子邮件地址不会被公开。 必填项已用*标注