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

View File

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

View File

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