falzonv / discreet-launcher

Enjoy a clean home screen while accessing everything in an instant! (Profitez d'un écran d'accueil épuré tout en accédant à tout en un instant !)
https://vincent-falzon.com
GNU General Public License v3.0
224 stars 42 forks source link

Icon color changes of Simple apps not handled and may cause crashes #318

Closed AdalynBlack closed 1 year ago

AdalynBlack commented 1 year ago

If an app icon changes (this is particularly noticeable with the "simple" app series on F-Droid), the app launcher crashes. This didn't happen previously

falzonv commented 1 year ago

Hello,

Thank you for the report!

It is quite strange because I didn't make any recent changes to the part of code handling apps and their icons and never faced this issue when some app icons changed across updates.

Here are some additional questions to try to understand the issue better:

Best regards

AdalynBlack commented 1 year ago

I went ahead and recorded a screen capture of what exactly happens. You see that after trying to change the app icon, the app closes (this is normal behavior for the simple apps), then, when going back in, it doesn't even open, and I'm immediately taken to a new app. When trying to return to the homescreen, Android asks what launcher to use, and previously, I've had a dialog come up when doing this saying the app was crashing frequently. You'll also notice that the app appears in the main home screen, rather than inside the folder it was previously in. This seems to happen only on occasion. Sometimes it works, sometimes it doesn't

With normal behavior, after clicking to change the app icon color, it would close the app, and then upon re-entering the app, the icon would change color on the launcher

As for versioning and specs, I'm running a Samsung Galaxy S21 on Android 13 on the latest available version that I currently have access to

Screen capture link: https://drive.google.com/file/d/1uoq2lUAw2D6h2XlhD0qrPme0XgbLK6Q5/view?usp=drivesdk

Android Dialog if it crashes too often: Screenshot_20231022_084529_Device care

falzonv commented 1 year ago

Hello,

Thank you for the clarification and video! I also had a look to the source code of some of the Simple apps and now I understand what is going wrong. Unfortunately, even if it should be possible to at least avoid the crash, I won't be able to fix the behavior itself (too complex and I have neither the time or energy to rewrite half of the launcher).

However, here are some explanations so that at least you know what is going on:


Internally in Discreet Launcher, each installed app is uniquely identified by a combination of its package name and the full name of the activity which is the entry point for this app (the package name alone is not enough because some packages embed several apps, as I discovered with a camera/gallery app in ticket #3).

Here are some examples (you can find more examples by running an "Export" in the main menu and checking the text file):

{com.android.contacts/com.android.contacts.activities.PeopleActivity}
{com.simplemobiletools.gallery.pro/com.simplemobiletools.gallery.pro.activities.SplashActivity.Orange}
{it.niedermann.owncloud.notes/it.niedermann.owncloud.notes.SplashscreenActivity}
{net.sourceforge.opencamera/net.sourceforge.opencamera.MainActivity}
{org.lineageos.snap/com.android.camera.CameraLauncher}

These identifiers are used for many things: store which favorites are selected, store which apps are in which folders, store which apps have been renamed and what is the new name, ... And the second part of the identifier is of course used to launch the app.

Looking at the end of the longest line above, which is Simple Gallery, we see that the entry point explicitly contains the color "Orange". I am not sure what is the exact mechanism behind but we see in the Android manifest file for this app that a different entry point is defined for each icon color (".SplashActivity.Pink", ".SplashActivity.Indigo", ".SplashActivity.Purple", ....) even though Discreet Launcher can see only one at once (in this case "Orange").

When the user changes the icon color in the Simple app, the entry point changes from ".SplashActivity.Orange" to (for example) ".SplashActivity.Blue" but Discreet Launcher is unaware of that and still has the entry point with "Orange". So when trying to open the app it crashes as the "Orange" entry point is not reachable anymore (the new one being "Blue").

After the crash, Discreet Launcher is restarted, reloads the full list of apps and gets the entry point with "Blue" so now clicking the app will work (but this time it cannot see "Orange", so if we change the color back to "Orange" we get the same issue again).

But in all internal files, such as the ones for folders and favorites, the identifier for the app is still the one with "Orange". Since the app is now referenced as "Blue", it is not assigned to any folder and is displayed directly in the app drawer.

The crash, by the way, can be avoided by refreshing the list of apps in the main menu before trying to open the app whose icon color has been changed, but this won't change anything about the Discreet Launcher internal files.


Sorry again for the inconvenience, I will have a look to avoid the crash and get a "softer fail" but won't be able to fix the behavior.

Best regards

AdalynBlack commented 1 year ago

Ok, thank you for your time checking that issue out I'm guessing the simple app changed how they manage app colors at some point, which broke compatibility here Thanks for the information on how to avoid the crash as well