yashsingh1/xdaforums huggingface dataset:
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
*** CLICK HERE for updated code and compiled fix.

[MENTION=5554845]rogersb11[/MENTION], [MENTION=6159291]Lysergic Acid[/MENTION], [MENTION=4141005]Lanchon[/MENTION], [MENTION=5294352]cyril279[/MENTION]

Sup guys, spent some time looking into the outgoing call bug with the i777 this weekend and patched up a fix. This is a total hack (and not even an efficient one at that) - it modifies core android behavior and doesn't address whatever the underlying issue in the device specific code is. At least it gets us a little bit closer. Tested it on my device and it works great, although on outgoing calls there is no audible "ring" which is not stock behavior. See below. I also attached a few logs of the issue (before the patch).

1) Log spanning from immediately before an incoming call to immediately after connection.

2) Log spanning from immediately before an outgoing call to immediately after connection.

3) Log spanning from after an outgoing call connection, immediately before the speaker is toggled on, off, and on again.

In this file: /android/system/packages/services/Telecomm/src/com/android/server/telecom/CallsManager.java

Add code to the end of this method:

private void setCallState(Call call, int newState)

...

Log.i(this, "i777 hack: toggle speakerphone on/off");
if (CallState.toString(oldState).equals("DIALING") && CallState.toString(newState).equals("ACTIVE")) {
mCallAudioManager.i777hack();
}

In this file: /android/system/packages/services/Telecomm/src/com/android/server/telecom/CallAudioManager.java

Add a method to this class:

final class CallAudioManager

...

public void i777hack() {
int oRoute=mAudioState.getRoute();
int oMask=mAudioState.getSupportedRouteMask();
setSystemAudioState(false, AudioState.ROUTE_SPEAKER, oMask);
setSystemAudioState(false, oRoute, oMask);
}
[AT&T Samsung Galaxy S II SGH-I777] Quicksilver13:
Mobile Odin will flash tar files or img files. I think I used a jellybean kernel that I extracted from the zip ROM file. I just copied the boot. Img file over to the root directory on my phone and use mobile Odin to flash that kernel, and from there I could flash other kernels or regular zip files or restore my backup files.
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
Fixed (see above) and built latest nightly. Worked well on my i777 while testing briefly. Enjoy.

https://www.androidfilehost.com/?fid=24052804347819614
[AT&T Samsung Galaxy S II SGH-I777] justanother1020:
we need to put this fix into SlimLP

that rom is more stable and better, but the radio isn't as good, it keeps disconnecting but everything else is butter.
[AT&T Samsung Galaxy S II SGH-I777] cyril279:
I am certainly glad that you took the time to work through, and figured this out, even as a hack. I'm hesitant to incorporate it into the device code base just yet, but I'm happy to link the zip-post into the Slim OP as an option.

I appreciate that you prefer slim firmware, I do too. I run a slim variant on every device that I have.

That said, we should certainly refrain from declaring it as more stable or better. It's all personal preference - The varying features, style and functionality appeal differently to each of us.

Cheers all,

-Cyril
[AT&T Samsung Galaxy S II SGH-I777] Cooldato:
Thank you for your reply :3 I will try to flash JB Kernel via Mobile Odin :x
[AT&T Samsung Galaxy S II SGH-I777] rogersb11:
Hack or not, this is a nice job man. Very well done, without a device I never got this far into debugging so wanted to be sure to say VERY well done!!!! I will look into this further once I release my final Lollipop builds for Cyanide and see if I can adapt to not "hack" status and submit to cm without breaking stuff for anyone else. If so I will contact you so I can give you proper credits. Again very very well done, you should be proud
[AT&T Samsung Galaxy S II SGH-I777] pg1980:
Hi [MENTION=6074762]dimoochka[/MENTION],

