yashsingh1/xdaforums huggingface dataset:
[Xperia Z1 Compact Android Development] chris2017@xda:
Thanks a lot sugnuf!

I reviewed the ril.cpp and ril_commands.h used in the AOSP-ROM. It looks as if the commit 378068 is not used there (no dispatchNetworkManual), even though the manual network selection works in roaming.

Hope the commit will work anyway in your ROM, munjeni.

Thanks again, guys. You re all incredibly talented!
[Xperia Z1 Compact Android Development] sugnuf:
Just search for link You provided, but without "#/c/" in los reops :)
[Xperia Z1 Compact Android Development] munjeni:
Yes, allready fixed network selection manual, now another problem - sigsegv on network selection automatic :) Working on it !

Edit:

Can't get it right now must go, will continue tommorow!

09-30 22:25:02.531 4280 4280 F DEBUG : pid: 4203, tid: 4214, name: rild >>> /system/bin/rild <<<
09-30 22:25:02.531 4280 4280 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
09-30 22:25:02.531 4280 4280 F DEBUG : r0 b58a7008 r1 b58a6fac r2 b58a6fac r3 00000000
09-30 22:25:02.531 4280 4280 F DEBUG : r4 b64e6b60 r5 00000000 r6 00000000 r7 0000002e
09-30 22:25:02.532 4280 4280 F DEBUG : r8 b6449c28 r9 b6add244 sl b58a779c fp b5093168
09-30 22:25:02.532 4280 4280 F DEBUG : ip 00000002 sp b58a6f48 lr b5f600e1 pc b60ec3ec cpsr 800f0030
09-30 22:25:02.560 4280 4280 F DEBUG :
09-30 22:25:02.560 4280 4280 F DEBUG : backtrace:
09-30 22:25:02.560 4280 4280 F DEBUG : #00 pc 002143ec /system/vendor/lib/libril-qc-qmi-1.so (qcril_qmi_nas_set_network_selection_automatic+15)
09-30 22:25:02.560 4280 4280 F DEBUG : #01 pc 000880df /system/vendor/lib/libril-qc-qmi-1.so (qcril_dispatch_event+974)
09-30 22:25:02.560 4280 4280 F DEBUG : #02 pc 0009683d /system/vendor/lib/libril-qc-qmi-1.so
09-30 22:25:02.560 4280 4280 F DEBUG : #03 pc 0008c255 /system/vendor/lib/libril-qc-qmi-1.so
09-30 22:25:02.560 4280 4280 F DEBUG : #04 pc 0008c6f7 /system/vendor/lib/libril-qc-qmi-1.so
09-30 22:25:02.560 4280 4280 F DEBUG : #05 pc 00004b1d /system/lib/libril.so
09-30 22:25:02.560 4280 4280 F DEBUG : #06 pc 0000c07b /system/lib/libril.so (_Z14ril_event_loopv+566)
09-30 22:25:02.560 4280 4280 F DEBUG : #07 pc 000044e5 /system/lib/libril.so
09-30 22:25:02.560 4280 4280 F DEBUG : #08 pc 0004da3f /system/lib/libc.so (_ZL15__pthread_startPv+22)
09-30 22:25:02.560 4280 4280 F DEBUG : #09 pc 00019ff5 /system/lib/libc.so (__start_thread+6)
09-30 22:25:02.964 850 1346 W NativeCrashListener: Couldn't find ProcessRecord for pid 4203

Thanks all!
[Xperia Z1 Compact Android Development] chris2017@xda:
thanks for the remark, hackintosh5.

If I understand correctly, Android RIL tries to communicate with the vendor RIL binaries.

Both ROMs I tested, which do not have the problem with manual selecting the network operator (AOSP and the ParanoidAndroid 6.0.3), use kernel 3.10. Unfortunately, I don't know how to find out more info about binaries and for which kernel they are compiled.

[MENTION=4120742]munjeni[/MENTION]: which binary versions do you use for the radio

Update: I have exchanged the modem binaries in /etc/firmware via adb with the binaries of the SONY stock Rom. That did not help. So, my assumption might be wrong.
[Xperia Z1 Compact Android Development] munjeni:
Done, let me know if this one from attachment is ok! Put into /system/lib

Edit:

