- android/BOINC/: rename of MainActivity to BOINCActivity

- android/BOINC/: getVersionCode added to AIDL
- android/BOINC/: reduce import warnings
This commit is contained in:
Joachim Fritzsch 2013-02-04 12:19:38 +01:00 committed by Oliver Bock
parent 123c725cac
commit 2097bbdbc8
7 changed files with 35 additions and 18 deletions

View File

@ -34,7 +34,7 @@
android:allowBackup="false">
<activity
android:name="edu.berkeley.boinc.MainActivity"
android:name="edu.berkeley.boinc.BOINCActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>

View File

@ -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

View File

@ -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

View File

@ -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");
}
}

View File

@ -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.

View File

@ -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<retryAttempts)) { //re-trys setting up the client several times, before giving up.
MainActivity.logMessage(getApplicationContext(), TAG, "--- restart setup ---");
BOINCActivity.logMessage(getApplicationContext(), TAG, "--- restart setup ---");
counter++;
try {
Thread.sleep(retryRate);
@ -857,10 +857,10 @@ public class Monitor extends Service{
protected Boolean doInBackground(Void... params) {
Log.d(TAG, "doInBackground");
Boolean success = rpc.quit();
MainActivity.logMessage(getApplicationContext(), TAG, "graceful shutdown returned " + success);
BOINCActivity.logMessage(getApplicationContext(), TAG, "graceful shutdown returned " + success);
if(!success) {
clientProcess.destroy();
MainActivity.logMessage(getApplicationContext(), TAG, "process killed ");
BOINCActivity.logMessage(getApplicationContext(), TAG, "process killed ");
}
return success;
}

View File

@ -19,7 +19,7 @@
package edu.berkeley.boinc.receiver;
import edu.berkeley.boinc.AppPreferences;
import edu.berkeley.boinc.MainActivity;
import edu.berkeley.boinc.BOINCActivity;
import edu.berkeley.boinc.R;
import edu.berkeley.boinc.client.Monitor;
import android.app.Notification;
@ -49,7 +49,7 @@ public class BootReceiver extends BroadcastReceiver {
mNM = (NotificationManager) context.getSystemService(Service.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.boinc, context.getString(R.string.autostart_notification_header), System.currentTimeMillis());
PendingIntent contentIntent = PendingIntent.getActivity(context.getApplicationContext(), 0, new Intent(context.getApplicationContext(), MainActivity.class), 0);
PendingIntent contentIntent = PendingIntent.getActivity(context.getApplicationContext(), 0, new Intent(context.getApplicationContext(), BOINCActivity.class), 0);
// Set current view for notification panel
notification.setLatestEventInfo(context.getApplicationContext(), context.getString(R.string.autostart_notification_header), context.getString(R.string.autostart_notification_text), contentIntent);