Merge "Correct requestRefLocation"
This commit is contained in:
@@ -1447,7 +1447,9 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
||||
* @return the cell ID or -1 if invalid
|
||||
*/
|
||||
private static long getCidFromCellIdentity(CellIdentity id) {
|
||||
if (id == null) return -1;
|
||||
if (id == null) {
|
||||
return -1;
|
||||
}
|
||||
long cid = -1;
|
||||
switch(id.getType()) {
|
||||
case CellInfo.TYPE_GSM: cid = ((CellIdentityGsm) id).getCid(); break;
|
||||
@@ -1522,7 +1524,8 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
||||
|
||||
for (CellInfo ci : cil) {
|
||||
int status = ci.getCellConnectionStatus();
|
||||
if (status == CellInfo.CONNECTION_PRIMARY_SERVING
|
||||
if (ci.isRegistered()
|
||||
|| status == CellInfo.CONNECTION_PRIMARY_SERVING
|
||||
|| status == CellInfo.CONNECTION_SECONDARY_SERVING) {
|
||||
CellIdentity c = ci.getCellIdentity();
|
||||
int t = getCellType(ci);
|
||||
|
||||
@@ -55,13 +55,13 @@ jboolean AGnssRil::setRefLocation(jint type, jint mcc, jint mnc, jint lac, jlong
|
||||
case IAGnssRil::AGnssRefLocationType::UMTS_CELLID:
|
||||
case IAGnssRil::AGnssRefLocationType::LTE_CELLID:
|
||||
case IAGnssRil::AGnssRefLocationType::NR_CELLID:
|
||||
location.cellID.mcc = mcc;
|
||||
location.cellID.mnc = mnc;
|
||||
location.cellID.lac = lac;
|
||||
location.cellID.cid = cid;
|
||||
location.cellID.tac = tac;
|
||||
location.cellID.pcid = pcid;
|
||||
location.cellID.arfcn = arfcn;
|
||||
location.cellID.mcc = static_cast<int>(mcc);
|
||||
location.cellID.mnc = static_cast<int>(mnc);
|
||||
location.cellID.lac = static_cast<int>(lac);
|
||||
location.cellID.cid = static_cast<long>(cid);
|
||||
location.cellID.tac = static_cast<int>(tac);
|
||||
location.cellID.pcid = static_cast<int>(pcid);
|
||||
location.cellID.arfcn = static_cast<int>(arfcn);
|
||||
break;
|
||||
default:
|
||||
ALOGE("Unknown cellid (%s:%d).", __FUNCTION__, __LINE__);
|
||||
@@ -106,20 +106,24 @@ jboolean AGnssRil_V1_0::setSetId(jint type, const jstring& setid_string) {
|
||||
return checkHidlReturn(result, "IAGnssRil_V1_0 setSetId() failed.");
|
||||
}
|
||||
|
||||
jboolean AGnssRil_V1_0::setRefLocation(jint type, jint mcc, jint mnc, jint lac, jlong cid, jint,
|
||||
jint, jint) {
|
||||
jboolean AGnssRil_V1_0::setRefLocation(jint type, jint mcc, jint mnc, jint lac, jlong cid, jint tac,
|
||||
jint pcid, jint) {
|
||||
IAGnssRil_V1_0::AGnssRefLocation location;
|
||||
switch (static_cast<IAGnssRil_V1_0::AGnssRefLocationType>(type)) {
|
||||
location.type = static_cast<IAGnssRil_V1_0::AGnssRefLocationType>(type);
|
||||
|
||||
switch (location.type) {
|
||||
case IAGnssRil_V1_0::AGnssRefLocationType::GSM_CELLID:
|
||||
case IAGnssRil_V1_0::AGnssRefLocationType::UMTS_CELLID:
|
||||
location.type = static_cast<IAGnssRil_V1_0::AGnssRefLocationType>(type);
|
||||
location.cellID.mcc = mcc;
|
||||
location.cellID.mnc = mnc;
|
||||
location.cellID.lac = lac;
|
||||
location.cellID.cid = cid;
|
||||
case IAGnssRil_V1_0::AGnssRefLocationType::LTE_CELLID:
|
||||
location.cellID.mcc = static_cast<uint16_t>(mcc);
|
||||
location.cellID.mnc = static_cast<uint16_t>(mnc);
|
||||
location.cellID.lac = static_cast<uint16_t>(lac);
|
||||
location.cellID.cid = static_cast<uint32_t>(cid);
|
||||
location.cellID.tac = static_cast<uint16_t>(tac);
|
||||
location.cellID.pcid = static_cast<uint16_t>(pcid);
|
||||
break;
|
||||
default:
|
||||
ALOGE("Neither a GSM nor a UMTS cellid (%s:%d).", __FUNCTION__, __LINE__);
|
||||
ALOGE("Unknown cellid (%s:%d).", __FUNCTION__, __LINE__);
|
||||
return JNI_FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user