legacy/core-utils/src/main/java/androidx/legacy/content/WakefulBroadcastReceiver.java
public static boolean completeWakefulIntent(Intent intent) {
        final int id = intent.getIntExtra(EXTRA_WAKE_LOCK_ID, 0);
        if (id == 0) {
            return false;
        }
        synchronized (sActiveWakeLocks) {
            PowerManager.WakeLock wl = sActiveWakeLocks.get(id);
            if (wl != null) {
                wl.release();
                sActiveWakeLocks.remove(id);
                return true;
            }
            // We return true whether or not we actually found the wake lock
            // the return code is defined to indicate whether the Intent contained
            // an identifier for a wake lock that it was supposed to match.
            // We just log a warning here if there is no wake lock found, which could
            // happen for example if this function is called twice on the same
            // intent or the process is killed and restarted before processing the intent.
            Log.w("WakefulBroadcastReceiv.", "No active wake lock id #" + id);
            return true;
        }
    }
/**
     * Finish the execution from a previous {@link #startWakefulService}.  Any wake lock
     * that was being held will now be released.
     *
     * @param intent The Intent as originally generated by {@link #startWakefulService}.
     * @return Returns true if the intent is associated with a wake lock that is
     * now released; returns false if there was no wake lock specified for it.
     */
Finish the execution from a previous  #startWakefulService.  Any wake lock
that was being held will now be released.

@param intent The Intent as originally generated by  #startWakefulService.
@return Returns true if the intent is associated with a wake lock that is
now released; returns false if there was no wake lock specified for it.
Finish the execution from a previous #startWakefulService . Any wake lock that was being held will now be released . @param intent The Intent as originally generated by #startWakefulService . @return Returns true if the intent is associated with a wake lock that is now released ; returns false if there was no wake lock specified for it .
public static boolean completeWakefulIntent(Intent intent) {
        final int id = intent.getIntExtra(EXTRA_WAKE_LOCK_ID, 0);
        if (id == 0) {
            return false;
        }
        synchronized (sActiveWakeLocks) {
            PowerManager.WakeLock wl = sActiveWakeLocks.get(id);
            if (wl != null) {
                wl.release();
                sActiveWakeLocks.remove(id);
                return true;
            }
            Log.w("WakefulBroadcastReceiv.", "No active wake lock id #" + id);
            return true;
        }
    }
public static boolean completeWakefulIntent ( Intent intent ) { final int id = intent . getIntExtra ( EXTRA_WAKE_LOCK_ID , 0 ) ; if ( id == 0 ) { return false ; } synchronized ( sActiveWakeLocks ) { PowerManager . WakeLock wl = sActiveWakeLocks . get ( id ) ; if ( wl != null ) { wl . release ( ) ; sActiveWakeLocks . remove ( id ) ; return true ; } Log . w ( "WakefulBroadcastReceiv." , "No active wake lock id #" + id ) ; return true ; } }
Finish the execution from a previous {@link #startWakefulService}.
Finish the execution from a previous { @link #startWakefulService } .
// We return true whether or not we actually found the wake lock // the return code is defined to indicate whether the Intent contained // an identifier for a wake lock that it was supposed to match. // We just log a warning here if there is no wake lock found, which could // happen for example if this function is called twice on the same // intent or the process is killed and restarted before processing the intent.