I tried this Rom but this fix is not working for me. I still have to toggle speaker on outgoing calls. I also tried replacing telecom.apk but I'm getting error when trying to call "No app exist...
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
Yeah I wasn't able to test the Telecom.apk thing out yet. Did you install the ROM from the link in my post? That is the one I tested. I don't think it's been incorporated into the OP post yet.
[AT&T Samsung Galaxy S II SGH-I777] pg1980:
Yes, I'm using the one you have posted, but still having issue with outgoing call.
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
Give me a week - I'll recompile and retest on my device. What device are you using? i777?

Also - can you please post a logcat from the time that you press the call button to the time the call connects?
[AT&T Samsung Galaxy S II SGH-I777] pg1980:
Yes, i777. Will try to post logcat later today or tomorrow. Thanks Much.

Log attached.
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
[MENTION=5554845]rogersb11[/MENTION], [MENTION=6159291]Lysergic Acid[/MENTION], [MENTION=4141005]Lanchon[/MENTION], [MENTION=5294352]cyril279[/MENTION]

Hello gentlemen, I have been working on this all weekend. My eyes are bleeding and I still can't figure out what's causing the bug. I'm about to give up and just stick with the stupid hack fix (UPDATED setCallState code below to make it work better). I am trying to debug this thing with gdbclient - any of you guys have any idea what process name I need to attach to in order to debug the CallAudioManager class (is that even possible)? I tried to attach to system_server but gdb wouldn't recongize the filename or method I was looking for.

Compiled, fixed Telecom.apk is attached (installation instructions below).

In this file: /android/system/packages/services/Telecomm/src/com/android/server/telecom/CallsManager.java

Add code to the end of this method:

private void setCallState(Call call, int newState)

...
// i777 hack
if (oldState==CallState.CONNECTING && newState==CallState.DIALING) {
mCallAudioManager.i777hack();
}

In this file: /android/system/packages/services/Telecomm/src/com/android/server/telecom/CallAudioManager.java

Add a method to this class:

final class CallAudioManager

...

public void i777hack() {
int oRoute=mAudioState.getRoute();
int oMask=mAudioState.getSupportedRouteMask();
setSystemAudioState(false, AudioState.ROUTE_SPEAKER, oMask);
setSystemAudioState(false, oRoute, oMask);
}

Instructions (works on latest CM12.1 i777 nightly - I have not tested this on any other ROM)

1) Reboot into recovery.

2) mount /system

3) Make a backup of your existing /system/priv-app/Telecom/Telecom.apk - then replace it with attached file.

4) chmod 644 /system/priv-app/Telecom/Telecom.apk

5) umount /system

6) Reboot, profit.
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
See above post with revised Telecom.apk and proper installation instructions.
[AT&T Samsung Galaxy S II SGH-I777] pg1980:
Thanks [MENTION=6074762]dimoochka[/MENTION], this is working for me now.
[AT&T Samsung Galaxy S II SGH-I777] stefano91av:
Hello, I installed through crosskernel for I9100T the 12.1 cm for i9100. Everything perfect except the network of the SIM card. In a nutshell it comes and goes. Sometimes you have to turn off the phone and so does the network again. then back down. how to solve?

Inviato dal mio ZP998 utilizzando Tapatalk
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
Encryption

[MENTION=5554845]rogersb11[/MENTION], [MENTION=6159291]Lysergic Acid[/MENTION], [MENTION=4141005]Lanchon[/MENTION], [MENTION=5294352]cyril279[/MENTION]

Hello again friends. I have been working on device encryption for a while since this device (as well as others) only encrypts the /data partition and leave /storage/sdcard0 open for the world to see. I've figured out a universal workaround that I've been using as my daily driver for over a year that has no noticeable performance impact**. I use cryptsetup to build a LUKS volume on /storage/sdcard0 that fills most of the space on the partition, and then automount it via a startup script. The decryption key is located in plaintext on the /data partition (/data partition must first be decrypted/mounted by Android via startup passphrase, so the keyfile is secure despite the fact that it's stored in plaintext). The real advantage of this setup is that the LUKS volume can be mounted in any recovery (!!) using the cryptsetup binary. As far as I know recoveries cannot mount AOSP encrypted volumes yet (which makes offline backups/file retrieval a pain in the a$$).

So - two questions.

1) Do you guys know of any recovery (I'm still on TWRP 2.7) that's capable of mounting AOSP encrypted volumes? If so - I'll get to work on figuring out how to get Android to natively encrypt sdcard0.

2) If not - does anyone want my source for integration into your ROMs/kernels?

