mirror of https://github.com/BOINC/boinc.git
android: bug fix for changing p_ncpus in host_info. issue #1300.
previous attempt to acquire full wake lock during setup routine has not fixed this bug. changed p_ncpus detection from sysconf(_SC_NPRROCESSORS_ONLN) to _SC_NPROCESSORS_CONF in client's get_host_info for Android devices.
This commit is contained in:
parent
1d590434ea
commit
bcaf537228
|
@ -49,7 +49,6 @@ import android.os.Binder;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.PowerManager.WakeLock;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import edu.berkeley.boinc.AppPreferences;
|
import edu.berkeley.boinc.AppPreferences;
|
||||||
import edu.berkeley.boinc.R;
|
import edu.berkeley.boinc.R;
|
||||||
|
@ -107,13 +106,6 @@ public class Monitor extends Service {
|
||||||
private Boolean clientSetup() {
|
private Boolean clientSetup() {
|
||||||
if(Logging.DEBUG) Log.d(Logging.TAG,"Monitor.clientSetup()");
|
if(Logging.DEBUG) Log.d(Logging.TAG,"Monitor.clientSetup()");
|
||||||
|
|
||||||
// initialize full wakelock.
|
|
||||||
// gets used if client has to be started from scratch
|
|
||||||
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
|
||||||
WakeLock setupWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, Logging.TAG);
|
|
||||||
// do not acquire here, otherwise screen turns on, every time rpc connection
|
|
||||||
// gets reconnected.
|
|
||||||
|
|
||||||
// try to get current client status from monitor
|
// try to get current client status from monitor
|
||||||
ClientStatus status;
|
ClientStatus status;
|
||||||
try{
|
try{
|
||||||
|
@ -172,14 +164,8 @@ public class Monitor extends Service {
|
||||||
Integer clientPid = getPidForProcessName(clientProcessName);
|
Integer clientPid = getPidForProcessName(clientProcessName);
|
||||||
if(clientPid == null) {
|
if(clientPid == null) {
|
||||||
if(Logging.DEBUG) Log.d(Logging.TAG, "Starting the BOINC client");
|
if(Logging.DEBUG) Log.d(Logging.TAG, "Starting the BOINC client");
|
||||||
// wake up device and acquire full WakeLock here to allow BOINC client to detect
|
|
||||||
// all available CPU cores if not acquired and device in power saving mode, client
|
|
||||||
// might detect fewer CPU cores than available.
|
|
||||||
// Lock needs to be release, before return!
|
|
||||||
setupWakeLock.acquire();
|
|
||||||
if (!runClient()) {
|
if (!runClient()) {
|
||||||
if(Logging.DEBUG) Log.d(Logging.TAG, "BOINC client failed to start");
|
if(Logging.DEBUG) Log.d(Logging.TAG, "BOINC client failed to start");
|
||||||
setupWakeLock.release();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,9 +209,6 @@ public class Monitor extends Service {
|
||||||
status.setSetupStatus(ClientStatus.SETUP_STATUS_ERROR,true);
|
status.setSetupStatus(ClientStatus.SETUP_STATUS_ERROR,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
|
||||||
setupWakeLock.release(); // throws exception if it has not been acquired before
|
|
||||||
} catch(Exception e){}
|
|
||||||
return connected;
|
return connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1347,7 +1347,9 @@ int HOST_INFO::get_host_info() {
|
||||||
///////////// p_ncpus /////////////////
|
///////////// p_ncpus /////////////////
|
||||||
|
|
||||||
// sysconf not working on OS2
|
// sysconf not working on OS2
|
||||||
#if defined(_SC_NPROCESSORS_ONLN) && !defined(__EMX__) && !defined(__APPLE__)
|
#if defined(ANDROID)
|
||||||
|
p_ncpus = sysconf(_SC_NPROCESSORS_CONF);
|
||||||
|
#elif defined(_SC_NPROCESSORS_ONLN) && !defined(__EMX__) && !defined(__APPLE__)
|
||||||
p_ncpus = sysconf(_SC_NPROCESSORS_ONLN);
|
p_ncpus = sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
#elif defined(HAVE_SYS_SYSCTL_H) && defined(CTL_HW) && defined(HW_NCPU)
|
#elif defined(HAVE_SYS_SYSCTL_H) && defined(CTL_HW) && defined(HW_NCPU)
|
||||||
// Get number of CPUs
|
// Get number of CPUs
|
||||||
|
|
Loading…
Reference in New Issue