Program: 199471
Project: 199471
Buggy source:
@Override public void onStart(){
  mAm=ActivityManagerNative.getDefault();
  mAppOps=(AppOpsManager)getContext().getSystemService(Context.APP_OPS_SERVICE);
  mVibrator=(Vibrator)getContext().getSystemService(Context.VIBRATOR_SERVICE);
  mHandler=new WorkerHandler();
  importOldBlockDb();
  mStatusBar=getLocalService(StatusBarManagerInternal.class);
  mStatusBar.setNotificationDelegate(mNotificationDelegate);
  final LightsManager lights=getLocalService(LightsManager.class);
  mNotificationLight=lights.getLight(LightsManager.LIGHT_ID_NOTIFICATIONS);
  mAttentionLight=lights.getLight(LightsManager.LIGHT_ID_ATTENTION);
  Resources resources=getContext().getResources();
  mDefaultNotificationColor=resources.getColor(R.color.config_defaultNotificationColor);
  mDefaultNotificationLedOn=resources.getInteger(R.integer.config_defaultNotificationLedOn);
  mDefaultNotificationLedOff=resources.getInteger(R.integer.config_defaultNotificationLedOff);
  mDefaultVibrationPattern=getLongArray(resources,R.array.config_defaultNotificationVibePattern,VIBRATE_PATTERN_MAXLEN,DEFAULT_VIBRATE_PATTERN);
  mFallbackVibrationPattern=getLongArray(resources,R.array.config_notificationFallbackVibePattern,VIBRATE_PATTERN_MAXLEN,DEFAULT_VIBRATE_PATTERN);
  if (0 == Settings.Global.getInt(getContext().getContentResolver(),Settings.Global.DEVICE_PROVISIONED,0)) {
    mDisableNotificationAlerts=true;
  }
  updateZenMode();
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_SCREEN_ON);
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
  filter.addAction(Intent.ACTION_USER_PRESENT);
  filter.addAction(Intent.ACTION_USER_STOPPED);
  filter.addAction(Intent.ACTION_USER_SWITCHED);
  filter.addAction(Intent.ACTION_USER_ADDED);
  getContext().registerReceiver(mIntentReceiver,filter);
  IntentFilter pkgFilter=new IntentFilter();
  pkgFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
  pkgFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
  pkgFilter.addAction(Intent.ACTION_PACKAGE_CHANGED);
  pkgFilter.addAction(Intent.ACTION_PACKAGE_RESTARTED);
  pkgFilter.addAction(Intent.ACTION_QUERY_PACKAGE_RESTART);
  pkgFilter.addDataScheme("String_Node_Str");
  getContext().registerReceiver(mIntentReceiver,pkgFilter);
  IntentFilter sdFilter=new IntentFilter(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
  getContext().registerReceiver(mIntentReceiver,sdFilter);
  mSettingsObserver=new SettingsObserver(mHandler);
  mSettingsObserver.observe();
  String[] notificationScorerNames=resources.getStringArray(R.array.config_notificationScorers);
  for (  String scorerName : notificationScorerNames) {
    try {
      Class<?> scorerClass=getContext().getClassLoader().loadClass(scorerName);
      NotificationScorer scorer=(NotificationScorer)scorerClass.newInstance();
      scorer.initialize(getContext());
      mScorers.add(scorer);
    }
 catch (    ClassNotFoundException e) {
      Slog.w(TAG,"String_Node_Str" + scorerName + "String_Node_Str",e);
    }
catch (    InstantiationException e) {
      Slog.w(TAG,"String_Node_Str" + scorerName + "String_Node_Str",e);
    }
catch (    IllegalAccessException e) {
      Slog.w(TAG,"String_Node_Str" + scorerName + "String_Node_Str",e);
    }
  }
  publishBinderService(Context.NOTIFICATION_SERVICE,mService);
  publishLocalService(NotificationManagerInternal.class,mInternalService);
}

