nus-yam/ex-repair huggingface dataset:
Program: 1465
Project: 1465
Buggy source:
@Override public boolean performHapticFeedbackLw(WindowState win,int effectId,boolean always){
  if (!mVibrator.hasVibrator()) {
    return false;
  }
  final boolean hapticsDisabled=Settings.System.getIntForUser(mContext.getContentResolver(),Settings.System.HAPTIC_FEEDBACK_ENABLED,0,UserHandle.USER_CURRENT) == 0;
  if (!always && (hapticsDisabled || mKeyguardDelegate.isShowingAndNotHidden())) {
    return false;
  }
  long[] pattern=null;
switch (effectId) {
case HapticFeedbackConstants.LONG_PRESS:
    pattern=mLongPressVibePattern;
  break;
case HapticFeedbackConstants.VIRTUAL_KEY:
pattern=mVirtualKeyVibePattern;
break;
case HapticFeedbackConstants.KEYBOARD_TAP:
pattern=mKeyboardTapVibePattern;
break;
case HapticFeedbackConstants.SAFE_MODE_DISABLED:
pattern=mSafeModeDisabledVibePattern;
break;
case HapticFeedbackConstants.SAFE_MODE_ENABLED:
pattern=mSafeModeEnabledVibePattern;
break;
default :
return false;
}
int owningUid;
String owningPackage;
if (win != null) {
owningUid=win.getOwningUid();
owningPackage=win.getOwningPackage();
}
 else {
owningUid=android.os.Process.myUid();
owningPackage=mContext.getBasePackageName();
}
if (pattern.length == 1) {
mVibrator.vibrate(owningUid,owningPackage,pattern[0]);
}
 else {
mVibrator.vibrate(owningUid,owningPackage,pattern,-1);
}
return true;
}

Fixed version (ground truth):
@Override public boolean performHapticFeedbackLw(WindowState win,int effectId,boolean always){
  if (!mVibrator.hasVibrator()) {
    return false;
  }
  final boolean hapticsDisabled=Settings.System.getIntForUser(mContext.getContentResolver(),Settings.System.HAPTIC_FEEDBACK_ENABLED,0,UserHandle.USER_CURRENT) == 0;
  if (!always && (hapticsDisabled || mKeyguardDelegate.isShowingAndNotHidden())) {
    return false;
  }
  long[] pattern=null;
switch (effectId) {
case HapticFeedbackConstants.LONG_PRESS:
    pattern=mLongPressVibePattern;
  break;
case HapticFeedbackConstants.VIRTUAL_KEY:
pattern=mVirtualKeyVibePattern;
break;
case HapticFeedbackConstants.KEYBOARD_TAP:
pattern=mKeyboardTapVibePattern;
break;
case HapticFeedbackConstants.SAFE_MODE_DISABLED:
pattern=mSafeModeDisabledVibePattern;
break;
case HapticFeedbackConstants.SAFE_MODE_ENABLED:
pattern=mSafeModeEnabledVibePattern;
break;
default :
return false;
}
int owningUid;
String owningPackage;
if (win != null) {
owningUid=win.getOwningUid();
owningPackage=win.getOwningPackage();
}
 else {
owningUid=android.os.Process.myUid();
owningPackage=mContext.getOpPackageName();
}
if (pattern.length == 1) {
mVibrator.vibrate(owningUid,owningPackage,pattern[0]);
}
 else {
mVibrator.vibrate(owningUid,owningPackage,pattern,-1);
}
return true;
}
Program: 1466
Project: 1466
Buggy source:
/** 
 * Returns the neighboring cell information of the device. The getAllCellInfo is preferred and use this only if getAllCellInfo return nulls or an empty list. <p> In the future this call will be deprecated. <p>
 * @return List of NeighboringCellInfo or null if info unavailable.<p>Requires Permission: (@link android.Manifest.permission#ACCESS_COARSE_UPDATES}
 */
public List<NeighboringCellInfo> getNeighboringCellInfo(){
  try {
    return getITelephony().getNeighboringCellInfo(mContext.getBasePackageName());
  }
 catch (  RemoteException ex) {
    return null;
  }
catch (  NullPointerException ex) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Returns the neighboring cell information of the device. The getAllCellInfo is preferred and use this only if getAllCellInfo return nulls or an empty list. <p> In the future this call will be deprecated. <p>
 * @return List of NeighboringCellInfo or null if info unavailable.<p>Requires Permission: (@link android.Manifest.permission#ACCESS_COARSE_UPDATES}
 */
public List<NeighboringCellInfo> getNeighboringCellInfo(){
  try {
    return getITelephony().getNeighboringCellInfo(mContext.getOpPackageName());
  }
 catch (  RemoteException ex) {
    return null;
  }
catch (  NullPointerException ex) {
    return null;
  }
}
Program: 1467
Project: 1467
Buggy source:
/** 
 * @hide 
 */
public int startOp(int op){
  return startOp(op,Process.myUid(),mContext.getBasePackageName());
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public int startOp(int op){
  return startOp(op,Process.myUid(),mContext.getOpPackageName());
}
Program: 1468
Project: 1468
Buggy source:
public void finishOp(int op){
  finishOp(op,Process.myUid(),mContext.getBasePackageName());
}

Fixed version (ground truth):
public void finishOp(int op){
  finishOp(op,Process.myUid(),mContext.getOpPackageName());
}
Program: 1469
Project: 1469
Buggy source:
/** 
 * @hide 
 */
public int noteOp(int op){
  return noteOp(op,Process.myUid(),mContext.getBasePackageName());
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public int noteOp(int op){
  return noteOp(op,Process.myUid(),mContext.getOpPackageName());
}
Program: 1470
Project: 1470
Buggy source:
/** 
 * Do a quick check for whether an application might be able to perform an operation. This is <em>not</em> a security check; you must use   {@link #noteOp(int,int,String)}or   {@link #startOp(int,int,String)} for your actual security checks, which alsoensure that the given uid and package name are consistent.  This function can just be used for a quick check to see if an operation has been disabled for the application, as an early reject of some work.  This does not modify the time stamp or other data about the operation.
 * @param op The operation to check.  One of the OP_* constants.
 * @param uid The user id of the application attempting to perform the operation.
 * @param packageName The name of the application attempting to perform the operation.
 * @return Returns {@link #MODE_ALLOWED} if the operation is allowed, or{@link #MODE_IGNORED} if it is not allowed and should be silently ignored (withoutcausing the app to crash).
 * @throws SecurityException If the app has been configured to crash on this op.
 */
public int checkOp(int op,int uid,String packageName){
  try {
    int mode=mService.checkOperation(op,uid,packageName);
    if (mode == MODE_ERRORED) {
      throw new SecurityException("String_Node_Str");
    }
    return mode;
  }
 catch (  RemoteException e) {
  }
  return MODE_IGNORED;
}

Fixed version (ground truth):
/** 
 * Do a quick check for whether an application might be able to perform an operation. This is <em>not</em> a security check; you must use   {@link #noteOp(int,int,String)}or   {@link #startOp(int,int,String)} for your actual security checks, which alsoensure that the given uid and package name are consistent.  This function can just be used for a quick check to see if an operation has been disabled for the application, as an early reject of some work.  This does not modify the time stamp or other data about the operation.
 * @param op The operation to check.  One of the OP_* constants.
 * @param uid The user id of the application attempting to perform the operation.
 * @param packageName The name of the application attempting to perform the operation.
 * @return Returns {@link #MODE_ALLOWED} if the operation is allowed, or{@link #MODE_IGNORED} if it is not allowed and should be silently ignored (withoutcausing the app to crash).
 * @throws SecurityException If the app has been configured to crash on this op.
 */
public int checkOp(int op,int uid,String packageName){
  try {
    int mode=mService.checkOperation(op,uid,packageName);
    if (mode == MODE_ERRORED) {
      throw new SecurityException(buildSecurityExceptionMsg(op,uid,packageName));
    }
    return mode;
  }
 catch (  RemoteException e) {
  }
  return MODE_IGNORED;
}
Program: 1471
Project: 1471
Buggy source:
@Override public void setApplicationEnabledSetting(String packageName,int newState,int flags){
  try {
    mPM.setApplicationEnabledSetting(packageName,newState,flags,mContext.getUserId(),mContext.getBasePackageName());
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
@Override public void setApplicationEnabledSetting(String packageName,int newState,int flags){
  try {
    mPM.setApplicationEnabledSetting(packageName,newState,flags,mContext.getUserId(),mContext.getOpPackageName());
  }
 catch (  RemoteException e) {
  }
}
Program: 1472
Project: 1472
Buggy source:
/** 
 * Create a new ApplicationContext from an existing one.  The new one works and operates the same as the one it is copying.
 * @param context Existing application context.
 */
public ContextImpl(ContextImpl context){
  mPackageInfo=context.mPackageInfo;
  mBasePackageName=context.mBasePackageName;
  mResources=context.mResources;
  mMainThread=context.mMainThread;
  mContentResolver=context.mContentResolver;
  mUser=context.mUser;
  mDisplay=context.mDisplay;
  mOuterContext=this;
  mDisplayAdjustments.setCompatibilityInfo(mPackageInfo.getCompatibilityInfo());
}

Fixed version (ground truth):
/** 
 * Create a new ApplicationContext from an existing one.  The new one works and operates the same as the one it is copying.
 * @param context Existing application context.
 */
public ContextImpl(ContextImpl context){
  mPackageInfo=context.mPackageInfo;
  mBasePackageName=context.mBasePackageName;
  mOpPackageName=context.mOpPackageName;
  mResources=context.mResources;
  mMainThread=context.mMainThread;
  mContentResolver=context.mContentResolver;
  mUser=context.mUser;
  mDisplay=context.mDisplay;
  mOuterContext=this;
  mDisplayAdjustments.setCompatibilityInfo(mPackageInfo.getCompatibilityInfo());
}
Program: 1473
Project: 1473
Buggy source:
final void init(Resources resources,ActivityThread mainThread,UserHandle user){
  mPackageInfo=null;
  mBasePackageName=null;
  mResources=resources;
  mMainThread=mainThread;
  mContentResolver=new ApplicationContentResolver(this,mainThread,user);
  mUser=user;
}

Fixed version (ground truth):
final void init(Resources resources,ActivityThread mainThread,UserHandle user){
  mPackageInfo=null;
  mBasePackageName=null;
  mOpPackageName=null;
  mResources=resources;
  mMainThread=mainThread;
  mContentResolver=new ApplicationContentResolver(this,mainThread,user);
  mUser=user;
}
Program: 1474
Project: 1474
Buggy source:
/** 
 * Post a notification to be shown in the status bar. If a notification with the same tag and id has already been posted by your application and has not yet been canceled, it will be replaced by the updated information.
 * @param tag A string identifier for this notification.  May be {@code null}.
 * @param id An identifier for this notification.  The pair (tag, id) must be uniquewithin your application.
 * @param notification A {@link Notification} object describing what toshow the user. Must not be null.
 */
public void notify(String tag,int id,Notification notification){
  int[] idOut=new int[1];
  INotificationManager service=getService();
  String pkg=mContext.getPackageName();
  if (notification.sound != null) {
    notification.sound=notification.sound.getCanonicalUri();
    if (StrictMode.vmFileUriExposureEnabled()) {
      notification.sound.checkFileUriExposed("String_Node_Str");
    }
  }
  if (localLOGV)   Log.v(TAG,pkg + "String_Node_Str" + id+ "String_Node_Str"+ notification+ "String_Node_Str");
  try {
    service.enqueueNotificationWithTag(pkg,mContext.getBasePackageName(),tag,id,notification,idOut,UserHandle.myUserId());
    if (id != idOut[0]) {
      Log.w(TAG,"String_Node_Str" + id + "String_Node_Str"+ idOut[0]);
    }
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
/** 
 * Post a notification to be shown in the status bar. If a notification with the same tag and id has already been posted by your application and has not yet been canceled, it will be replaced by the updated information.
 * @param tag A string identifier for this notification.  May be {@code null}.
 * @param id An identifier for this notification.  The pair (tag, id) must be uniquewithin your application.
 * @param notification A {@link Notification} object describing what toshow the user. Must not be null.
 */
public void notify(String tag,int id,Notification notification){
  int[] idOut=new int[1];
  INotificationManager service=getService();
  String pkg=mContext.getPackageName();
  if (notification.sound != null) {
    notification.sound=notification.sound.getCanonicalUri();
    if (StrictMode.vmFileUriExposureEnabled()) {
      notification.sound.checkFileUriExposed("String_Node_Str");
    }
  }
  if (localLOGV)   Log.v(TAG,pkg + "String_Node_Str" + id+ "String_Node_Str"+ notification+ "String_Node_Str");
  try {
    service.enqueueNotificationWithTag(pkg,mContext.getOpPackageName(),tag,id,notification,idOut,UserHandle.myUserId());
    if (id != idOut[0]) {
      Log.w(TAG,"String_Node_Str" + id + "String_Node_Str"+ idOut[0]);
    }
  }
 catch (  RemoteException e) {
  }
}
Program: 1475
Project: 1475
Buggy source:
/** 
 * @hide
 */
public void notifyAsUser(String tag,int id,Notification notification,UserHandle user){
  int[] idOut=new int[1];
  INotificationManager service=getService();
  String pkg=mContext.getPackageName();
  if (notification.sound != null) {
    notification.sound=notification.sound.getCanonicalUri();
    if (StrictMode.vmFileUriExposureEnabled()) {
      notification.sound.checkFileUriExposed("String_Node_Str");
    }
  }
  if (localLOGV)   Log.v(TAG,pkg + "String_Node_Str" + id+ "String_Node_Str"+ notification+ "String_Node_Str");
  try {
    service.enqueueNotificationWithTag(pkg,mContext.getBasePackageName(),tag,id,notification,idOut,user.getIdentifier());
    if (id != idOut[0]) {
      Log.w(TAG,"String_Node_Str" + id + "String_Node_Str"+ idOut[0]);
    }
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
/** 
 * @hide
 */
public void notifyAsUser(String tag,int id,Notification notification,UserHandle user){
  int[] idOut=new int[1];
  INotificationManager service=getService();
  String pkg=mContext.getPackageName();
  if (notification.sound != null) {
    notification.sound=notification.sound.getCanonicalUri();
    if (StrictMode.vmFileUriExposureEnabled()) {
      notification.sound.checkFileUriExposed("String_Node_Str");
    }
  }
  if (localLOGV)   Log.v(TAG,pkg + "String_Node_Str" + id+ "String_Node_Str"+ notification+ "String_Node_Str");
  try {
    service.enqueueNotificationWithTag(pkg,mContext.getOpPackageName(),tag,id,notification,idOut,user.getIdentifier());
    if (id != idOut[0]) {
      Log.w(TAG,"String_Node_Str" + id + "String_Node_Str"+ idOut[0]);
    }
  }
 catch (  RemoteException e) {
  }
}
Program: 1476
Project: 1476
Buggy source:
/** 
 * Returns true if there is currently a primary clip on the clipboard.
 */
public boolean hasPrimaryClip(){
  try {
    return getService().hasPrimaryClip(mContext.getBasePackageName());
  }
 catch (  RemoteException e) {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Returns true if there is currently a primary clip on the clipboard.
 */
public boolean hasPrimaryClip(){
  try {
    return getService().hasPrimaryClip(mContext.getOpPackageName());
  }
 catch (  RemoteException e) {
    return false;
  }
}
Program: 1477
Project: 1477
Buggy source:
/** 
 * Returns the current primary clip on the clipboard.
 */
public ClipData getPrimaryClip(){
  try {
    return getService().getPrimaryClip(mContext.getBasePackageName());
  }
 catch (  RemoteException e) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Returns the current primary clip on the clipboard.
 */
public ClipData getPrimaryClip(){
  try {
    return getService().getPrimaryClip(mContext.getOpPackageName());
  }
 catch (  RemoteException e) {
    return null;
  }
}
Program: 1478
Project: 1478
Buggy source:
/** 
 * Returns a description of the current primary clip on the clipboard but not a copy of its data.
 */
public ClipDescription getPrimaryClipDescription(){
  try {
    return getService().getPrimaryClipDescription(mContext.getBasePackageName());
  }
 catch (  RemoteException e) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Returns a description of the current primary clip on the clipboard but not a copy of its data.
 */
public ClipDescription getPrimaryClipDescription(){
  try {
    return getService().getPrimaryClipDescription(mContext.getOpPackageName());
  }
 catch (  RemoteException e) {
    return null;
  }
}
Program: 1479
Project: 1479
Buggy source:
public void addPrimaryClipChangedListener(OnPrimaryClipChangedListener what){
synchronized (mPrimaryClipChangedListeners) {
    if (mPrimaryClipChangedListeners.size() == 0) {
      try {
        getService().addPrimaryClipChangedListener(mPrimaryClipChangedServiceListener,mContext.getBasePackageName());
      }
 catch (      RemoteException e) {
      }
    }
    mPrimaryClipChangedListeners.add(what);
  }
}

Fixed version (ground truth):
public void addPrimaryClipChangedListener(OnPrimaryClipChangedListener what){
synchronized (mPrimaryClipChangedListeners) {
    if (mPrimaryClipChangedListeners.size() == 0) {
      try {
        getService().addPrimaryClipChangedListener(mPrimaryClipChangedServiceListener,mContext.getOpPackageName());
      }
 catch (      RemoteException e) {
      }
    }
    mPrimaryClipChangedListeners.add(what);
  }
}
Program: 1480
Project: 1480
Buggy source:
/** 
 * @deprecated Use {@link #hasPrimaryClip()} instead.
 */
public boolean hasText(){
  try {
    return getService().hasClipboardText(mContext.getBasePackageName());
  }
 catch (  RemoteException e) {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * @deprecated Use {@link #hasPrimaryClip()} instead.
 */
public boolean hasText(){
  try {
    return getService().hasClipboardText(mContext.getOpPackageName());
  }
 catch (  RemoteException e) {
    return false;
  }
}
Program: 1481
Project: 1481
Buggy source:
/** 
 * Sets the current primary clip on the clipboard.  This is the clip that is involved in normal cut and paste operations.
 * @param clip The clipped data item to set.
 */
public void setPrimaryClip(ClipData clip){
  try {
    if (clip != null) {
      clip.prepareToLeaveProcess();
    }
    getService().setPrimaryClip(clip,mContext.getBasePackageName());
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
/** 
 * Sets the current primary clip on the clipboard.  This is the clip that is involved in normal cut and paste operations.
 * @param clip The clipped data item to set.
 */
public void setPrimaryClip(ClipData clip){
  try {
    if (clip != null) {
      clip.prepareToLeaveProcess();
    }
    getService().setPrimaryClip(clip,mContext.getOpPackageName());
  }
 catch (  RemoteException e) {
  }
}
Program: 1482
Project: 1482
Buggy source:
public ContentResolver(Context context){
  mContext=context != null ? context : ActivityThread.currentApplication();
  mPackageName=mContext.getBasePackageName();
}

Fixed version (ground truth):
public ContentResolver(Context context){
  mContext=context != null ? context : ActivityThread.currentApplication();
  mPackageName=mContext.getOpPackageName();
}
Program: 1484
Project: 1484
Buggy source:
public SystemVibrator(Context context){
  mPackageName=context.getBasePackageName();
  mService=IVibratorService.Stub.asInterface(ServiceManager.getService("String_Node_Str"));
}

Fixed version (ground truth):
public SystemVibrator(Context context){
  mPackageName=context.getOpPackageName();
  mService=IVibratorService.Stub.asInterface(ServiceManager.getService("String_Node_Str"));
}
Program: 1485
Project: 1485
Buggy source:
/** 
 * Adjusts the master volume for the device's audio amplifier. <p>
 * @param steps The number of volume steps to adjust. A positivevalue will raise the volume.
 * @param flags One or more flags.
 * @hide
 */
public void adjustMasterVolume(int steps,int flags){
  IAudioService service=getService();
  try {
    service.adjustMasterVolume(steps,flags,mContext.getBasePackageName());
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Adjusts the master volume for the device's audio amplifier. <p>
 * @param steps The number of volume steps to adjust. A positivevalue will raise the volume.
 * @param flags One or more flags.
 * @hide
 */
public void adjustMasterVolume(int steps,int flags){
  IAudioService service=getService();
  try {
    service.adjustMasterVolume(steps,flags,mContext.getOpPackageName());
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 1486
Project: 1486
Buggy source:
/** 
 * @hide Used internally by telephony package to request audio focus. Will cause the focus request to be associated with the "voice communication" identifier only used in AudioService to identify this use case.
 * @param streamType use STREAM_RING for focus requests when ringing, VOICE_CALL forthe establishment of the call
 * @param durationHint the type of focus request. AUDIOFOCUS_GAIN_TRANSIENT is recommended somedia applications resume after a call
 */
public void requestAudioFocusForCall(int streamType,int durationHint){
  IAudioService service=getService();
  try {
    service.requestAudioFocus(streamType,durationHint,mICallBack,null,MediaFocusControl.IN_VOICE_COMM_FOCUS_ID,mContext.getBasePackageName());
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
}

Fixed version (ground truth):
/** 
 * @hide Used internally by telephony package to request audio focus. Will cause the focus request to be associated with the "voice communication" identifier only used in AudioService to identify this use case.
 * @param streamType use STREAM_RING for focus requests when ringing, VOICE_CALL forthe establishment of the call
 * @param durationHint the type of focus request. AUDIOFOCUS_GAIN_TRANSIENT is recommended somedia applications resume after a call
 */
public void requestAudioFocusForCall(int streamType,int durationHint){
  IAudioService service=getService();
  try {
    service.requestAudioFocus(streamType,durationHint,mICallBack,null,MediaFocusControl.IN_VOICE_COMM_FOCUS_ID,mContext.getOpPackageName());
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str" + e);
  }
}
Program: 1488
Project: 1488
Buggy source:
/** 
 * Adjusts the volume of a particular stream by one step in a direction. <p> This method should only be used by applications that replace the platform-wide management of audio settings or the main telephony application.
 * @param streamType The stream type to adjust. One of {@link #STREAM_VOICE_CALL},  {@link #STREAM_SYSTEM},   {@link #STREAM_RING},   {@link #STREAM_MUSIC} or{@link #STREAM_ALARM}
 * @param direction The direction to adjust the volume. One of{@link #ADJUST_LOWER},   {@link #ADJUST_RAISE}, or  {@link #ADJUST_SAME}.
 * @param flags One or more flags.
 * @see #adjustVolume(int,int)
 * @see #setStreamVolume(int,int,int)
 */
public void adjustStreamVolume(int streamType,int direction,int flags){
  IAudioService service=getService();
  try {
    if (mUseMasterVolume) {
      service.adjustMasterVolume(direction,flags,mContext.getBasePackageName());
    }
 else {
      service.adjustStreamVolume(streamType,direction,flags,mContext.getBasePackageName());
    }
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Adjusts the volume of a particular stream by one step in a direction. <p> This method should only be used by applications that replace the platform-wide management of audio settings or the main telephony application.
 * @param streamType The stream type to adjust. One of {@link #STREAM_VOICE_CALL},  {@link #STREAM_SYSTEM},   {@link #STREAM_RING},   {@link #STREAM_MUSIC} or{@link #STREAM_ALARM}
 * @param direction The direction to adjust the volume. One of{@link #ADJUST_LOWER},   {@link #ADJUST_RAISE}, or  {@link #ADJUST_SAME}.
 * @param flags One or more flags.
 * @see #adjustVolume(int,int)
 * @see #setStreamVolume(int,int,int)
 */
public void adjustStreamVolume(int streamType,int direction,int flags){
  IAudioService service=getService();
  try {
    if (mUseMasterVolume) {
      service.adjustMasterVolume(direction,flags,mContext.getOpPackageName());
    }
 else {
      service.adjustStreamVolume(streamType,direction,flags,mContext.getOpPackageName());
    }
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 1489
Project: 1489
Buggy source:
/** 
 * Adjusts the volume of the most relevant stream, or the given fallback stream. <p> This method should only be used by applications that replace the platform-wide management of audio settings or the main telephony application.
 * @param direction The direction to adjust the volume. One of{@link #ADJUST_LOWER},   {@link #ADJUST_RAISE}, or  {@link #ADJUST_SAME}.
 * @param suggestedStreamType The stream type that will be used if thereisn't a relevant stream.  {@link #USE_DEFAULT_STREAM_TYPE} is valid here.
 * @param flags One or more flags.
 * @see #adjustVolume(int,int)
 * @see #adjustStreamVolume(int,int,int)
 * @see #setStreamVolume(int,int,int)
 */
public void adjustSuggestedStreamVolume(int direction,int suggestedStreamType,int flags){
  IAudioService service=getService();
  try {
    if (mUseMasterVolume) {
      service.adjustMasterVolume(direction,flags,mContext.getBasePackageName());
    }
 else {
      service.adjustSuggestedStreamVolume(direction,suggestedStreamType,flags,mContext.getBasePackageName());
    }
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Adjusts the volume of the most relevant stream, or the given fallback stream. <p> This method should only be used by applications that replace the platform-wide management of audio settings or the main telephony application.
 * @param direction The direction to adjust the volume. One of{@link #ADJUST_LOWER},   {@link #ADJUST_RAISE}, or  {@link #ADJUST_SAME}.
 * @param suggestedStreamType The stream type that will be used if thereisn't a relevant stream.  {@link #USE_DEFAULT_STREAM_TYPE} is valid here.
 * @param flags One or more flags.
 * @see #adjustVolume(int,int)
 * @see #adjustStreamVolume(int,int,int)
 * @see #setStreamVolume(int,int,int)
 */
public void adjustSuggestedStreamVolume(int direction,int suggestedStreamType,int flags){
  IAudioService service=getService();
  try {
    if (mUseMasterVolume) {
      service.adjustMasterVolume(direction,flags,mContext.getOpPackageName());
    }
 else {
      service.adjustSuggestedStreamVolume(direction,suggestedStreamType,flags,mContext.getOpPackageName());
    }
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 1490
Project: 1490
Buggy source:
/** 
 * Adjusts the volume of the most relevant stream. For example, if a call is active, it will have the highest priority regardless of if the in-call screen is showing. Another example, if music is playing in the background and a call is not active, the music stream will be adjusted. <p> This method should only be used by applications that replace the platform-wide management of audio settings or the main telephony application.
 * @param direction The direction to adjust the volume. One of{@link #ADJUST_LOWER},   {@link #ADJUST_RAISE}, or  {@link #ADJUST_SAME}.
 * @param flags One or more flags.
 * @see #adjustSuggestedStreamVolume(int,int,int)
 * @see #adjustStreamVolume(int,int,int)
 * @see #setStreamVolume(int,int,int)
 */
public void adjustVolume(int direction,int flags){
  IAudioService service=getService();
  try {
    if (mUseMasterVolume) {
      service.adjustMasterVolume(direction,flags,mContext.getBasePackageName());
    }
 else {
      service.adjustVolume(direction,flags,mContext.getBasePackageName());
    }
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Adjusts the volume of the most relevant stream. For example, if a call is active, it will have the highest priority regardless of if the in-call screen is showing. Another example, if music is playing in the background and a call is not active, the music stream will be adjusted. <p> This method should only be used by applications that replace the platform-wide management of audio settings or the main telephony application.
 * @param direction The direction to adjust the volume. One of{@link #ADJUST_LOWER},   {@link #ADJUST_RAISE}, or  {@link #ADJUST_SAME}.
 * @param flags One or more flags.
 * @see #adjustSuggestedStreamVolume(int,int,int)
 * @see #adjustStreamVolume(int,int,int)
 * @see #setStreamVolume(int,int,int)
 */
public void adjustVolume(int direction,int flags){
  IAudioService service=getService();
  try {
    if (mUseMasterVolume) {
      service.adjustMasterVolume(direction,flags,mContext.getOpPackageName());
    }
 else {
      service.adjustVolume(direction,flags,mContext.getOpPackageName());
    }
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 1491
Project: 1491
Buggy source:
/** 
 * Sets the volume index for master volume.
 * @param index The volume index to set. See{@link #getMasterMaxVolume()} for the largest valid value.
 * @param flags One or more flags.
 * @see #getMasterMaxVolume()
 * @see #getMasterVolume()
 * @hide
 */
public void setMasterVolume(int index,int flags){
  IAudioService service=getService();
  try {
    service.setMasterVolume(index,flags,mContext.getBasePackageName());
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Sets the volume index for master volume.
 * @param index The volume index to set. See{@link #getMasterMaxVolume()} for the largest valid value.
 * @param flags One or more flags.
 * @see #getMasterMaxVolume()
 * @see #getMasterVolume()
 * @hide
 */
public void setMasterVolume(int index,int flags){
  IAudioService service=getService();
  try {
    service.setMasterVolume(index,flags,mContext.getOpPackageName());
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 1492
Project: 1492
Buggy source:
/** 
 * Sets the volume index for a particular stream.
 * @param streamType The stream whose volume index should be set.
 * @param index The volume index to set. See{@link #getStreamMaxVolume(int)} for the largest valid value.
 * @param flags One or more flags.
 * @see #getStreamMaxVolume(int)
 * @see #getStreamVolume(int)
 */
public void setStreamVolume(int streamType,int index,int flags){
  IAudioService service=getService();
  try {
    if (mUseMasterVolume) {
      service.setMasterVolume(index,flags,mContext.getBasePackageName());
    }
 else {
      service.setStreamVolume(streamType,index,flags,mContext.getBasePackageName());
    }
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Sets the volume index for a particular stream.
 * @param streamType The stream whose volume index should be set.
 * @param index The volume index to set. See{@link #getStreamMaxVolume(int)} for the largest valid value.
 * @param flags One or more flags.
 * @see #getStreamMaxVolume(int)
 * @see #getStreamVolume(int)
 */
public void setStreamVolume(int streamType,int index,int flags){
  IAudioService service=getService();
  try {
    if (mUseMasterVolume) {
      service.setMasterVolume(index,flags,mContext.getOpPackageName());
    }
 else {
      service.setStreamVolume(streamType,index,flags,mContext.getOpPackageName());
    }
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 1493
Project: 1493
Buggy source:
/** 
 * @hide If the stream is active locally or remotely, adjust its volume according to the enforced priority rules. Note: only AudioManager.STREAM_MUSIC is supported at the moment
 */
public void adjustLocalOrRemoteStreamVolume(int streamType,int direction){
  if (streamType != STREAM_MUSIC) {
    Log.w(TAG,"String_Node_Str" + streamType);
  }
  IAudioService service=getService();
  try {
    service.adjustLocalOrRemoteStreamVolume(streamType,direction,mContext.getBasePackageName());
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * @hide If the stream is active locally or remotely, adjust its volume according to the enforced priority rules. Note: only AudioManager.STREAM_MUSIC is supported at the moment
 */
public void adjustLocalOrRemoteStreamVolume(int streamType,int direction){
  if (streamType != STREAM_MUSIC) {
    Log.w(TAG,"String_Node_Str" + streamType);
  }
  IAudioService service=getService();
  try {
    service.adjustLocalOrRemoteStreamVolume(streamType,direction,mContext.getOpPackageName());
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 1494
Project: 1494
Buggy source:
/** 
 * Tell the audio service to adjust the volume appropriate to the event.
 * @param keycode
 */
void handleVolumeKey(int stream,int keycode){
  IAudioService audioService=getAudioService();
  if (audioService == null) {
    return;
  }
  try {
    mBroadcastWakeLock.acquire();
    audioService.adjustStreamVolume(stream,keycode == KeyEvent.KEYCODE_VOLUME_UP ? AudioManager.ADJUST_RAISE : AudioManager.ADJUST_LOWER,0,mContext.getBasePackageName());
  }
 catch (  RemoteException e) {
    Log.w(TAG,"String_Node_Str" + e);
  }
 finally {
    mBroadcastWakeLock.release();
  }
}

Fixed version (ground truth):
/** 
 * Tell the audio service to adjust the volume appropriate to the event.
 * @param keycode
 */
void handleVolumeKey(int stream,int keycode){
  IAudioService audioService=getAudioService();
  if (audioService == null) {
    return;
  }
  try {
    mBroadcastWakeLock.acquire();
    audioService.adjustStreamVolume(stream,keycode == KeyEvent.KEYCODE_VOLUME_UP ? AudioManager.ADJUST_RAISE : AudioManager.ADJUST_LOWER,0,mContext.getOpPackageName());
  }
 catch (  RemoteException e) {
    Log.w(TAG,"String_Node_Str" + e);
  }
 finally {
    mBroadcastWakeLock.release();
  }
}
Program: 1495
Project: 1495
Buggy source:
@Override public boolean performHapticFeedbackLw(WindowState win,int effectId,boolean always){
  if (!mVibrator.hasVibrator()) {
    return false;
  }
  final boolean hapticsDisabled=Settings.System.getIntForUser(mContext.getContentResolver(),Settings.System.HAPTIC_FEEDBACK_ENABLED,0,UserHandle.USER_CURRENT) == 0;
  if (!always && (hapticsDisabled || mKeyguardDelegate.isShowingAndNotHidden())) {
    return false;
  }
  long[] pattern=null;
switch (effectId) {
case HapticFeedbackConstants.LONG_PRESS:
    pattern=mLongPressVibePattern;
  break;
case HapticFeedbackConstants.VIRTUAL_KEY:
pattern=mVirtualKeyVibePattern;
break;
case HapticFeedbackConstants.KEYBOARD_TAP:
pattern=mKeyboardTapVibePattern;
break;
case HapticFeedbackConstants.SAFE_MODE_DISABLED:
pattern=mSafeModeDisabledVibePattern;
break;
case HapticFeedbackConstants.SAFE_MODE_ENABLED:
pattern=mSafeModeEnabledVibePattern;
break;
default :
return false;
}
int owningUid;
String owningPackage;
if (win != null) {
owningUid=win.getOwningUid();
owningPackage=win.getOwningPackage();
}
 else {
owningUid=android.os.Process.myUid();
owningPackage=mContext.getBasePackageName();
}
if (pattern.length == 1) {
mVibrator.vibrate(owningUid,owningPackage,pattern[0]);
}
 else {
mVibrator.vibrate(owningUid,owningPackage,pattern,-1);
}
return true;
}

Fixed version (ground truth):
@Override public boolean performHapticFeedbackLw(WindowState win,int effectId,boolean always){
  if (!mVibrator.hasVibrator()) {
    return false;
  }
  final boolean hapticsDisabled=Settings.System.getIntForUser(mContext.getContentResolver(),Settings.System.HAPTIC_FEEDBACK_ENABLED,0,UserHandle.USER_CURRENT) == 0;
  if (!always && (hapticsDisabled || mKeyguardDelegate.isShowingAndNotHidden())) {
    return false;
  }
  long[] pattern=null;
switch (effectId) {
case HapticFeedbackConstants.LONG_PRESS:
    pattern=mLongPressVibePattern;
  break;
case HapticFeedbackConstants.VIRTUAL_KEY:
pattern=mVirtualKeyVibePattern;
break;
case HapticFeedbackConstants.KEYBOARD_TAP:
pattern=mKeyboardTapVibePattern;
break;
case HapticFeedbackConstants.SAFE_MODE_DISABLED:
pattern=mSafeModeDisabledVibePattern;
break;
case HapticFeedbackConstants.SAFE_MODE_ENABLED:
pattern=mSafeModeEnabledVibePattern;
break;
default :
return false;
}
int owningUid;
String owningPackage;
if (win != null) {
owningUid=win.getOwningUid();
owningPackage=win.getOwningPackage();
}
 else {
owningUid=android.os.Process.myUid();
owningPackage=mContext.getOpPackageName();
}
if (pattern.length == 1) {
mVibrator.vibrate(owningUid,owningPackage,pattern[0]);
}
 else {
mVibrator.vibrate(owningUid,owningPackage,pattern,-1);
}
return true;
}
Program: 1496
Project: 1496
Buggy source:
/** 
 * Returns the neighboring cell information of the device. The getAllCellInfo is preferred and use this only if getAllCellInfo return nulls or an empty list. <p> In the future this call will be deprecated. <p>
 * @return List of NeighboringCellInfo or null if info unavailable.<p>Requires Permission: (@link android.Manifest.permission#ACCESS_COARSE_UPDATES}
 */
public List<NeighboringCellInfo> getNeighboringCellInfo(){
  try {
    return getITelephony().getNeighboringCellInfo(mContext.getBasePackageName());
  }
 catch (  RemoteException ex) {
    return null;
  }
catch (  NullPointerException ex) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Returns the neighboring cell information of the device. The getAllCellInfo is preferred and use this only if getAllCellInfo return nulls or an empty list. <p> In the future this call will be deprecated. <p>
 * @return List of NeighboringCellInfo or null if info unavailable.<p>Requires Permission: (@link android.Manifest.permission#ACCESS_COARSE_UPDATES}
 */
public List<NeighboringCellInfo> getNeighboringCellInfo(){
  try {
    return getITelephony().getNeighboringCellInfo(mContext.getOpPackageName());
  }
 catch (  RemoteException ex) {
    return null;
  }
catch (  NullPointerException ex) {
    return null;
  }
}
Program: 1497
Project: 1497
Buggy source:
/** 
 * {@hide} 
 */
public static void closeQuietly(ContentProviderClient client){
  if (client != null) {
    client.release();
  }
}

Fixed version (ground truth):
/** 
 * {@hide} 
 */
public static void closeQuietly(ContentProviderClient client){
  if (client != null) {
    try {
      client.release();
    }
 catch (    Exception ignored) {
    }
  }
}
Program: 1498
Project: 1498
Buggy source:
/** 
 * {@hide} 
 */
public static void closeQuietly(ContentProviderClient client){
  if (client != null) {
    client.release();
  }
}

Fixed version (ground truth):
/** 
 * {@hide} 
 */
public static void closeQuietly(ContentProviderClient client){
  if (client != null) {
    try {
      client.release();
    }
 catch (    Exception ignored) {
    }
  }
}
Program: 1499
Project: 1499
Buggy source:
/** 
 * {@hide} 
 */
public static void closeQuietly(ContentProviderClient client){
  if (client != null) {
    client.release();
  }
}

Fixed version (ground truth):
/** 
 * {@hide} 
 */
public static void closeQuietly(ContentProviderClient client){
  if (client != null) {
    try {
      client.release();
    }
 catch (    Exception ignored) {
    }
  }
}
Program: 1500
Project: 1500
Buggy source:
/** 
 * {@hide} 
 */
public static void closeQuietly(ContentProviderClient client){
  if (client != null) {
    client.release();
  }
}

Fixed version (ground truth):
/** 
 * {@hide} 
 */
public static void closeQuietly(ContentProviderClient client){
  if (client != null) {
    try {
      client.release();
    }
 catch (    Exception ignored) {
    }
  }
}
Program: 1501
Project: 1501
Buggy source:
/** 
 * @hide 
 */
public static int checkComponentPermission(String permission,int uid,int owningUid,boolean exported){
  if (uid == 0 || uid == Process.SYSTEM_UID) {
    return PackageManager.PERMISSION_GRANTED;
  }
  if (UserHandle.isIsolated(uid)) {
    return PackageManager.PERMISSION_DENIED;
  }
  if (owningUid >= 0 && UserHandle.isSameApp(uid,owningUid)) {
    return PackageManager.PERMISSION_GRANTED;
  }
  if (!exported) {
    Slog.w(TAG,"String_Node_Str" + owningUid);
    return PackageManager.PERMISSION_DENIED;
  }
  if (permission == null) {
    return PackageManager.PERMISSION_GRANTED;
  }
  try {
    return AppGlobals.getPackageManager().checkUidPermission(permission,uid);
  }
 catch (  RemoteException e) {
    Slog.e(TAG,"String_Node_Str",e);
  }
  return PackageManager.PERMISSION_DENIED;
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public static int checkComponentPermission(String permission,int uid,int owningUid,boolean exported){
  if (uid == 0 || uid == Process.SYSTEM_UID) {
    return PackageManager.PERMISSION_GRANTED;
  }
  if (UserHandle.isIsolated(uid)) {
    return PackageManager.PERMISSION_DENIED;
  }
  if (owningUid >= 0 && UserHandle.isSameApp(uid,owningUid)) {
    return PackageManager.PERMISSION_GRANTED;
  }
  if (!exported) {
    return PackageManager.PERMISSION_DENIED;
  }
  if (permission == null) {
    return PackageManager.PERMISSION_GRANTED;
  }
  try {
    return AppGlobals.getPackageManager().checkUidPermission(permission,uid);
  }
 catch (  RemoteException e) {
    Slog.e(TAG,"String_Node_Str",e);
  }
  return PackageManager.PERMISSION_DENIED;
}
Program: 1502
Project: 1502
Buggy source:
/** 
 * @hide 
 */
public static int checkComponentPermission(String permission,int uid,int owningUid,boolean exported){
  if (uid == 0 || uid == Process.SYSTEM_UID) {
    return PackageManager.PERMISSION_GRANTED;
  }
  if (UserHandle.isIsolated(uid)) {
    return PackageManager.PERMISSION_DENIED;
  }
  if (owningUid >= 0 && UserHandle.isSameApp(uid,owningUid)) {
    return PackageManager.PERMISSION_GRANTED;
  }
  if (!exported) {
    Slog.w(TAG,"String_Node_Str" + owningUid);
    return PackageManager.PERMISSION_DENIED;
  }
  if (permission == null) {
    return PackageManager.PERMISSION_GRANTED;
  }
  try {
    return AppGlobals.getPackageManager().checkUidPermission(permission,uid);
  }
 catch (  RemoteException e) {
    Slog.e(TAG,"String_Node_Str",e);
  }
  return PackageManager.PERMISSION_DENIED;
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public static int checkComponentPermission(String permission,int uid,int owningUid,boolean exported){
  if (uid == 0 || uid == Process.SYSTEM_UID) {
    return PackageManager.PERMISSION_GRANTED;
  }
  if (UserHandle.isIsolated(uid)) {
    return PackageManager.PERMISSION_DENIED;
  }
  if (owningUid >= 0 && UserHandle.isSameApp(uid,owningUid)) {
    return PackageManager.PERMISSION_GRANTED;
  }
  if (!exported) {
    return PackageManager.PERMISSION_DENIED;
  }
  if (permission == null) {
    return PackageManager.PERMISSION_GRANTED;
  }
  try {
    return AppGlobals.getPackageManager().checkUidPermission(permission,uid);
  }
 catch (  RemoteException e) {
    Slog.e(TAG,"String_Node_Str",e);
  }
  return PackageManager.PERMISSION_DENIED;
}
Program: 1503
Project: 1503
Buggy source:
/** 
 * @hide 
 */
public static int checkComponentPermission(String permission,int uid,int owningUid,boolean exported){
  if (uid == 0 || uid == Process.SYSTEM_UID) {
    return PackageManager.PERMISSION_GRANTED;
  }
  if (UserHandle.isIsolated(uid)) {
    return PackageManager.PERMISSION_DENIED;
  }
  if (owningUid >= 0 && UserHandle.isSameApp(uid,owningUid)) {
    return PackageManager.PERMISSION_GRANTED;
  }
  if (!exported) {
    Slog.w(TAG,"String_Node_Str" + owningUid);
    return PackageManager.PERMISSION_DENIED;
  }
  if (permission == null) {
    return PackageManager.PERMISSION_GRANTED;
  }
  try {
    return AppGlobals.getPackageManager().checkUidPermission(permission,uid);
  }
 catch (  RemoteException e) {
    Slog.e(TAG,"String_Node_Str",e);
  }
  return PackageManager.PERMISSION_DENIED;
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public static int checkComponentPermission(String permission,int uid,int owningUid,boolean exported){
  if (uid == 0 || uid == Process.SYSTEM_UID) {
    return PackageManager.PERMISSION_GRANTED;
  }
  if (UserHandle.isIsolated(uid)) {
    return PackageManager.PERMISSION_DENIED;
  }
  if (owningUid >= 0 && UserHandle.isSameApp(uid,owningUid)) {
    return PackageManager.PERMISSION_GRANTED;
  }
  if (!exported) {
    return PackageManager.PERMISSION_DENIED;
  }
  if (permission == null) {
    return PackageManager.PERMISSION_GRANTED;
  }
  try {
    return AppGlobals.getPackageManager().checkUidPermission(permission,uid);
  }
 catch (  RemoteException e) {
    Slog.e(TAG,"String_Node_Str",e);
  }
  return PackageManager.PERMISSION_DENIED;
}
Program: 1504
Project: 1504
Buggy source:
/** 
 * @hide 
 */
public static int checkComponentPermission(String permission,int uid,int owningUid,boolean exported){
  if (uid == 0 || uid == Process.SYSTEM_UID) {
    return PackageManager.PERMISSION_GRANTED;
  }
  if (UserHandle.isIsolated(uid)) {
    return PackageManager.PERMISSION_DENIED;
  }
  if (owningUid >= 0 && UserHandle.isSameApp(uid,owningUid)) {
    return PackageManager.PERMISSION_GRANTED;
  }
  if (!exported) {
    Slog.w(TAG,"String_Node_Str" + owningUid);
    return PackageManager.PERMISSION_DENIED;
  }
  if (permission == null) {
    return PackageManager.PERMISSION_GRANTED;
  }
  try {
    return AppGlobals.getPackageManager().checkUidPermission(permission,uid);
  }
 catch (  RemoteException e) {
    Slog.e(TAG,"String_Node_Str",e);
  }
  return PackageManager.PERMISSION_DENIED;
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public static int checkComponentPermission(String permission,int uid,int owningUid,boolean exported){
  if (uid == 0 || uid == Process.SYSTEM_UID) {
    return PackageManager.PERMISSION_GRANTED;
  }
  if (UserHandle.isIsolated(uid)) {
    return PackageManager.PERMISSION_DENIED;
  }
  if (owningUid >= 0 && UserHandle.isSameApp(uid,owningUid)) {
    return PackageManager.PERMISSION_GRANTED;
  }
  if (!exported) {
    return PackageManager.PERMISSION_DENIED;
  }
  if (permission == null) {
    return PackageManager.PERMISSION_GRANTED;
  }
  try {
    return AppGlobals.getPackageManager().checkUidPermission(permission,uid);
  }
 catch (  RemoteException e) {
    Slog.e(TAG,"String_Node_Str",e);
  }
  return PackageManager.PERMISSION_DENIED;
}
Program: 1508
Project: 1508
Buggy source:
/** 
 * @hide Retrieve the string value for the attribute at <var>index</var> that is not allowed to change with the given configurations.
 * @param index Index of attribute to retrieve.
 * @param allowedChangingConfigs Bit mask of configurations fromActivityInfo that are allowed to change.
 * @return String holding string data.  Any styling information isremoved.  Returns null if the attribute is not defined.
 */
public String getNonConfigurationString(int index,int allowedChangingConfigs){
  index*=AssetManager.STYLE_NUM_ENTRIES;
  final int[] data=mData;
  final int type=data[index + AssetManager.STYLE_TYPE];
  if ((data[index + AssetManager.STYLE_CHANGING_CONFIGURATIONS] & ~allowedChangingConfigs) != 0) {
    return null;
  }
  if (type == TypedValue.TYPE_NULL) {
    return null;
  }
 else   if (type == TypedValue.TYPE_STRING) {
    return loadStringValueAt(index).toString();
  }
  TypedValue v=mValue;
  if (getValueAt(index,v)) {
    Log.w(Resources.TAG,"String_Node_Str" + v);
    CharSequence cs=v.coerceToString();
    return cs != null ? cs.toString() : null;
  }
  Log.w(Resources.TAG,"String_Node_Str" + Integer.toHexString(type));
  return null;
}

Fixed version (ground truth):
/** 
 * @hide Retrieve the string value for the attribute at <var>index</var> that is not allowed to change with the given configurations.
 * @param index Index of attribute to retrieve.
 * @param allowedChangingConfigs Bit mask of configurations from{@link Configuration}.NATIVE_CONFIG_* that are allowed to change.
 * @return String holding string data.  Any styling information isremoved.  Returns null if the attribute is not defined.
 */
public String getNonConfigurationString(int index,int allowedChangingConfigs){
  index*=AssetManager.STYLE_NUM_ENTRIES;
  final int[] data=mData;
  final int type=data[index + AssetManager.STYLE_TYPE];
  if ((data[index + AssetManager.STYLE_CHANGING_CONFIGURATIONS] & ~allowedChangingConfigs) != 0) {
    return null;
  }
  if (type == TypedValue.TYPE_NULL) {
    return null;
  }
 else   if (type == TypedValue.TYPE_STRING) {
    return loadStringValueAt(index).toString();
  }
  TypedValue v=mValue;
  if (getValueAt(index,v)) {
    Log.w(Resources.TAG,"String_Node_Str" + v);
    CharSequence cs=v.coerceToString();
    return cs != null ? cs.toString() : null;
  }
  Log.w(Resources.TAG,"String_Node_Str" + Integer.toHexString(type));
  return null;
}