Chris confirmed by pm that ril is ok now, I'm going to make some more changes before I make new build.
[Xperia Z1 Compact Android Development] chris2017@xda:
Munjeni, you are the best! It works now.

Changing the operator takes quite some time. There's still a problem with weak signals. The phone hops back to the "best" network operator after some time. See logcat: Start registering in Swiss network (sunrise) at 12:31:50. At 12:33:30 "No signal". At ~12:33:50 registers on German network (vodafone.de) again.

Maybe that happens also with stronger signals after some time. I haven't had time to test.

It seems as if automatic network selection is overrides manual selection after some time/if network drops.

Maybe that's related to the way Nougat handels network selection. In Lollipop that was much better in my opinion, when you can choose between manual or automatic network selection in the menu.

Thanks again! I have to head off now and will be abroad for one week. An opportunity to test extensively ;)
[Xperia Z1 Compact Android Development] munjeni:
Hmm seems you failed to set network selection:

10-01 12:32:39.508 D/phone ( 1420): [NetworksList] hideProgressPanel
10-01 12:32:39.533 D/phone ( 1420): [NetworksList] manual network selection: failed! switch back to auto
10-01 12:32:39.560 D/phone ( 1420): [NetworksList] select network automatically...

Can you read this https://jira.lineageos.org/browse/BUGBASH-161?jql=text~"data" < I realy have no idea, maybe lineageos bug?
[Xperia Z1 Compact Android Development] hackintosh5:
Sounds stupid but... did you apply patch?
[Xperia Z1 Compact Android Development] munjeni:
Yes ofcourse :laugh:
[Xperia Z1 Compact Android Development] munjeni:
I have reverse enginer sony stock rom hal, if somebody need it here is it -> https://pastebin.com/VMsCQQw9
[Xperia Z1 Compact Android Development] munjeni:
Anybody noticed that posts on xda sometimes is so late??
[Xperia Z1 Compact Android Development] munjeni:
Anybody help me find what is default offhost route and defaulte route in NFC on stock rom? It can be seen in logcat, I'm having no plan to install stockrom again and it would be great if somebody research for it in stock rom logcat! I have fixed hce crash with this:

