FORUMS
Remove All Ads from XDA

[MAGISK] Google camera with telephoto lens

513 posts
Thanks Meter: 360
 
By sipollo, Senior Member on 23rd March 2018, 11:11 AM
Post Reply Email Thread
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/mod...le-camera.html

UPDATE V2:
Now is included fix for WhatsApp camera crashes when rotating phone.
https://forum.xda-developers.com/sho...&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://forum.xda-developers.com/sho...&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/mod...ml#post7995410
The Following 47 Users Say Thank You to sipollo For This Useful Post: [ View ] Gift sipollo Ad-Free
 
 
23rd March 2018, 04:13 PM |#2  
Senior Member
Thanks Meter: 9
 
More
cool
The Following User Says Thank You to jeneb11 For This Useful Post: [ View ] Gift jeneb11 Ad-Free
23rd March 2018, 06:47 PM |#3  
cstark27's Avatar
Senior Member
Thanks Meter: 4,739
 
Donate to Me
More
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     <------------ Start at Camera ID 1 (Front Camera)

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

    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     <------------ Add 1 to counter to end at Camera ID 2 (Secondary rear)

    goto :goto_0     <------------ Loop back to goto_0 label

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      <----- add this line. Sets a variable to 2 (Camera ID 2)
	
	if-ne v4, v3, :cond_f     <--------- 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)
	
	const v4, 0x0       <-------- 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.
	
	:cond_f           <-------- add this line for the reference above
    :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.
The Following 11 Users Say Thank You to cstark27 For This Useful Post: [ View ] Gift cstark27 Ad-Free
23rd March 2018, 08:53 PM |#4  
FerrarisIV's Avatar
Senior Member
Flag Rome
Thanks Meter: 37
 
More
Great job. I flashed your module to try and the pictures in 2X are very nice!

Here the difference





The Following 2 Users Say Thank You to FerrarisIV For This Useful Post: [ View ] Gift FerrarisIV Ad-Free
23rd March 2018, 09:12 PM |#5  
Member
Thanks Meter: 3
 
More
Working great, thank you so much!
24th March 2018, 01:32 AM |#6  
Senior Member
Thanks Meter: 29
 
More
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
24th March 2018, 03:07 AM |#7  
Rajeev's Avatar
Recognized Contributor
Flag Chennai , I N D I A
Thanks Meter: 26,501
 
Donate to Me
More
Quote:
Originally Posted by duniatri

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

Which one u using latest? Normal or wide cam ?
24th March 2018, 03:15 AM |#8  
Senior Member
Thanks Meter: 29
 
More
Quote:
Originally Posted by Rajeev

Which one u using latest? Normal or wide cam ?

Wide (zoom) one
The Following User Says Thank You to duniatri For This Useful Post: [ View ] Gift duniatri Ad-Free
24th March 2018, 03:29 AM |#9  
Rajeev's Avatar
Recognized Contributor
Flag Chennai , I N D I A
Thanks Meter: 26,501
 
Donate to Me
More
Quote:
Originally Posted by duniatri

Wide (zoom) one


Thanks friend. Still settling force close is there right?
24th March 2018, 04:09 AM |#10  
Senior Member
Thanks Meter: 29
 
More
Quote:
Originally Posted by Rajeev

Thanks friend. Still settling force close is there right?

Nope. No force close on setting and video on last version. All good so far
Attached Thumbnails
Click image for larger version

Name:	Screenshot_20180324-100719.png
Views:	3954
Size:	99.6 KB
ID:	4455999  
The Following User Says Thank You to duniatri For This Useful Post: [ View ] Gift duniatri Ad-Free
24th March 2018, 04:10 AM |#11  
Rajeev's Avatar
Recognized Contributor
Flag Chennai , I N D I A
Thanks Meter: 26,501
 
Donate to Me
More
Quote:
Originally Posted by duniatri

Nope. No force close on setting and video on last version. All good so far

Fantastic..
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes