Stop using Intent.setClassName()

Use the type-safe Intent constructor to reference internal classes.
This commit is contained in:
cketti 2015-02-16 22:27:44 +01:00
parent 461778ed11
commit 24e6b39dc0
3 changed files with 6 additions and 12 deletions

View File

@ -163,8 +163,7 @@ public class MailService extends CoreService {
} }
private void cancel() { private void cancel() {
Intent i = new Intent(); Intent i = new Intent(this, MailService.class);
i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.MailService");
i.setAction(ACTION_CHECK_MAIL); i.setAction(ACTION_CHECK_MAIL);
BootReceiver.cancelIntent(this, i); BootReceiver.cancelIntent(this, i);
} }
@ -304,8 +303,7 @@ public class MailService extends CoreService {
Log.e(K9.LOG_TAG, "Exception while logging", e); Log.e(K9.LOG_TAG, "Exception while logging", e);
} }
Intent i = new Intent(); Intent i = new Intent(this, MailService.class);
i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.MailService");
i.setAction(ACTION_CHECK_MAIL); i.setAction(ACTION_CHECK_MAIL);
BootReceiver.scheduleIntent(MailService.this, nextTime, i); BootReceiver.scheduleIntent(MailService.this, nextTime, i);
} }
@ -410,8 +408,7 @@ public class MailService extends CoreService {
long nextTime = System.currentTimeMillis() + minInterval; long nextTime = System.currentTimeMillis() + minInterval;
if (K9.DEBUG) if (K9.DEBUG)
Log.d(K9.LOG_TAG, "Next pusher refresh scheduled for " + new Date(nextTime)); Log.d(K9.LOG_TAG, "Next pusher refresh scheduled for " + new Date(nextTime));
Intent i = new Intent(); Intent i = new Intent(this, MailService.class);
i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.MailService");
i.setAction(ACTION_REFRESH_PUSHERS); i.setAction(ACTION_REFRESH_PUSHERS);
BootReceiver.scheduleIntent(MailService.this, nextTime, i); BootReceiver.scheduleIntent(MailService.this, nextTime, i);
} }

View File

@ -134,15 +134,13 @@ public class RemoteControlService extends CoreService {
editor.commit(); editor.commit();
if (needsReschedule) { if (needsReschedule) {
Intent i = new Intent(); Intent i = new Intent(RemoteControlService.this, RemoteControlService.class);
i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.RemoteControlService");
i.setAction(RESCHEDULE_ACTION); i.setAction(RESCHEDULE_ACTION);
long nextTime = System.currentTimeMillis() + 10000; long nextTime = System.currentTimeMillis() + 10000;
BootReceiver.scheduleIntent(RemoteControlService.this, nextTime, i); BootReceiver.scheduleIntent(RemoteControlService.this, nextTime, i);
} }
if (needsPushRestart) { if (needsPushRestart) {
Intent i = new Intent(); Intent i = new Intent(RemoteControlService.this, RemoteControlService.class);
i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.RemoteControlService");
i.setAction(PUSH_RESTART_ACTION); i.setAction(PUSH_RESTART_ACTION);
long nextTime = System.currentTimeMillis() + 10000; long nextTime = System.currentTimeMillis() + 10000;
BootReceiver.scheduleIntent(RemoteControlService.this, nextTime, i); BootReceiver.scheduleIntent(RemoteControlService.this, nextTime, i);

View File

@ -31,8 +31,7 @@ public class SleepService extends CoreService {
sleepDatum.reacquireLatch = new CountDownLatch(1); sleepDatum.reacquireLatch = new CountDownLatch(1);
sleepData.put(id, sleepDatum); sleepData.put(id, sleepDatum);
Intent i = new Intent(); Intent i = new Intent(context, SleepService.class);
i.setClassName(context.getPackageName(), "com.fsck.k9.service.SleepService");
i.putExtra(LATCH_ID, id); i.putExtra(LATCH_ID, id);
i.setAction(ALARM_FIRED + "." + id); i.setAction(ALARM_FIRED + "." + id);
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();