title: Android 9 (API 28) activity crashes on start (setContentView)
body: <p>The issue started when updating my phone from Android 8 to 9.
  The app was working perfectly before.</p>
  
  <p>I tried to replicate this in some other app I am working on, by including the same dependencies/configuration, but I am unable to replicate the behavior. It always crashes at the setContentView, even for a simple activity and simple layout.</p>
  
  <p>I did my research and came to the conclusion that <code>INTERACT_ACROSS_USERS_FULL</code> permission is not the real cause of the issue.</p>
  
  <p>This crash actually happens in all app activities, but the TestActivity is the simplest one. Tested on Samsung S9+ running API 28 and Pixel Emulator running Android 9, API 28.</p>
  
  <p><strong>EDIT</strong>: This seems to happen when I put the android:name="...." attribute to the manifest definition. Since I really need the application class, I'm still in search of a solution to make this work.</p>
  
  <hr>
  
  <p>The activity (simplified to have the minimum code needed for a crash):</p>
  
  <blockquote>
  <pre><code>package com.marhat.albatros
  
  import android.os.Bundle import androidx.appcompat.app.AppCompatActivity;
  
  class TestActivity : AppCompatActivity() {
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_test)
      }
  }
  </code></pre>
  </blockquote>
  
  <hr>
  
  <p>Layout:</p>
  
  <blockquote>
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                                       xmlns:tools="http://schemas.android.com/tools"
                                                       android:layout_width="match_parent"
                                                       android:layout_height="match_parent"
                                                       tools:context=".TestActivity"&gt;
  
  &lt;/androidx.coordinatorlayout.widget.CoordinatorLayout&gt;
  </code></pre>
  </blockquote>
  
  <hr>
  
  <p>This is the output:</p>
  
  <blockquote>
  <pre><code>2019-02-08 11:54:19.088 20298-20298/com.marhat.albatros E/AndroidRuntime: FATAL EXCEPTION: main
      Process: com.marhat.albatros, PID: 20298
      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.marhat.albatros/com.marhat.albatros.TestActivity}:
  </code></pre>
    
    <p>java.lang.SecurityException: Call from user 0 as user 1 without
    permission INTERACT_ACROSS_USERS or INTERACT_ACROSS_USERS_FULL not
    allowed.
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
                at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
                at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
                at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
                at android.os.Handler.dispatchMessage(Handler.java:106)
                at android.os.Looper.loop(Looper.java:193)
                at android.app.ActivityThread.main(ActivityThread.java:6669)
                at java.lang.reflect.Method.invoke(Native Method)
                at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
             Caused by: java.lang.SecurityException: Call from user 0 as user 1 without permission INTERACT_ACROSS_USERS or
    INTERACT_ACROSS_USERS_FULL not allowed.
                at android.os.Parcel.createException(Parcel.java:1942)
                at android.os.Parcel.readException(Parcel.java:1910)
                at android.os.Parcel.readException(Parcel.java:1860)
                at android.view.accessibility.IAccessibilityManager$Stub$Proxy.addClient(IAccessibilityManager.java:295)
                at android.view.accessibility.AccessibilityManager.tryConnectToServiceLocked(AccessibilityManager.java:1125)
                at android.view.accessibility.AccessibilityManager.(AccessibilityManager.java:358)
                at android.view.accessibility.AccessibilityManager.getInstance(AccessibilityManager.java:336)
                at android.view.View.setFlags(View.java:14008)
                at android.view.View.(View.java:5565)
                at android.view.ViewGroup.(ViewGroup.java:659)
                at android.view.ViewGroup.(ViewGroup.java:655)
                at android.view.ViewGroup.(ViewGroup.java:651)
                at android.view.ViewGroup.(ViewGroup.java:647)
                at android.widget.FrameLayout.(FrameLayout.java:78)
                at com.android.internal.policy.DecorView.(DecorView.java:255)
                at com.android.internal.policy.PhoneWindow.generateDecor(PhoneWindow.java:2310)
                at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2662)
                at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2071)
                at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:575)
                at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:518)
                at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:466)
                at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                at com.marhat.albatros.TestActivity.onCreate(TestActivity.kt:9)
                at android.app.Activity.performCreate(Activity.java:7136)
                at android.app.Activity.performCreate(Activity.java:7127)
                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) 
                at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
                at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
                at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) 
                at android.os.Handler.dispatchMessage(Handler.java:106) 
                at android.os.Looper.loop(Looper.java:193) 
                at android.app.ActivityThread.main(ActivityThread.java:6669) 
                at java.lang.reflect.Method.invoke(Native Method) 
                at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
             Caused by: android.os.RemoteException: Remote stack trace:
                at com.android.server.accessibility.AccessibilityManagerService$SecurityPolicy.resolveCallingUserIdEnforcingPermissionsLocked(AccessibilityManagerService.java:3522)
                at com.android.server.accessibility.AccessibilityManagerService.addClient(AccessibilityManagerService.java:487)
                at android.view.accessibility.IAccessibilityManager$Stub.onTransact(IAccessibilityManager.java:82)
                at android.os.Binder.execTransact(Binder.java:731)</p>
  </blockquote>
  
  <hr>
  
  <p>Manifest:</p>
  
  <blockquote>
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
            package="com.marhat.albatros"&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
      &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt;
  
      &lt;uses-feature
              android:name="android.hardware.usb.host"
              android:required="true"/&gt;
      &lt;uses-feature android:name="android.hardware.location.gps"/&gt;
  
      &lt;application
              android:name=".AlbatrossApplication"
              android:allowBackup="true"
              android:icon="@mipmap/ic_icon_main"
              android:label="@string/app_name"
              android:roundIcon="@mipmap/ic_icon_main_round"
              android:supportsRtl="true"
              android:theme="@style/AppTheme"&gt;
          &lt;activity
                  android:name=".TestActivity"
                  android:label="@string/title_activity_test"
                  android:theme="@style/AppTheme.NoActionBar"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN"/&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
                  android:name=".TasksActivity"
                  android:label="@string/title_activity_tasks"
                  android:theme="@style/AppTheme.NoActionBar"/&gt;
  
          &lt;meta-data
                  android:name="com.google.android.geo.API_KEY"
                  android:value="xxx"/&gt;
  
          &lt;activity
                  android:name=".MainActivity"
                  android:label="@string/app_name"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN"/&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
          &lt;service
                  android:name=".UsbService"
                  android:enabled="true"/&gt;
  
          &lt;activity android:name=".FPViewActivity"/&gt;
          &lt;activity
                  android:name=".SplashActivity"
                  android:theme="@style/AppTheme.Launcher"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN"/&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
                  android:name=".TaskViewActivity"
                  android:theme="@style/AppTheme"&gt;
              &lt;intent-filter android:label="@string/app_name"&gt;
                  &lt;action android:name="android.intent.action.VIEW"/&gt;
  
                  &lt;category android:name="android.intent.category.DEFAULT"/&gt;
                  &lt;category android:name="android.intent.category.BROWSABLE"/&gt;
  
                  &lt;data android:mimeType="*/*"/&gt;
                  &lt;data android:scheme="file"/&gt;
                  &lt;data android:scheme="content"/&gt;
                  &lt;data android:pathPattern=".*\\.xfd"/&gt;
                  &lt;data android:host="*"/&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
                  android:name=".SettingsActivity"
                  android:windowSoftInputMode="stateVisible|adjustResize"/&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  </blockquote>
  
  <hr>
  
  <p>Project gradle file:</p>
  
  <blockquote>
  <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  
  buildscript {
      ext.kotlin_version = '1.3.21'
      repositories {
          google()
          jcenter()
          maven {
              url 'https://maven.fabric.io/public'
          }
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:3.2.1'
          classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
          classpath 'com.google.gms:google-services:4.2.0'
          classpath 'io.fabric.tools:gradle:1.25.4'
      } }
  
  allprojects {
      repositories {
          google()
          jcenter()
          maven {
              url 'https://maven.google.com/'
          }
  
          maven {
              url "https://jitpack.io"
          }
      } }
  
  task clean(type: Delete) {
      delete rootProject.buildDir }
  </code></pre>
  </blockquote>
  
  <hr>
  
  <p>The app / gradle file:</p>
  
  <blockquote>
  <pre><code>apply plugin: 'com.android.application'
  apply plugin: 'kotlin-android'
  apply plugin: 'kotlin-android-extensions'
  apply plugin: 'kotlin-kapt'
  apply plugin: 'io.fabric'
  
  android {
      compileSdkVersion 28
      defaultConfig {
          applicationId "com.marhat.albatros"
          minSdkVersion 18
          targetSdkVersion 28
          multiDexEnabled true
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
          // vectorDrawables.useSupportLibrary = true
      }
      buildTypes {
          release {
              minifyEnabled true
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
  
      dataBinding {
          enabled = true
      }
  }
  
  dependencies {
      implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
      implementation 'com.android.support:multidex:1.0.3'
      implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
      implementation 'androidx.appcompat:appcompat:1.0.2'
      implementation 'com.android.support:appcompat-v7:28'
      implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
      implementation 'com.google.android.material:material:1.0.0'
      implementation 'androidx.legacy:legacy-support-v4:1.0.0'
      implementation 'androidx.vectordrawable:vectordrawable:1.0.1'
      implementation 'com.github.QuadFlask:colorpicker:0.0.13'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'androidx.test:runner:1.1.1'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
      implementation 'com.android.support:support-core-utils:28.0.0'
      implementation 'com.android.support:design:28.0.0'
      implementation 'com.google.firebase:firebase-core:16.0.7'
      implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
      implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1'
      implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1'
      implementation 'com.google.android.gms:play-services-maps:16.1.0'
      implementation 'com.google.maps.android:android-maps-utils:0.5'
      def room_version = "2.1.0-alpha04"
      implementation "androidx.room:room-runtime:$room_version"
      kapt "androidx.room:room-compiler:$room_version"
      testImplementation "androidx.room:room-testing:$room_version"
      def lifecycle_version = "2.0.0"
      implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
      kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
      implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
      implementation "androidx.lifecycle:lifecycle-reactivestreams:$lifecycle_version"
      testImplementation "androidx.arch.core:core-testing:$lifecycle_version"
      implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
      implementation 'com.google.code.gson:gson:2.8.5'
  
      implementation 'com.squareup.retrofit2:retrofit:2.4.0'
      implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
      implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
      implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
  
  }
  
  apply plugin: 'com.google.gms.google-services'
  </code></pre>
  </blockquote>