Kiss: bug: KISS does not work after reboot, green circle is rotating but i have to restart KISS to make it work

Created on 18 Feb 2019  Â·  30Comments  Â·  Source: Neamar/KISS

  • app version 3.7.5 (from fdroid)
  • android version P
  • device used Xiaomi Redmi Note 5 Pro (whyred) and Xiaomi Mi Max 3 (nitrogen)
  • custom settings that might have an impact: no idea (tried with and without the "root option" and with and without the "widget option") nothing changed

I use on both phones custom ROMs based on aosp (havoc os and cosp).

Most helpful comment

The reason why it worked on some devices on not others: if you have do not have full disk encryption but are using Android 9, KISS starts before you pass the lockscreen, and at this point starting service is not allowed.
If, however, you do have full disk encryption, then KISS can't start before you've typed your passphrase, and it works fine in this situation :)

(unrelated to this issue, but don't forget to encrypt your devices y'all)

All 30 comments

Some logs would be nice

How can i log when kiss does not start?
adb?
Need some help how to do this.

Yes adb logcat...it keeps history,...you can look at the time it failed.

I had this happen to me last week.

I was able to restart (advanced settings, restart), and it was fine.

Here are the logs for me:

2019-02-14 01:57:39.943 15706-15706/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: fr.neamar.kiss, PID: 15706
    java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.neamar.kiss/fr.neamar.kiss.MainActivity}: java.lang.ClassCastException: android.app.Application cannot be cast to fr.neamar.kiss.KissApplication
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2951)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6718)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.ClassCastException: android.app.Application cannot be cast to fr.neamar.kiss.KissApplication
        at fr.neamar.kiss.KissApplication.getApplication(KissApplication.java:18)
        at fr.neamar.kiss.MainActivity.onCreate(MainActivity.java:153)
        at android.app.Activity.performCreate(Activity.java:7144)
        at android.app.Activity.performCreate(Activity.java:7135)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2931)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6718) 
        at java.lang.reflect.Method.invoke(Native Method) 

It's a RuntimeException, but I didn't get an error message -- just a rotating circle.

I'm also on Android P and I suspect some limitation in the new version of the OS.

It seems like Android is creating a base Application class, rather than the one specified in the manifest. Since it obviously fails, the UI remains in an un-initialised state forever...

I think I triggered it today too, it was mid-rotation from landscape when it got stuck. I just went to app settings restart and it got fixed.

I have it everytime when i reboot.
I always have to restart KISS to make it work.

How often do you reboot? :-D

Any chance one of you can send a log to make sure it's the same issue?

Anytime i reboot means also everytime i switch it on.
Boy, i am new in github and i see i have to be more detailed here.
;)
I will try to log this tomorrow.

Not sure if this was at fault, but I don't have many kiss entries

02-19 14:31:27.438   948  1317 W ActivityManager: Background start not allowed: service Intent { cmp=fr.neamar.kiss/.dataprovider.ContactsProvider } to fr.neamar.kiss/.dataprovider.ContactsProvider from pid=32005 uid=10141 pkg=fr.neamar.kiss startFg?=false
02-19 14:31:27.439 32005 32005 W System.err: java.lang.ClassNotFoundException: fr.neamar.kiss.dataprovider.PhoneProvider
02-19 14:31:27.440 32005 32005 W System.err:    at fr.neamar.kiss.DataHandler.providerName2Intent(DataHandler.java:139)
02-19 14:31:27.440 32005 32005 W System.err:    at fr.neamar.kiss.DataHandler.connectToProvider(DataHandler.java:161)
02-19 14:31:27.440 32005 32005 W System.err:    at fr.neamar.kiss.DataHandler.<init>(DataHandler.java:93)
02-19 14:31:27.440 32005 32005 W System.err:    at fr.neamar.kiss.KissApplication.getDataHandler(KissApplication.java:23)
02-19 14:31:27.440 32005 32005 W System.err:    at fr.neamar.kiss.broadcast.IncomingCallHandler.onReceive(IncomingCallHandler.java:24)
02-19 14:31:27.441 32005 32005 W System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "fr.neamar.kiss.dataprovider.PhoneProvider" on path: DexPathList[[zip file "/data/app/fr.neamar.kiss-Gab5SFRMN7I3V0I7JQgT3A==/base.apk"],nativeLibraryDirectories=[/data/app/fr.neamar.kiss-Gab5SFRMN7I3V0I7JQgT3A==/lib/arm64, /system/lib64, /vendor/lib64]]