With love,

dimoochka

**There is probably a write-performance impact because the mmc blocks occupied by the LUKS volume cannot be FSTRIM'ed (xoxo [MENTION=4141005]Lanchon[/MENTION]) despite the fact that the LUKS volume is not actually full.
[AT&T Samsung Galaxy S II SGH-I777] Lanchon:
hi,

afaik latest twrp mounts aosp encryption. but there are some limitations, such as if using patterns, only 3x3 are supported.

LUKS optionally support trim pass-thru, with some (very small) loss of privacy. IMHO, in general you need to either accept this loss or over-provision your ssd (just another cost of encryption); simply ignoring the need for trim is not a viable option. however sdcard0 is usually fat, and our kernels cannot trim it, so this is a non-issue unless you switched to ext4.

yours is a good solution. i would have probably made a /data/media rom for myself instead, but your solution is more versatile. just beware that if you ever wipe data, you'll effectively wipe sdcard too!
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
No way - did someone compile this for the i777? I've scoured XDA for this forever... where do I get it?

Done and done. There's about 500MB of unprovisioned space on the card so maybe I am not incurring as much of a performance penalty as I thought. Also - good point - I did format the sdcard0 to ext4 specifically so I could TRIM it (the LUKS volume is formatted as vfat to stay compatible with the ROM). I'll have to look into how TRIM would work through LUKS.

The best part of LUKS is the ability to use multiple keys. So I actually use a remembered passphrase (key #2) when I mount the volume in recovery. /data went spontaneously corrupt on me once in the past so this (and backing up) is a must :D
[AT&T Samsung Galaxy S II SGH-I777] Lanchon:
well LA builds twrp for the i9100, maybe the same kernel works, if only to flash it temporarily.

your LUKS vol is fat, so no trim will be generated by the file system; so enabling the pass thru wont add any value in your setup.
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
I just got TWRP working with device encryption (!!). Will post in a bit. Can you walk me through the /data/media solution you were suggesting? Not too familiar how that's handled between fstab.smdk... and vold
[AT&T Samsung Galaxy S II SGH-I777] Lysergic Acid:
I still wonder if this couldn't be implemented in our audio blob instead of changing core android, that's the main reason a open source replica was made. Nice job anyway, maybe sometime we figure out how to do that in the device tree
[AT&T Samsung Galaxy S II SGH-I777] TeutonJon78:
Blick, I hate the Cyanogen Recovery. Is there a way to wipe the system partition using it (to make sure to wipe any GAPPS packages).
[AT&T Samsung Galaxy S II SGH-I777] fairmount97:
which kernel we should use for this instructions? can i just replace telecom.apk to /system? i didnt understand how to mount /system on recovery?
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
1. Any kernel or CM12-based ROM should be fine. Telecom.apk is a system app and is unrelated to the kernel.

Here 's a more detailed instruction list:

Make a backup of your existing /system/priv-app/Telecom/Telecom.apk onto your computer.

Reboot into recovery.

Plug your phone into the USB port, and start adb.

In adb, type the following command: mount /system

In adb, type the following command: mount -o remount,rw /system

Replace /system/priv-app/Telecom/Telecom.apk with my version.

In adb, type the following command: chmod 644 /system/priv-app/Telecom/Telecom.apk

In adb, type the following command: umount /system
[AT&T Samsung Galaxy S II SGH-I777] pg1980:
You can also use Terminal Emulator app. I'm using Terminal Emulator app to replace Telecom.apk and it's pretty straight forward.
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
Just don't do step #8, "umount /system" if you're using the Terminal Emulator app ;)
[AT&T Samsung Galaxy S II SGH-I777] fairmount97:
i got one more question..

