Skip to content

Commit

Permalink
WiredAccessoryManager: replace every non digit character
Browse files Browse the repository at this point in the history
** example NFE from quicksilver

05-26 04:08:15.338  3764  3764 E WiredAccessoryManager: Error while attempting to determine initial switch state for hdmi_audio
05-26 04:08:15.338  3764  3764 E WiredAccessoryManager: java.lang.NumberFormatException: For input string: "HDMI=1"
05-26 04:08:15.338  3764  3764 E WiredAccessoryManager:         at java.lang.Integer.parseInt(Integer.java:747)
05-26 04:08:15.338  3764  3764 E WiredAccessoryManager:         at java.lang.Integer.parseInt(Integer.java:865)
05-26 04:08:15.338  3764  3764 E WiredAccessoryManager:         at com.android.server.WiredAccessoryManager$WiredAccessoryObserver.init(WiredAccessoryManager.java:414)
05-26 04:08:15.338  3764  3764 E WiredAccessoryManager:         at com.android.server.WiredAccessoryManager.onSystemReady(WiredAccessoryManager.java:148)
05-26 04:08:15.338  3764  3764 E WiredAccessoryManager:         at com.android.server.WiredAccessoryManager.-$$Nest$monSystemReady(Unknown Source:0)
05-26 04:08:15.338  3764  3764 E WiredAccessoryManager:         at com.android.server.WiredAccessoryManager$1.handleMessage(WiredAccessoryManager.java:309)
05-26 04:08:15.338  3764  3764 E WiredAccessoryManager:         at android.os.Handler.dispatchMessage(Handler.java:106)
05-26 04:08:15.338  3764  3764 E WiredAccessoryManager:         at android.os.Looper.loopOnce(Looper.java:201)
05-26 04:08:15.338  3764  3764 E WiredAccessoryManager:         at android.os.Looper.loop(Looper.java:288)
05-26 04:08:15.338  3764  3764 E WiredAccessoryManager:         at com.android.server.SystemServer.run(SystemServer.java:965)
05-26 04:08:15.338  3764  3764 E WiredAccessoryManager:         at com.android.server.SystemServer.main(SystemServer.java:650)
05-26 04:08:15.338  3764  3764 E WiredAccessoryManager:         at java.lang.reflect.Method.invoke(Native Method)
05-26 04:08:15.338  3764  3764 E WiredAccessoryManager:         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
05-26 04:08:15.338  3764  3764 E WiredAccessoryManager:         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:914)

Change-Id: I3d28058ab396345a4baa4242856532522f227ca9
(cherry picked from commit 8221cad4a2fa5801fac83dc1f2c1ed4aa93e5994)
  • Loading branch information
Dil3mm4 authored and ArmSM committed Jun 19, 2024
1 parent 0e77fa7 commit 1519ef6
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,8 @@ void init() {
FileReader file = new FileReader(switchStatePath);
int len = file.read(buffer, 0, 1024);
file.close();
curState = Integer.parseInt((new String(buffer, 0, len)).trim());
curState = Integer.parseInt(
(new String(buffer, 0, len).replaceAll("\\D+","")).trim());

if (curState > 0) {
int index = switchStatePath.lastIndexOf(".");
Expand Down

0 comments on commit 1519ef6

Please sign in to comment.