Ignore the cosmetic f-up, my logs output like that.

FYI, AOSP 9 here too.

Thanks, that will be helpful! If you don't know how to get the logs, you can just send a bug report to [email protected] following the instructions here: https://developer.android.com/studio/debug/bug-report

@licaon-kter thanks for the logs. It's interesting cause it's different. I'll look deeper into it at some point cause it shouldn't crash completely...

Have the same every reboot, Samsung s9+ android 9

@geekuillaume also had the issue, here are the same logs:

02-22 11:43:59.286 10133  5181  5181 W System.err: java.lang.ClassNotFoundException: fr.neamar.kiss.dataprovider.PhoneProvider
02-22 11:43:59.287 10133  5181  5181 W System.err:  at java.lang.Class.classForName(Native Method)
02-22 11:43:59.287 10133  5181  5181 W System.err:  at java.lang.Class.forName(Class.java:453)
02-22 11:43:59.287 10133  5181  5181 W System.err:  at java.lang.Class.forName(Class.java:378)
02-22 11:43:59.287 10133  5181  5181 W System.err:  at fr.neamar.kiss.DataHandler.providerName2Intent(DataHandler.java:139)
02-22 11:43:59.287 10133  5181  5181 W System.err:  at fr.neamar.kiss.DataHandler.connectToProvider(DataHandler.java:161)
02-22 11:43:59.287 10133  5181  5181 W System.err:  at fr.neamar.kiss.DataHandler.<init>(DataHandler.java:93)
02-22 11:43:59.287 10133  5181  5181 W System.err:  at fr.neamar.kiss.MainActivity.onCreate(MainActivity.java:1045)

I think I found the issue.

I'll send v3.7.6 on the beta channel of the Play Store, if you can confirm it's fixed?
I'll also push to f-droid.

This just happened to my phone after the latest update from Samsung with One Ui.
After getting the latest master the issue went away. Previously I was on the tab favourite branch.

Oh that's good to know. So @geekuillaume seems to be the only one still
having the issue. What's your device Geekuillaume?

Thanks!

On Fri, Mar 1, 2019, 19:00 TBog notifications@github.com wrote:

This just happened to my phone after the latest update from Samsung with
One Ui and the update mentioned worked!

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Neamar/KISS/issues/1154#issuecomment-468754448, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAgxDKi4eu4pT61HQEa1SSk4i5zjbYbBks5vSWrIgaJpZM4bAXww
.

I think a saw it glitch today twice, was showing only one shortcut for about 2 seconds, but it recovered afterwards.

Oh that's good to know. So @geekuillaume seems to be the only one still having the issue. What's your device Geekuillaume? Thanks!

