文章目录
- 【RK3288 Android6 T8, 突然无声音问题排查】
- 问题描述
- 问题调查
- patch
【RK3288 Android6 T8, 突然无声音问题排查】
问题描述
页面上方突然出现音量进度条,小铃铛图标显示静音状态,不再播报语音
手动去安卓设置内查看,小铃铛音量为0,手动恢复到有声音后继续执行送餐任务
然后下次任务在取餐页时页面上方又突然出现音量进度条显示为静音状态,无语音播报
问题调查
查看日志,可以发现,在随机出现静音的时候,会有这样的日志
通过查找到源码,并在该处添加打印调用栈的日志,并再一次复现
From 6162a8571f4ebbb9e27f3246630afe1f3899a079 Mon Sep 17 00:00:00 2001
From: liangji <liangji@keenon.com>
Date: Wed, 6 Dec 2023 18:45:55 +0800
Subject: [PATCH] feat: add debug info of audio mute_changeChange-Id: Id0697008aab0c8dc9ef4f6141ff2e3d979dfb8df
Signed-off-by: liangji <liangji@keenon.com>
---packages/SystemUI/src/com/android/systemui/volume/Events.java | 9 +++++++++1 file changed, 9 insertions(+)diff --git a/packages/SystemUI/src/com/android/systemui/volume/Events.java b/packages/SystemUI/src/com/android/systemui/volume/Events.java
index 893c939..d9f0ccc 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/Events.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/Events.java
@@ -145,6 +145,15 @@ public class Events {case EVENT_MUTE_CHANGED:sb.append(AudioSystem.streamToString((Integer) list[0])).append(' ').append(list[1]);
+
+ StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
+
+ System.out.println("Method Call Stack:");
+ for (StackTraceElement element : stackTrace) {
+ System.out.println(element.getClassName() + "." + element.getMethodName()
+ + "(" + element.getFileName() + ":" + element.getLineNumber() + ")");
+ }
+break;case EVENT_KEY:MetricsLogger.action(context, MetricsLogger.ACTION_VOLUME_KEY,
--
2.7.4
复现了之后,查看logcat,可以发现是接收到了广播来禁音,(至少肯定不是系统的bug)。
后续又想着可以通过dumpsys 来记录开机之后所有的广播时间,这样就可以知道这个广播是谁发出来的了
From d77e450a8a4477306e7fe8650f8b5f25fe5732c8 Mon Sep 17 00:00:00 2001
From: liangji <liangji@keenon.com>
Date: Sat, 9 Dec 2023 11:48:20 +0800
Subject: [PATCH] feat: support print broadcast package nameChange-Id: Iadc8e0f877b3599181b8ec5b37d08b7a35dcd367
Signed-off-by: liangji <liangji@keenon.com>
---.../systemui/volume/VolumeDialogController.java | 59 +++++++++++++++++++++-1 file changed, 58 insertions(+), 1 deletion(-)diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogController.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogController.java
index 32d6805..fa1f7bd 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogController.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogController.java
@@ -756,6 +756,54 @@ public class VolumeDialogController {}}+ /*keenon liangji add */
+ private static String exec(String command) {
+ Process process = null;
+ try {
+ process = Runtime.getRuntime().exec(command);
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ } //adb shell
+// final BufferedWriter outputStream = new BufferedWriter(new OutputStreamWriter(process.getOutputStream()));
+ final BufferedReader inputStream = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ //杩欓噷涓€瀹氳娉ㄦ剰閿欒娴佺殑璇诲彇锛屼笉鐒跺緢瀹规槗闃诲锛屽緱涓嶅埌浣犳兂瑕佺殑缁撴灉锛?+ final BufferedReader errorReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
+ final Process finalProcess = process;
+ new Thread(new Runnable() {
+ public void run() {
+ String line;
+ boolean castFlag = false;
+ String[] info;
+ try {
+ while ((line = inputStream.readLine()) != null) {
+ if (line.contains(ACTIONTAG)) {
+ castFlag = line.contains(CAST);
+ }
+ if (castFlag && line.contains(CALLERTAG)) {
+ line = line.trim();
+ info = line.split(" ");
+ for (String i: info)
+ Log.d(TAG, "run: " + i);
+ Log.d(TAG, "packageName: " + info[0].substring(CALLERTAG.length()));
+ finalProcess.destroy();
+ break;
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }).start();
+ try {
+ process.waitFor();
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+ return null;
+ }
+ /*keenon liangji add end*/
+
+private final class Receiver extends BroadcastReceiver {public void init() {
@@ -811,7 +859,16 @@ public class VolumeDialogController {final int stream = intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, -1);final boolean muted = intent.getBooleanExtra(AudioManager.EXTRA_STREAM_VOLUME_MUTED, false);
- if (D.BUG) Log.d(TAG, "onReceive STREAM_MUTE_CHANGED_ACTION stream=" + stream
+ /*keenon liangji add */
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ exec("dumpsys activity broadcasts");
+ }
+ });
+ thread.start();
+ /*keenon liangji add end*/
+ if (1) Log.d(TAG, "onReceive STREAM_MUTE_CHANGED_ACTION stream=" + stream+ " muted=" + muted);changed = updateStreamMuteW(stream, muted);} else if (action.equals(NotificationManager.ACTION_EFFECTS_SUPPRESSOR_CHANGED)) {
--
2.7.4
实际上后来并没有把这个dumpsys的日志加到源码里面,而是直接等待复现后执行dumpsys activity broadcast来查看就行了。
但是在等待复现的过程中,蒋工发现在dts里面有一个功能按键的码值和静音建的码值相同。因此怀疑是否是因为这个recovery按键导致的。
通过按下recovery按键后,这个日志和现象与测试所说的完全符合。因此,后来只是做这样的修复,并且测试后再也没有出现。
patch
From b012b4d5e61cab40b472fa44b012b9d4ec63c41f Mon Sep 17 00:00:00 2001
From: liangji <liangji@keenon.com>
Date: Tue, 12 Dec 2023 15:51:00 +0800
Subject: [PATCH] fix: disabled recovery key_muteChange-Id: I67f2fd680df216fe7749f0e43326101f0a04109b
Signed-off-by: liangji <liangji@keenon.com>
---arch/arm/boot/dts/rk3288-tb_8846.dts | 5 +++++1 file changed, 5 insertions(+)diff --git a/arch/arm/boot/dts/rk3288-tb_8846.dts b/arch/arm/boot/dts/rk3288-tb_8846.dts
index c4fcd7d..a6b8ee2 100644
--- a/arch/arm/boot/dts/rk3288-tb_8846.dts
+++ b/arch/arm/boot/dts/rk3288-tb_8846.dts
@@ -634,11 +634,16 @@label = "power";gpio-key,wakeup;};
+ /*
+ * disable recovery KEY_MUTE
+ *recovery-key {linux,code = <113>;label = "recovery";rockchip,adc_value = <4>;};
+ */
+/*menu-key {linux,code = <59>;
--
2.7.4