Program: 1483
Project: 1483
Buggy source:
/** 
 * Creates a new wake lock with the specified level and flags. <p> The   {@code levelAndFlags} parameter specifies a wake lock level and optional flagscombined using the logical OR operator. </p><p> The wake lock levels are:  {@link #PARTIAL_WAKE_LOCK},  {@link #FULL_WAKE_LOCK},   {@link #SCREEN_DIM_WAKE_LOCK}and   {@link #SCREEN_BRIGHT_WAKE_LOCK}.  Exactly one wake lock level must be specified as part of the   {@code levelAndFlags} parameter.</p><p> The wake lock flags are:  {@link #ACQUIRE_CAUSES_WAKEUP}and   {@link #ON_AFTER_RELEASE}.  Multiple flags can be combined as part of the  {@code levelAndFlags} parameters.</p><p> Call  {@link WakeLock#acquire() acquire()} on the object to acquire thewake lock, and  {@link WakeLock#release release()} when you are done.</p><p> {@samplecode PowerManager pm = (PowerManager)mContext.getSystemService( Context.POWER_SERVICE); PowerManager.WakeLock wl = pm.newWakeLock( PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, TAG); wl.acquire(); // ... do work... wl.release();}</p><p> Although a wake lock can be created without special permissions, the   {@link android.Manifest.permission#WAKE_LOCK} permission isrequired to actually acquire or release the wake lock that is returned. </p><p class="note"> If using this to keep the screen on, you should strongly consider using {@link android.view.WindowManager.LayoutParams#FLAG_KEEP_SCREEN_ON} instead.This window flag will be correctly managed by the platform as the user moves between applications and doesn't require a special permission. </p>
 * @param levelAndFlags Combination of wake lock level and flag values definingthe requested behavior of the WakeLock.
 * @param tag Your class name (or other tag) for debugging purposes.
 * @see WakeLock#acquire()
 * @see WakeLock#release()
 * @see #PARTIAL_WAKE_LOCK
 * @see #FULL_WAKE_LOCK
 * @see #SCREEN_DIM_WAKE_LOCK
 * @see #SCREEN_BRIGHT_WAKE_LOCK
 * @see #ACQUIRE_CAUSES_WAKEUP
 * @see #ON_AFTER_RELEASE
 */
public WakeLock newWakeLock(int levelAndFlags,String tag){
  validateWakeLockParameters(levelAndFlags,tag);
  return new WakeLock(levelAndFlags,tag,mContext.getBasePackageName());
}

Fixed version (ground truth):
/** 
 * Creates a new wake lock with the specified level and flags. <p> The   {@code levelAndFlags} parameter specifies a wake lock level and optional flagscombined using the logical OR operator. </p><p> The wake lock levels are:  {@link #PARTIAL_WAKE_LOCK},  {@link #FULL_WAKE_LOCK},   {@link #SCREEN_DIM_WAKE_LOCK}and   {@link #SCREEN_BRIGHT_WAKE_LOCK}.  Exactly one wake lock level must be specified as part of the   {@code levelAndFlags} parameter.</p><p> The wake lock flags are:  {@link #ACQUIRE_CAUSES_WAKEUP}and   {@link #ON_AFTER_RELEASE}.  Multiple flags can be combined as part of the  {@code levelAndFlags} parameters.</p><p> Call  {@link WakeLock#acquire() acquire()} on the object to acquire thewake lock, and  {@link WakeLock#release release()} when you are done.</p><p> {@samplecode PowerManager pm = (PowerManager)mContext.getSystemService( Context.POWER_SERVICE); PowerManager.WakeLock wl = pm.newWakeLock( PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, TAG); wl.acquire(); // ... do work... wl.release();}</p><p> Although a wake lock can be created without special permissions, the   {@link android.Manifest.permission#WAKE_LOCK} permission isrequired to actually acquire or release the wake lock that is returned. </p><p class="note"> If using this to keep the screen on, you should strongly consider using {@link android.view.WindowManager.LayoutParams#FLAG_KEEP_SCREEN_ON} instead.This window flag will be correctly managed by the platform as the user moves between applications and doesn't require a special permission. </p>
 * @param levelAndFlags Combination of wake lock level and flag values definingthe requested behavior of the WakeLock.
 * @param tag Your class name (or other tag) for debugging purposes.
 * @see WakeLock#acquire()
 * @see WakeLock#release()
 * @see #PARTIAL_WAKE_LOCK
 * @see #FULL_WAKE_LOCK
 * @see #SCREEN_DIM_WAKE_LOCK
 * @see #SCREEN_BRIGHT_WAKE_LOCK
 * @see #ACQUIRE_CAUSES_WAKEUP
 * @see #ON_AFTER_RELEASE
 */
public WakeLock newWakeLock(int levelAndFlags,String tag){
  validateWakeLockParameters(levelAndFlags,tag);
  return new WakeLock(levelAndFlags,tag,mContext.getOpPackageName());
}