Using my batch script you can easily set for the applauncher. To include the code in your launcher, it would be pretty simple. My batch script just runs two settings put system
commands, and the rest is just to detect the top activity.
From what I recall, apps only need WRITE_SECURE_SETTINGS for secure and global, not system. however, my batch script also force stops the launcher for the settings to take effect. I don't know if you're app can do that. After a reboot you should be fine.
Maybe you are interested in making an app that can set all the shorcut keys to any app 🙂 🙂?