Skip to content

Commit 4b3322c

Browse files
XuBing0sysopenci
authored andcommitted
Fix connection errors when hot pluging USB camera
system will throw CAMERA_ERROR_UNKNOWN error when hot pluging USB camera, It's a fatal error but Camera2 app think it's a normal error, correct it. Tracked-On: OAM-132658 Signed-off-by: Xu Bing <bing.xu@intel.com>
1 parent 79c26de commit 4b3322c

2 files changed

Lines changed: 125 additions & 0 deletions

File tree

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
From db49e8681b4a8b952a4c92b4298964359c78ebf8 Mon Sep 17 00:00:00 2001
2+
From: Xu Bing <bing.xu@intel.com>
3+
Date: Mon, 16 Jun 2025 14:58:30 +0800
4+
Subject: [PATCH] Fix the error of sound output disorder
5+
6+
System will reuse the ringtone on multi-passenger mode when the ringtone
7+
has been used, but the sould will be closed when finishing to play,
8+
the sould will be played on remote and on another zone. so we always
9+
stop old sound and start to play new sound when adjusting the sound
10+
volumn.
11+
12+
Tracked-On: OAM-133048
13+
Signed-off-by: Xu Bing <bing.xu@intel.com>
14+
---
15+
...x-the-error-of-sound-output-disorder.patch | 65 +++++++++++++++++++
16+
1 file changed, 65 insertions(+)
17+
create mode 100644 aosp_diff/aaos_iasw/packages/apps/Car/Settings/0001-Fix-the-error-of-sound-output-disorder.patch
18+
19+
diff --git a/aosp_diff/aaos_iasw/packages/apps/Car/Settings/0001-Fix-the-error-of-sound-output-disorder.patch b/aosp_diff/aaos_iasw/packages/apps/Car/Settings/0001-Fix-the-error-of-sound-output-disorder.patch
20+
new file mode 100644
21+
index 0000000..d95c5d6
22+
--- /dev/null
23+
+++ b/aosp_diff/aaos_iasw/packages/apps/Car/Settings/0001-Fix-the-error-of-sound-output-disorder.patch
24+
@@ -0,0 +1,65 @@
25+
+From 112effcca0369045f950ad8618f2501b0f0b77e7 Mon Sep 17 00:00:00 2001
26+
+From: Xu Bing <bing.xu@intel.com>
27+
+Date: Mon, 16 Jun 2025 14:19:29 +0800
28+
+Subject: [PATCH] Fix the error of sound output disorder
29+
+
30+
+System will reuse the ringtone on multi-passenger mode when the ringtone
31+
+has been used, but the sould will be closed when finishing to play,
32+
+the sould will be played on remote and on another zone. so we always
33+
+stop old sound and start to play new sound when adjusting the sound
34+
+volumn.
35+
+
36+
+Tracked-On: OAM-133048
37+
+Signed-off-by: Xu Bing <bing.xu@intel.com>
38+
+---
39+
+ .../sound/VolumeSettingsRingtoneManager.java | 32 +++++++++++--------
40+
+ 1 file changed, 18 insertions(+), 14 deletions(-)
41+
+
42+
+diff --git a/src/com/android/car/settings/sound/VolumeSettingsRingtoneManager.java b/src/com/android/car/settings/sound/VolumeSettingsRingtoneManager.java
43+
+index 8a6d0d0b7..e5bf0f1c6 100644
44+
+--- a/src/com/android/car/settings/sound/VolumeSettingsRingtoneManager.java
45+
++++ b/src/com/android/car/settings/sound/VolumeSettingsRingtoneManager.java
46+
+@@ -113,22 +113,26 @@ public class VolumeSettingsRingtoneManager {
47+
+
48+
+ /** If we have already seen this ringtone, use it. Otherwise load when requested. */
49+
+ private Ringtone lazyLoadRingtone(int group, int usage) {
50+
+- if (!mGroupToRingtoneMap.containsKey(group)) {
51+
+- Ringtone ringtone = RingtoneManager.getRingtone(mContext, getRingtoneUri(usage));
52+
+- if (ringtone == null) {
53+
+- return null;
54+
+- }
55+
+-
56+
+- AudioAttributes.Builder builder = new AudioAttributes.Builder();
57+
+- if (AudioAttributes.isSystemUsage(usage)) {
58+
+- builder.setSystemUsage(usage);
59+
+- } else {
60+
+- builder.setUsage(usage);
61+
+- }
62+
++ //Remove the group and recreate because mLocalPlayer is stopped on multi-zone
63+
++ if (mGroupToRingtoneMap.containsKey(group)) {
64+
++ stopCurrentRingtone();
65+
++ mGroupToRingtoneMap.remove(group);
66+
++ }
67+
++ Ringtone ringtone = RingtoneManager.getRingtone(mContext, getRingtoneUri(usage));
68+
++ if (ringtone == null) {
69+
++ return null;
70+
++ }
71+
+
72+
+- ringtone.setAudioAttributes(builder.build());
73+
+- mGroupToRingtoneMap.put(group, ringtone);
74+
++ AudioAttributes.Builder builder = new AudioAttributes.Builder();
75+
++ if (AudioAttributes.isSystemUsage(usage)) {
76+
++ builder.setSystemUsage(usage);
77+
++ } else {
78+
++ builder.setUsage(usage);
79+
+ }
80+
++
81+
++ ringtone.setAudioAttributes(builder.build());
82+
++ mGroupToRingtoneMap.put(group, ringtone);
83+
++
84+
+ return mGroupToRingtoneMap.get(group);
85+
+ }
86+
+
87+
+--
88+
+2.34.1
89+
+
90+
--
91+
2.34.1
92+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
From f8d9f26dd3de6e954987d6830f23def17938e21e Mon Sep 17 00:00:00 2001
2+
From: Xu Bing <bing.xu@intel.com>
3+
Date: Thu, 19 Jun 2025 15:06:51 +0800
4+
Subject: [PATCH] Fix connection errors when hot pluging USB camera
5+
6+
system will throw CAMERA_ERROR_UNKNOWN error when hot pluging USB
7+
camera, It's a fatal error but Camera2 app think it's a normal
8+
error, correct it.
9+
10+
Tracked-On: OAM-132658
11+
Signed-off-by: Xu Bing <bing.xu@intel.com>
12+
---
13+
src/com/android/camera/CameraActivity.java | 4 ++++
14+
1 file changed, 4 insertions(+)
15+
16+
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
17+
index 3133f57eb..759f6664b 100644
18+
--- a/src/com/android/camera/CameraActivity.java
19+
+++ b/src/com/android/camera/CameraActivity.java
20+
@@ -1366,6 +1366,10 @@ public class CameraActivity extends QuickActivity
21+
public void onCameraError(int errorCode) {
22+
// Not a fatal error. only do Log.e().
23+
Log.e(TAG, "Camera error callback. error=" + errorCode);
24+
+ if (errorCode == 1) {
25+
+ Log.e(TAG, "Camera error unknown, throw fatal error to reset!");
26+
+ onFatalError();
27+
+ }
28+
}
29+
@Override
30+
public void onCameraException(
31+
--
32+
2.34.1
33+

0 commit comments

Comments
 (0)