Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
219 commits
Select commit Hold shift + click to select a range
4bc4254
#1394 copy privileged starter code from the old branch
sds100 Jul 6, 2025
48c8fe2
#1394 create basic PrivService
sds100 Jul 6, 2025
fdb6036
#1394 add libevdev code to priv module
sds100 Jul 6, 2025
ef2a1ef
#1394 simplify code
sds100 Jul 6, 2025
364313c
#1394 WIP: pair with ADB
sds100 Jul 6, 2025
3bb9af2
#1394 demo reading pairing code and port with BaseAccessibilityServic…
sds100 Jul 6, 2025
0b38692
#1394 automatically pairing with ADB when the pairing dialog is shown…
sds100 Jul 6, 2025
9e8fd35
#1394 delete event-names.h
sds100 Jul 6, 2025
3ef0a47
#1394 gitignore event-names.h
sds100 Jul 6, 2025
913cb62
#1394 delete unnecessary ADB native files and other tweaks
sds100 Jul 6, 2025
0e6a96e
#1394 detecting ADB connection port works, and starting the priv service
sds100 Jul 6, 2025
96c904e
#1394 bunch of changes
sds100 Jul 8, 2025
1b3abbe
#1394 add PRO Mode settings landing page
sds100 Jul 10, 2025
dfd9c67
#1394 add libsu code from old branch
sds100 May 15, 2025
91bef90
#1394 WIP: add the binder content provider (ShizukuProvider)
sds100 Jul 11, 2025
295a905
#1394 rename priv service to system bridge
sds100 Jul 11, 2025
4a9bf04
#1394 WIP: create content provider to receive system bridge Binder
sds100 Jul 11, 2025
d6f7302
#1394 sending system bridge binder to app works
sds100 Jul 12, 2025
551af8c
AccessibilityServiceAdapterImpl: do not spam log when checking servic…
sds100 Jul 15, 2025
7c3c218
#1394 bunch of fixes and removing uses of the word "shizuku" in the code
sds100 Jul 15, 2025
938ffbf
#1394 delete shizuku strings
sds100 Jul 16, 2025
111983d
#1394 WIP: add AOSP code to convert evdev events to Android key events
sds100 Jul 16, 2025
058ee7b
#1394 replace uses of fmtlib with std::format
sds100 Jul 23, 2025
725f5ea
#1394 use log macros in logging.h in android files
sds100 Jul 23, 2025
fadc600
#1394 fix remaining compilation errors
sds100 Jul 23, 2025
2c18cbb
#1394 WIP: bunch of fixes and use static libc++ library
sds100 Jul 24, 2025
7207e25
#1394 key layout map files compile and run on device
sds100 Jul 24, 2025
c4cdded
#1394 parsing key layout files works
sds100 Jul 24, 2025
0e0464a
#1394 add InputDevice.cpp and its dependencies
sds100 Jul 24, 2025
9f3cfc5
#1394 use the Generic.kl as a fallback if the device key layout file …
sds100 Jul 24, 2025
db9981a
#1394 read key code and flags from key layout map
sds100 Jul 24, 2025
e227579
#1394 set the device name
sds100 Jul 24, 2025
0a11413
#1394 log the event time
sds100 Jul 24, 2025
9b0ef27
#1394 demonstrate how to create a virtual device
sds100 Jul 25, 2025
6c51bff
#1394 refactor: rename MyKeyEvent to KMKeyEvent and MyMotionEvent to …
sds100 Jul 25, 2025
4914b71
#1394 create KMInputEvent interface to be inherited by KMKeyEvent and…
sds100 Jul 25, 2025
3331965
#1394 send evdev callback Binder to libevdev_jni
sds100 Jul 27, 2025
0ce8b3d
#1394 set min sdk of 29 for sysbridge files and make the internal to …
sds100 Jul 27, 2025
ef4e013
#1394 remove unnecessary code for checking native library location
sds100 Jul 27, 2025
23196c4
#1394 build AIDL file for IEvdevCallback for native library
sds100 Jul 27, 2025
d06e09f
#1394 commit generated native AIDL interfaces without formatting
sds100 Jul 27, 2025
42d4597
#1394 sending evdev events over Binder works!
sds100 Jul 27, 2025
6d98532
#1394 refactor libevdev_jni.cpp and store evdevcallback connections
sds100 Jul 28, 2025
962bdf0
#1394 use one evdevcallback for multiple devices from system bridge
sds100 Jul 28, 2025
e3f4fdd
#1394 commit generated native AIDL interfaces without formatting
sds100 Jul 28, 2025
1d4c90e
#1394 use epoll to listen to input events
sds100 Jul 30, 2025
ba75573
#1394 WIP and not working: communicate with epoll between threads
sds100 Jul 30, 2025
4bee3c6
#1394 WIP use eventfd
sds100 Jul 30, 2025
d02aa90
#1394 grabbing multiple devices WORKS. Had to initialize my own loope…
sds100 Aug 2, 2025
7234bf2
#1394 clean up evdev code a bit
sds100 Aug 3, 2025
008ac63
#1394 SystemBridge: call input manager inject input event
sds100 Aug 3, 2025
11267f9
refactor: rename RecordTriggerUseCase.kt to RecordTriggerController.kt
sds100 Aug 4, 2025
113ad17
#1394 create interface for InputEventHub
sds100 Aug 4, 2025
528f0fe
#1394 WIP: create InputEventHub
sds100 Aug 5, 2025
385b55d
#1394 InputEventHub: write code to inject input events
sds100 Aug 5, 2025
dd33c74
#1394 InputEventHub: handle remote exceptions
sds100 Aug 5, 2025
50f39b1
#1394 refactor KeyEventRelayServiceWrapper to be a singleton and clie…
sds100 Aug 5, 2025
7ac36c8
#1394 RecordTriggerController now handles recording keys from the Inp…
sds100 Aug 5, 2025
1b8ba4f
#1394 InputEventHub: specify which evdev devices to grab
sds100 Aug 5, 2025
cc819dd
Merge branch 'develop' into feature/1394-kernel-remapping-new
sds100 Aug 6, 2025
0df8ed0
#1394 AndroidDevicesAdapter: log information about input devices when…
sds100 Aug 6, 2025
f170ed9
#1394 recording triggers from evdev events works
sds100 Aug 6, 2025
418a42d
fix (InputEventUtils): add DPAD_CENTER to list of dpad buttons
sds100 Aug 6, 2025
baae43c
Merge branch 'develop' into feature/1394-kernel-remapping-new
sds100 Aug 6, 2025
d5e2425
#1394 create EvdevTriggerKey and refactor a lot of code to handle it …
sds100 Aug 7, 2025
5858f26
#1394 create separate class for KeyMapAlgorithm from KeyMapController
sds100 Aug 7, 2025
1be08f4
#1394 fix KeyEventTriggerDevice tests
sds100 Aug 7, 2025
5edf062
#1394 libevdev_jni: do not use EPOLLWAKEUP
sds100 Aug 7, 2025
ac8d5cd
#1394 KeyMapDetectionController: register InputEventHub client first
sds100 Aug 7, 2025
4af7d56
#1394 show pro mode keys in the user interface
sds100 Aug 7, 2025
f9117d2
#1394 bunch of fixes for the input event pipeline
sds100 Aug 7, 2025
57682ad
#1394 key map detection with evdev works
sds100 Aug 7, 2025
6e70790
#1394 evdev key maps work and passthrough keys if they aren't remapped
sds100 Aug 8, 2025
8fb2d09
#1394 bump version to 4.0.0
sds100 Aug 8, 2025
6fc5920
#1394 pass correct package name to sysbridge
sds100 Aug 8, 2025
59be6c9
#1394 libevdev_jni.cpp: reformat
sds100 Aug 8, 2025
9f56d80
#1394 create a event loop for injecting key events asynchronously
sds100 Aug 8, 2025
e6164fd
#1394 create a event loop for injecting key events asynchronously
sds100 Aug 8, 2025
5b34431
#1394 bunch of tweaks to SystemBridge
sds100 Aug 8, 2025
d240377
Merge remote-tracking branch 'origin/feature/1394-kernel-remapping-ne…
sds100 Aug 8, 2025
9993945
#1394 ignore touch screen key events
sds100 Aug 8, 2025
8835dfb
#1394 fix: loop over all pending evdev events so that mice work corre…
sds100 Aug 8, 2025
107d957
#1394 remove some comments and add extra logging
sds100 Aug 8, 2025
9b1618b
#1394 better detect grabbing an already grabbed device by comparing t…
sds100 Aug 8, 2025
18e1355
#1394 libevdev_jni.cpp add DEBUG_PROBE switch
sds100 Aug 8, 2025
82523f9
#1394 do not map evdev devices to Android input devices because Andro…
sds100 Aug 9, 2025
042dee6
#1394 ungrab devices when key maps are paused
sds100 Aug 9, 2025
777d54f
#1394 imitate evdev events through evdev
sds100 Aug 9, 2025
b5e65a3
#1394 ignore BTN_TOUCH key events from the touchscreen when recording
sds100 Aug 9, 2025
0a5f8dd
#1394 grab and ungrab devices synchronously
sds100 Aug 9, 2025
5df3cd9
#1394 fix tests
sds100 Aug 9, 2025
02ca732
#1394 style: reformat
sds100 Aug 9, 2025
9a26c86
remove code from #1276 that created a fake key code when it was unknown
sds100 Aug 9, 2025
ca724b9
#1394 #761 fall back to scan code automatically if the key code is un…
sds100 Aug 9, 2025
d850759
refactor: move key map related files to separate packages
sds100 Aug 9, 2025
fa72515
refactor: split up ConfigKeyMapUseCase into separate classes
sds100 Aug 9, 2025
d8bd765
#1394 fix tests
sds100 Aug 9, 2025
4b62d03
#1394 extract the core logic for configuring triggers into a separate…
sds100 Aug 9, 2025
7ca9b9e
#1394 #761 automatically use scan code detection for a trigger if it …
sds100 Aug 9, 2025
4419f52
fix: use title case for volume key code strings
sds100 Aug 9, 2025
e99559e
#1394 lock evdev devices when getting evdev devices
sds100 Aug 9, 2025
6efaf70
#761 add button to turn on scan code detection
sds100 Aug 9, 2025
0c38091
#761 update the algorithm for scan code detection
sds100 Aug 10, 2025
eb25180
fix: use disabled text for Advanced Triggers button when recording
sds100 Aug 10, 2025
158a2d2
#1394 WIP: add pro mode recording toggle switch
sds100 Aug 10, 2025
d660d0d
#761 show the key code and scan code number in the buttons to switch …
sds100 Aug 10, 2025
d128942
feat: use segmented buttons instead of radio buttons for click type
sds100 Aug 10, 2025
9dd49a5
feat: use segmented buttons for trigger mode
sds100 Aug 10, 2025
598d8e2
feat: extract segmented button rows styling into KeyMapperSegmentedBu…
sds100 Aug 10, 2025
6b1e73a
use text with lower weight for compact SegmentedButtonRow
sds100 Aug 10, 2025
333cd0a
fix: fix padding in TriggerKeyOptionsBottomSheet.kt
sds100 Aug 10, 2025
727e466
refactor trigger validation when configuring
sds100 Aug 10, 2025
7ba0c71
#1394 fix some memory access crashes and race conditions in libevdev_…
sds100 Aug 10, 2025
03532c8
#1394 show switch with icon for enabling/disabling PRO mode recording…
sds100 Aug 10, 2025
f4c4f94
#1394 fix device disconnection causing infinite loop in onEpollEvdevE…
sds100 Aug 10, 2025
d7fd092
#1394 always put the click type buttons in the same order
sds100 Aug 10, 2025
f16e4e0
#1394 stopping system bridge from pro mode screen works and showing r…
sds100 Aug 11, 2025
d48b790
#1394 update pro mode warning text
sds100 Aug 11, 2025
9006051
feat: just say "short, long, double" for click types on compact screens
sds100 Aug 11, 2025
0946817
#1394 add pro mode card to set up with key mapper
sds100 Aug 11, 2025
7f4a6bc
#1394 setting up Shizuku for pro mode works
sds100 Aug 11, 2025
07f7501
#1394 starting the system bridge with Shizuku works
sds100 Aug 11, 2025
8ffcba1
#1394 detect root properly
sds100 Aug 12, 2025
960a18e
#1394 starting system bridge with root works
sds100 Aug 12, 2025
ccafc17
#1394 refactor SystemBridgeConnectionManager and starting the system …
sds100 Aug 12, 2025
2669ad0
#1394 use separate methods for starting system bridge with root, shiz…
sds100 Aug 12, 2025
38c912d
#1394 create setup wizard screen with content for each step
sds100 Aug 12, 2025
ff961e1
#1394 switching to developer options step and toggling setup assistan…
sds100 Aug 12, 2025
854c29d
#1394 change text of start accessibility service button
sds100 Aug 12, 2025
2e9c54b
#1394 animate setup progress indicator
sds100 Aug 12, 2025
fe8a9d4
#1394 launching developer options and connecting to a wifi network st…
sds100 Aug 12, 2025
5a07776
#1394 launching developer options and highlighting wireless debugging…
sds100 Aug 12, 2025
1630a79
#1394 launching wireless debugging directly works
sds100 Aug 12, 2025
2f9d42b
#1394 add set up step requesting notification permission
sds100 Aug 12, 2025
addbaf9
#1394 show notification on pro mode starting
sds100 Aug 12, 2025
1c3fed3
add field to create a silent notification
sds100 Aug 12, 2025
df26089
#1394 auto dismiss success notification
sds100 Aug 12, 2025
1d21aac
#1394 open key mapper after successfully starting system bridge
sds100 Aug 13, 2025
ea55c7d
#1394 automatically click the button to pair with pairing code
sds100 Aug 13, 2025
6709a8f
#1394 refactor adb starter code
sds100 Aug 23, 2025
00474f5
#1394 complete system bridge setup screen
sds100 Aug 23, 2025
61a8d7d
#1394 make empty settings screen
sds100 Aug 24, 2025
133b63b
#1394 show new settings to change theme and toggle key maps notification
sds100 Aug 24, 2025
ceea3c9
#1394 create new default settings screen with long press delay
sds100 Aug 24, 2025
37237e9
#1394 complete settings screen for default options
sds100 Aug 24, 2025
61513cd
#1394 add setting to turn on automatic back up
sds100 Aug 24, 2025
76a87ec
#1394 add link to pro mode in settings
sds100 Aug 24, 2025
e319cbe
#1394 do not crash if ADB SSL handshake fails
sds100 Aug 24, 2025
c3e1dbb
#1394 create AutomaticChangeImeSettingsScreen
sds100 Aug 24, 2025
5baf356
#1394 update default settings strings
sds100 Aug 24, 2025
074dfd4
#1394 create new preference to force vibrate all key maps
sds100 Aug 24, 2025
56ed35d
#1394 create new logging screen
sds100 Aug 24, 2025
d342568
#1394 create setting to hide home screen alerts
sds100 Aug 24, 2025
cce12f0
#1394 create setting to for showing device descriptors
sds100 Aug 24, 2025
37250b9
minimum supported Android version is now 8.0 Oreo
sds100 Aug 24, 2025
b9aa5b5
#1394 delete old Settings fragments
sds100 Aug 24, 2025
e87fea3
#1394 enable extractNativeLibs in manifest so system bridge native li…
sds100 Aug 24, 2025
3d831d1
#1394 update string
sds100 Aug 24, 2025
bd97231
#1394 improve pro mode setup process
sds100 Aug 24, 2025
89c9f01
#1394 improve pro mode setup process more
sds100 Aug 24, 2025
e1ae226
remove users from about screen
sds100 Aug 24, 2025
d3921d6
#1394 delete reroute key events code
sds100 Aug 24, 2025
7ee0cd7
#1394 delete code for showing ime picker notifications
sds100 Aug 24, 2025
9b8ebd2
#1394 use system bridge for wifi actions
sds100 Aug 25, 2025
655b351
#1394 create card explaining what PRO mode unlocks
sds100 Aug 25, 2025
857a228
rename WiFi to Wi-Fi in strings
sds100 Aug 25, 2025
0c52160
fix: navigating back from choose action screen after replacing an act…
sds100 Aug 25, 2025
9c18c6c
#1394 only show the PRO mode info card if it has not been dismissed b…
sds100 Aug 25, 2025
5354bd7
#1394 discover ADB pairing port with mDNS
sds100 Aug 25, 2025
59a8441
#1394 auto start system bridge when Key Mapper has root or shizuku pe…
sds100 Aug 25, 2025
933e528
#1394 automatically rebind the system bridge when key mapper process …
sds100 Aug 25, 2025
647d325
#1394 use IO dispatcher in RoomLogRepository
sds100 Aug 25, 2025
7f4391a
#1394 add more notifications when finding the pairing code fails
sds100 Aug 27, 2025
6947492
#1394 enable USB debugging and disable ADB authorization timeout when…
sds100 Aug 27, 2025
3e98ea0
#1394 show notification when system bridge is killed
sds100 Aug 29, 2025
fcf2202
#1394 use version catalogs for sysbridge and systemstubs build.gradle
sds100 Aug 29, 2025
6a8a4cd
#1394 NetworkAdapter: check all networks for a WiFi transport
sds100 Aug 29, 2025
d41270f
#1394 check every minute if Key Mapper is uninstalled when it unbinds…
sds100 Aug 29, 2025
ec587ba
#1394 grant WRITE_SECURE_SETTINGS permission when the System Bridge s…
sds100 Aug 29, 2025
fdf2434
#1394 fix proguard rules for system bridge
sds100 Aug 29, 2025
dc5ada6
#1394 fix: starting system bridge on Android 11 works
sds100 Aug 29, 2025
61d54ac
#1394 various fixes for starting system bridge and auto start with ADB
sds100 Aug 29, 2025
ea19bab
#1394 prevent system bridge killing any time it is started as shell user
sds100 Aug 29, 2025
e3e7f1c
#1394 auto starting system bridge is more robust
sds100 Aug 29, 2025
8a8ff1f
#1394 do not autostart if the system bridge was killed less than a mi…
sds100 Aug 29, 2025
f9f0346
#1394 autostart on boot or when key mapper is opened
sds100 Aug 29, 2025
15bf0d1
#1394 starting system bridge with ADB is more robust
sds100 Aug 30, 2025
4888b29
#1394 add card to pro mode screen asking for notification permission
sds100 Aug 30, 2025
7513e0d
#1394 do not execute any ADB commands when auto starting if rooted
sds100 Aug 30, 2025
af67385
#1394 grabbing evdev devices is more robust and thread safe
sds100 Aug 30, 2025
745feb2
fix: restoring subgroups works
sds100 Aug 30, 2025
ff082db
#1394 random fixes
sds100 Aug 30, 2025
0122a0a
fix: use display listener to update isScreenOn
sds100 Aug 30, 2025
716db22
undo IEvdevCallback.cpp formating
sds100 Aug 30, 2025
1568dcc
#1394: hold down power for 10 seconds to kill the system bridge in an…
sds100 Aug 30, 2025
7e7ce92
undo style reformatting
sds100 Aug 30, 2025
35abae3
#1394 add option to turn off auto start at boot and show emergency tip
sds100 Aug 30, 2025
b85a767
#1394 remove unused PRO mode switch in trigger screen
sds100 Aug 30, 2025
b96c2fd
#1394 automatically restart the system bridge if it has a different v…
sds100 Aug 31, 2025
5a253ee
#1394 random fixes in ADB Mdns
sds100 Aug 31, 2025
e0b10e9
#1394 fix bugs when recording and do not record BTN_TOOL_FINGER
sds100 Aug 31, 2025
2f1549e
#1394 fix bugs autostarting on boot
sds100 Aug 31, 2025
c55c83e
#1394 use input event hub for recording motion events
sds100 Aug 31, 2025
afea48b
#1394 disable pro mode in settings on SDK < Q
sds100 Aug 31, 2025
cb5d90a
#1394 show system bridge errors for actions
sds100 Aug 31, 2025
04a25ed
#1394 support mobile data actions with system bridge
sds100 Sep 1, 2025
39f5c11
#1394 recording triggers with accessibility service works again
sds100 Sep 1, 2025
93ec20f
#1394 WIP: use system bridge for Bluetooth actions
sds100 Sep 2, 2025
fd69e57
#1394 use system bridge for Bluetooth actions on Android 13+
sds100 Sep 6, 2025
1030ece
replace Wi-Fi with WiFi in strings so it is easier to search for the …
sds100 Sep 6, 2025
84e3cef
#1394 use system bridge for NFC actions
sds100 Sep 7, 2025
fd032c8
#1394 use system bridge for airplane mode actions
sds100 Sep 7, 2025
522696f
#1394 use system bridge for power on/off action
sds100 Sep 7, 2025
3cab7a1
#1394 automatically set power trigger key to long press
sds100 Sep 7, 2025
ac47d21
#1394 remove detect screen off option and use shell for key event act…
sds100 Sep 7, 2025
4f2d712
#1394 complete more TODOs
sds100 Sep 7, 2025
2924359
Merge branch 'develop' into feature/1394-kernel-remapping-new
sds100 Sep 7, 2025
ccd0246
style: ktlint reformat
sds100 Sep 7, 2025
ec7fe2c
#1394 fix tests
sds100 Sep 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
## [4.0.0 Beta 1](https://github.com/sds100/KeyMapper/releases/tag/v4.0.0-beta.01)

