{"id":21169577,"url":"https://github.com/pellaeon/reverse_eng_samsung_camera","last_synced_at":"2026-01-02T13:19:15.961Z","repository":{"id":146908246,"uuid":"169411867","full_name":"pellaeon/reverse_eng_samsung_camera","owner":"pellaeon","description":"Reverse engineering Samsung Android camera stack","archived":false,"fork":false,"pushed_at":"2019-02-06T14:24:10.000Z","size":22747,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-21T10:50:45.521Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pellaeon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-06T13:39:29.000Z","updated_at":"2024-10-13T22:23:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"6714ef11-d563-4622-ac93-70e2641b5c4e","html_url":"https://github.com/pellaeon/reverse_eng_samsung_camera","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pellaeon%2Freverse_eng_samsung_camera","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pellaeon%2Freverse_eng_samsung_camera/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pellaeon%2Freverse_eng_samsung_camera/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pellaeon%2Freverse_eng_samsung_camera/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pellaeon","download_url":"https://codeload.github.com/pellaeon/reverse_eng_samsung_camera/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243616227,"owners_count":20319855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T15:52:32.398Z","updated_at":"2026-01-02T13:19:15.916Z","avatar_url":"https://github.com/pellaeon.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n\nThis repository contains my note and collected tools to reverse engineer and understand the Samsung Android camera stack.\n\nEnvironment: Ubuntu 16.04\n\n# SamsungCamera app\n\nTo obtain the APK, we need to extract it from the system image.\n\n## Mount system.img\n\nOf course, you need to obtain your `system.img` from Samsung stock ROM. You can extract it from your rooted device or simply download from sites like [Sammobile](https://www.sammobile.com/FIRMWARES/).\n\n```\nsudo apt install android-tools-fsutils\nsimg2img system.img system.img.raw\nsudo mount -t ext4 -o loop system.img.raw /mnt/\n```\n\nref: http://omappedia.org/wiki/Android_eMMC_Booting#Modifying_.IMG_Files\n\nThe SamsungCamera app is located in `/mnt/priv-app/SamsungCamera7/SamsungCamera7.apk`, copy it somewhere and use standard APK analysis tool to analyze. A good all-in-one tool is the [Mobile Security Framework](https://github.com/MobSF/Mobile-Security-Framework-MobSF). I will not detail the steps here, since it's already covered by many other tutorials.\n\n## Analysis\n\nMain app should be this one: `com/sec/android/app/camera/Camera.java`, it delegates the camera operation to the \"Engine\".\n\nHere's the Engine interface `com/sec/android/app/camera/interfaces/Engine.java`, camera is opened by the implementation of the Engine, called \"CommonEngine\" here in `com/sec/android/app/camera/engine/CommonEngine.java`:\n\n```\n1547     private void openCameraDevice() {\n```\n\n`mCameraDevice` is of type `SemCamera`, i.e. `com.samsung.android.camera.core.SemCamera`, which is implemented in the system framework. So to understand camera operations, I need to look deeper into SemCamera.\n\nBut turned out getting the Java source code of SemCamera is not that easy..\n\n# SemCamera system framework\n\n## Deodex framework odex\n\n`/mnt/framework/semcamera.jar` is just empty, a quick search of files named `\"semcamera*\"` returned `/mnt/framework/oat/arm/semcamera.odex`, looking at the file size, there should be something inside.\n\nDeodex:\n\n```\njava -jar baksmali-2.2.6.jar x /mnt/framework/oat/arm/semcamera.odex -d /mnt/framework/arm/\n```\n\nDeodexed smali files will be put in `out/`\n\nref:\n- https://www.jianshu.com/p/a1f4ffc0254e\n- https://github.com/JesusFreke/smali/wiki/DeodexInstructions\n\nUse `smali` to assemble dex:\n\n```\njava -jar smali-2.2.6.jar out -o classes.dex\n```\n\nUse `jadx` to put back Java source:\n\n```\nbin/jadx -d java_out out.dex\n```\n\nResult Java source will be put in `java_out`. Now I get the source code!\n\n# Next steps\n\n- [ ] get source code of other libraries that SamsungCamera depends on\n- [ ] look at the source code!\n\n## References\n\n- Related work: https://hackcorrelation.blogspot.com/2017/08/a-look-inside-samsung-s7-camera.html\n- https://dorylabs.com/enable-1440p-video-recording-60fps-on-galaxy-s8/\n\nOther ports I have found:\n\n- https://forum.xda-developers.com/galaxy-s8/themes/port-samsung-s9-camera-port-ar-emoji-t3826284\n- https://forum.xda-developers.com/note5/themes-apps/s8-camera-port-t3592871/page3\n\nTo understand camera app operations, take a look at [OpenCamera source code](https://github.com/almalence/OpenCamera/blob/master/src/com/almalence/opencam/cameracontroller/CameraController.java)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpellaeon%2Freverse_eng_samsung_camera","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpellaeon%2Freverse_eng_samsung_camera","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpellaeon%2Freverse_eng_samsung_camera/lists"}