Skip to content

Commit

Permalink
removed extraneous imports, added better type declaration,
Browse files Browse the repository at this point in the history
use application context everywhere
  • Loading branch information
commonsguy committed Jul 31, 2011
1 parent 2a8096b commit 04bb4a3
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/com/commonsware/cwac/wakeful/WakefulIntentService.java
Expand Up @@ -14,15 +14,10 @@

package com.commonsware.cwac.wakeful;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.IBinder;
import android.os.PowerManager;
import android.util.Log;

abstract public class WakefulIntentService extends IntentService {
abstract protected void doWakefulWork(Intent intent);
Expand All @@ -47,7 +42,7 @@ public static void sendWakefulWork(Context ctxt, Intent i) {
ctxt.startService(i);
}

public static void sendWakefulWork(Context ctxt, Class clsService) {
public static void sendWakefulWork(Context ctxt, Class<?> clsService) {
sendWakefulWork(ctxt, new Intent(ctxt, clsService));
}

Expand All @@ -59,7 +54,7 @@ public WakefulIntentService(String name) {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if ((flags & START_FLAG_REDELIVERY)!=0) { // if crash restart...
getLock(this).acquire(); // ...then quick grab the lock
getLock(this.getApplicationContext()).acquire(); // ...then quick grab the lock
}

super.onStartCommand(intent, flags, startId);
Expand All @@ -73,7 +68,7 @@ final protected void onHandleIntent(Intent intent) {
doWakefulWork(intent);
}
finally {
getLock(this).release();
getLock(this.getApplicationContext()).release();
}
}
}

0 comments on commit 04bb4a3

Please sign in to comment.