Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27375] Android: launch activity no longer throws create & start lifecycle events as of 8.0.1

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 8.0.1
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, engSchedule
ReporterJoe Falcone
AssigneeYordan Banev
Created2019-08-31T05:41:32.000+0000
Updated2019-09-17T12:16:35.000+0000

Description

For historical reasons, we had incorporated receiving the 'start' event from the launch activity into how our app unfolds. Let's look at a startup log for an app that just creates and opens a window. app.js:
if (Ti.Platform.osname === 'android') {
    var launcher = Ti.Android.currentActivity;
    launcher.addEventListener('create', function(e) {
        Ti.API.info('+++ LAUNCHER onCreate');;
    });
    launcher.addEventListener('destroy', function(e) {
        Ti.API.info('+++ LAUNCHER onDestroy');
    });
    launcher.addEventListener('pause', function(e) {
        Ti.API.info('+++ LAUNCHER onPause');
    });
    launcher.addEventListener('resume', function(e) {
        Ti.API.info('+++ LAUNCHER onResume');
    });
    launcher.addEventListener('start', function(e) {
            Ti.API.info('+++ LAUNCHER onStart: ');

    });
    launcher.addEventListener('stop', function(e) {
        Ti.API.info('+++ LAUNCHER onStop');
    });

    launcher.addEventListener('newintent', function(e) {
        Ti.API.info('+++ LAUNCHER onNewIntent: ' + JSON.stringify(e));
    });
}

var window = Ti.UI.createWindow({
    backgroundColor: 'white',
    layout: 'vertical'
});

window.open();
The log looks like this for SDK 8.0.0.GA: -- Start application log ----------------------------------------------------- [INFO] : Project built successfully in 57s 612ms [ERROR] : Zygote: v2 [INFO] : SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.phondini.test [INFO] : TiApplication: (main) [0,0] checkpoint, app created. [INFO] : MultiDex: VM with version 2.1.0 has multidex support [INFO] : MultiDex: Installing application [INFO] : MultiDex: VM has multidex support, MultiDex support library is disabled. [ERROR] : Zygote: accessInfo : 0 [WARN] : SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2], Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0010, [-1 -1 -4 -1 0 1] [INFO] : TiApplication: (main) [110,110] Analytics have been disabled [INFO] : TiApplication: (main) [1761,1871] Titanium Javascript runtime: v8 [INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null [WARN] : art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable [INFO] : test 1.0 (Powered by Titanium 8.0.0.3726240fa2) [INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.phondini.test.TestActivity@db057c6 [INFO] : InputMethodManager: HSI ignore mServedView == null or mServedView.getWindowToken() != windowToken, mServedView :0 {color:blue}[INFO] : +++ LAUNCHER onCreate [INFO] : +++ LAUNCHER onStart:{color} {color:red}[INFO] : +++ LAUNCHER onResume{color} [ERROR] : E/ViewRootImpl@819222d[TestActivity]: ViewRootImpl #2 Surface is not valid. [INFO] : +++ LAUNCHER onPause [INFO] : OpenGLRenderer: Initialized EGL, version 1.4 [INFO] : InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus [INFO] : +++ LAUNCHER onStop [INFO] : TiVerify: (Timer-0) [4995,4995] Verifying module licenses... [INFO] : I/System.out: (HTTPLog)-Static: isSBSettingEnabled false [INFO] : I/System.out: (HTTPLog)-Static: isSBSettingEnabled false [INFO] : TiVerify: (Timer-0) [372,5367] Successfully verified module licenses but with the SDK 8.0.1.GA, the log looks like this: -- Start application log ----------------------------------------------------- [INFO] : Project built successfully in 56s 798ms [ERROR] : Zygote: v2 [INFO] : SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.phondini.test [INFO] : TiApplication: (main) [0,0] checkpoint, app created. [INFO] : art: Background partial concurrent mark sweep GC freed 49185(3MB) AllocSpace objects, 14(1184KB) LOS objects, 39% free, 11MB/19MB, paused 7.077ms total 77.640ms [INFO] : MultiDex: VM with version 2.1.0 has multidex support [INFO] : MultiDex: Installing application [ERROR] : Zygote: accessInfo : 0 [WARN] : SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2], Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0010, [-1 -1 -4 -1 0 1] [INFO] : MultiDex: VM has multidex support, MultiDex support library is disabled. [INFO] : TiApplication: (main) [213,213] Analytics have been disabled [INFO] : TiApplication: (main) [2051,2264] Titanium Javascript runtime: v8 [INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null [WARN] : art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable [INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.phondini.test.TestActivity@db057c6 [INFO] : test 1.0 (Powered by Titanium 8.0.1.c4f6f25c7d) [INFO] : InputMethodManager: HSI ignore mServedView == null or mServedView.getWindowToken() != windowToken, mServedView :0 {color:red}[INFO] : +++ LAUNCHER onResume{color} [INFO] : +++ LAUNCHER onPause [INFO] : +++ LAUNCHER onStop [INFO] : OpenGLRenderer: Initialized EGL, version 1.4 [INFO] : InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus These events are missing starting with the 8.0.1.GA SDK. [INFO] : +++ LAUNCHER onCreate [INFO] : +++ LAUNCHER onStart: I don't know whether this was intentional or not, but it did take us a while to figure out what was going on in our code when our app behaved differently starting with 8.0.1. Anyway, not sure whether this is a bug or a documentation issue but felt it was important to point out that this is a change in behavior.

Comments

  1. Joshua Quick 2019-09-03

  2. Joe Falcone 2019-09-03

    1. If you are going to change a significant behavior that has been around for many years, it is a good idea to document it at least in the release notes. Assuming that no one is depending on it or using it for whatever reason is pretty dangerous. It cost me hours of debugging to realize what was really going on when our app was stuck on the splash screen. I don't work for some mega-corporation so this is time out of my own pocket. 2. We waited for 'start' for historical reasons (going back years - we've been using Titanium since 2012). Years ago, there were issues with spinning up certain modules before the app was really well and truly running so we found that waiting for 'start' was a safe way of doing this. 3. Again for historical reasons, our app startup using lifecycle events was completely separate for iOS and Android. So this is good that we can fold them together.
  3. Joshua Quick 2019-09-03

    I hear you. In Titanium 8.0.x, we've refactored the app startup/resume/exit behavior to resolve some design issues we've had and to improve intent/resume handling. The most noteworthy changes are the below. * [TIMOB-26075] * [TIMOB-26538] * [TIMOB-26555] * [TIMOB-26850]

JSON Source