Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5410] IllegalArgumentException on APN_SETTINGS (Android API 24 and up)

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionInvalid
Resolution Date2017-12-08T22:52:54.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsandroid, apn, crash, window
ReporterDaniel Falcon
AssigneeShak Hossain
Created2017-11-27T16:15:23.000+0000
Updated2017-12-08T22:52:54.000+0000

Description

When starting an Activity in order to open the APN_SETTINGS a new Activity is opened and immediately closed on Android API 24 (Android 7) and up. The same code works perfectly in lower Android API versions. The code to reproduce this is the following:
intent = Ti.Android.createIntent({ action : 'android.settings.APN_SETTINGS' });
intent.addFlags(Ti.Android.FLAG_ACTIVITY_NEW_TASK);
Ti.Android.currentActivity.startActivity(intent);
Appcelerator console doesn't give any information about the failure, but tracking it with the adb logcat, I got the following snippet:
11-27 14:36:46.498  1408  1408 W ContextImpl: Failed to ensure /data/user_de/0/com.android.settings/shared_prefs: mkdir failed: EACCES (Permission denied)
11-27 14:36:46.534  1408  1408 E MPlugin : Unsupported class: com.mediatek.settings.ext.IApnSettingsExt
11-27 14:36:46.534  1408  1408 E MPlugin : Unsupported class: com.mediatek.settings.ext.IRcseOnlyApnExt
11-27 14:36:46.687  1117  1862 W InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@351f8d3 attribute=null, token = android.os.BinderProxy@daa15cf
11-27 14:36:47.366  1117  1171 W WindowManager: Failed looking up window
11-27 14:36:47.366  1117  1171 W WindowManager: java.lang.IllegalArgumentException: Requested window android.view.ViewRootImpl$W@deb4747 does not exist
11-27 14:36:47.366  1117  1171 W WindowManager: 	at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9471)
11-27 14:36:47.366  1117  1171 W WindowManager: 	at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9462)
11-27 14:36:47.366  1117  1171 W WindowManager: 	at com.android.server.wm.WindowManagerService.removeWindow(WindowManagerService.java:2460)
11-27 14:36:47.366  1117  1171 W WindowManager: 	at com.android.server.wm.Session.remove(Session.java:196)
11-27 14:36:47.366  1117  1171 W WindowManager: 	at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:3700)
11-27 14:36:47.366  1117  1171 W WindowManager: 	at android.view.ViewRootImpl.doDie(ViewRootImpl.java:6429)
11-27 14:36:47.366  1117  1171 W WindowManager: 	at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:4052)
11-27 14:36:47.366  1117  1171 W WindowManager: 	at android.os.Handler.dispatchMessage(Handler.java:110)
11-27 14:36:47.366  1117  1171 W WindowManager: 	at android.os.Looper.loop(Looper.java:203)
11-27 14:36:47.366  1117  1171 W WindowManager: 	at android.os.HandlerThread.run(HandlerThread.java:61)
11-27 14:36:47.366  1117  1171 W WindowManager: 	at com.android.server.ServiceThread.run(ServiceThread.java:46)

Attachments

FileDateSize
app.js2017-12-01T08:31:35.000+0000461

Comments

  1. Mostafizur Rahman 2017-11-28

    Hello [~dfalcon], Thanks for sharing with us. Please provide a full sample test code that regenerates the issue. Better to provide a sample app as an attachment here. Can you please test in latest SDK and android api(27) and let us know how it goes. Best
  2. Mostafizur Rahman 2017-11-30

    [~dfalcon], I just wanted to follow up here. Did you manage to follow the instructions provided earlier? Let us know if you still experience any issue. We would be happy to assist you. Best Regards! Best
  3. Daniel Falcon 2017-12-01

    Hi Mostafizur Rahman, Apologies for the late answer, I made an extensive test in several devices and emulators. All the emulators I've tested are working, and I've had the oportunity to test in an Android 8 device (API 26), with successful results. What I found in this testing is the following: This code works in the majority of the devices and emulators, however there are some that are not working or doing complete different things. Some examples: - Gigaset GS170, with Android 7.0 (API 24): The phone tries to open the activity, but it fails and closes it, with the result of the error stack that I have added to the ticket. - Nokia 8, with Android 7.1.1 (API 25): The phone goes to "About phone" instead of "APN Settings". I've added a simple app.js file to the ticket in order to test this. Thanks for your attention. Best regards.
  4. Gary Mathews 2017-12-01

    [~dfalcon] This can happen when vendors create their own custom Settings navigator; some actions can become invalid like android.settings.APN_SETTINGS. It's hard to get this to work for all devices, unless you figure out the correct actions for problematic vendors.
  5. Daniel Falcon 2017-12-04

    Hi Gary Mathews, For the Gigaset and other "not-so-well-known" brands, your sentence is for sure correct. I've experienced this before: Vendors modifying Android in their phones, which can lead to funny situations. But in the case of the Nokia I'm not so sure. They even claim in their website that they have "Pure Android" in their phones. Could be that they are lying about this? Thank you for your answers. Best regards
  6. Sharif AbuDarda 2017-12-04

    Hello [~dfalcon], I believe this is most certainly a vender issue. Since I can reproduce the issue with your code in Nokia 6 (Android 7.1.2) device. So, I think the issue here is with Nokia or Gigaset or such. The vendors decided not to update the actions for their Settings navigator. In that case, we have nothing to do here. Thanks.

JSON Source