[MAGISK] Google camera with telephoto lens

Search This thread

sipollo

Senior Member
Jan 4, 2015
577
459
Hi everybody!
I made a very simple module to expose auxiliary camera to @cstark27 Google Camera port.
As you may know his app is targeted to LGs wide cameras, but with this module you can use his app to take wonderful shots with our telephoto lens.
I originally posted here:
http://www.androidiani.com/forum/mo...ocamera-zoom-2x-ottico-con-google-camera.html

UPDATE V2:
Now is included fix for WhatsApp camera crashes when rotating phone.
https://xdaforums.com/showpost.php?p=76506333&postcount=134

CUSTOM ROMS version:

This version enables Zoom support for Cstark27 "wide" versions WITHOUT breaking stock camera portrait mode.

I had to merge my fix with @ramesh1686 work.
https://xdaforums.com/showpost.php?p=77984552&postcount=289

Known bugs:

Sometimes setting flash to "auto" makes dark photos. Set flash ON or OFF instead.

Istructions:

Install the module you need.
Reboot.


Install one of Cstark27 Google Camera "wide" or "tele" port.

Enjoy :)

Tested with Xiaomi mi a1 but it might work with other models too. (Dual cameras models of course)

A quick comparison:
http://www.androidiani.com/forum/mo...reo-porting-google-camera-31.html#post7995410
 
Last edited:

cstark27

Senior Member
Jul 2, 2010
1,240
7,270
Nice work! Hopefully this gets it in the hands of more capable devs! I look forward to seeing the progress.

PS: V3.3 is a couple versions old, but if it works the best no problem. Just though I'd mention that. The up to date thread can be found here.

Here's what's changed to access the secondary rear camera for Google Camera. The code is a little different on my newer versions because I added a toggle to fix LG G6 Lineage OS Camera ID, but the concept is the same and this is simpler to show.

