client (Android): don't use network preferences

Many Android users had existing preferences with settings like
"don't compute when idle" that make sense for PCs but not mobile devices.
When this pref is enforced on Android, no computing happens
and user confusion results.
We're addressing this by using only local prefs on Android.
We considered other approaches - e.g. having a "mobile" venue -
but they're too complex.
This commit is contained in:
David Anderson 2013-08-04 15:13:26 -07:00
parent 6a34f264d4
commit 59ba61b323
4 changed files with 17 additions and 0 deletions

View File

@ -641,6 +641,7 @@ void ACCT_MGR_OP::handle_reply(int http_op_retval) {
}
}
#ifdef USE_NET_PREFS
bool read_prefs = false;
if (strlen(host_venue) && strcmp(host_venue, gstate.main_host_venue)) {
safe_strcpy(gstate.main_host_venue, host_venue);
@ -664,6 +665,7 @@ void ACCT_MGR_OP::handle_reply(int http_op_retval) {
if (read_prefs) {
gstate.read_global_prefs();
}
#endif
handle_sr_feeds(rss_feeds, &gstate.acct_mgr_info);

View File

@ -602,4 +602,15 @@ extern double calculate_exponential_backoff(
// min/max account manager RPC backoff
#define ANDROID_KEEPALIVE_TIMEOUT 30
// Android: if don't get a report_device_status() RPC from the GUI
// in this interval, exit.
// We rely on the GUI to report battery status.
#ifndef ANDROID
#define USE_NET_PREFS
// use preferences obtained over the network
// (i.e. through scheduler replies)
// Don't do this on Android
#endif
#endif

View File

@ -576,6 +576,7 @@ void CLIENT_STATE::read_global_prefs(
FILE* f;
string foo;
#ifdef USE_NET_PREFS
if (override_fname) {
retval = read_file_string(override_fname, foo);
if (!retval) {
@ -615,6 +616,7 @@ void CLIENT_STATE::read_global_prefs(
}
show_global_prefs_source(found_venue);
}
#endif
// read the override file
//

View File

@ -687,6 +687,7 @@ int CLIENT_STATE::handle_scheduler_reply(
}
}
#ifdef USE_NET_PREFS
// see if we have a new venue from this project
// (this must go AFTER the above, since otherwise
// global_prefs_source_project() is meaningless)
@ -704,6 +705,7 @@ int CLIENT_STATE::handle_scheduler_reply(
if (update_global_prefs) {
read_global_prefs();
}
#endif
// deal with project preferences (should always be there)
// If they've changed, write to account file,