move some stuff out of try block

This commit is contained in:
Brad Fitzpatrick 2010-08-01 17:20:35 -07:00
parent 078760fed5
commit d4566398d6
1 changed files with 12 additions and 13 deletions

View File

@ -107,30 +107,29 @@ public class UploadService extends Service {
stopServiceIfEmpty(); stopServiceIfEmpty();
return; return;
} }
String action = intent.getAction(); String action = intent.getAction();
if (Intent.ACTION_SEND.equals(action)) {
handleSend(intent);
return;
}
if (Intent.ACTION_SEND_MULTIPLE.equals(action)) {
handleSendMultiple(intent);
return;
}
try { try {
if (INTENT_POWER_CONNECTED.equals(intent.getAction())) { if (INTENT_POWER_CONNECTED.equals(action)) {
service.resume(); service.resume();
startBackgroundWatchers(); startBackgroundWatchers();
} }
if (INTENT_POWER_DISCONNECTED.equals(intent.getAction()) if (INTENT_POWER_DISCONNECTED.equals(action)
&& mPrefs.getBoolean(Preferences.AUTO_REQUIRE_POWER, false)) { && mPrefs.getBoolean(Preferences.AUTO_REQUIRE_POWER, false)) {
service.pause(); service.pause();
stopBackgroundWatchers(); stopBackgroundWatchers();
} }
if (Intent.ACTION_SEND.equals(action)) {
handleSend(intent);
return;
}
if (Intent.ACTION_SEND_MULTIPLE.equals(action)) {
handleSendMultiple(intent);
return;
}
} catch (RemoteException e) { } catch (RemoteException e) {
// Ignore. // Ignore.
} }