From: Android (Google) Code Review Date: Tue, 29 Sep 2009 18:19:46 +0000 (-0400) Subject: Merge change I3105cddf into eclair X-Git-Tag: android-x86-2.2~127^2~13 X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fpackages-apps-DeskClock.git;a=commitdiff_plain;h=511c35144c8e976bb75f6c066f7c3a2ebbbc83b8;hp=27d3defc38208ef56be33ea634ecdef17caf3f86 Merge change I3105cddf into eclair * changes: Use onStartCommand since onStart is deprecated. --- diff --git a/src/com/android/alarmclock/AlarmKlaxon.java b/src/com/android/alarmclock/AlarmKlaxon.java index a20f68d..7205db6 100644 --- a/src/com/android/alarmclock/AlarmKlaxon.java +++ b/src/com/android/alarmclock/AlarmKlaxon.java @@ -109,13 +109,20 @@ public class AlarmKlaxon extends Service { } @Override - public void onStart(Intent intent, int startId) { + public int onStartCommand(Intent intent, int flags, int startId) { + // No intent, tell the system not to restart us. + if (intent == null) { + stopSelf(); + return START_NOT_STICKY; + } + final Alarm alarm = intent.getParcelableExtra( Alarms.ALARM_INTENT_EXTRA); if (alarm == null) { Log.v("AlarmKlaxon failed to parse the alarm from the intent"); - return; + stopSelf(); + return START_NOT_STICKY; } if (mCurrentAlarm != null) { @@ -127,6 +134,8 @@ public class AlarmKlaxon extends Service { // Record the initial call state here so that the new alarm has the // newest state. mInitialCallState = mTelephonyManager.getCallState(); + + return START_STICKY; } private void sendKillBroadcast(Alarm alarm) {