<commit_before>package info.spielproject.spiel

import android.accessibilityservice._
import android.content.Intent
import android.os.Debug
import android.util.Log
import android.view.accessibility.AccessibilityEvent
import com.nullwire.trace.ExceptionHandler

import handlers.Handler
import scripting.Scripter

class SpielService extends AccessibilityService {

  override def onCreate {
    super.onCreate
    Log.d("spiel", "onCreate")
    //Debug.startMethodTracing("spiel")
    ExceptionHandler.register(this, "http://stacktrace.spielproject.info/index.php")
    Preferences(this)
    TTS(this)
    Handler(this)
    Scripter(this)
    StateObserver(this)
    telephony.TelephonyListener(this)
  }

  override def onDestroy {
    super.onDestroy
    Log.d("spiel", "onDestroy")
    Handler.onDestroy
    TTS.shutdown
    //Debug.stopMethodTracing
  }

  override protected def onServiceConnected {
    Log.d("spiel", "onServiceConnected")
    val info = new AccessibilityServiceInfo()
    import AccessibilityServiceInfo._
    info.feedbackType = FEEDBACK_SPOKEN
    import AccessibilityEvent._
    info.eventTypes = TYPES_ALL_MASK
    setServiceInfo(info)
  }

  override def onInterrupt = TTS.stop

  override def onAccessibilityEvent(event:AccessibilityEvent) {

    def clone = {
      val e = AccessibilityEvent.obtain
      e.setAddedCount(event.getAddedCount())
      e.setBeforeText(event.getBeforeText())
      e.setChecked(event.isChecked())
      e.setClassName(event.getClassName())<commit_msg>Shut down Scripter on termination.<commit_after>package info.spielproject.spiel

import android.accessibilityservice._
import android.content.Intent
import android.os.Debug
import android.util.Log
import android.view.accessibility.AccessibilityEvent
import com.nullwire.trace.ExceptionHandler

import handlers.Handler
import scripting.Scripter

class SpielService extends AccessibilityService {

  override def onCreate {
    super.onCreate
    Log.d("spiel", "onCreate")
    //Debug.startMethodTracing("spiel")
    ExceptionHandler.register(this, "http://stacktrace.spielproject.info/index.php")
    Preferences(this)
    TTS(this)
    Handler(this)
    Scripter(this)
    StateObserver(this)
    telephony.TelephonyListener(this)
  }

  override def onDestroy {
    super.onDestroy
    Log.d("spiel", "onDestroy")
    Handler.onDestroy
    TTS.shutdown
    Scripter.onDestroy
    //Debug.stopMethodTracing
  }

  override protected def onServiceConnected {
    Log.d("spiel", "onServiceConnected")
    val info = new AccessibilityServiceInfo()
    import AccessibilityServiceInfo._
    info.feedbackType = FEEDBACK_SPOKEN
    import AccessibilityEvent._
    info.eventTypes = TYPES_ALL_MASK
    setServiceInfo(info)
  }

  override def onInterrupt = TTS.stop

  override def onAccessibilityEvent(event:AccessibilityEvent) {

    def clone = {
      val e = AccessibilityEvent.obtain
      e.setAddedCount(event.getAddedCount())
      e.setBeforeText(event.getBeforeText())
      e.setChecked(event.isChecked())
      e.setClassName(event.getClassName())
{'fraction_non_alphanumeric': 0.09001956947162426, 'fraction_numerical': 0.0, 'mean_word_length': 4.09468438538206, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7388954', 'n_tokens_mistral': 931, 'n_tokens_neox': 900, 'n_words': 166}