private boolean throttled(){
  boolean throttled=false;
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
  String sThrottle=prefs.getString(getString(R.string.pref_key_throttle),THROTTLE_DEFAULT);
  int throttle=Integer.parseInt(sThrottle);
  CoreEventLogsDbHelper coreEventLogsDbHelper=new CoreEventLogsDbHelper(this);
  if ((throttle != THROTTLE_DISABLED) && (coreEventLogsDbHelper.getLogCountDuringLastMinute() > throttle)) {
    String log=getString(R.string.throttle_alert_msg,throttle,coreEventLogsDbHelper.getLogCountDuringLastMinute());
    Logger.w(TAG,log);
    CoreGeneralLogsDbHelper coreGeneralLogsDbHelper=new CoreGeneralLogsDbHelper(this);
    GeneralLog generalLog=new GeneralLog(log,Logger.INFO);
    coreGeneralLogsDbHelper.insert(generalLog);
    coreGeneralLogsDbHelper.close();
    UtilUI.showNotification(this,UtilUI.NOTIFICATION_WARN,getString(R.string.throttle_alert_title),log.toString());
    throttled=true;
  }
  coreEventLogsDbHelper.close();
  return throttled;
}

private boolean throttled ( ) { boolean throttled = false ; SharedPreferences prefs = PreferenceManager . getDefaultSharedPreferences ( this ) ; String sThrottle = prefs . getString ( getString ( R . string . pref_key_throttle ) , THROTTLE_DEFAULT ) ; int throttle = Integer . parseInt ( sThrottle ) ; CoreEventLogsDbHelper coreEventLogsDbHelper = new CoreEventLogsDbHelper ( this ) ; if ( ( throttle != THROTTLE_DISABLED ) && ( coreEventLogsDbHelper . getLogCountDuringLastMinute ( ) > throttle ) ) { String log = getString ( R . string . throttle_alert_msg , throttle , coreEventLogsDbHelper . getLogCountDuringLastMinute ( ) ) ; Logger . w ( TAG , log ) ; CoreGeneralLogsDbHelper coreGeneralLogsDbHelper = new CoreGeneralLogsDbHelper ( this ) ; GeneralLog generalLog = new GeneralLog ( log , Logger . INFO ) ; coreGeneralLogsDbHelper . insert ( generalLog ) ; coreGeneralLogsDbHelper . close ( ) ; UtilUI . showNotification ( this , UtilUI . NOTIFICATION_WARN , getString ( R . string . throttle_alert_title ) , log . toString ( ) ) ; throttled = true ; } coreEventLogsDbHelper . close ( ) ; return throttled ; }
todo ( acase ) : write test units for this .
