Uploaded image for project: 'Appcelerator - INBOX'
  1. Appcelerator - INBOX
  2. AC-5890

Android: Camera activity crashes app on some devices

    Details

      Description

      Following up this closed issue: https://jira.appcelerator.org/browse/TIMOB-12848

      var win = Titanium.UI.createWindow();
      var btn = Ti.UI.createButton({
      	title: "cam"
      });
      win.add(btn);
      btn.addEventListener("click", function() {
      	Ti.Media.showCamera({
      		success: function(e) {
      			console.log(e.media)
      		},
      		animate: false
      	});
      })
      win.open();
      

      Issues:
      In Ti 7.3.1.GA when using the normal camera (not the overlay) the app crashes from time to time with the following error:

      08-31 15:27:14.251 26035 26035 I TiAPI   :  --------------show camera----------------
      08-31 15:27:17.518 27370 27370 W HTCCamera: saveAndFinish() - contentUri = 'content://com.miga.moments.tifileprovider/filesystem/storage/emulated/0/Android/data/com.miga.moments/files/Pictures/moments/tia585926368.jpg'
      08-31 15:27:17.529  2466  2491 I art     : Explicit concurrent mark sweep GC freed 34329(1857KB) AllocSpace objects, 9(196KB) LOS objects, 9% free, 155MB/171MB, paused 2.341ms total 362.763ms
      08-31 15:27:17.529  2466  2475 I art     : WaitForGcToComplete blocked for 237.338ms for cause HeapTrim
      08-31 15:27:17.533  2466  3616 I ActivityManager: Start proc 27513:com.miga.moments/u0a1046 for content provider com.miga.moments/org.appcelerator.titanium.io.TiFileProvider
      08-31 15:27:17.534  2466  2625 V NetworkPolicy: updateRuleForRestrictBackgroundLocked(11046): isForeground=true, isBlacklisted=false, isWhitelisted=false, oldRule=0 (NONE), newRule=0 (NONE), newUidRules=0 (NONE), oldUidRules=0 (NONE)
      08-31 15:27:17.534  2466  2625 V NetworkPolicy: updateRulesForNonMeteredNetworksLocked(11046), isIdle: false, mRestrictPower: false, mDeviceIdleMode: false, isForeground=true, isWhitelisted=false, oldRule=0 (NONE), newRule=0 (NONE), newUidRules=0 (NONE), oldUidRules=0 (NONE)
      08-31 15:27:17.653 27513 27513 I TiApplication: (main) [0,0] checkpoint, app created.
      08-31 15:27:17.757 27513 27513 I TiApplication: (main) [110,110] Titanium 7.3.1 (2018/08/29 00:19 undefined)
      08-31 15:27:17.793 27370 27370 W HTCCamera: finish()
      08-31 15:27:17.807 27370 27370 W HTCCamera: onPause() - start
      08-31 15:27:17.809 27370 27370 W HTCCamera: onPreviewResourcesDestroyed()
      08-31 15:27:17.811 27370 27370 D HTCCamera(BaseObjectProxy): [Event] Pausing : End
      08-31 15:27:17.811 27370 27370 D Property: [HTCCamera.IsActivityPaused] false -> true
      08-31 15:27:17.829 27370 27370 W HTCCamera: onPause() - mIsUIReady = false
      08-31 15:27:17.830 27370 27370 W HTCCamera: onPause mIdle is false
      08-31 15:27:17.844 27370 27370 D Property: [HTCCamera.TakingPictureState] Reviewing -> Preparing
      08-31 15:27:17.845 27370 27370 W HTCCamera: onActionScreenClosed() - Activity is paused
      08-31 15:27:17.845 27370 27370 W HTCCamera: OnPause - Freeze UI !!!
      08-31 15:27:17.847 27370 27370 W HTCCamera: doOnPause() - start
      08-31 15:27:17.847 27370 27370 W HTCCamera: OnPause - hide UI, set mMainLayout invisible
      08-31 15:27:17.848 27370 27370 W HTCCamera: doOnPause() - end
      08-31 15:27:17.849 27370 27370 W HTCCamera: onPause +++stopPreview()
      08-31 15:27:17.851 27370 27370 W HTCCamera: onPause ---stopPreview()
      08-31 15:27:17.851 27370 27390 W CameraThread: closeCamera() - Start
      08-31 15:27:17.858 27370 27370 W HTCCamera: onPause() - end
      08-31 15:27:17.867 27370 27390 W CameraDeviceManager: closeCamera() - Release camera - start
      08-31 15:27:17.867 27370 27390 W CameraController: close(Main)
      08-31 15:27:17.867 27370 27390 W CameraController: suspendCamera(Front)
      08-31 15:27:17.868 27370 27390 W CameraController: suspendCamera(Front3D)
      08-31 15:27:17.868 27370 27390 W CameraController: close() - Release camera [start]
      08-31 15:27:17.994  2466  3902 W ActivityManager: Exception when starting activity com.miga.moments/org.appcelerator.titanium.TiActivity
      08-31 15:27:17.994  2466  3902 W ActivityManager: android.os.DeadObjectException
      08-31 15:27:17.994  2466  3902 W ActivityManager: 	at android.os.BinderProxy.transactNative(Native Method)
      08-31 15:27:17.994  2466  3902 W ActivityManager: 	at android.os.BinderProxy.transact(Binder.java:623)
      08-31 15:27:17.994  2466  3902 W ActivityManager: 	at android.app.ApplicationThreadProxy.scheduleLaunchActivity(ApplicationThreadNative.java:942)
      08-31 15:27:17.994  2466  3902 W ActivityManager: 	at com.android.server.am.ActivityStackSupervisor.realStartActivityLocked(ActivityStackSupervisor.java:1309)
      08-31 15:27:17.994  2466  3902 W ActivityManager: 	at com.android.server.am.ActivityStackSupervisor.startSpecificActivityLocked(ActivityStackSupervisor.java:1408)
      08-31 15:27:17.994  2466  3902 W ActivityManager: 	at com.android.server.am.ActivityStack.resumeTopActivityInnerLocked(ActivityStack.java:2660)
      08-31 15:27:17.994  2466  3902 W ActivityManager: 	at com.android.server.am.ActivityStack.resumeTopActivityUncheckedLocked(ActivityStack.java:2193)
      08-31 15:27:17.994  2466  3902 W ActivityManager: 	at com.android.server.am.ActivityStackSupervisor.resumeFocusedStackTopActivityLocked(ActivityStackSupervisor.java:1832)
      08-31 15:27:17.994  2466  3902 W ActivityManager: 	at com.android.server.am.ActivityStack.completePauseLocked(ActivityStack.java:1378)
      08-31 15:27:17.994  2466  3902 W ActivityManager: 	at com.android.server.am.ActivityStack.activityPausedLocked(ActivityStack.java:1252)
      08-31 15:27:17.994  2466  3902 W ActivityManager: 	at com.android.server.am.ActivityManagerService.activityPaused(ActivityManagerService.java:7207)
      08-31 15:27:17.994  2466  3902 W ActivityManager: 	at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:602)
      08-31 15:27:17.994  2466  3902 W ActivityManager: 	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2925)
      08-31 15:27:17.994  2466  3902 W ActivityManager: 	at android.os.Binder.execTransact(Binder.java:573)
      08-31 15:27:17.995  2466  3902 D ActivityManager: cleanUpApplicationRecord -- 27513
      08-31 15:27:18.008  2466  3902 I ActivityManager: Start proc 27536:com.miga.moments/u0a1046 for activity com.miga.moments/org.appcelerator.titanium.TiActivity
      08-31 15:27:18.012  2466  4565 W ActivityManager: Spurious death for ProcessRecord{3331f36 27536:com.miga.moments/u0a1046}, curProc for 27513: null
      08-31 15:27:18.021 27370 27390 W CameraController: close() - Release camera [end]
      08-31 15:27:18.021 27370 27390 D Event   : [CameraThread.CameraClosed] rasing
      08-31 15:27:18.022 27370 27390 D Event   : [CameraThread.CameraClosed] raised
      08-31 15:27:18.022 27370 27390 W CameraThread: Release Camera
      08-31 15:27:18.022 27370 27390 W CameraThread: closeCamera() - End
      08-31 15:27:19.898  2466  2491 W WindowManager: App freeze timeout expired.
      08-31 15:27:19.898  2466  2491 W WindowManager: Force clearing freeze: AppWindowToken{a1471ec token=Token{6a83c9f ActivityRecord{d64863e u0 com.miga.moments/org.appcelerator.titanium.TiActivity t4808}}}
      08-31 15:27:19.899  2466  2485 D StatusBarManagerService: setSystemUiVisibility(0x8608)
      08-31 15:27:19.899  2466  2485 D StatusBarManagerService: disable:userId=0 what=0x0 which=0x1 pkg=null
      08-31 15:27:19.899  2466  2485 D StatusBarManagerService: hiding MENU key
      08-31 15:27:19.900  2466  2491 I WindowManager: Screen frozen for +2s20ms due to Window{56a375b u0 Starting com.miga.moments}
      08-31 15:27:20.310 27536 27536 I TiApplication: (main) [2097,2215] Titanium Javascript runtime: v8
      08-31 15:27:20.345 27536 27536 W TiBaseActivity: (main) [35,2250] Runtime has been disposed or app has been killed. Finishing.
      

      The log is from a HTC A9, Android 7, TiSDK 7.3.1.GA

      It starts when I open the camera (inside showCamera) and I take an image.
      You'll see that is saves the image to a temp location and shortly after that (search for TiApplication) it looks like it restarts the app "checkpoint, app created" ? Then it releases the camera view and it show this error:

       Exception when starting activity com.miga.moments/org.appcelerator.titanium.TiActivity
      08-31 15:27:17.994  2466  3902 W ActivityManager: android.os.DeadObjectException
      

      then it will crash the whole app restarts the app (at the end of the log)

      Looking up the "camera intent crash" situation you'll find a lot like this: http://stackoverflow.com/a/26708283/5193915

      Launching camera requires a lot of memory. So on devices with low memory android system closes the Activities running in background

      Works fine when using an overlay (so launchNativeCamera from MediaModule.java) but I would lose all the native camera features.

      I can reproduces this issue very frequently on a HTC A9, on a Samsung device I'm not able to see this issue.

        Attachments

          Activity

            People

            • Assignee:
              shossain Shak Hossain
              Reporter:
              michael Michael Gangolf
            • Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

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

                  Git Source Code