Skip to content

Commit

Permalink
Add workaround for Pico 4 Ultra
Browse files Browse the repository at this point in the history
Make ActivityThread.isSystem() return true to avoid a
NullPointerException later.

Refs #5659 comment <#5659 (comment)>
Fixes #5659 <#5659>
  • Loading branch information
rom1v committed Dec 14, 2024
1 parent 6926470 commit dc2fcc4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/src/main/java/com/genymobile/scrcpy/Workarounds.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public final class Workarounds {
Field sCurrentActivityThreadField = ACTIVITY_THREAD_CLASS.getDeclaredField("sCurrentActivityThread");
sCurrentActivityThreadField.setAccessible(true);
sCurrentActivityThreadField.set(null, ACTIVITY_THREAD);

// activityThread.mSystemThread = true;
Field mSystemThreadField = ACTIVITY_THREAD_CLASS.getDeclaredField("mSystemThread");
mSystemThreadField.setAccessible(true);
mSystemThreadField.setBoolean(ACTIVITY_THREAD, true);
} catch (Exception e) {
throw new AssertionError(e);
}
Expand Down

0 comments on commit dc2fcc4

Please sign in to comment.