From 59ba61b323e4e02850e97614fc9c076995a74b0a Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 4 Aug 2013 15:13:26 -0700 Subject: [PATCH] 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. --- client/acct_mgr.cpp | 2 ++ client/client_state.h | 11 +++++++++++ client/cs_prefs.cpp | 2 ++ client/cs_scheduler.cpp | 2 ++ 4 files changed, 17 insertions(+) diff --git a/client/acct_mgr.cpp b/client/acct_mgr.cpp index ba5b7e6ac9..dfe78b4299 100644 --- a/client/acct_mgr.cpp +++ b/client/acct_mgr.cpp @@ -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); diff --git a/client/client_state.h b/client/client_state.h index 6f36df05e6..007a2c8673 100644 --- a/client/client_state.h +++ b/client/client_state.h @@ -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 diff --git a/client/cs_prefs.cpp b/client/cs_prefs.cpp index 7298576804..0ac9743da4 100644 --- a/client/cs_prefs.cpp +++ b/client/cs_prefs.cpp @@ -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 // diff --git a/client/cs_scheduler.cpp b/client/cs_scheduler.cpp index 9a2edba93f..8e85e4fe7a 100644 --- a/client/cs_scheduler.cpp +++ b/client/cs_scheduler.cpp @@ -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,