KeyMapper
KeyMapper copied to clipboard
Allowing camera "Pro" mode to be launched by KeyMapper
Thank you for creating this great app!
It's oh so close to being exactly what I want, and I think it probably can be enhanced to do what I want.
I want to be able to open the "Pro" mode of Samsung's native camera app using your app. Samsung's native camera app comes with it's own launcher icon (like all apps) and within their Camera app, there is an option to create another launcher icon for the "Pro" mode.
Although the icon for that "Pro" mode appears in any launcher (including third-party launchers), it is not available in KeyMapper.
Can we work together to make it available?
Yeah!
We need to figure out what is the Intent it is sending. Have you ever used ADB (Android Debug Bridge)? If not, I'll guide you through setting it up (if you need it) and entering commands to figure it out.
this is for future reference command to type in: adb shell; dumpsys activity broadcasts |grep -iE ".+.[0-9A-Z_-]+:$" |sort
Several years ago, I used ADB quite a bit. I haven't needed to use it since then, so I'm a bit rusty, but I imagine it's like riding a bicycle.
I have v22 and v26 ready to go, as that's what I was using at the time. Will those versions work with Nougat 7.0? I don't want to mess up my day-to-day phone, especially with COVID-19 being a big issue.
If I need a newer version of ADB, just let me know.
Also, what steps would you like me to take while dumpsys is running?
Outside of ADB, another possibility is that I have Nova Launcher Pro installed, and it can generate backup files. If creating a Nova backup and looking in that file might give you the answers you need, that would be real fast and easy for me.
Yeah, can you post the nova launcher backup file on here so I can take a look?
I can do better than that! :)
I happen to be skilled at data and file analysis. Looking in the backup file with a hex editor, I determined it is a renamed compressed ZIP file (using the Deflate algorithm) with XML and SQL files inside.
Here is all the relevant data from those files:
intent #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x14200000;component=com.sec.android.app.camera/.Camera;S.activity_name=com.sec.android.app.camera.shootingmode.pro;l.profile=-1;end
iconPackage com.sec.android.app.camera
iconResource com.sec.android.app.camera:drawable/home_ic_pro_pressed
oh wow, thank you! ill have a go making an action today. ill upload an apk for you test with here
You're welcome... and thank you!.
here, try this. the action is at the bottom of the "other" tab. app-debug.zip
Thank you so much! I will test it very soon and report back to you how it goes.
I gave it a try. Here's what I did and what happened:
Steps Taken:
- Installed app-debug.apk on Android 7.0
- Launched it
- Turned on accessibility services for it
- Did not do anything else (did not turn off battery optimization, did not enable WRITE_SECURE_SETTINGS, did not enable "Keycode"/"Key"/"Text", did not give Do Not Disturb access.)
- Clicked the red plus sign
- Clicked Choose Action
- Scrolled to Other heading
- Selected "Samsung Camera Pro Mode"
- Pressed Test
Result: Nothing happens for 5-6 seconds. Then the app crashes.
I repeated steps 2-9 (skipping step 3, as it was unneeded for repeat tests) 5 times, and each time the result was identical.
I then turned on in-app logging and repeated the test, but nothing besides the "Accessibility service enabled" message appeared in the log.
That's my report! :)
okay, thanks for trying! i'll make sure the crash is reported into the app's log and then try again to figure out what is causing it to crash.
try this! app-debug.zip
Thanks. Here's the error:
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.sec.android.app.camera/Camera}; have you declared this activity in your AndroidManifest.xml?
try this app-debug.zip
Same error in log.
im trying to figure out the activity name... app-debug (2).zip
It's not just com.sec.android.app.camera.shootingmode.pro?
oh, yeah it is. my bad. I meant I am trying to figure out the "component" in the Intent. maybe i dont need it... try this... app-debug (3).zip
ok... I tried app-debug (2).zip - it didn't crash, but brought up the regular (non Pro) camera. There was a message in the log about not supporting Samsung Dex.
Trying app-debug (3).zip momentarily.
You successfully launched the Gallery. That might be useful too. :)
haha, can you try this one... app-debug (4).zip
Testing it momentarily. BTW, I just asked Stanley (https://f-droid.org/en/packages/fr.xgouchet.packageexplorer/) for details, but I don't see anything that I think will be helpful.
The camcorder activity is .Camcoder. That would be a great one to have as well.
can you upload the apk so I can have a look at Stanley?
the camera
i like to use this... https://play.google.com/store/apps/details?id=com.javiersantos.mlmanager
thanks
can you upload it again, i accidently stopped the download and cant download again.
i wont mess up this time....
got it. :)
did you try app-debug (4).zip?
Yes, it loads the camera in non-Pro mode.
try this one... we will get there eventually. 😄 app-debug (5).zip
I have great confidence in you. :)
It also loads the camera in non-Pro mode.
I tried shoving the entire device into the Ethernet port to send it directly to you, but it didn't fit. ;)
v6 = non-pro cam v7 = error 'Unable to find explicit activity class...' v8 = error 'Unable to find explicit activity class...'
If you need the exact error strings, I can get those for you.
I don't know if it's relevant, but there is an S. before the activity name:
#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x14200000;component=com.sec.android.app.camera/.Camera;S.activity_name=com.sec.android.app.camera.shootingmode.pro;l.profile=-1;end
What's the significance of the S.?
i have no idea 😂 but it isnt a part of the activity name. can you give me the exact error strings?
actually, i have an idea what it is....
Here are the full error strings for v7 and v8:
v7 android.content.ActivityNotFoundException: Unable to find explicit activity class {com.sec.android.app.camera/com.sec.android.app.camera.shootingmode.pro}; have you declared this activity in your AndroidManifest.xml?
v8 android.content.ActivityNotFoundException: Unable to find explicit activity class {com.sec.android.app.camera/.shootingmode.pro}; have you declared this activity in your AndroidManifest.xml?
Ill try v9 now.
SUCCESS!!!!! :)
What was it?
yaayyy. the S. and l. were very significant. they are the data types of the Extras attached to the Intent. E.g S. means the Intent has a string extra called "com.sec.android.app.camera.shootingmode.pro". Thank you for making me think harder about it and question myself! 😄
so it works reliably? can you try remapping a key to it and seeing what happens.
I had a hunch! :)
What does an I. represent?
Can you add an item for the camcorder too?
The camcorder activity is .Camcoder
I'll try remapping a key now.
It is an L. the L means Long. hard to distinguish between 1, I, and l in many fonts. 😄 yeah, I'll that as well.... gimme a few mins...
Long integer?
I mapped the Pro camera mode to the camera button, and it works! There is a fairly long delay though. Maybe 3 seconds after pressing the camera button, the camera loads. Normally it's instantaneous.
Within Key Mapper or another app, it's instant; but from the launcher it's 3-4 seconds. Hmmm...
yeah, a Long integer. So the keymap works instantaneously from all apps except the launcher?
Correct.
thats strange. since it is just the launcher and not globally, I'll assume it isn't my fault for now.... do you have a different launcher to try it with?
what other camera modes does the samsung camera app have? I might as well add them all...
can you give me the same intent information you gave me before.
I'm using Nova Launcher Prime v6.2.9.
I just tried it with the default Samsung launcher (TouchWiz? I don't know), and there is no delay.
Why in the world would there be a delay in Nova?
intent #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x14200000;component=com.sec.android.app.camera/.Camera;S.activity_name=com.sec.android.app.camera.shootingmode.pro;l.profile=-1;end
The activity name for the camcorder is .Camcoder I'll get the other camera modes.
i have no idea. thank you.
Think harder! :) :) :) LOL
The camera settings are: .setting.CameraSettingActivity
More to follow...
can you make shortcuts for the other modes and extract the intent data for them as well? i need to know the S.activity_name and l.profile
The regular camera is ,Camera The camcorder is .Camcorder
For settings, there is also .SettingReceiveActivity, but I kinda doubt that is useful.
All the other activities are help activities and other stuff that I don't think anyone would find useful.
Just got your last message. Yes, I can definitely do that. Would it be okay with you if we resume in 10-15 hours?
yeah, no problem! just send me the stuff whenever you can and I'll get on top of it as soon as possible.
Thanks so much for everything. It's great working with you.
That was a long hour!
Here are all the intents. The only things I haven't been able to figure out are:
- The
l.profile=-1. Any ideas? - The long delay in Nova Launcher Prime. Any chance that could be related to
l.profile=-1?
BTW, notice that the launchFlags are not all identical.
Live Broadcast #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x30220000;component=com.sec.android.app.camera.plb/.Camera;S.activity_name=com.sec.android.app.camera.plb.Camera;end
Virtual shot #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x14200000;component=com.sec.android.app.camera/.Camera;S.activity_name=com.sec.android.app.camera.shootingmode.virtualshot;end
Video collage #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x14200000;component=com.sec.android.app.camera/.Camera;S.activity_name=com.sec.android.app.camera.shootingmode.videocollage;end
Slow motion #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x14200000;component=com.sec.android.app.camera/.Camera;S.activity_name=com.sec.android.app.camera.shootingmode.slowmotion;end
Selective focus #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x14200000;component=com.sec.android.app.camera/.Camera;S.activity_name=com.sec.android.app.camera.shootingmode.selectivefocus;end
Pro #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x14200000;component=com.sec.android.app.camera/.Camera;S.activity_name=com.sec.android.app.camera.shootingmode.pro;l.profile=-1;end
Pro #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x14200000;component=com.sec.android.app.camera/.Camera;S.activity_name=com.sec.android.app.camera.shootingmode.pro;end
Panorama #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x14200000;component=com.sec.android.app.camera/.Camera;S.activity_name=com.sec.android.app.camera.shootingmode.panorama;end
Fast motion #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x14200000;component=com.sec.android.app.camera/.Camera;S.activity_name=com.sec.android.app.camera.shootingmode.fastmotion;end
Auto #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x14200000;component=com.sec.android.app.camera/.Camera;S.activity_name=com.sec.android.app.camera.shootingmode.auto;end
Camera #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.sec.android.app.camera/.Camera;l.profile=-1;end
thank you! i have no idea what L.profile means now. I thought it meant something to do with the "mode" (profile) to launch the camera in. E.g -1 = pro mode. But that doesn't seem to be the case. I'll send you an apk which doesn't attach the L.profile to the intent.
Great! Is v11 the same as v10, but v10 doesn't have the L.profile and v11 does?
Can you make a single version with L.profile and without? Then I can quickly test them back-to-back to see if there are differences. You can postfix items with L.profile with (L) in the UI for now.
V10 is exact same as v9 but doesn't have the l.profile.
So I can test all the possibilities together, can you add the two l.profile items to v11?
Yes to both questions. If you could test V10 and V11 to see if all the modes work, that would be great. let me know which ones work and don't work.
ok... So both v10 and v11 have all the modes (and v11 adds l.profile, whereas v10 has no l.profile intents)?
I'm a little confused because reading through our thread it looks like v10 was finished before you added all the modes.
Yeah, only v11 has all the modes. V10 is exact same as V9 except for I made V10 to test whether the l.profile is even needed for any of the intents which seem to need it.
That's what I thought. Don't we need to test both of the intents that have l.profile (in the details I provided) with and without the use of the l.profile param?
Yeah, I'll do that once I know that the l.profile is even required for atleast one of them. If the Pro mode doesn't open without l.profile and doesn't make a difference to the Nova launcher behaviour, then I'll assume that it is needed for them all.
OK... I'm curious to see if l.profile makes a difference for any of the intents, even if it's not required. That's why I was thinking of having a version where all the intents are available without l.profile (I currently don't have the option to test). Does that make sense to you?
Yeah, I'll do that now... first test v10 and v11 while I do this...
Sorry for the short delay in testing this. A few high priority items hit at the same time.
Don't worry. There is no rush.
ok... not rushing... but definitely soon... haven't forgotten... just real busy.
Hi. I invested some time testing Key Mapper debug versions 10-13. The results are below.
Note that the "video mode" always opened in "auto mode", but perhaps there is no distinct video mode for this version of Samsung Camera. I recommend just including it for the sake of completeness and in case other versions of the Samsung Camera app support a special video mode. Also, you'll likely want to make sure you check the code for video mode just to make sure there isn't an error for that mode.
Debug v10
Pro - Yes Long Delay for Trigger to Respond from Nova Launcher - Yes Able to still open default camera afterwards - Yes
Debug v11
Camera - Y Video - NO, Opened in Auto Mode Pro - Y Live Broadcast - Crashed Key Mapper Virtual Shot - Y Video Collage - Y Slow Motion - Y Selective Focus - Y Panorama - Y Fast Motion - Y Auto - Y Long Delay for Trigger to Respond from Nova Launcher - Yes Able to still open default camera afterwards - Yes
Debug v12
Pro - Error android.content.ActivityNotFoundException: Unable to find explicit activity class (com.sec.android.app.camera/.Camera); have you declared this activity in your AndroidManifest.xml?
Debug v13
Camera - Y Video - NO, Opened in Auto Mode Pro - Y Live Broadcast - Crashed Key Mapper Virtual Shot - Y Video Collage - Y Slow Motion - Y Selective Focus - Y Panorama - Y Fast Motion - Y Auto - Y Long Delay for Trigger to Respond from Nova Launcher - No!!! Able to still open default camera afterwards - Yes Weird Behavior - Home button now tries to load Google Assistant, even though nothing has been remapped for that button
the video mode didn't work because I forgot to add the activity name for it when creating the intent. fixing that now...
i think i've fixed the video issue. i've tried something different with the live broadcast one, not sure it fixes it.
I'll give v14 a whirl. Do you know why v13 worked so well with Nova Launcher, as compared to the previous versions? Also, any insight as to why it messed up the Home button?
I've got no idea why it messed up the Home button. 😄
implemented
@sds100 Thanks. I don't think I performed all the testing and variations you wanted. Doing so has been on my list, but I've been so busy. I am sorry. If you want me to test something, just point me to it.
Oh yeah, we didn't finish testing. I thought it was implemented by mistake
Can you just test v14? I felt confident that everything had been fixed.
Can you just test v14? I felt confident that everything had been fixed.
Yes. I've prioritised the task, but if I don't get it done soon enough for you, just let me know and I'll make room for it in the urgent queue one way or another.
There is no rush or deadline. I consider this your feature since no one else has requested it. I will just merge it into whatever release is ready whenever you have tested it..
Thank you. It's actually been weighing on me that I haven't had the time to get it done. I'm going to make a push for it this weekend. I have already blocked off 30 minutes in my schedule for this project. I just hope the phone doesn't keep ringing with urgent issues.
@Gitoffthelawn keymapper-samsung-camera-actions-v15.zip This is updated to the latest version of Key Mapper.
Got it. Thank you.
@Gitoffthelawn I remember us talking about this 2 years ago 😂 Still here?
@sds100 Hi Seth. I'm still here. Glad you are too. :)
Do the samsung camera actions I put in that apk from 2 years ago work?
@Gitoffthelawn Do you still want this feature? Otherwise I'll just close it. Have a 2 year old branch 😂😂
@sds100 Yes, I'm still interested in this feature. 😃 I thought, perhaps mistakenly, that when you wrote "This is updated to the latest version of Key Mapper." that you meant you added it to the main branch. Did you happen to mean something else?
It looks like I was asking you to test v14, can you test it?