Resolved Redmi 4X / santoni: Bad Network Location and no Camera2 API


Status
Not open for further replies.

jdr_85

Members
Nov 13, 2018
7
5
Hi,
just upgraded my santoni from MIUI 9 Global Stable to MIUI 10 EU Stable (10.1.1.0). It runs very smoothly and the battery life is awesome but unfortunately I found two annoying bugs:

1. Network Location does not work very well
The integrated Network Location Provider really sucks as it does not detect my position exactly. The position it shows is not wrong but accuracy is really bad. The Google Play Services fuse NLP works properly so using Google Maps and other fuse apps is perfectly OK. Unfortunately I still use an app (Tasker) that uses Android‘s integrated NLP so all my location stuff does not work any more. On the old Global MIUI and on all my other phones the integrated Android NLP works perfectly so I never had this issue.

Could it be the case that EU ROM uses some crappy Chinese Network Location Provider from the original Chinese ROM it is based on? Is there anything that can be done about it?

2. No Camera2 API
Well, this is probably Xiaomi‘s fault. On MIUI 9 I always used a *no-support-for-this-app-on-this-forum* Mod which worked perfectly. On MIUI 10 Camera2 API is unavailable although I activated HAL3. What can be done about it?

Best regards
 

Attachments

  • 9AFC4825-0BEA-4892-9D2A-749C712D7164.jpeg
    9AFC4825-0BEA-4892-9D2A-749C712D7164.jpeg
    178.4 KB · Views: 1,179
Yes, Camera2 API is probably nothing we can fix ourselves.

-----

But I am sure that the first problem with the Network Location Provider can be solved. I found a solution for it in several forums (especially this quite old one).

The reason is (almost as assumed in my original post) that the Network Location Provider is misconfigured. The /system/framework/framework-res.apk contains the files res/values/strings.xml and bools.xml

