keymapperorg / KeyMapper

An Android app that change what the buttons do on your devices!
http://docs.keymapper.club
GNU General Public License v3.0
1.06k stars 153 forks source link

Allow EMM/MDM solutions to deploy configs to the application #876

Open Losingthewires opened 2 years ago

Losingthewires commented 2 years ago

Developer TODO (don't remove)

EMMs and MDMs can interrogate an application manifest in order to configure settings on managed devices via application configs. It would be great if KeyMapper could support this or perhaps a way to deploy a configuration backup so that where it's required on a number of devices, the same config can be easily distributed and applied?

I appreciate a backup function exists - this could be used on a source device and the resulting configuration backup then sent to other devices running KeyMapper and the configuration automatically applied?

sds100 commented 2 years ago

@Losingthewires

Hi, I've never heard of EEMs and MDMs before but they seem to enterprise device management software right? How do this work exactly? I.e what would Key Mapper have to do to make them work? Key Mapper already supports the Android app backup/restore feature.

Losingthewires commented 2 years ago

Hi,

Correct - I am perhaps suggesting a more enterprise version of the software (perhaps for a fee) which enable organisations to both deploy the app and the associated configuration?

Deploying the app is easy - any Enterprise Mobility Management (EMM) or Mobile Device Management (MDM) should be able to do that from a managed Play Store.

What I am suggesting is that either direct configuration of the settings is possible by supplying keys as an application configuration or configuration designer where pre-defined keys can be set (e.g. boolean, values, etc.)

sds100 commented 2 years ago

Ah, interesting. Do you know of an organization interested in a key-mapping app for enterprise use? I've never used or heard much about EMM/MDM. I'm aware of Android for Work. Are there multiple solutions available? What do apps have to do to add support for the solution you're interested in?

Losingthewires commented 2 years ago

Hi,

I am hoping to use KeyMapper to enable Microsoft Teams Walkie Talkie on a range of devices - as you might be aware, Microsoft Teams is growing in popularity and the Walkie Talkie mode is being introduced steadily among its customers.

While the Push To Talk functionality can be deployed on 2 brands of device via an EMM deployment using vendor specific functions (OEMConfig), there are many that won't work or don't support this.

Here is where KeyMapper comes in to enable anything from BlackView to Zebra devices, for example.

If it's possible to pre-configure the settings (either via a payload or app config) then it's easy to deploy.

Even if the press and release intents are working and it's deployed via a backup file, this could work - it just requires something to be done on the device.

Hope this helps.

sds100 commented 2 years ago

Yeah, that makes it clearer what you want to do and it makes sense why you created the other issue. How do other apps do this pre-configuration step?

Losingthewires commented 2 years ago

Here is an example of the configuration settings available from the Microsoft Managed Homescreen app.

Config designer - Managed Homescreen

sds100 commented 2 years ago

Ah, I see. Does this work with any 3rd party app or do they have to implement some Microsoft API?

sds100 commented 2 years ago

Answered my own question I think :). I've had a quick look into this whole EMM thing and how it works with Android. Very interesting. It looks like all the EMM solutions use the Android Enterprise APIs and Android apps just need to implement some standard features to get it to work. Link to developer guide: https://developer.android.com/courses/pathways/android-enterprise-build-apps?hl=en

Losingthewires commented 2 years ago

Hi - yes, managed configurations is what is used , I believe and what exposes those settings. Not sure if it's something easy to include or a lot of work, which you may not want to do anyway?

sds100 commented 2 years ago

I'll need to look into it a bit more to see how to implement it exactly. The amount of work will depend on how much control you want over Key Mapper. Do you just want the ability to automatically deploy some key maps to a device? Would there by anything else you want to control? I wonder if there is a way to enable accessibility services as well automatically if you wouldn't want the user to have to configure anything themselves.

sds100 commented 2 years ago

Also, how will you get Key Mapper to trigger Microsoft Teams Walkie Talkie? Is this with an Intent action?

sds100 commented 2 years ago

FYI: A limitation to be aware of is that Android doesn't allow Key Mapper to detect key presses when the screen is off. Depending on your use-case this might be an issue.

Losingthewires commented 2 years ago

Hi - yes - it needs to send different broadcast intents on key press (PTT_Down) and release (PTT_up), hence the request.

I think the screen will be on in most cases when Walkie Talkie mode is in operation.

Losingthewires commented 2 years ago

So for teams, the key code could be different, depending on device but the action (send intent) would be the same and it would need to be long press on the key.

Losingthewires commented 2 years ago

Here it is on a Blackview BV9900E using the screen tap Action with a long-press on the programmable key.

WIN_20220110_20_36_00_Pro_AdobeCreativeCloudExpress (1)

sds100 commented 2 years ago

Hi - yes - it needs to send different broadcast intents on key press (PTT_Down) and release (PTT_up), hence the request.

I think the screen will be on in most cases when Walkie Talkie mode is in operation.

So this will be solved by #817. I'll need to think a bit about how to do this if I were to develop an UI for this. For your use case you don't even need a UI so maybe a "headless" Key Mapper could be something to think about... especially if you don't want people to mess with the configuration.

How do you know the intents to trigger PTT in Teams? Can you send some documentation?

Losingthewires commented 2 years ago

Hi Seth,

Apologies for not coming back to you.

I am probably not allowed to disclose those as they are not in the public domain at the moment, but a field into which a PTT_DOWN and PTT_UP intents can be put would be ideal.

Separately, is it possible to send custom key codes that simulate the key codes of SCAN buttons on rugged smartphones such as 291, 292, 293, 288, 287, 289 and 290?

Kind regards,

Rob Knight.