are there still outgoing call issue on last nightly official?
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
Probably, that bug has been really tenacious and I think I'm the only one that's really spent any substantial amount of time looking into it.
[AT&T Samsung Galaxy S II SGH-I777] fairmount97:
i think they just use your solve.. can apply this without adb?
[AT&T Samsung Galaxy S II SGH-I777] TeutonJon78:
[MENTION=6159291]Lysergic Acid[/MENTION], is it possible to get a flashable stock CM kernel with TWRP built for the i777 like you do for the i9100? CM Recovery is just abysmal (esp. for an old device where you need to control more low level aspects to keep it functioning).

Thanks.
[AT&T Samsung Galaxy S II SGH-I777] fairmount97:
which official nightly is most stable.. You know last one has wifi bug.. Which one i should install..?

Is the Dimoocha's rom (09.25.2015) stable enough? And Can I install TWRP on your Rom Dimoocha?
[AT&T Samsung Galaxy S II SGH-I777] Lysergic Acid:
Yes, but I won't be able to test it. I'm gonna ask another i777 dev for some help there
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
To save you some trouble, I already have this built: http://xdaforums.com/galaxy-s2-att/development/mtp-twrp-2-8-7-0-i777-s959g-t3212309

Not totally "cutting edge" - but less than a month old. I'll rebuild it in about a week to catch up with your kernel changes.

LA, do you want me to provide my code patches? TWRP required multiple patches to work properly on this device.
[AT&T Samsung Galaxy S II SGH-I777] cyril279:
Can you tell me more about what your patches do for TWRP?

