diff --git a/android/BOINC/AndroidManifest.xml b/android/BOINC/AndroidManifest.xml index 68ea58a7c6..00421b10ce 100644 --- a/android/BOINC/AndroidManifest.xml +++ b/android/BOINC/AndroidManifest.xml @@ -34,7 +34,7 @@ android:allowBackup="false"> diff --git a/android/BOINC/src/edu/berkeley/boinc/MainActivity.java b/android/BOINC/src/edu/berkeley/boinc/BOINCActivity.java similarity index 98% rename from android/BOINC/src/edu/berkeley/boinc/MainActivity.java rename to android/BOINC/src/edu/berkeley/boinc/BOINCActivity.java index 059b6cdafa..6a88dbddb7 100644 --- a/android/BOINC/src/edu/berkeley/boinc/MainActivity.java +++ b/android/BOINC/src/edu/berkeley/boinc/BOINCActivity.java @@ -38,7 +38,7 @@ import android.widget.LinearLayout; import android.widget.TabHost; import android.widget.TabHost.TabSpec; -public class MainActivity extends TabActivity { +public class BOINCActivity extends TabActivity { private final String TAG = "MainActivity"; @@ -250,7 +250,7 @@ public class MainActivity extends TabActivity { Log.d(TAG,"tab layout setup done"); - MainActivity.logMessage(this, TAG, "tab setup finished"); + BOINCActivity.logMessage(this, TAG, "tab setup finished"); } // triggered by click on noproject_warning, starts login activity diff --git a/android/BOINC/src/edu/berkeley/boinc/client/ClientRemoteService.java b/android/BOINC/src/edu/berkeley/boinc/client/ClientRemoteService.java index dfe4dd718c..a14c82600c 100644 --- a/android/BOINC/src/edu/berkeley/boinc/client/ClientRemoteService.java +++ b/android/BOINC/src/edu/berkeley/boinc/client/ClientRemoteService.java @@ -6,6 +6,7 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; +import android.content.pm.PackageManager.NameNotFoundException; import android.os.IBinder; import android.os.RemoteException; import android.util.Log; @@ -41,6 +42,17 @@ public class ClientRemoteService extends Service { return mIsMonitorBound; } + @Override + public int getVersionCode() throws RemoteException { + Integer version = 0; + try { + version = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode; + } catch (NameNotFoundException e) { + Log.e(TAG,"could not retrieve own version code!",e); + } + return version; + } + @Override public boolean attachProject(String packageName, String url, String id, String pwd) throws RemoteException { // TODO store packageName in AppPreferences diff --git a/android/BOINC/src/edu/berkeley/boinc/client/ClientStatus.java b/android/BOINC/src/edu/berkeley/boinc/client/ClientStatus.java index e12dbd80c5..2971e81007 100644 --- a/android/BOINC/src/edu/berkeley/boinc/client/ClientStatus.java +++ b/android/BOINC/src/edu/berkeley/boinc/client/ClientStatus.java @@ -23,7 +23,7 @@ import java.util.ArrayList; import android.content.Context; import android.content.Intent; import android.util.Log; -import edu.berkeley.boinc.MainActivity; +import edu.berkeley.boinc.BOINCActivity; import edu.berkeley.boinc.definitions.CommonDefs; import edu.berkeley.boinc.rpc.CcStatus; import edu.berkeley.boinc.rpc.GlobalPreferences; @@ -109,7 +109,7 @@ public class ClientStatus { if(!computingParseError && !networkParseError && !setupStatusParseError) { fire(); // broadcast that status has changed } else { - MainActivity.logMessage(ctx, TAG, "discard status change due to parse error" + computingParseError + computingStatus + computingSuspendReason + "-" + networkParseError + networkStatus + networkSuspendReason + "-" + setupStatusParseError); + BOINCActivity.logMessage(ctx, TAG, "discard status change due to parse error" + computingParseError + computingStatus + computingSuspendReason + "-" + networkParseError + networkStatus + networkSuspendReason + "-" + setupStatusParseError); } } @@ -183,7 +183,7 @@ public class ClientStatus { } catch (Exception e) { setupStatusParseError = true; Log.e(TAG, "parseProjectStatus - Exception", e); - MainActivity.logMessage(ctx, TAG, "error parsing setup status (project state)"); + BOINCActivity.logMessage(ctx, TAG, "error parsing setup status (project state)"); } } @@ -228,7 +228,7 @@ public class ClientStatus { } } catch (Exception e) { Log.e(TAG, "parseComputingStatus - Exception", e); - MainActivity.logMessage(ctx, TAG, "error - client computing status"); + BOINCActivity.logMessage(ctx, TAG, "error - client computing status"); } } @@ -255,7 +255,7 @@ public class ClientStatus { } } catch (Exception e) { Log.e(TAG, "parseNetworkStatus - Exception", e); - MainActivity.logMessage(ctx, TAG, "error - client network status"); + BOINCActivity.logMessage(ctx, TAG, "error - client network status"); } } diff --git a/android/BOINC/src/edu/berkeley/boinc/client/IClientRemoteService.aidl b/android/BOINC/src/edu/berkeley/boinc/client/IClientRemoteService.aidl index 949a9f6e21..50ab5a0c00 100644 --- a/android/BOINC/src/edu/berkeley/boinc/client/IClientRemoteService.aidl +++ b/android/BOINC/src/edu/berkeley/boinc/client/IClientRemoteService.aidl @@ -33,6 +33,11 @@ interface IClientRemoteService { /* Checks whether interface recipient is ready to serve commands. * returns success*/ boolean isReady(); + + /* Returns the version code specified in AndroidManifest.xml. + * can be used to detect new AIDL versions. + * returns version code as Integer*/ + int getVersionCode(); //== project management == /* Attach project to BOINC application. diff --git a/android/BOINC/src/edu/berkeley/boinc/client/Monitor.java b/android/BOINC/src/edu/berkeley/boinc/client/Monitor.java index 0d99860b53..ee4799e421 100644 --- a/android/BOINC/src/edu/berkeley/boinc/client/Monitor.java +++ b/android/BOINC/src/edu/berkeley/boinc/client/Monitor.java @@ -38,7 +38,7 @@ import android.os.IBinder; import android.util.Log; import android.widget.Toast; import edu.berkeley.boinc.LoginActivity; -import edu.berkeley.boinc.MainActivity; +import edu.berkeley.boinc.BOINCActivity; import edu.berkeley.boinc.AppPreferences; import edu.berkeley.boinc.R; import edu.berkeley.boinc.rpc.AccountIn; @@ -179,7 +179,7 @@ public class Monitor extends Service{ public void restartMonitor() { if(Monitor.monitorActive) { //monitor is already active, launch cancelled - MainActivity.logMessage(getApplicationContext(), TAG, "monitor active - restart cancelled"); + BOINCActivity.logMessage(getApplicationContext(), TAG, "monitor active - restart cancelled"); } else { Log.d(TAG,"restart monitor"); @@ -418,7 +418,7 @@ public class Monitor extends Service{ if((status!=null)&&(results!=null)&&(projects!=null)&&(transfers!=null)&&(clientPrefs!=null)) { Monitor.clientStatus.setClientStatus(status,results,projects,transfers,clientPrefs,msgs); } else { - MainActivity.logMessage(getApplicationContext(), TAG, "client status connection problem"); + BOINCActivity.logMessage(getApplicationContext(), TAG, "client status connection problem"); } Intent clientStatus = new Intent(); @@ -437,7 +437,7 @@ public class Monitor extends Service{ @Override protected void onProgressUpdate(String... arg0) { Log.d(TAG+"-onProgressUpdate",arg0[0]); - MainActivity.logMessage(getApplicationContext(), TAG, arg0[0]); + BOINCActivity.logMessage(getApplicationContext(), TAG, arg0[0]); } @Override @@ -487,7 +487,7 @@ public class Monitor extends Service{ @Override protected void onProgressUpdate(String... arg0) { Log.d(TAG+"-onProgressUpdate",arg0[0]); - MainActivity.logMessage(getApplicationContext(), TAG, arg0[0]); + BOINCActivity.logMessage(getApplicationContext(), TAG, arg0[0]); } private Boolean startUp() { @@ -509,7 +509,7 @@ public class Monitor extends Service{ Boolean connected = false; Integer counter = 0; while(!(connected=connectClient()) && (counter