diff --git a/src/com/android/nfc/cardemulation/AidRoutingManager.java b/src/com/android/nfc/cardemulation/AidRoutingManager.java
index 96225b7..de67704 100644
--- a/src/com/android/nfc/cardemulation/AidRoutingManager.java
+++ b/src/com/android/nfc/cardemulation/AidRoutingManager.java
@@ -68,16 +68,16 @@ public class AidRoutingManager {
// Easy look-up what the route is for a certain AID
HashMap<String, Integer> mRouteForAid = new HashMap<String, Integer>();

- private native int doGetDefaultRouteDestination();
- private native int doGetDefaultOffHostRouteDestination();
- private native int doGetAidMatchingMode();
+ //private native int doGetDefaultRouteDestination();
+ //private native int doGetDefaultOffHostRouteDestination();
+ //private native int doGetAidMatchingMode();

public AidRoutingManager() {
- mDefaultRoute = doGetDefaultRouteDestination();
[COLOR="Red"]+ mDefaultRoute = 0;[/COLOR]
if (DBG) Log.d(TAG, "mDefaultRoute=0x" + Integer.toHexString(mDefaultRoute));
- mDefaultOffHostRoute = doGetDefaultOffHostRouteDestination();
[COLOR="Red"]+ mDefaultOffHostRoute = 2;[/COLOR]
if (DBG) Log.d(TAG, "mDefaultOffHostRoute=0x" + Integer.toHexString(mDefaultOffHostRoute));
- mAidMatchingSupport = doGetAidMatchingMode();
+ mAidMatchingSupport = 20;
if (DBG) Log.d(TAG, "mAidMatchingSupport=0x" + Integer.toHexString(mAidMatchingSupport));
}

but its seems a wrong offhost and host route, Crash is no more happened, hce is now enabled, but its curently non working.
[Xperia Z1 Compact Android Development] alex88510:
I'm on your old .108 stock rom.

I grabbed a copy of the logcat while I was turning on NFC service.

I didn't try to use NFC though, my only other NFC-capable device needs some charging before it will work...

Not sure the log contains what you need.

Let me know if I need to do something first.
[Xperia Z1 Compact Android Development] munjeni:
Thanks mate but I don't have time for nfc, thats why I need help, see my post, I told that somebody look into his own logcat and research byself for it, I have no free time researching, to be honest I am lazy doing that because Idon't use nfc!

Anyway I have found it:

- default route is 2

- default offhost route is 2 too

- onhost route is 0

- aid routing have no idea
[Xperia Z1 Compact Android Development] hackintosh5:
So hce is working?

---------- Post added at 04:46 PM ---------- Previous post was at 04:44 PM ----------

Time difference?
[Xperia Z1 Compact Android Development] munjeni:
Hm seems time diferencie cause that, my win10 after every reboot have time 2 hours late, fixed it last time by using nistgov time server but seems bug again.

Hey, new version is out lineage-14.1-20170930

- new nfc hal (reverse enginered stock rom nfc.msm8974.so)

- enable hce and fixed crash (don't know if it can read tags...etc), but now hce is enable and didn't crash. YOu can see now new option in nfc settings aka tap&pay

- fix network manual/auto selection (seems some more work is need since chris2017@xda reported that network manual selection is somehow not permanent). Anybody confirm?

I have enable nfc verbose logging so if you need to figure out something see your logcat! If you have idea let me know! Some more hacking in packages/apps/Nfc is need (for idea you can online decompile http://www.javadecompilers.com/apk stock rom nfc.apk and look for diferencie)! I'm believing nxp stack (libnfc and libnfc-jni is ok), only framework and app part need to be hacked in order to use old nxp stack (libnfc, libnfc-jni) on new android api which curently support only nci stack. I didn't see problems on nxp logcat lines (seems nxp stack ok) other than that hce timeout log spam (for idea look into your logcat).
[Xperia Z1 Compact Android Development] [GER]Roxxor:
I just discovered this thread! I am using a LG G3 at the moment, but I will consider reviving my Amami! I will try this ROM now with a mouse (touchscreen broken), and if I like it, I'll order a new screen!

Recently Xperia Z was added to official LineageOS devices. Is this also possible with Amami?
[Xperia Z1 Compact Android Development] munjeni:
Probably yes, but who knows. :) I'm planing to move to oreo when it get a bit stable and I will continue to use amami and release builds, will not change amami another year(s), got new battery and its ready for some more fun. Thinked to buy xz1c but seems guys who bought it is disapointed, so...
[Xperia Z1 Compact Android Development] munjeni:
Libril source code from here -> https://github.com/LineageOS/android_device_sony_fusion3-common/tree/cm-14.1/libril have some interesting commits, very promising! Will check tommorow. I'm compared and found some things and prety sure it will solve some isues which we curently have e.g. that delays while searching networks and while registering on networks, we curently use dispatchNetworkManual for booth auto/manual, that I have added yesterday to fix manual network selection, but now I found some more things on that ril source code in function dispatchNetworkManual. You can wait tommorow for download today build, I will update it with new ril!
[Xperia Z1 Compact Android Development] BokeB:
Could you take a look at Camera, also?

Force close when double tap on screen in video mode.

Log attached.

Edit: Attachment removed, because of a lot of unrelated errors.
[Xperia Z1 Compact Android Development] BokeB:
Sorry got some more errors in log file.

Here without cpu errors :silly:
[Xperia Z1 Compact Android Development] munjeni:
10-02 22:04:05.859 E/AndroidRuntime(26740): FATAL EXCEPTION: Camera Handler Thread
10-02 22:04:05.859 E/AndroidRuntime(26740): Process: org.cyanogenmod.snap, PID: 26740
10-02 22:04:05.859 E/AndroidRuntime(26740): java.lang.RuntimeException: autoFocus failed
10-02 22:04:05.859 E/AndroidRuntime(26740):	at android.hardware.Camera.native_autoFocus(Native Method)
10-02 22:04:05.859 E/AndroidRuntime(26740):	at android.hardware.Camera.autoFocus(Camera.java:1356)
10-02 22:04:05.859 E/AndroidRuntime(26740):	at com.android.camera.AndroidCameraManagerImpl$CameraHandler.handleMessage(AndroidCameraManagerImpl.java:314)
10-02 22:04:05.859 E/AndroidRuntime(26740):	at android.os.Handler.dispatchMessage(Handler.java:102)
10-02 22:04:05.859 E/AndroidRuntime(26740):	at android.os.Looper.loop(Looper.java:154)
10-02 22:04:05.859 E/AndroidRuntime(26740):	at android.os.HandlerThread.run(HandlerThread.java:61)
10-02 22:04:05.861 D/NuPlayerDriver( 323): reset(0xa83d0c40) at state 4
10-02 22:04:05.861 D/NuPlayerDriver( 323): notifyListener_l(0xa83d0c40), (8, 0, 0), loop setting(0, 0)
10-02 22:04:05.861 W/AMessage( 323): failed to post message as target looper for handler 0 is gone.

Hmm, double click in video mode need to take picture shoot, thats new, but seems we can't use that in stockrom camera hal, will look that later. Can you help and try search for fix on google?
[Xperia Z1 Compact Android Development] BokeB:
Seems that camera isn't ready when trying to focus again. When tapping with a short period of time between taps, everything is okay.

Google gives me only hack solutions like (Barcodescanner apps):

https://github.com/journeyapps/zxin...canner/camera/AutoFocusManager.java#L107-L110

Or

https://github.com/dm77/barcodescanner/commit/c8ec26066c5a6aead9b68cf2ad3684821de5b1a5

Everything seems to be related to sony devices. So maybe stock rom does also have fc!?
[Xperia Z1 Compact Android Development] poruid:
Seems a nice port of LineageOS, thanks.

Question: howto flash new release without having to reinstall and reconfigure everything ?

The Aroma installer does not let doing an update without "Clear stufs"; it just offers either "Exit" to abort installation or "Back" to change settings.
[Xperia Z1 Compact Android Development] munjeni:
Hi, change in updater-script

if file_getprop("/tmp/aroma-data/wipe.prop","selected.0") == "2" then

change to

if file_getprop("/tmp/aroma-data/wipe.prop","selected.0") == "1" then

so when you select wipe it will skip wipe since its no more 2
[Xperia Z1 Compact Android Development] munjeni:
Thanks man! I will look into camera source and try to do something like this https://github.com/plastiv/barcodescanner/commit/3724a9e504b7c4fe1d96cacfbd7e5ada5b9d1a78
[Xperia Z1 Compact Android Development] hackintosh5:
Or just comment out wipe.sh in root of zip
[Xperia Z1 Compact Android Development] dmgZero:
[MENTION=4120742]munjeni[/MENTION]

Perhaps this thread(from author of Cyberian Camera) will help make the camera better (Camera2 API).

The advantages of Camera2API are the native support of the following functions (without the need to install any mods) for a lot of camera apps (as far as I know for Google Camera, too):

(from here)

And other.

Maybe someday we'll reach even "Google Camera HDR+" (requires Camera 2api).:)
[Xperia Z1 Compact Android Development] hackintosh5:
[MENTION=4120742]munjeni[/MENTION], please could you let us use standard (non-aroma) installer for latest ROM for when we want auto-update script! I have written update script, only problem is that I have to tap through prompts. What would be truly awesome is if you could have script read config file to give AROMA-level config options!
[Xperia Z1 Compact Android Development] munjeni:
To get camera api2 its so hard, I will not do anything camera related, hard work, even jerpelea and co didn't got it working at least he never finished camera on xpreriadev project. I will stay on stock blobs. :)

I have found what crash camera when we double tap in video mode:

amami:/ $ logcat | grep autofocus
10-03 16:22:15.962 13976 13976 V CAM_FocusManager: Start autofocus.
10-03 16:22:20.643 13976 13976 V CAM_FocusManager: Cancel autofocus.
10-03 16:22:20.655 13976 13976 V CAM_FocusManager: Start autofocus.
10-03 16:22:25.637 13976 13976 V CAM_FocusManager: Cancel autofocus.
10-03 16:22:25.650 13976 13976 V CAM_FocusManager: Start autofocus.
10-03 16:22:34.759 13976 13976 V CAM_FocusManager: Cancel autofocus.
10-03 16:22:34.771 13976 13976 V CAM_FocusManager: Start autofocus.
10-03 16:22:54.448 13976 13976 V CAM_FocusManager: Cancel autofocus.
10-03 16:22:54.463 13976 13976 V CAM_FocusManager: Start autofocus.
10-03 16:22:54.850 13976 13976 V CAM_FocusManager: Cancel autofocus.
10-03 16:22:54.861 13976 13976 V CAM_FocusManager: Start autofocus.
10-03 16:23:07.978 14248 14248 V CAM_FocusManager: Start autofocus.
10-03 16:27:24.521 15548 15548 V CAM_FocusManager: Start autofocus.
10-03 16:27:25.448 15548 15548 V CAM_FocusManager: Cancel autofocus.
10-03 16:27:26.480 15548 15548 V CAM_FocusManager: Start autofocus.
10-03 16:27:27.398 15548 15548 V CAM_FocusManager: Cancel autofocus.
10-03 16:27:28.445 15548 15548 V CAM_FocusManager: Start autofocus.
10-03 16:27:29.328 15548 15548 V CAM_FocusManager: Cancel autofocus.
10-03 16:27:37.497 15548 15548 V CAM_FocusManager: Start autofocus.
10-03 16:27:37.721 15548 15548 V CAM_FocusManager: Cancel autofocus.
10-03 16:27:37.734 15548 15548 V CAM_FocusManager: Start autofocus.
10-03 16:27:41.598 15787 15787 V CAM_FocusManager: Start autofocus.
10-03 16:27:44.676 15787 15787 V CAM_FocusManager: Cancel autofocus.
10-03 16:27:44.687 15787 15787 V CAM_FocusManager: Start autofocus.
10-03 16:27:51.404 15985 15985 V CAM_FocusManager: Start autofocus.
10-03 16:27:55.162 15985 15985 V CAM_FocusManager: Cancel autofocus.
10-03 16:27:55.172 15985 15985 V CAM_FocusManager: Start autofocus.
10-03 16:28:00.253 16203 16203 V CAM_FocusManager: Start autofocus.
10-03 16:28:03.608 16203 16203 V CAM_FocusManager: Cancel autofocus.
10-03 16:28:05.179 16203 16203 V CAM_FocusManager: Start autofocus.
10-03 16:28:09.051 16203 16203 V CAM_FocusManager: Cancel autofocus.
10-03 16:28:09.061 16203 16203 V CAM_FocusManager: Start autofocus.

you can notice that sometime two times "start autofocus", when it happen camera crash because "cancel autofocus" is not done :) I'm looking into source code now, will try to fix.

Ril, done, manual and auto registration on prefered network is working now.
[Xperia Z1 Compact Android Development] munjeni:
Fixed camera! :)

