Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-24265

Android: Application can't recover from storage permission change

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 6.0.4
    • Component/s: Android
    • Environment:

      Ti SDK 5.5.1/6.0.0
      Appc CLI 5.5.1
      Mac OS X 10.11.6
      Android: Nexus 6P API 24/25 (Android N)

    • Story Points:
      5
    • Sprint:
      2017 Sprint 02 SDK, 2017 Sprint 04 SDK, 2017 Sprint 08 SDK

      Description

      When changing the storage permissions to off (after the user already approved in the app), if the app is in background, it can't recover when the user select the app in the overview, it just crash.

      I added a small example with only the permissions part

      Steps:

      • Build and install app in Android N
      • Click in the label
      • Accept storage permission
      • Send app to background
      • Open Settings
      • Click Apps > Example App > Permissions
      • Remove storage permission
      • Try to go back to the example app, it will crash or get stuck in the splash screen
      • Only way to recover from this is forcing the app to close and re-open it

      Log for reference:

                                  Process com.moovel.storagepermissions.example created for activity com.moovel.storagepermissions.example/.StoragepermissionsActivity
                                  PID: 4421   UID:    GIDs:
       
                TiApplication  I  (main) [0,0] checkpoint, app created.
                               I  (main) [24,24] Titanium 5.5.1 (2016/09/27 05:39 b18727f)
                     V8Object  W  (main) [131,155] Runtime disposed, cannot set property 'userAgent'
                TiApplication  I  (main) [12,167] Titanium Javascript runtime: v8
               TiRootActivity  I  (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
                       Module  D  Loading module: alloy -> Resources/alloy.js
                               D  Loading module: alloy/underscore -> Resources/alloy/underscore.js
                               D  Loading module: alloy/backbone -> Resources/alloy/backbone.js
                               D  Loading module: alloy/constants -> Resources/alloy/constants.js
                               D  Loading module: alloy/CFG -> Resources/alloy/CFG.js
                          art  I  Background sticky concurrent mark sweep GC freed 19063(1306KB) AllocSpace objects, 13(480KB) LOS objects, 0% free, 15MB/15MB, paused 610us total 100.631ms
                       Module  D  Loading module: alloy/controllers/index -> Resources/alloy/controllers/index.js
                               D  Loading module: alloy/controllers/BaseController -> Resources/alloy/controllers/BaseController.js
                               D  Loading module: permissions -> Resources/permissions.js
               TiRootActivity  I  (main) [0,0] checkpoint, on root activity resume. activity = com.moovel.storagepermissions.example.StoragepermissionsActivity@309f52e
                          art  I  Background partial concurrent mark sweep GC freed 4555(336KB) AllocSpace objects, 13(360KB) LOS objects, 20% free, 15MB/19MB, paused 7.148ms total 97.169ms
                               D  HostConnection::get() New Host Connection established 0xdc579e80, tid 4444
                               W  Process pipe failed
               OpenGLRenderer  I  Initialized EGL, version 1.4
                               D  Swap behavior 1
                EGL_emulation  E  tid 4444: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
               OpenGLRenderer  W  Failed to set EGL_SWAP_BEHAVIOR on surface 0xe734f360, error=EGL_BAD_MATCH
                       Window  D  Checkpoint: postWindowCreated()
                EGL_emulation  E  tid 4444: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
               OpenGLRenderer  W  Failed to set EGL_SWAP_BEHAVIOR on surface 0xe7350780, error=EGL_BAD_MATCH
                        TiAPI  I   [androidPermissions] - verifyStoragePermissions
            AppCompatDelegate  I  The Activity's LayoutInflater already has a Factory installed so we can not install AppCompat's
                EGL_emulation  E  tid 4444: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
               OpenGLRenderer  W  Failed to set EGL_SWAP_BEHAVIOR on surface 0xe73506e0, error=EGL_BAD_MATCH
                               D  endAllActiveAnimators on 0xcb05cc80 (RippleDrawable) with handle 0xc9b1b200
       
                                  Process com.moovel.storagepermissions.example (PID: 4421) ended
       
       
                                  Process com.moovel.storagepermissions.example created for activity com.moovel.storagepermissions.example/org.appcelerator.titanium.TiActivity
                                  PID: 4498   UID:    GIDs:
       
                          art  W  Unexpected CPU variant for X86 using defaults: x86
                TiApplication  I  (main) [0,0] checkpoint, app created.
                               I  (main) [18,18] Titanium 5.5.1 (2016/09/27 05:39 b18727f)
                     V8Object  W  (main) [68,86] Runtime disposed, cannot set property 'userAgent'
                TiApplication  I  (main) [13,99] Titanium Javascript runtime: v8
               TiBaseActivity  W  (main) [18,117] Runtime has been disposed or app has been killed. Finishing.
                TiApplication  W  (main) [8,125] Scheduling application restart
               AndroidRuntime  D  Shutting down VM
                TiApplication  E  (main) [2385,2510] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to destroy activity {com.moovel.storagepermissions.example/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke vir
                                  tual method 'void android.view.OrientationEventListener.disable()' on a null object reference; Titanium 5.5.1,2016/09/27 05:39,b18727f
                               E  java.lang.RuntimeException: Unable to destroy activity {com.moovel.storagepermissions.example/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.OrientationEventListener.disable(
                                  )' on a null object reference
                               E      at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4203)
                               E      at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4221)
                               E      at android.app.ActivityThread.-wrap6(ActivityThread.java)
                               E      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1538)
                               E      at android.os.Handler.dispatchMessage(Handler.java:102)
                               E      at android.os.Looper.loop(Looper.java:154)
                               E      at android.app.ActivityThread.main(ActivityThread.java:6119)
                               E      at java.lang.reflect.Method.invoke(Native Method)
                               E      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                               E      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
                               E  Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.OrientationEventListener.disable()' on a null object reference
                               E      at org.appcelerator.titanium.TiBaseActivity.onDestroy(TiBaseActivity.java:1523)
                               E      at org.appcelerator.titanium.TiActivity.onDestroy(TiActivity.java:29)
                               E      at android.app.Activity.performDestroy(Activity.java:6881)
                               E      at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1153)
                               E      at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4190)
                               E      ... 9 more
                          art  I  Starting a blocking GC HeapTrim
                               I  Starting a blocking GC HomogeneousSpaceCompact
       
                                  Process com.moovel.storagepermissions.example (PID: 4498) ended
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gmathews Gary Mathews
                Reporter:
                reymundolopez Reymundo López
                Reviewer:
                Maggie Chen
                Tester:
                Lee Morris (Inactive)
              • Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • It looks like Backbone Issue Sync is not enabled for your project.

                    Git Source Code