androidandroid-emulatorandroid-wifi

Android 8 Settings app crashes on emulator with clean AOSP build


"Settings" app will crash immediately after open with clean Android 8 build (aosp_x86-eng) on emulator. logcat output is below:

--------- beginning of main
1536  1550 E memtrack: Couldn't load memtrack module
1536  1550 W android.os.Debug: failed to get memory consumption info: -1
--------- beginning of system
1536  1548 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.settings/.Settings (has extras)} from uid 10013
1373  2321 W audio_hw_generic: Not supplying enough data to HAL, expected position 926726 , only wrote 926722
2477  2477 W zygote  : Unexpected CPU variant for X86 using defaults: x86
1536  1548 I ActivityManager: Start proc 2477:com.android.settings/1000 for activity com.android.settings/.Settings
2477  2477 I zygote  : The ClassLoaderContext is a special shared library.
2477  2477 D OpenGLRenderer: HWUI GL Pipeline
2477  2477 W TileUtils: Found com.android.settings.backup.BackupSettingsActivity for intent Intent { act=com.android.settings.action.SETTINGS pkg=com.android.settings } missing metadata com.android.settings.category
2477  2477 D ConditionManager: conditions loading asychronously
2477  2496 D ConditionManager: loading conditions from xml
2477  2495 E BluetoothAdapter: Bluetooth binder is null
2477  2495 V NFC     : this device does not have NFC support
1388  1836 E SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
2477  2500 D SuggestionParser: Day 0 for com.android.settings.suggested.category.FIRST_IMPRESSION
2477  2495 D BatteryInfo: time to make batteryStatsHelper: 1ms
1536  1554 I WifiService: requestActivityInfo uid=1000
1536  1554 I WifiService: reportActivityInfo uid=1000
1536  1554 I WifiService: getSupportedFeatures uid=1000
1536  1606 W HalDeviceManager: isWifiStarted called but mWifi is null!?
2477  2500 I SuggestionParser: Use fingerprint requires unavailable feature android.hardware.fingerprint
1536  1554 E BluetoothAdapter: Bluetooth binder is null
1536  1554 E BatteryExternalStatsWorker: no controller energy info supplied for wifi
1536  1554 E KernelCpuSpeedReader: Failed to read cpu-freq: /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state (No such file or directory)
1536  1554 E BatteryExternalStatsWorker: modem info is invalid: ModemActivityInfo{ mTimestamp=0 mSleepTimeMs=0 mIdleTimeMs=0 mTxTimeMs[]=[0, 0, 0, 0, 0] mRxTimeMs=0 mEnergyUsed=0}
2477  2500 I SuggestionParser: Add another fingerprint requires unavailable feature android.hardware.fingerprint
2477  2495 D BatteryInfo: time for getStats: 10ms
2477  2500 W TileUtils: Found com.android.settings.backup.BackupSettingsActivity for intent Intent { act=com.android.settings.action.SETTINGS pkg=com.android.settings } missing metadata com.android.settings.category
1643  1852 D EGL_emulation: eglMakeCurrent: 0x945dab60: ver 2 0 (tinfo 0x945e4970)
1380  1380 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 1540096
1380  1525 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 1540096
2477  2499 D         : HostConnection::get() New Host Connection established 0xa750eb00, tid 2499
2477  2499 I zygote  : android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2477  2499 I OpenGLRenderer: Initialized EGL, version 1.4
2477  2499 D OpenGLRenderer: Swap behavior 1
2477  2500 E SystemServiceRegistry: No service published for: wifip2p
2477  2500 E SystemServiceRegistry: android.os.ServiceManager$ServiceNotFoundException: No service published for: wifip2p
2477  2500 E SystemServiceRegistry:     at android.os.ServiceManager.getServiceOrThrow(ServiceManager.java:75)
2477  2500 E SystemServiceRegistry:     at android.app.SystemServiceRegistry$49.createService(SystemServiceRegistry.java:569)
2477  2500 E SystemServiceRegistry:     at android.app.SystemServiceRegistry$49.createService(SystemServiceRegistry.java:567)
2477  2500 E SystemServiceRegistry:     at android.app.SystemServiceRegistry$StaticServiceFetcher.getService(SystemServiceRegistry.java:987)
2477  2500 E SystemServiceRegistry:     at android.app.SystemServiceRegistry.getSystemService(SystemServiceRegistry.java:914)
2477  2500 E SystemServiceRegistry:     at android.app.ContextImpl.getSystemService(ContextImpl.java:1667)
2477  2500 E SystemServiceRegistry:     at android.view.ContextThemeWrapper.getSystemService(ContextThemeWrapper.java:171)
2477  2500 E SystemServiceRegistry:     at android.app.Activity.getSystemService(Activity.java:5915)
2477  2500 E SystemServiceRegistry:     at com.android.settings.wfd.WifiDisplaySettings.isAvailable(WifiDisplaySettings.java:216)
2477  2500 E SystemServiceRegistry:     at com.android.settings.SettingsActivity.doUpdateTilesList(SettingsActivity.java:845)
2477  2500 E SystemServiceRegistry:     at com.android.settings.SettingsActivity.-wrap0(Unknown Source:0)
2477  2500 E SystemServiceRegistry:     at com.android.settings.SettingsActivity$5.run(SettingsActivity.java:747)
2477  2500 E SystemServiceRegistry:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
2477  2500 E SystemServiceRegistry:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
2477  2500 E SystemServiceRegistry:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
2477  2500 E SystemServiceRegistry:     at java.lang.Thread.run(Thread.java:764)
1536  1548 W ActivityManager:   Force finishing activity com.android.settings/.Settings
1536  1552 I ActivityManager: Showing crash dialog for package com.android.settings u0

It seems that crash is somehow related to WiFi, but Android emulator shouldn't have WiFi support anyway. What could be the issue here?


Solution

  • I managed to fix it myself. The problem seems to be due to com.android.settings.wfd.WifiDisplaySettings.isAvailable reporting that WiFi is available, while wifip2p service is absent. I went to WifiDisplaySettings.java:216 and replaced this check with false, so it won't try to locate the service. Now Settings can be opened properly.