cam patch ->https://pastebin.com/jC785KHB

ril patch -> https://pastebin.com/PV3Z5Ci0

Have added build prop tweak for ril -> ro.use_qcril_send_fake=1

Will give you now libril.so and Snap.apk , download and replace. Or redownload rom which is updated right now.
[Xperia Z1 Compact Android Development] vildevilde:
Is the rom updated today? The one on the download link is dated 20170930
[Xperia Z1 Compact Android Development] munjeni:
Yes 20170930
[Xperia Z1 Compact Android Development] hackintosh5:
Please! I really need this
[Xperia Z1 Compact Android Development] A_Laser:
Hi munjeni, thanks a lot for making this rom!!! :)

I can confirm that the manual network selection is still not working very well. I live at the Swiss boarder and i selected manually a German network.

After a while the phone connect into a another (Swiss and expensive) network. This often happens if there is temporarily no home-network reachable.

Is it possible to implement a deactivation of the automatic network selection by menu?

Thanks a lot!!!

Frank
[Xperia Z1 Compact Android Development] hackintosh5:
Nfc tags work - no chance to test hce yet!?
[Xperia Z1 Compact Android Development] Brozada:
Thanks munjeni for your ROM. Instaled 20170930 relese yesterday and it works flawlessly. Nice ROM to replace stock one, I'll just perform some extra testing. Gives impression of being way faster than stock lollipop rom. I own two Z1 compacts so I installed your ROM in the second one to test. Here are the results of comparison of antutu benchmarks in both phones, just in case someone is interested:

