Skip to content

Commit

Permalink
Allow to disable the new scan API for manual network search.
Browse files Browse the repository at this point in the history
The implementation to attempt new API and then fallback after
error is generic but may be not efficient. For the devices that
is not capable of using new API, it lengthens the network search
because of the new API scan trial in the first place and may fail
if the error is not properly caught.
(Refer to Ifebbac9965a40acaff0d50d32ca8603c72a6a77f for details)

As an alternative, this commit provides a config for devices that
are known as not capable of using new API to disable new API scan
and start network search through old API directly.

Change-Id: Iac3d70d91ee449a3a2ce4e5729176e09cb80b711
  • Loading branch information
nicorg2515 authored and Darkstar085 committed Oct 10, 2019
1 parent e01427d commit e73da35
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions res/values/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,10 @@
slot. If true, telephony will always try to place the emergency call on the subscription
associated with default data first, instead of using the default voice configuration.-->
<bool name="config_gnss_supl_requires_default_data_for_emergency">false</bool>

<!-- Flag indicating if network query through TelephonyManager.requestNetworkScan() should be
disabled.
If set to true, it will send network query through Phone.getAvailableNetworks() directly
rather than attempt to query through TelephonyManager.requestNetworkScan() first. -->
<bool name="config_disable_TelephonyManager_network_scan">false</bool>
</resources>
8 changes: 8 additions & 0 deletions src/com/android/phone/NetworkQueryService.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ public void startNetworkQuery(
switch (mState) {
case QUERY_READY:

final boolean isRequestNetworkScanDisabled =
getApplicationContext().getResources().getBoolean(
R.bool.config_disable_TelephonyManager_network_scan);
if (isRequestNetworkScanDisabled && isIncrementalResult) {
if (DBG) log("network scan via TelephonyManager is disabled");
isIncrementalResult = false;
}

if (isIncrementalResult) {
if (DBG) log("start network scan via TelephonManager");
TelephonyManager tm = (TelephonyManager) getSystemService(
Expand Down

0 comments on commit e73da35

Please sign in to comment.