Skip to content

Commit

Permalink
fix: check if auto profiling is enabled before launching apps
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtr126 committed Oct 5, 2024
1 parent d8d78da commit aa233d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
10 changes: 1 addition & 9 deletions app/src/main/java/xtr/keymapper/TouchPointer.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,6 @@ public void setCursorY(int y) {
* service.
*/
private final ActivityObserver mActivityObserverCallback = new ActivityObserver.Stub() {
private void reloadKeymap() {
try {
mService.resumeMouse();
mService.reloadKeymap();
} catch (RemoteException ignored) {
}
}
private String lastPackageName = null;

@Override
Expand All @@ -308,8 +301,7 @@ public void onForegroundActivitiesChanged(String packageName) {
mHandler.post(() -> {
ProfileSelector.showEnableProfileDialog(context, packageName, enabled ->
ProfileSelector.createNewProfileForApp(context, packageName, enabled, profile -> {
TouchPointer.this.selectedProfile = profile;
reloadKeymap();
launchProfile(profile);
}));
});
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/xtr/keymapper/server/RemoteService.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public void startServer(KeymapProfile profile, KeymapConfig keymapConfig, IRemot
throw new RuntimeException(e);
}
// Launch app/game
if (!profile.packageName.equals(BuildConfig.APPLICATION_ID)) {
if (!profile.packageName.equals(BuildConfig.APPLICATION_ID) && keymapConfig.disableAutoProfiling) {
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(profile.packageName);
if (launchIntent != null && launchIntent.getComponent() != null) try {
new ProcessBuilder("am", "start", "-a", "android.intent.action.MAIN", "-n",
Expand Down

0 comments on commit aa233d4

Please sign in to comment.