## LineageOS 14.1:

Antutu: 57783

3D: 7513

UX: 20635

CPU: 21129

RAM: 8516

## Stock Lollipop:

Antutu: 55989

3D: 7014

UX: 20199

CPU: 20262

RAM: 8514
[Xperia Z1 Compact Android Development] dmgZero:
Is anybody tried actual paying (e.g. AndroidPay) through NFC on the last builds?
[Xperia Z1 Compact Android Development] munjeni:
Sorry not, most non experienced users like aroma since its much much easier to chose what need or what not need and in the same time everything needed is included in just one zip file. If I come back to standard non aroma installer many will lost e.g. permissive kernel, many will ask ten times how to install rom, with aroma everything is clear and realy no need to write tutorial since its very easy to folow prompt menus.
[Xperia Z1 Compact Android Development] munjeni:
Hm, I realy have no idea why that happening, for example on stock rom its so clear when we select network manualy, manu string says that is is manualy selected, but on loc string on menu says auto, probably los bug? Also in wifi settings, when I select country code and reboot, sometimes its permanent but a most of time its not permanent and lost after reboot. I'm believing that we have missing something or that los have bug and didn't store permanent property propertly. If somebody have free time for debuging please look into logcat and tell me if you found something missing e.g. missing folder or something!
[Xperia Z1 Compact Android Development] munjeni:
I can confirm that tags is working now, just tried read my visa ant it was read. Didn't tried hce, have no idea how to test it.
[Xperia Z1 Compact Android Development] BokeB:
No more annoying "LTE+", no more network switching in WCDMA preferred mode.