I wanted to replace the location configuration strings as proposed in the post but was unable to recompile the apk file afterwards (don't know how to work with apktool).

I am not sure how to make the developers here aware of the problem and possible solution. It will probably work after just replacing these strings (which should be quite easy). Hopefully @Igor Eisberg or some other team member sees this.

My temporary workaround at the moment is to install and activate XposedGmsCoreUnifiedNlp Xposed module.

Before workaround:
Code:
dumpsys location

Current Location Manager state:
  Location Listeners:
    Reciever[20abad1 listener UpdateRecord[passive android(1000) Request[POWER_NONE passive fastest=0]]]
    Reciever[2236936 listener UpdateRecord[passive com.xiaomi.location.fused(1000) Request[POWER_NONE passive fastest=+1s0ms]]]
    Reciever[8e67037 listener UpdateRecord[passive com.xiaomi.metoknlp(10073) Request[POWER_NONE passive fastest=+1s0ms]]]
    Reciever[1d8b9a4 listener UpdateRecord[passive com.google.android.gms(10016) Request[POWER_NONE passive fastest=0]]]
    Reciever[aaf330d listener UpdateRecord[passive com.qualcomm.location(1000) Request[POWER_NONE passive fastest=0]]]
    Reciever[734e2c2 listener UpdateRecord[passive com.google.android.gms(10016) Request[POWER_NONE passive fastest=0]]]
    Reciever[2a7d8d3 listener UpdateRecord[passive android(1000) Request[POWER_NONE passive fastest=0]]]
    Reciever[bb9cc10 listener UpdateRecord[passive com.xiaomi.metoknlp(10073) Request[POWER_NONE passive fastest=+2s0ms]]]
  Active Records by Provider:
    fused:
    network:
    passive:
      UpdateRecord[passive android(1000) Request[POWER_NONE passive fastest=0]]
      UpdateRecord[passive android(1000) Request[POWER_NONE passive fastest=0]]
      UpdateRecord[passive com.qualcomm.location(1000) Request[POWER_NONE passive fastest=0]]
      UpdateRecord[passive com.xiaomi.metoknlp(10073) Request[POWER_NONE passive fastest=+2s0ms]]
      UpdateRecord[passive com.xiaomi.metoknlp(10073) Request[POWER_NONE passive fastest=+1s0ms]]
      UpdateRecord[passive com.google.android.gms(10016) Request[POWER_NONE passive fastest=0]]
      UpdateRecord[passive com.google.android.gms(10016) Request[POWER_NONE passive fastest=0]]
      UpdateRecord[passive com.xiaomi.location.fused(1000) Request[POWER_NONE passive fastest=+1s0ms]]
    gps:
  Historical Records by Provider:
    jp.osaka.appppy.locationprovidertest: gps: Interval 0 seconds: Duration requested 0 out of the last 3 minutes
    com.xiaomi.metoknlp: passive: Min interval 1 seconds: Max interval 2 seconds: Duration requested 5 out of the last 5 minutes: Currently active
    jp.osaka.appppy.locationprovidertest: network: Interval 0 seconds: Duration requested 0 out of the last 3 minutes
    android: fused: Interval 0 seconds: Duration requested 0 out of the last 2 minutes
    android: passive: Interval 0 seconds: Duration requested 5 out of the last 5 minutes: Currently active
    com.android.settings: network: Interval 1 seconds: Duration requested 1 out of the last 4 minutes
    com.qualcomm.location: passive: Interval 0 seconds: Duration requested 5 out of the last 5 minutes: Currently active
    android: gps: Interval 1 seconds: Duration requested 0 out of the last 2 minutes
    com.google.android.apps.maps: gps: Interval 1 seconds: Duration requested 0 out of the last 3 minutes
    com.google.android.gms: passive: Interval 0 seconds: Duration requested 5 out of the last 5 minutes: Currently active
    net.dinglisch.android.taskerm: network: Interval 0 seconds: Duration requested 1 out of the last 4 minutes
    com.xiaomi.location.fused: passive: Interval 1 seconds: Duration requested 4 out of the last 4 minutes: Currently active
  Last Known Locations:
    network: Location[network 49,xxx,8,xxx acc=460 et=+4m27s565ms alt=0.0 vel=0.0 bear=0.0 {Bundle[{noGPSLocation=Location[network 49,xxx,8,xxx acc=460 et=+4m27s565ms alt=0.0 vel=0.0 bear=0.0], com.qualcomm.location.nlp:ready=true}]}]
    passive: Location[network 49,xxx,8,xxx acc=460 et=+4m27s565ms alt=0.0 vel=0.0 bear=0.0 {Bundle[{noGPSLocation=Location[network 49,xxx,8,xxx acc=460 et=+4m27s565ms alt=0.0 vel=0.0 bear=0.0], com.qualcomm.location.nlp:ready=true}]}]
  Last Known Locations Coarse Intervals:
    network: Location[network 49,xxx,8,xxx acc=460 et=+4m22s931ms alt=0.0 vel=0.0 bear=0.0 {Bundle[{noGPSLocation=Location[network 49,xxx,8,xxx acc=460 et=+4m22s931ms alt=0.0 vel=0.0 bear=0.0 {Bundle[{coarseLocation=Location[network 49,387387,8,359342 acc=2000 et=+4m22s931ms]}]}], com.qualcomm.location.nlp:ready=true}]}]
    passive: Location[network 49,xxx,8,xxx acc=460 et=+4m22s931ms alt=0.0 vel=0.0 bear=0.0 {Bundle[{noGPSLocation=Location[network 49,xxx,8,xxx acc=460 et=+4m22s931ms alt=0.0 vel=0.0 bear=0.0 {Bundle[{coarseLocation=Location[network 49,387387,8,359342 acc=2000 et=+4m22s931ms]}]}], com.qualcomm.location.nlp:ready=true}]}]
  Geofences:
  Enabled Providers:
    fused
    passive
  mWhitelist=[] mBlacklist=[]
  fudger: offset: -201, -14 (meters)
passive Internal State:
mReportLocation=true
gps Internal State:
  mFixInterval=1000
  mDisableGps (battery saver mode)=false
  mEngineCapabilities=0x0 ( )
nullnetwork Internal State (com.qualcomm.location):
REMOTE SERVICE name=network pkg=com.qualcomm.location version=10000
fused Internal State (com.qualcomm.location):
REMOTE SERVICE name=fused pkg=com.qualcomm.location version=1

After workaround:
Code:
Current Location Manager state:
  Location Listeners:
    Reciever[3e15675 listener UpdateRecord[passive com.qualcomm.location(1000) Request[POWER_NONE passive fastest=0]]]
    Reciever[2c7a60a listener UpdateRecord[passive com.xiaomi.location.fused(1000) Request[POWER_NONE passive fastest=+1s0ms]]]
    Reciever[954ee7b listener UpdateRecord[passive com.xiaomi.metoknlp(10073) Request[POWER_NONE passive fastest=+2s0ms]]]
    Reciever[7f53498 listener UpdateRecord[passive com.xiaomi.metoknlp(10073) Request[POWER_NONE passive fastest=+1s0ms]]]
    Reciever[efde4f1 listener UpdateRecord[passive android(1000) Request[POWER_NONE passive fastest=0]]]
    Reciever[14218d6 listener UpdateRecord[passive com.google.android.gms(10016) Request[POWER_NONE passive fastest=0]]]
    Reciever[839f757 listener UpdateRecord[passive com.google.android.gms(10016) Request[POWER_NONE passive fastest=0]]]
    Reciever[e550244 listener UpdateRecord[passive android(1000) Request[POWER_NONE passive fastest=0]]]
  Active Records by Provider:
    network:
    fused:
    passive:
      UpdateRecord[passive android(1000) Request[POWER_NONE passive fastest=0]]
      UpdateRecord[passive android(1000) Request[POWER_NONE passive fastest=0]]
      UpdateRecord[passive com.qualcomm.location(1000) Request[POWER_NONE passive fastest=0]]
      UpdateRecord[passive com.xiaomi.metoknlp(10073) Request[POWER_NONE passive fastest=+2s0ms]]
      UpdateRecord[passive com.google.android.gms(10016) Request[POWER_NONE passive fastest=0]]
      UpdateRecord[passive com.xiaomi.metoknlp(10073) Request[POWER_NONE passive fastest=+1s0ms]]
      UpdateRecord[passive com.google.android.gms(10016) Request[POWER_NONE passive fastest=0]]
      UpdateRecord[passive com.xiaomi.location.fused(1000) Request[POWER_NONE passive fastest=+1s0ms]]
    gps:
  Historical Records by Provider:
    jp.osaka.appppy.locationprovidertest: gps: Interval 0 seconds: Duration requested 0 out of the last 0 minutes
    com.xiaomi.metoknlp: passive: Min interval 1 seconds: Max interval 2 seconds: Duration requested 3 out of the last 3 minutes: Currently active
    jp.osaka.appppy.locationprovidertest: network: Interval 0 seconds: Duration requested 0 out of the last 0 minutes
    android: fused: Interval 0 seconds: Duration requested 0 out of the last 2 minutes
    android: passive: Interval 0 seconds: Duration requested 3 out of the last 3 minutes: Currently active
    com.android.settings: network: Interval 1 seconds: Duration requested 0 out of the last 3 minutes
    com.qualcomm.location: passive: Interval 0 seconds: Duration requested 3 out of the last 3 minutes: Currently active
    android: gps: Interval 1 seconds: Duration requested 0 out of the last 2 minutes
    com.google.android.gms: passive: Interval 0 seconds: Duration requested 3 out of the last 3 minutes: Currently active
    net.dinglisch.android.taskerm: network: Interval 0 seconds: Duration requested 0 out of the last 3 minutes
    com.xiaomi.location.fused: passive: Interval 1 seconds: Duration requested 2 out of the last 2 minutes: Currently active
  Last Known Locations:
    network: Location[network 49,xxx,8,xxx acc=19 et=+6m26s471ms {Bundle[{networkLocationType=wifi, noGPSLocation=Location[network 49,xxx,8,xxx acc=19 et=+6m26s471ms {Bundle[mParcelledData.dataSize=68]}]}]}]
    passive: Location[network 49,xxx,8,xxx acc=19 et=+6m26s471ms {Bundle[{networkLocationType=wifi, noGPSLocation=Location[network 49,xxx,8,xxx acc=19 et=+6m26s471ms {Bundle[mParcelledData.dataSize=68]}]}]}]
  Last Known Locations Coarse Intervals:
    network: Location[network 49,yyy,8,yyy acc=20 et=+3m4s613ms {Bundle[{networkLocationType=wifi, noGPSLocation=Location[network 49,yyy,8,yyy acc=20 et=+3m4s613ms {Bundle[{networkLocationType=wifi, coarseLocation=Location[network 49,369369,8,356278 acc=2000 et=+3m4s613ms]}]}]}]}]
    passive: Location[network 49,yyy,8,yyy acc=20 et=+3m4s613ms {Bundle[{networkLocationType=wifi, noGPSLocation=Location[network 49,yyy,8,yyy acc=20 et=+3m4s613ms {Bundle[{networkLocationType=wifi, coarseLocation=Location[network 49,369369,8,356278 acc=2000 et=+3m4s613ms]}]}]}]}]
  Geofences:
  Enabled Providers:
    fused
    passive
  mWhitelist=[] mBlacklist=[]
  fudger: offset: -248, -565 (meters)
passive Internal State:
mReportLocation=true
gps Internal State:
  mFixInterval=1000
  mDisableGps (battery saver mode)=false
  mEngineCapabilities=0x0 ( )
nullnetwork Internal State (com.google.android.gms):
REMOTE SERVICE name=network pkg=com.google.android.gms version=2
fused Internal State (com.qualcomm.location):
REMOTE SERVICE name=fused pkg=com.qualcomm.location version=1

It works perfectly. Maybe there is an easy way to include this fix in EU ROM?
 
Try flashing this, tell me if Network Location works for you. (This test is only for Redmi 4X)
https://www.mediafire.com/file/k4lvt4ju4fhzy00/NLPTest_HM4X.flashable.zip/file

Hi Igor,
thanks for your prompt bugfix. I have flashed the zip file and got a bootloop afterwards. Don't know why because it just removes the MetokNLP and replaces the izat.conf. Maybe I forgot to clean dalvik, so my fault.

However, just to make sure, I reflashed the EU ROM, then flashed your fix and afterwards flashed Magisk. Network Location now works properly without beforementioned Xposed module, so I guess your fix works! Will this be included in future EU ROMs?
 
Hi Igor,
thanks for your prompt bugfix. I have flashed the zip file and got a bootloop afterwards. Don't know why because it just removes the MetokNLP and replaces the izat.conf. Maybe I forgot to clean dalvik, so my fault.

However, just to make sure, I reflashed the EU ROM, then flashed your fix and afterwards flashed Magisk. Network Location now works properly without beforementioned Xposed module, so I guess your fix works! Will this be included in future EU ROMs?
Basically I removed MetokNLP, which [from investigation of Qualcomm Location Provider] is intended for use in China region [although worked fine in my region, but was misbehaving in the EU region], and re-enabled Google Play services as default network location provider [like it is in Global ROM]. Now with your confirmation, I think it's safe to implement in our releases. Thanks for the feedback.
 
  • Like
Reactions: jdr_85
Cool, thanks @Igor Eisberg. Good to hear that the fix will be included in your releases. And interesting that MetokNLP works in Israel.
You can probably mark this as not in progess any more :).
 
Status
Not open for further replies.