Fixed version (ground truth):
@Override public void onStart(){
  mAm=ActivityManagerNative.getDefault();
  mAppOps=(AppOpsManager)getContext().getSystemService(Context.APP_OPS_SERVICE);
  mVibrator=(Vibrator)getContext().getSystemService(Context.VIBRATOR_SERVICE);
  mHandler=new WorkerHandler();
  importOldBlockDb();
  mStatusBar=getLocalService(StatusBarManagerInternal.class);
  mStatusBar.setNotificationDelegate(mNotificationDelegate);
  final LightsManager lights=getLocalService(LightsManager.class);
  mNotificationLight=lights.getLight(LightsManager.LIGHT_ID_NOTIFICATIONS);
  mAttentionLight=lights.getLight(LightsManager.LIGHT_ID_ATTENTION);
  Resources resources=getContext().getResources();
  mDefaultNotificationColor=resources.getColor(R.color.config_defaultNotificationColor);
  mDefaultNotificationLedOn=resources.getInteger(R.integer.config_defaultNotificationLedOn);
  mDefaultNotificationLedOff=resources.getInteger(R.integer.config_defaultNotificationLedOff);
  mDefaultVibrationPattern=getLongArray(resources,R.array.config_defaultNotificationVibePattern,VIBRATE_PATTERN_MAXLEN,DEFAULT_VIBRATE_PATTERN);
  mFallbackVibrationPattern=getLongArray(resources,R.array.config_notificationFallbackVibePattern,VIBRATE_PATTERN_MAXLEN,DEFAULT_VIBRATE_PATTERN);
  if (0 == Settings.Global.getInt(getContext().getContentResolver(),Settings.Global.DEVICE_PROVISIONED,0)) {
    mDisableNotificationAlerts=true;
  }
  updateZenMode();
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_SCREEN_ON);
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
  filter.addAction(Intent.ACTION_USER_PRESENT);
  filter.addAction(Intent.ACTION_USER_STOPPED);
  filter.addAction(Intent.ACTION_USER_SWITCHED);
  filter.addAction(Intent.ACTION_USER_ADDED);
  getContext().registerReceiver(mIntentReceiver,filter);
  IntentFilter pkgFilter=new IntentFilter();
  pkgFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
  pkgFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
  pkgFilter.addAction(Intent.ACTION_PACKAGE_CHANGED);
  pkgFilter.addAction(Intent.ACTION_PACKAGE_RESTARTED);
  pkgFilter.addAction(Intent.ACTION_QUERY_PACKAGE_RESTART);
  pkgFilter.addDataScheme("String_Node_Str");
  getContext().registerReceiver(mIntentReceiver,pkgFilter);
  IntentFilter sdFilter=new IntentFilter(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
  getContext().registerReceiver(mIntentReceiver,sdFilter);
  mSettingsObserver=new SettingsObserver(mHandler);
  String[] notificationScorerNames=resources.getStringArray(R.array.config_notificationScorers);
  for (  String scorerName : notificationScorerNames) {
    try {
      Class<?> scorerClass=getContext().getClassLoader().loadClass(scorerName);
      NotificationScorer scorer=(NotificationScorer)scorerClass.newInstance();
      scorer.initialize(getContext());
      mScorers.add(scorer);
    }
 catch (    ClassNotFoundException e) {
      Slog.w(TAG,"String_Node_Str" + scorerName + "String_Node_Str",e);
    }
catch (    InstantiationException e) {
      Slog.w(TAG,"String_Node_Str" + scorerName + "String_Node_Str",e);
    }
catch (    IllegalAccessException e) {
      Slog.w(TAG,"String_Node_Str" + scorerName + "String_Node_Str",e);
    }
  }
  publishBinderService(Context.NOTIFICATION_SERVICE,mService);
  publishLocalService(NotificationManagerInternal.class,mInternalService);
}