NFC Test App says hce works.

Camera works.

Thank you for your work. Good job. :)
[Xperia Z1 Compact Android Development] hackintosh5:
Ok. Will updater-script ever be changed? If not, I can just write a script to replace aroma-related files!
[Xperia Z1 Compact Android Development] munjeni:
HCE works, realy? Thats great if true! WCDMA mode I also found that it works now realy good, so only remaining bug in telephony is to fix that automode switch somehow, I'm in hope its los bug and it somehow get fixed soon. Sim contacts "export contacts to sim card" need to be solved, I have found right now that superlamic use libril header in msm8974_common and I have noticed that its outdated, I'm in hope when I delete it we will get sim contacts solved (maybe automode/manualmode network switch too finaly). Curently I'm comparing lineageos/msm8974-common device tree with one which we curently use and have moved all things which we have done in our los to the amami device tree and I'm going to use lineage device tree now for msm8974_common. About rhine_common on lineage repo, its outdated, last branch in his repo is cm-13, so I will try to give push reguest on his repo in hope it get merged. About amami device tree on lineage repo, its outdated too, so I will try to give push reguest to lineage repo for amami in hope it get merged too. So if booth gets merged and lineage devs accept that we probably can get oficial builds finaly. Let hope it happen. :) But before anything everybody is involved solving remaining isue! I will try to fix that telephony and sim contacts, if you have some more time for researching and you have identified some isue and you have time and skills for solving it it would help a lot and spidup process for getting oficial build!

This is a list of bugs with priority:

1. fix remaining telephony bugs aka didn't stay on manual network selection (hope header related, wil try to fix)

2. fix sim contacts export to sim (hope header related, will try to fix)

3. fm no stereo (have no idea whats going on, no errors in log, probably audio config .xml files need to be investigated. I think double mono in output configurtion is need?)

4. somebody test and confirm that nfc all is ok

5. identify isue about why persistent props is not saved, e.g. when setup wifi country code in wifi setting, after reboot its didn't remembered. Can it be missing folder?

6. the rest, please post if you found!
[Xperia Z1 Compact Android Development] munjeni:
No mate, updater-script is hardcoded using my tool which converts .img files to ota package (romgen_lp.sh), you can get it from attachment https://xdaforums.com/showpost.php?p=69158225&postcount=105 , script converts .img to .zip and generate update-script which is hardcoded (every file for every line), so e.g. if you remove some lines from updater-script installation will fail, you can modify lines only or add new one. Please lets focus on fixing the rest of bugs, it have much more importanty than updater-script
[Xperia Z1 Compact Android Development] munjeni:
We can look to https://github.com/LineageOS/android_device_sony_fusion3-common , xperia z allready have oficial builds! Contain realy good commits which we can try on amami and look into it for more ideas.