title: Android onAccessibilityEvent in AccessibilityService not getting called
body: <p>I try to develop a very simple scenario where I just get a small toast message when an event occurs. Unfortunately, I can't find out why the code below doesn't open a toast message. I know there are already some posts on the subject that I have all read and none of them have been able to help me. I would be very grateful if someone could help me or provide a working example.</p>
  
  <p>Manifest</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.android.testing.attack"&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:roundIcon="@mipmap/ic_launcher_round"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
  
          &lt;service android:name=".MaliciousService"
              android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
              android:label="A malicious service"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.accessibilityservice.AccessibilityService"/&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>The service</p>
  
  <pre><code>package com.example.android.testing.attack;
  
  import android.accessibilityservice.AccessibilityService;
  import android.accessibilityservice.AccessibilityServiceInfo;
  import android.view.accessibility.AccessibilityEvent;
  import android.widget.Toast;
  
  public class MaliciousService extends AccessibilityService {
  
      @Override
      public void onServiceConnected() {
          AccessibilityServiceInfo info = new AccessibilityServiceInfo();
          info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;
          info.notificationTimeout = 100;
          this.setServiceInfo(info);
          Toast t = Toast.makeText(getApplicationContext(), "Malicious Accessibility Service is connected now", Toast.LENGTH_SHORT);
          t.show();
      }
  
      @Override
      public void onAccessibilityEvent(AccessibilityEvent event) {
          Toast t = Toast.makeText(getApplicationContext(), "An event occurred", Toast.LENGTH_SHORT);
          t.show();
      }
  
      @Override
      public void onInterrupt() {
          Toast t = Toast.makeText(getApplicationContext(), "An interrupt occurred", Toast.LENGTH_SHORT);
          t.show();
      }
  }
  </code></pre>
  
  <p>I turn on the service in the settings and I get the initial Toast which says "Malicious Service is connected now". But I dont get any other Toast whenever I swipe or open a new activity or something else.</p>