-Cyril
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
Yes, aside from creating the twrp.fstab and adjusting the BoardCommonConfig.mk with the proper values (took forever), there were multiple bugs (1-3 are common to all TWRP - I let a maintainer know about it but I don't think if the fixes have ever been merged):

Bug 1: storagename fstab flag value wasn't being evaluated

Bug 2: storagename/backupname fstab flag values would always be interpreted to be prefixed by =" (ptr_len comparator & rval were too small)

Bug 3: If /data is encrypted, a repeat call to TWPartition::Setup_File_System during decryption resets the Display_Name and Backup_Name

Bug 4: (Probably no longer relevant since LA's changes to the i777 encryption footer) For devices that use /efs/metadata to store the /data encryption key, decryption dialog fails to open because EFS is not mounted at the time that TWRP checks for device encryption.
[AT&T Samsung Galaxy S II SGH-I777] cyril279:
Do you have the patch file(s) published anywhere? Or have the changes pushed to a github repository? I am interested to incorporate and try them.

creating the twrp.fstab? I'm not sure I understand, I have been building slim with a twrp clad kernel since 4.4, and things were well established when I started. The boardcommonconfig values may need minor tweaking, but they are not a mystery for these devices.

https://github.com/cyril279/android...mmit/5350153e1d43c6448769bca1357e9a4a33dd95dc

https://github.com/cyril279/android_device_samsung_i777/blob/cyng-5.1/BoardConfig.mk#L37

Edit_______________________________

Omni since 4.3:

https://github.com/omnirom/android_device_samsung_i777/blob/android-4.3/BoardConfig.mk#L37

https://github.com/omnirom/android_...on/blob/android-4.3/BoardCommonConfig.mk#L171

https://github.com/omnirom/android_...on/blob/android-4.3/BoardCommonConfig.mk#L158

https://github.com/omnirom/android_device_samsung_galaxys2-common/blob/android-4.3/common.mk#L23
[AT&T Samsung Galaxy S II SGH-I777] Lysergic Acid:
I've previously asked [MENTION=5294352]cyril279[/MENTION] about that, but any of you guys can send me the file I need, if you can grant me your TWRP works as it should obviously. I need the recovery-ramdisk.cpio placed in your /out folder, that's what I'll merge with CM ramdisk and then use it in the kernel.
[AT&T Samsung Galaxy S II SGH-I777] cyril279:
ramdisk-recovery.cpio:

https://drive.google.com/file/d/0B0R9j8_Y-KixRHBvbDNacUNHSmc/view?usp=docslist_api
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
[MENTION=5294352]cyril279[/MENTION]

Here are my patches/source files. Note that this (for some reason) breaks the compiled cm12...-NIGHTLY.zip installer (not sure why). Replacing bootable/recovery with the stock CM12.1 repository seems to restore it - not sure what I'm doing wrong.

twrp-fixes-for-i777.patch should be applied to bootable/recovery

twrp-setup.patch should be applied to build/core

BoardConfig.mk.additions.txt - self explanatory goes into device/samsung/i777/BoardConfig.mk

twrp.fstab.txt - self explanatory. goes into device/samsung/i777/twrp.fstab .... Note: still uses encryptable=/efs/metadata so this needs to be adjusted, just change to encryptable=footer and it'll work with LA's latest encryption commits

Also add twrp.xml in .repo/local_manifests:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="twrp" fetch="git://github.com/" />
<remove-project name="CyanogenMod/android_bootable_recovery" />
<project path="bootable/recovery" name="omnirom/android_bootable_recovery" remote="twrp" revision="android-5.1"/>
</manifest>

... and repo init/sync it obviously.
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
Interesting ... I couldn't get PRODUCT_COPY_FILES to work on twrp.fstab. I wonder what I was doing wrong. I had to mess with the build/core/Makefile ;(
[AT&T Samsung Galaxy S II SGH-I777] TeutonJon78:
Which is a good effort, but currently not working. Lyseric Acid already has the full working kernel source, has working TWRP for the i9100, and is the developer of the ROM (which no offense, gives him a way higher trust rating to me).
[AT&T Samsung Galaxy S II SGH-I777] cyril279:
LA is using a prebuilt (by another user/builder) ramdisk to complete the TWRP'd kernel builds. In this case, having a fully functioning, device specific TWRP is better than one that just covers some core functionality, and that's where [MENTION=6074762]dimoochka[/MENTION] 's interest, and work, becomes quite valuable. Understanding the code, well enough to fix remaining issues that will extend its use beyond the core functionality is something that we should be encouraging. *especially considering the lack of developer support for this device.

-Cyril
[AT&T Samsung Galaxy S II SGH-I777] TeutonJon78:
Oh for sure. As I said, I applaud the effort. And if we get a real TWRP and someone maintaining it, all the better.
[AT&T Samsung Galaxy S II SGH-I777] mmystere68:
Is there outgoing call bug in latest nightly??
[AT&T Samsung Galaxy S II SGH-I777] d_j_l:
yes. in the official nightly.
[AT&T Samsung Galaxy S II SGH-I777] pepe100:
I installed this rom in my old but loved s2 i777 and it gave life to my device. Thanks Lysergic Acid for this rom
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
Bluetooth Locking Up

[MENTION=6159291]Lysergic Acid[/MENTION]

Hey LA! I wanted to make you aware of a bug I have been having trouble with for a long time. I've tried to diagnose it myself but it's unfortunately beyond my skillset.

Basically any time a bluetooth device is connected and is actively used for audio I/O, the entire UI will intermittently freeze (often times for up to 10 seconds) with intermittent periods of smooth operation lasting 2-3 seconds each. This makes dialing touch-tones while connected to bluetooth nearly impossible. Surprisingly the incoming / outgoing audio seems to be completely unaffected.

This issue wasn't present in CM10.1. I first noticed it when I upgraded to CM11 and it has persisted through Lollipop. I have done a full wipe and fresh install multiple times since I first noticed it with no success. I imagine it'll also affect your upcoming work on CM13.

I've attached a short logcat of the issue (during the course of a phone call, using touch tones intermittently). These are the relevant messages (out of order):

W/AudioTrack( 3326): dead IAudioTrack, PCM, creating a new one from start()

E/AudioTrack( 3326): detected illegal retrograde motion by the server: mServer advanced by -9024

W/SurfaceFlinger( 1846): Timed out waiting for hw vsync; faking it

E/ToneGenerator( 3326): --- Stop timed out

I/Choreographer(17676): Skipped 142 frames! The application may be doing too much work on its main thread.

E/TinyALSA-Audio Output( 3005): pcm write failed!

E/TinyALSA-Audio Output( 3005): Process and write failed!

W/AudioFlinger( 3005): write blocked for 9999 msecs, 4 delayed writes, thread 0x40ef8008

In scouring the forums, I couldn't find anybody that had also experienced this issue (so I'm assuming it's a problem with the device specific code, ie. TinyALSA). Let me know if you plan on looking at this. I'm happy to assist in resolving this if you like (I could debug in specific situations or scour the code if you point me in the right direction).

Thanks!
[AT&T Samsung Galaxy S II SGH-I777] yunior597:
Is call bug fixed in latest nightly? 12-10-2015
[AT&T Samsung Galaxy S II SGH-I777] pepe100:
+1
[AT&T Samsung Galaxy S II SGH-I777] Linwood.Ferguson:
The bug is still present in the 12/17 nightly. Also, not sure if it's mentioned above but I can't get bluetooth to carry sound at all, it pairs, but no audio (Plantronics earpiece).
[AT&T Samsung Galaxy S II SGH-I777] pepe100:
Hello

how can I install X-posed in this rom?? Thanks in advance

Edit: I used FlashFire and It worked great. (An option because of lack of custom recovery) Version xposed used-v79-sdk22-arm.zip

This ROM is awesome.
[AT&T Samsung Galaxy S II SGH-I777] Phalanx7621:
Netflix Issues

Hey guys, LOVING this so much thanks LA for doing this for us and for everything you do for the community. I am experiencing an odd issue and I've done all the troubleshooting on my end that I can so I'm asking you guys. Anyone else not able to play the Netflix app? I know it's weird and all but it's not my internet connection and it's not a bad download....just curious if somehow I'm missing something here? I can play it fine on any other ROM just not sure what's up here. Anyone have any ideas?
[AT&T Samsung Galaxy S II SGH-I777] bleggy:
can this rom be installed without a sim inserted? my i777 is currently my backup phone and I'd like to use it for travel where I purchase a sim card on the go.
[AT&T Samsung Galaxy S II SGH-I777] pepe100:
Yes you can
[AT&T Samsung Galaxy S II SGH-I777] TeutonJon78:
I haven't tried this ROM yet, but often Netflix is an issue with either the DRM libraries, or with the media codec setup.
[AT&T Samsung Galaxy S II SGH-I777] TeutonJon78:
The first bug I've found is when I went to install CF.Lumen to give more control over the color temperature (I know CM has a built in option, but you can't control times).

Upon going to install CF.Lumen, it complains about SELinux being set to enforcing but not having a sepolicy set. I assume this is CF.Lumen.

I also wanted to say, it's working well with the IsoRec setup to get TWRP back. Hopefully that can get merged into CM mainline.
[AT&T Samsung Galaxy S II SGH-I777] Lanchon:
what is the call bug?
[AT&T Samsung Galaxy S II SGH-I777] dimoochka:
On the i777, no sound or microphone when making an outgoing call. Fixed (for that call only) by toggling speaker mode on/off. Underlying cause unknown - looked for it for a while and then gave up. I hacked together a fix for it here:

http://xdaforums.com/galaxy-s2-att/...tly-builds-t3149626/post62923329#post62923329

However, the real bug still exists somewhere in the device code ...