iga.smali
Code:
    :cond_0
    :try_start_1
    iget-object v0, p0, Liga;->b:Landroid/hardware/camera2/CameraManager;

    invoke-virtual {v0}, Landroid/hardware/camera2/CameraManager;->getCameraIdList()[Ljava/lang/String;

    move-result-object v2

    invoke-static {v2}, Liya;->b(Ljava/lang/Object;)Ljava/lang/Object;

    new-instance v3, Ljava/util/ArrayList;

    array-length v0, v2

    invoke-direct {v3, v0}, Ljava/util/ArrayList;-><init>(I)V

    array-length v4, v2

    const/4 v0, 0x1     [B]<------------ Start at Camera ID 1 (Front Camera)[/B]

    :goto_0
    if-ge v0, v4, :cond_1     [B]<------------ If greater or equal to 'v4' then skip the code below and continue[/B]

    aget-object v5, v2, v0

    new-instance v6, Ligc;

    invoke-static {v5}, Ligc;->a(Ljava/lang/String;)Ljava/lang/Integer;

    move-result-object v7

    invoke-direct {v6, v5, v7}, Ligc;-><init>(Ljava/lang/String;Ljava/lang/Integer;)V

    invoke-interface {v3, v6}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    add-int/lit8 v0, v0, 0x1     [B]<------------ Add 1 to counter to end at Camera ID 2 (Secondary rear)[/B]

    goto :goto_0     [B]<------------ Loop back to goto_0 label[/B]


ecu.smali This edit fixes it so ZSL HDR+ works
Code:
    const-string v4, "Acquired metadata from the first frame."

    invoke-interface {v3, v4}, Licu;->b(Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/util/concurrent/ExecutionException; {:try_start_0 .. :try_end_0} :catch_0

    move-object/from16 v0, p0

    iget-object v3, v0, Lecu;->e:Lgdq;

    invoke-interface {v3}, Lgdq;->a()Ligc;

    move-result-object v3

    invoke-virtual {v3}, Ligc;->a()I

    move-result v4
	
	const v3, 0x2      [B]<----- add this line. Sets a variable to 2 (Camera ID 2)[/B]
	
	if-ne v4, v3, :cond_f    [B] <--------- add this line. If v4 is not equal to v3, skip over next line (this means if Camera ID is not 2, then keep the ID number and carry on)[/B]
	
	const v4, 0x0       [B]<-------- add this line. Sets the variable to 0 (Camera ID 0). This means that if the Camera ID is set to 2 (Wide Angle app) then we need to make GCam think the ID is 0 for it to do ZSL HDR+ Processing.[/B]
	
	:cond_f           [B]<-------- add this line for the reference above[/B]
    :try_start_1
    move-object/from16 v0, p0

    iget-object v3, v0, Lecu;->c:Licu;

    const-string v5, "Starting HdrPlus#ZslShotCapture."


To get all cameras working in the app, we probably need to add a toggle that goes back to iga.smali and changes the start value to 0. Good luck!
@aer0zer0 this thread may be worth checking out for your phone/mods.
 
Last edited:

duniatri

Senior Member
Apr 8, 2013
197
43
Yes, it's working great. I'm using latest version of @cstark27 Gcam. Hdr+ result for zoom camera is also great!
Thanks for your works!

Just one question, is there any possibility in the future that one moded Gcam can use both normal and zoom lens? Like it has a switch to choose between normal and zoom lens.

Now i have 3 camera version, miui cam, arnova's, and cstark's. I think that's too much :D
 

Rajeev

Inactive Recognized Contributor
Nov 24, 2012
16,306
26,540
Chennai , I N D I A
Xiaomi 13 Pro
Yes, it's working great. I'm using latest version of @cstark27 Gcam. Hdr+ result for zoom camera is also great!
Thanks for your works!

Just one question, is there any possibility in the future that one moded Gcam can use both normal and zoom lens? Like it has a switch to choose between normal and zoom lens.

Now i have 3 camera version, miui cam, arnova's, and cstark's. I think that's too much :D

Which one u using latest? Normal or wide cam ?
 

duniatri

Senior Member
Apr 8, 2013
197
43

Attachments

  • Screenshot_20180324-100719.png
    Screenshot_20180324-100719.png
    99.6 KB · Views: 4,361
  • Like
Reactions: burimi007

cstark27

Senior Member
Jul 2, 2010
1,240
7,270
Nope. No force close on setting and video on last version. All good so far :good:

That's Arnova's version I believe. The Wide (zoom) app should say Camera (Wide). My version Settings doesn't have the margins in the left and has a couple different options.

I'm going to assume that there's no Video related parameters available through the Camera2 API for the Zoom lens, so when you try to go to settings it crashes when it's trying to find that info. Not sure when I'll have time to dig into for you guys.

How does GCam 2x digital zoom on your regular lens compare to using GCam on the Zoom lens?
 
  • Like
Reactions: sipollo

Rajeev

Inactive Recognized Contributor
Nov 24, 2012
16,306
26,540
Chennai , I N D I A
Xiaomi 13 Pro
Finally no more ****ty Beauty mod.. Superb.. If we get working settings then can make some changes too...

@sipollo and @cstark27 thanks for everything
 

Attachments

  • IMG_20180324_103025.jpg
    IMG_20180324_103025.jpg
    221.9 KB · Views: 1,731
  • 00100sPORTRAIT_00100_20180324103004572_COVER.jpg
    00100sPORTRAIT_00100_20180324103004572_COVER.jpg
    250.1 KB · Views: 1,744

joeyhuab

Recognized Developer
Same version that available in OP bro. And my primary GCam is MGC Final v3.4. Using cstark version only for Telephoto... I think only cstark version support Telephoto. Am i correct?

Thanks! Will stock to Tolyan's version for primary GCam. :) Will stick to v3.3 for Camera (Wide) but hopefully someone updates the app for v3.6 support.
 

duniatri

Senior Member
Apr 8, 2013
197
43
That's Arnova's version I believe. The Wide (zoom) app should say Camera (Wide). My version Settings doesn't have the margins in the left and has a couple different options.

I'm going to assume that there's no Video related parameters available through the Camera2 API for the Zoom lens, so when you try to go to settings it crashes when it's trying to find that info. Not sure when I'll have time to dig into for you guys.

How does GCam 2x digital zoom on your regular lens compare to using GCam on the Zoom lens?

It's your cam. I can go to settings, open video, and even see 'about' to see your cam version. See my screenshot. Ohya, video recording also works :good:
 

Attachments

  • Screenshot_20180324-124559.png
    Screenshot_20180324-124559.png
    142.3 KB · Views: 1,404
  • Screenshot_20180324-124634.jpg
    Screenshot_20180324-124634.jpg
    229 KB · Views: 1,394

joeyhuab

Recognized Developer
It's your cam. I can go to settings, open video, and even see 'about' to see your cam version. See my screenshot. Ohya, video recording also works :good:

Which ROM are you using and what other modules do you have installed? I installed the module and APK linked in the OP but the Camera (Wide) crashes in Pixel Experience ROM.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 47
    Hi everybody!
    I made a very simple module to expose auxiliary camera to @cstark27 Google Camera port.
    As you may know his app is targeted to LGs wide cameras, but with this module you can use his app to take wonderful shots with our telephoto lens.
    I originally posted here:
    http://www.androidiani.com/forum/mo...ocamera-zoom-2x-ottico-con-google-camera.html

    UPDATE V2:
    Now is included fix for WhatsApp camera crashes when rotating phone.
    https://xdaforums.com/showpost.php?p=76506333&postcount=134

    CUSTOM ROMS version:

    This version enables Zoom support for Cstark27 "wide" versions WITHOUT breaking stock camera portrait mode.

    I had to merge my fix with @ramesh1686 work.
    https://xdaforums.com/showpost.php?p=77984552&postcount=289

    Known bugs:

    Sometimes setting flash to "auto" makes dark photos. Set flash ON or OFF instead.

    Istructions:

    Install the module you need.
    Reboot.


    Install one of Cstark27 Google Camera "wide" or "tele" port.

    Enjoy :)

    Tested with Xiaomi mi a1 but it might work with other models too. (Dual cameras models of course)

    A quick comparison:
    http://www.androidiani.com/forum/mo...reo-porting-google-camera-31.html#post7995410
    20
    I have an alpha GCam for you guys. If someone else wants to pick up development for A1 Tele lens be my guest. I won't have much time.

    Requires the Magisk module from @sipollo of course.

    GCam_5.1.018_24_tele_v0.1a https://drive.google.com/open?id=1RfobiV3FH9ApVYWv2XykmA9_g5d92PO2
    -Based off cstark27 wide V3.6
    -Remove the Camera ID toggle for LG G6
    -Remove HDR+ mode resetting after going to Settings
    -Change default zoom on rear Portrait Mode to 1x (from default 1.5x)
    -Change app icon color and shortcut name to Camera (Tele)

    GCam_5.1.018_24_tele_v0.1b https://drive.google.com/open?id=1ISTpNO-FTvbzctKi2-M0MWjmAlm5iWZE
    -Replace App Shortcut "Take a Video" with "Portrait" (long press Camera (Tele) shortcut)
    -Replace swipe to Video action with swipe to Portrait
    --bug: shutter button shows as Video Record button but when you click it, it will capture a Portrait
    --bug: Top bar doesn't show proper Portrait Mode icons
    -The rest is the same as v0.1a
    16
    @sipollo
    GCam_5.1.018_by_SerJo87_1.6RC2_test4d_fixed-Fu24-6.apk
    Changelog:
    * Change the wide angle / telephoto switching mode. Hold the camera switch icon (it should be red now) and exit the settings window that pops up. Then the camera ID will be changed.
    * Add adjust bitrate of video by IDan1109.
    * The maximum brightness of the screen is changed within the setting.
    * Resolution for main and aux lens separated.

    Switching the aux back lens must install a module with zoomfix.
    This is suitable for MI A1.
    https://xdaforums.com/showpost.php?p=77849079&postcount=247
    12
    1.6RC3_pre-Release: https://www97.zippyshare.com/v/Ek8CvHLu/file.htm

    This is new test version with new features

    Changelog:
    THE CAMERA MUST BE INSTALLED CLEAN WITH REMOVAL PREVIOUS !!!
    + added experimental settings with settings from different mods (see Experimental Settings);
    + setting ToneMap_Mode, Noise_Reduction_Mode, Edge_Mode;
    + at the zoom of the photo resolution, upscale to full resolution of the camera tasks (in the settings of the Resampling method: Raisr) (B-S-G);
    + hevc entry is enabled by default (it is turned off in the developer settings);
    + Motion Photo is turned off by default (enabled in developer settings);
    + RAW is activated for the front-facing camera by default (When HDR + RAW + JPG is activated, all cameras are shot in RAW, in other cameras the front-facing camera does not take off, you need to make additional movement to activate);
    + video bitrate (IDan1109), framerate above 60 does not work;
    + added the ability to use the second rear camera sensor (Cstark27);
    + changed settings of HDR + Parameters (from the minimum available to the maximum in the camera);
    + Added HDR Saturation adjustment (B-S-G);
    + Fixed telephoto crash when using the camera (now the problem frame is skipped and it is possible to take the next frame);
    + for convenience, switching to the second rear camera module is done by holding the camera switching button (front <-> rear);
    + option maximum brightness viewfinder;
    + Fixed the option to select the save directory (the SD entry does not work. Should work with the module for Magisk (check later));
    + configuration settings from nHappyMann "without omni- (gnome-) points";
    + fixed flash;
    + editing the library on the gamut (eszdman) + ISO changes (Wave Generator);
    + menu item of removal of restrictions on ISO (B-S-G);
    + menu item to remove restrictions on HDR + parameters (buffer) in any light (Idan1109);
    + the ability to take a picture by holding the “MENU” button (useful for phones with a diagonal> 5.5) (B-S-G);
    + the name of the photos starts with PHOTO_ instead of IMG_ for clarity and comparison;
    + Maybe something else, all that I remember is written.

    This magisk module for stable work telephoto lens on Mi A1: https://www110.zippyshare.com/v/o5QVAsFi/file.html

    To obtain the maximum image quality, we activate Advanced HDR + and set the Parameters HDR + to Maximum, well, if desired, auto-exposure mode - Exposure max. Everything! The rest can be used in stock condition. Balance your auto-exposure mode settings and HDR + Parameters to get your dzen.
    11
    Nice work! Hopefully this gets it in the hands of more capable devs! I look forward to seeing the progress.

    PS: V3.3 is a couple versions old, but if it works the best no problem. Just though I'd mention that. The up to date thread can be found here.

    Here's what's changed to access the secondary rear camera for Google Camera. The code is a little different on my newer versions because I added a toggle to fix LG G6 Lineage OS Camera ID, but the concept is the same and this is simpler to show.

    iga.smali
    Code:
        :cond_0
        :try_start_1
        iget-object v0, p0, Liga;->b:Landroid/hardware/camera2/CameraManager;
    
        invoke-virtual {v0}, Landroid/hardware/camera2/CameraManager;->getCameraIdList()[Ljava/lang/String;
    
        move-result-object v2
    
        invoke-static {v2}, Liya;->b(Ljava/lang/Object;)Ljava/lang/Object;
    
        new-instance v3, Ljava/util/ArrayList;
    
        array-length v0, v2
    
        invoke-direct {v3, v0}, Ljava/util/ArrayList;-><init>(I)V
    
        array-length v4, v2
    
        const/4 v0, 0x1     [B]<------------ Start at Camera ID 1 (Front Camera)[/B]
    
        :goto_0
        if-ge v0, v4, :cond_1     [B]<------------ If greater or equal to 'v4' then skip the code below and continue[/B]
    
        aget-object v5, v2, v0
    
        new-instance v6, Ligc;
    
        invoke-static {v5}, Ligc;->a(Ljava/lang/String;)Ljava/lang/Integer;
    
        move-result-object v7
    
        invoke-direct {v6, v5, v7}, Ligc;-><init>(Ljava/lang/String;Ljava/lang/Integer;)V
    
        invoke-interface {v3, v6}, Ljava/util/List;->add(Ljava/lang/Object;)Z
    
        add-int/lit8 v0, v0, 0x1     [B]<------------ Add 1 to counter to end at Camera ID 2 (Secondary rear)[/B]
    
        goto :goto_0     [B]<------------ Loop back to goto_0 label[/B]


    ecu.smali This edit fixes it so ZSL HDR+ works
    Code:
        const-string v4, "Acquired metadata from the first frame."
    
        invoke-interface {v3, v4}, Licu;->b(Ljava/lang/String;)V
        :try_end_0
        .catch Ljava/util/concurrent/ExecutionException; {:try_start_0 .. :try_end_0} :catch_0
    
        move-object/from16 v0, p0
    
        iget-object v3, v0, Lecu;->e:Lgdq;
    
        invoke-interface {v3}, Lgdq;->a()Ligc;
    
        move-result-object v3
    
        invoke-virtual {v3}, Ligc;->a()I
    
        move-result v4
    	
    	const v3, 0x2      [B]<----- add this line. Sets a variable to 2 (Camera ID 2)[/B]
    	
    	if-ne v4, v3, :cond_f    [B] <--------- add this line. If v4 is not equal to v3, skip over next line (this means if Camera ID is not 2, then keep the ID number and carry on)[/B]
    	
    	const v4, 0x0       [B]<-------- add this line. Sets the variable to 0 (Camera ID 0). This means that if the Camera ID is set to 2 (Wide Angle app) then we need to make GCam think the ID is 0 for it to do ZSL HDR+ Processing.[/B]
    	
    	:cond_f           [B]<-------- add this line for the reference above[/B]
        :try_start_1
        move-object/from16 v0, p0
    
        iget-object v3, v0, Lecu;->c:Licu;
    
        const-string v5, "Starting HdrPlus#ZslShotCapture."


    To get all cameras working in the app, we probably need to add a toggle that goes back to iga.smali and changes the start value to 0. Good luck!
    @aer0zer0 this thread may be worth checking out for your phone/mods.