From: Seth Schroeder @.> Sent: 12 January 2022 15:22 To: sds100/KeyMapper @.> Cc: Losingthewires @.>; Mention @.> Subject: Re: [sds100/KeyMapper] Allow EMM/MDM solutions to deploy configs to the application (Issue #876)

Hi - yes - it needs to send different broadcast intents on key press (PTT_Down) and release (PTT_up), hence the request.

I think the screen will be on in most cases when Walkie Talkie mode is in operation.

So this will be solved by #817 https://github.com/sds100/KeyMapper/issues/817 . I'll need to think a bit about how to do this if I were to develop an UI for this. For your use case you don't even need a UI so maybe a "headless" Key Mapper could be something to think about... especially if you don't want people to mess with the configuration.

How do you know the intents to trigger PTT in Teams? Can you send some documentation?

— Reply to this email directly, view it on GitHub https://github.com/sds100/KeyMapper/issues/876#issuecomment-1011154666 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AXITJSH537UALRO3RKAVXSDUVWL73ANCNFSM5LYQYNSA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AXITJSAEC466RKWG4UIHROTUVWL73A5CNFSM5LYQYNSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHRCP52Q.gif Message ID: @. @.> >

sds100 commented 2 years ago

No worries.

Ah, okay, that's fine. Was wondering if I could make a dedicated Teams action but the Intent action will suffice for you.

With Key Mapper it is possible to send any key codes with an input-method but this will only send the key-code to the application with input focus. It does not send it to the system. E.g when KEYCODE_VOLUME_DOWN is sent with the IME it will not lower the volume because it isn't sent to the system. Key Mapper can use Shizuku to send key codes to the system but this requires the user to setup ADB or be rooted. I'm not sure if you want those key codes you mentioned to be sent to the system or an app.

Losingthewires commented 2 years ago

Hi Seth,

I have found that key code 290 seems to produce the correct result for MS Teams PTT, at least on one device I have anyway.

I think the intent approach is probably the easiest way to go as that won’t require users to enable developer options etc.

Kind regards,

Rob.

From: Seth Schroeder @.> Sent: 18 January 2022 17:19 To: sds100/KeyMapper @.> Cc: Losingthewires @.>; Mention @.> Subject: Re: [sds100/KeyMapper] Allow EMM/MDM solutions to deploy configs to the application (Issue #876)

No worries.

Ah, okay, that's fine. Was wondering if I could make a dedicated Teams action but the Intent action will suffice for you.

With Key Mapper it is possible to send any key codes with an input-method but this will only send the key-code to the application with input focus. It does not send it to the system. E.g when KEYCODE_VOLUME_DOWN is sent with the IME it will not lower the volume because it isn't sent to the system. Key Mapper can use Shizuku to send key codes to the system but this requires the user to setup ADB or be rooted. I'm not sure if you want those key codes you mentioned to be sent to the system or an app.

— Reply to this email directly, view it on GitHub https://github.com/sds100/KeyMapper/issues/876#issuecomment-1015637332 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AXITJSFQFT7DL2HHWSEQHVLUWWOJTANCNFSM5LYQYNSA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AXITJSHW44AQFFS6OWX5JXLUWWOJTA5CNFSM5LYQYNSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHSEWKVA.gif Message ID: @. @.> >

M1-K3 commented 2 years ago

Hi,

I'm also looking for solution for customer request of navigation key remapping (Recent -> Menu for example) as HW vendor offers solution just for HW key remap.

From my experience there are two things when we are talking regarding application automatic mass-deployment:

  1. How to enable automatic import of configuration - IMHO this could (or should) not be bound to Google services or EMM/MDM solution and should be independent of it. For example .xml or .json file with settings placed in app folder ( /Android/data/packagename/files/ ) at the time of installation or first run of app. And its up to the user how he will place the file there (manually or using EMM/MDM)
  2. On top of above enable Google managed configurations https://developer.android.com/work/managed-configurations that require Google services and managed Google account on the device and EMM/MDM that supports it (without any of these three things it would not work)
sds100 commented 2 years ago

On Android 11 and newer apps and the user can't read from arbitrary folders so the first request may have some issues. If you want to completely automate the process then the EMM solution must be able to grant Key Mapper permission to read from a folder that isn't just the Downloads folder. The user also now can't modify data in /Android/data/packagename/files. Can your EMM solution?

M1-K3 commented 2 years ago

Are we talking about /internal shared storage/Android/...? If not sorry for not being specific. If yes than it's more messed up than I thought. Regarding the EMM - yes they are able (or should be able) to grant permissions (at least in managed device mode)

sds100 commented 2 years ago

Yeah, we are.

M1-K3 commented 2 years ago

Ok, I've just checked it and I was able to browse /internal shared storage/Android/data folders on Android 11 device using system Files app but I was not able to copy anything there (just to Downloads). But when I've connected the device via USB to my computer and set USB mode to File Transfer I was able to copy what I want from the comp to the any /Android/data/ subfolder so that's sufficient for deployment purposes.

GL513 commented 2 years ago

Look at total commander file explorer for on the fly full filesystem access. That should be of use. On Wed, Feb 2, 2022, 9:35 AM M1-K3 @.***> wrote:

Ok, I've just checked it and I was able to browse /internal shared storage/Android/data folders on Android 11 device using system Files app but I was not able to copy anything there (just to Downloads). But when I've connected the device via USB to my computer and set USB mode to File Transfer I was able to copy what I want from the comp to the any /Android/data/ subfolder so that's sufficient for deployment purposes.

— Reply to this email directly, view it on GitHub https://github.com/sds100/KeyMapper/issues/876#issuecomment-1028001741, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATZ4UFXSBRYN7GKB2WEMG63UZE6LLANCNFSM5LYQYNSA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

M1-K3 commented 2 years ago

Look at total commander file explorer for on the fly full filesystem access. That should be of use.

IMHO we are not looking for the trick how to access the files. I've used the Files app as an example to confirm the permissions Seth mentioned. But if the /Android/data/ space is still accessible for the user using USB transfer than it in my opinion still make sense to implement auto-import feature even without whole Google managed config EMM/MDM solution (and managed config feature maybe implement on top of it or afterwards or so)

sds100 commented 2 years ago

Ah, I wasn't sure if you wanted the process completely automated. If you have USB transfer to each device and they can access the /Android/data/ folder then we should be good.

M1-K3 commented 2 years ago

For fully automated proces is EMM/MDM or at least some kind of phone vendor solution needed. So that will be used to place configuration file there. Your app "should just" be able to process it somehow without user interaction in the GUI of the app itself. This way it could work even without the requirement of Google Play services. This is at least what I'm used to in enterprise apps I work with - many of them also enabled managed configuration on top of that but It's pain in the a.. If there are lot of configuration options to set up.

sds100 commented 1 year ago

I know it has been a while but are you still interested in this feature?