Sorry, to write so late but work irl is pretty heavy.
:(
I updated too but have still the described issue.

Hello, I run Motorola One with Android One and in beta with the supposedly fix that issue still persist.

@n0rrin @brumik Try to get a logcat when this happens.

If I start the app while the phone is locked (display off) I get the issue.

2019-03-04 13:23:13.422 11501-11501/fr.neamar.kiss D/MainActivity: onCreate()
2019-03-04 13:23:13.801 11501-11501/fr.neamar.kiss V/DataHandler: Connecting to app
2019-03-04 13:23:13.819 11501-11501/fr.neamar.kiss E/KISS: Unable to start service for app. This is likely because a broadcast receiver was triggered and KISS is not the default home app, so services are not running and can't be started in this context.
2019-03-04 13:23:13.819 11501-11501/fr.neamar.kiss V/DataHandler: Connecting to contacts
2019-03-04 13:23:13.837 11501-11501/fr.neamar.kiss E/KISS: Unable to start service for contacts. This is likely because a broadcast receiver was triggered and KISS is not the default home app, so services are not running and can't be started in this context.
2019-03-04 13:23:13.837 11501-11501/fr.neamar.kiss V/DataHandler: Connecting to search
2019-03-04 13:23:13.846 11501-11501/fr.neamar.kiss E/KISS: Unable to start service for search. This is likely because a broadcast receiver was triggered and KISS is not the default home app, so services are not running and can't be started in this context.
2019-03-04 13:23:13.846 11501-11501/fr.neamar.kiss V/DataHandler: Connecting to settings
2019-03-04 13:23:13.865 11501-11501/fr.neamar.kiss E/KISS: Unable to start service for settings. This is likely because a broadcast receiver was triggered and KISS is not the default home app, so services are not running and can't be started in this context.
2019-03-04 13:23:13.865 11501-11501/fr.neamar.kiss V/DataHandler: Connecting to shortcuts
2019-03-04 13:23:13.874 11501-11501/fr.neamar.kiss E/KISS: Unable to start service for shortcuts. This is likely because a broadcast receiver was triggered and KISS is not the default home app, so services are not running and can't be started in this context.
2019-03-04 13:23:14.017 11501-11501/fr.neamar.kiss I/DecorView: createDecorCaptionView >> DecorView@df80eef[], isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true
2019-03-04 13:23:14.239 11501-11501/fr.neamar.kiss W/fr.neamar.kiss: Verification of java.lang.Object fr.neamar.kiss.ui.BlockableListView.access$super(fr.neamar.kiss.ui.BlockableListView, java.lang.String, java.lang.Object[]) took 109.916ms
2019-03-04 13:23:14.629 11501-11501/fr.neamar.kiss D/ScrollView: initGoToTop
2019-03-04 13:23:14.869 11501-11501/fr.neamar.kiss D/MainActivity: onResume()

Note: KISS is my default launcher.

@TBog that's a really interesting stack trace.

It looks like even though the launcher is the foreground app, it is not allowed to start background services yet. Tbog does mention that the screen is off.. which is likely the issue here.

I'm not sure how this can be fixed, and it's a very unique problem that only a launcher would face -- having it's onCreate() called without actually being visible..

  • Easy: add a timer and retry. Very ugly.
  • Medium hard: implement an abstraction layer between a Service and whatever is now used in Android P (but they have drawbacks IIRC, for instance you need to have a notification? or they can be scheduled to run but not guarantee it will happen anytime soon?)
  • Refactor the whole app to stop using Services and instead rely on SharedPreferences, as done on #1146

@TBog if you can test, another potentially super easy fix would be to move the initialization of the DataHandler in onResume() rather than onCreate() -- or if it doesn't work, to find the "event" that is sent whenever the app gets displayed for real, not just loaded.

I think I have a solution that can work.

I'm able to reproduce with a device running Pie AND a screen locked, so now I can fix.

Sorry it took so long!

Saw it again today, using device as usual, press home, endless circle.

Spent some time with @geekuillaume device and was able to see what's going on. It looks like isInteractive() is not always accurate.

I've updated the code and will test again tomorrow -- if it works, I'll push the fix for everyone

Lot of details in source code iof #1163.

tl;dr: I'm pushing v3.7.8 to the beta and f-droid. Please test it and confirm if it works for you!
(fingers crossed)

The reason why it worked on some devices on not others: if you have do not have full disk encryption but are using Android 9, KISS starts before you pass the lockscreen, and at this point starting service is not allowed.
If, however, you do have full disk encryption, then KISS can't start before you've typed your passphrase, and it works fine in this situation :)

(unrelated to this issue, but don't forget to encrypt your devices y'all)

Seems fixed. Thanks.

Was this page helpful?
0 / 5 - 0 ratings