#### TO BE RELEASED

## Added

- #761 Detect keys with scancodes. Key Mapper will do this automatically if the key code is unknown
or you record different physical keys from the same device with the same key code.
- Redesign the Settings screen

## Removed

- The key event relay service is now also used on all Android versions below Android 14. The
broadcast receiver method is no longer used.
- Minimum supported Android version is now 8.0. Less than 1% of users are on older versions than
this and dropping support simplifies the codebase and maintenance.
- Dropped support for showing a keyboard picker notification and automatically showing it when a
device connects. This is only supported on Android 8.1 and is extra work to maintain it.
- Dropped support for rerouting key events on Android 11. This was a workaround for a specific bug
in Android 11 which fewer than 10% of users are using and less are probably using that feature.

## Fixed

- Restoring subgroups works and does not freeze Key Mapper

## [3.2.1](https://github.com/sds100/KeyMapper/releases/tag/v3.2.1)

#### 03 Sept 2025
Expand Down
2 changes: 2 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Many thanks to...
- @[MFlisar](https://github.com/MFlisar) for their [drag and select](https://github.com/MFlisar/DragSelectRecyclerView) library.
- @[RikkaApps](https://github.com/RikkaApps) for Shizuku! It is amazing.
- @[canopas](https://github.com/canopas) for their Jetpack Compose Tap Target library https://github.com/canopas/compose-intro-showcase.
- @[topjohnwu](https://github.com/topjohnwu) for Magisk
and [libsu](https://github.com/topjohnwu/libsu).

[salomonbrys]: https://github.com/salomonbrys
[Kotson]: https://github.com/salomonbrys/Kotson
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ import java.util.concurrent.ConcurrentHashMap
*
* This was originally implemented in issue #850 for the action to answer phone calls
* because Android doesn't pass volume down key events to the accessibility service
* when the phone is ringing or it is in a phone call.
* when the phone is ringing or it is in a phone call. Later, in Android 14 this relay must be
* used because they also introduced a 1-second delay to context-registered broadcast receivers.
* And who knows what other restrictions will be added in the future :)
*
* The accessibility service registers a callback and the input method service
* sends the key events.
*/
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ dependencies {
implementation(project(":base"))
implementation(project(":api"))
implementation(project(":data"))
implementation(project(":sysbridge"))
implementation(project(":system"))
compileOnly(project(":systemstubs"))

Expand Down
134 changes: 133 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,136 @@

-keep class com.google.gson.reflect.TypeToken
-keep class * extends com.google.gson.reflect.TypeToken
-keep public class * implements java.lang.reflect.Type
-keep public class * implements java.lang.reflect.Type

-keep class io.github.sds100.keymapper.sysbridge.service.SystemBridge {
public <methods>;
native <methods>;
static <methods>;
<init>(...);
}

# Keep all AIDL interface classes and their methods
-keep class io.github.sds100.keymapper.sysbridge.ISystemBridge** { *; }
-keep class io.github.sds100.keymapper.sysbridge.IEvdevCallback** { *; }
-keep class io.github.sds100.keymapper.sysbridge.IShizukuStarterService** { *; }

# Keep binder provider classes
-keep class io.github.sds100.keymapper.sysbridge.provider.** { *; }

# Keep classes accessed via reflection or from system services
-keep class io.github.sds100.keymapper.sysbridge.utils.** { *; }

# Keep native method signatures
-keepclasseswithmembernames class * {
native <methods>;
}

# Keep classes that might be accessed via ContentProvider
-keep class io.github.sds100.keymapper.sysbridge.** extends android.content.ContentProvider { *; }

# Keep parcelable classes used in AIDL
-keep class io.github.sds100.keymapper.common.models.EvdevDeviceHandle { *; }

# Keep all rikka.hidden classes and interfaces as they contain AIDL files
-keep class rikka.hidden.** { *; }
-keep interface rikka.hidden.** { *; }

# Keep Android system API classes and interfaces that rikka.hidden depends on
# android.app package classes
-keep class android.app.ActivityManagerNative { *; }
-keep class android.app.ActivityTaskManager$RootTaskInfo { *; }
-keep class android.app.ContentProviderHolder { *; }
-keep class android.app.IActivityManager** { *; }
-keep class android.app.IApplicationThread** { *; }
-keep class android.app.IProcessObserver** { *; }
-keep class android.app.ITaskStackListener** { *; }
-keep class android.app.IUidObserver** { *; }
-keep class android.app.ProfilerInfo { *; }

# android.content package classes
-keep class android.content.IContentProvider** { *; }
-keep class android.content.IIntentReceiver** { *; }

# android.content.pm package classes
-keep class android.content.pm.IPackageManager** { *; }
-keep class android.content.pm.IPackageInstaller** { *; }
-keep class android.content.pm.ILauncherApps** { *; }
-keep class android.content.pm.IOnAppsChangedListener** { *; }
-keep class android.content.pm.IPackageInstallerCallback** { *; }
-keep class android.content.pm.ParceledListSlice { *; }
-keep class android.content.pm.UserInfo { *; }

# android.hardware package classes
-keep class android.hardware.input.IInputManager** { *; }
-keep class android.hardware.display.IDisplayManager** { *; }
-keep class android.hardware.display.IDisplayManagerCallback** { *; }

# android.os package classes
-keep class android.os.BatteryProperty { *; }
-keep class android.os.IBatteryPropertiesRegistrar** { *; }
-keep class android.os.IDeviceIdleController { *; }
-keep class android.os.IDeviceIdleController** { *; }
-keep class android.os.IUserManager { *; }
-keep class android.os.IUserManager** { *; }
-keep class android.os.RemoteCallback** { *; }
-keep class android.os.ServiceManager { *; }

# android.view package classes
-keep class android.view.DisplayInfo { *; }
-keep class android.view.IWindowManager** { *; }

# android.permission package classes
-keep class android.permission.IPermissionManager** { *; }

# android.net package classes
-keep class android.net.wifi.IWifiManager** { *; }

# com.android.internal package classes
-keep class com.android.internal.app.IAppOpsActiveCallback** { *; }
-keep class com.android.internal.app.IAppOpsNotedCallback** { *; }
-keep class com.android.internal.app.IAppOpsService** { *; }
-keep class com.android.internal.policy.IKeyguardLockedStateListener** { *; }

# Keep all Android AIDL interfaces (they implement IInterface)
-keep class android.** implements android.os.IInterface { *; }

# Keep Android system service stubs and natives
-keep class android.**Native { *; }
-keep class android.**$Stub** { *; }
-keep class android.**$Proxy** { *; }

# Keep Android hidden/internal classes that might be accessed via reflection
-dontwarn android.app.ActivityManagerNative
-dontwarn android.app.ActivityTaskManager$**
-dontwarn android.app.ContentProviderHolder
-dontwarn android.app.IActivityManager**
-dontwarn android.app.IApplicationThread**
-dontwarn android.app.IProcessObserver**
-dontwarn android.app.ITaskStackListener**
-dontwarn android.app.IUidObserver**
-dontwarn android.app.ProfilerInfo
-dontwarn android.app.AppOpsManager$**
-dontwarn android.content.IContentProvider**
-dontwarn android.content.IIntentReceiver**
-dontwarn android.content.pm.ILauncherApps**
-dontwarn android.content.pm.IOnAppsChangedListener**
-dontwarn android.content.pm.IPackageInstallerCallback**
-dontwarn android.content.pm.ParceledListSlice
-dontwarn android.content.pm.UserInfo
-dontwarn android.content.pm.PackageManagerHidden
-dontwarn android.hardware.display.IDisplayManager**
-dontwarn android.hardware.display.IDisplayManagerCallback**
-dontwarn android.os.BatteryProperty
-dontwarn android.os.IBatteryPropertiesRegistrar**
-dontwarn android.os.IDeviceIdleController
-dontwarn android.os.IDeviceIdleController**
-dontwarn android.os.IUserManager
-dontwarn android.os.IUserManager**
-dontwarn android.os.RemoteCallback**
-dontwarn android.os.ServiceManager
-dontwarn android.os.UserHandle$**
-dontwarn android.view.DisplayInfo
-dontwarn android.view.IWindowManager**
-dontwarn com.android.internal.app.**
-dontwarn com.android.internal.policy.**
7 changes: 7 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@
<uses-feature
android:name="android.software.leanback"
android:required="false" />

<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />

<!-- This is required because sysbridge has a min sdk of 29 since it depends
on the binder-ndk library. Building will fail without this because the min sdk
of the app is 26.-->
<uses-sdk tools:overrideLibrary="io.github.sds100.keymapper.sysbridge" />

<application
android:name="io.github.sds100.keymapper.KeyMapperApp"
android:allowBackup="true"
Expand All @@ -19,6 +25,7 @@
android:supportsRtl="true"
android:theme="@style/AppTheme.NoActionBar"
android:usesCleartextTraffic="true"
android:extractNativeLibs="true"
tools:ignore="GoogleAppIndexingWarning,MissingTvBanner">
<!-- Allow clear text traffic due to the HTTP Request Action. -->

Expand Down
90 changes: 65 additions & 25 deletions app/src/main/java/io/github/sds100/keymapper/MainFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,24 @@ import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import dagger.hilt.android.AndroidEntryPoint
import io.github.sds100.keymapper.base.BaseMainNavHost
import io.github.sds100.keymapper.base.actions.ChooseActionScreen
import io.github.sds100.keymapper.base.actions.ChooseActionViewModel
import io.github.sds100.keymapper.base.actions.ActionsScreen
import io.github.sds100.keymapper.base.actions.ConfigActionsViewModel
import io.github.sds100.keymapper.base.compose.KeyMapperTheme
import io.github.sds100.keymapper.base.constraints.ConfigConstraintsViewModel
import io.github.sds100.keymapper.base.constraints.ConstraintsScreen
import io.github.sds100.keymapper.base.databinding.FragmentComposeBinding
import io.github.sds100.keymapper.base.home.HomeKeyMapListScreen
import io.github.sds100.keymapper.base.keymaps.ConfigKeyMapScreen
import io.github.sds100.keymapper.base.keymaps.ConfigKeyMapViewModel
import io.github.sds100.keymapper.base.keymaps.KeyMapOptionsScreen
import io.github.sds100.keymapper.base.utils.navigation.NavDestination
import io.github.sds100.keymapper.base.utils.navigation.NavigationProviderImpl
import io.github.sds100.keymapper.base.utils.navigation.SetupNavigation
import io.github.sds100.keymapper.base.utils.navigation.handleRouteArgs
import io.github.sds100.keymapper.base.utils.navigation.setupFragmentNavigation
import io.github.sds100.keymapper.base.utils.ui.DialogProviderImpl
import io.github.sds100.keymapper.home.HomeViewModel
import io.github.sds100.keymapper.keymaps.ConfigKeyMapScreen
import io.github.sds100.keymapper.keymaps.ConfigKeyMapViewModel
import io.github.sds100.keymapper.trigger.ConfigTriggerViewModel
import io.github.sds100.keymapper.trigger.TriggerScreen
import javax.inject.Inject

@AndroidEntryPoint
Expand All @@ -46,9 +50,6 @@ class MainFragment : Fragment() {
@Inject
lateinit var navigationProvider: NavigationProviderImpl

@Inject
lateinit var dialogProvider: DialogProviderImpl

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

Expand Down Expand Up @@ -107,45 +108,84 @@ class MainFragment : Fragment() {
}

composable<NavDestination.NewKeyMap> { backStackEntry ->
val viewModel: ConfigKeyMapViewModel = hiltViewModel()
val keyMapViewModel: ConfigKeyMapViewModel = hiltViewModel()
val triggerViewModel: ConfigTriggerViewModel = hiltViewModel()
val actionsViewModel: ConfigActionsViewModel = hiltViewModel()
val constraintsViewModel: ConfigConstraintsViewModel = hiltViewModel()
val snackbarHostState = remember { SnackbarHostState() }

backStackEntry.handleRouteArgs<NavDestination.NewKeyMap> { args ->
viewModel.loadNewKeyMap(groupUid = args.groupUid)
keyMapViewModel.loadNewKeyMap(groupUid = args.groupUid)

if (args.showAdvancedTriggers) {
viewModel.configTriggerViewModel.showAdvancedTriggersBottomSheet = true
triggerViewModel.showAdvancedTriggersBottomSheet = true
}
}

ConfigKeyMapScreen(
modifier = Modifier.fillMaxSize(),
viewModel = viewModel,
snackbarHostState = snackbarHostState,
keyMapViewModel = keyMapViewModel,
triggerScreen = {
TriggerScreen(Modifier.fillMaxSize(), triggerViewModel)
},
actionsScreen = {
ActionsScreen(Modifier.fillMaxSize(), actionsViewModel)
},
constraintsScreen = {
ConstraintsScreen(
Modifier.fillMaxSize(),
constraintsViewModel,
snackbarHostState,
)
},
optionsScreen = {
KeyMapOptionsScreen(
Modifier.fillMaxSize(),
triggerViewModel.optionsViewModel,
)
},
)
}

composable<NavDestination.OpenKeyMap> { backStackEntry ->
val viewModel: ConfigKeyMapViewModel = hiltViewModel()
val keyMapViewModel: ConfigKeyMapViewModel = hiltViewModel()
val triggerViewModel: ConfigTriggerViewModel = hiltViewModel()
val actionsViewModel: ConfigActionsViewModel = hiltViewModel()
val constraintsViewModel: ConfigConstraintsViewModel = hiltViewModel()
val snackbarHostState = remember { SnackbarHostState() }

backStackEntry.handleRouteArgs<NavDestination.OpenKeyMap> { args ->
viewModel.loadKeyMap(uid = args.keyMapUid)
keyMapViewModel.loadKeyMap(uid = args.keyMapUid)

if (args.showAdvancedTriggers) {
viewModel.configTriggerViewModel.showAdvancedTriggersBottomSheet = true
triggerViewModel.showAdvancedTriggersBottomSheet = true
}
}

ConfigKeyMapScreen(
modifier = Modifier.fillMaxSize(),
viewModel = viewModel,
)
}

composable<NavDestination.ChooseAction> {
val viewModel: ChooseActionViewModel = hiltViewModel()

ChooseActionScreen(
modifier = Modifier.fillMaxSize(),
viewModel = viewModel,
snackbarHostState = snackbarHostState,
keyMapViewModel = keyMapViewModel,
triggerScreen = {
TriggerScreen(Modifier.fillMaxSize(), triggerViewModel)
},
actionsScreen = {
ActionsScreen(Modifier.fillMaxSize(), actionsViewModel)
},
constraintsScreen = {
ConstraintsScreen(
Modifier.fillMaxSize(),
constraintsViewModel,
snackbarHostState,
)
},
optionsScreen = {
KeyMapOptionsScreen(
Modifier.fillMaxSize(),
triggerViewModel.optionsViewModel,
)
},
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package io.github.sds100.keymapper.home
import dagger.hilt.android.lifecycle.HiltViewModel
import io.github.sds100.keymapper.base.backup.BackupRestoreMappingsUseCase
import io.github.sds100.keymapper.base.home.BaseHomeViewModel
import io.github.sds100.keymapper.base.home.ListKeyMapsUseCase
import io.github.sds100.keymapper.base.home.ShowHomeScreenAlertsUseCase
import io.github.sds100.keymapper.base.keymaps.ListKeyMapsUseCase
import io.github.sds100.keymapper.base.keymaps.PauseKeyMapsUseCase
import io.github.sds100.keymapper.base.onboarding.OnboardingUseCase
import io.github.sds100.keymapper.base.sorting.SortKeyMapsUseCase
Expand Down
Loading