Skip to content

[BUG] Doubled app after installing #4262

Open
@jesmrec

Description

Steps to reproduce

  1. Install the app from scratch
  2. Open the app

Actual behaviour

App is doubled:

Screen_recording_20231215_085238.mp4

only happens if there is no accounts

Expected behaviour

app only once

Pixel 2, Android 11

Reproducible in v4.1.1 and so on

Activity

self-assigned this
on Jan 12, 2024
Aitorbp

Aitorbp commented on Jan 16, 2024

@Aitorbp
Contributor

We have to try to handle which activities are going to be shown in the Recents Screen. To prevent this, We must use android:excludeFromRecents manually so that the system does not open activities in Recent automatically. To give more context: Normally, we let the system define how our tasks and activities are represented in the Recents screen. We don't need to modify this behavior. However, your app can determine how and when activities appear in the Recents screen.

In our case, I don't see any behavior that directly handles the SplashActivity, which is the screen that remains open in Recent Apps. Following the documentation, the system is doing it internally. By default, a document task automatically exits from the Recents screen when its activity finishes. It is what is happening with SplashActivity.

But this solution does not work when the application is installed from scratch. Since three screens appear in Recent Apps SplashScreen, FileDisplayActivity and LoginActivity. So at this point we also have to delete this task manually.

Below I show you the following scenarios:

1. Without changes:

  • Screens in Recents screen when opening app from scratch:
SplashActivity
FileDisplayActivity
LoginActivity
  • Screen in Recents screen when opening app
SplashActivity
LoginActivity

2. With SplashScreen exclude from Recents screen:

  • Screens in Recents screen when opening app from scratch:
FileDisplayActivity
LoginActivity
  • Screens in Recents screen when opening app:
    LoginActivity

3. With SplashScreen exclude from Recents screen and FileDisplayActivity excludes too in SplashScreen:

  • Screens in Recents screen when opening app from scratch:
    LoginActivity
  • Screens in Recents screen when opening app:
    LoginActivity

The third option will be taken as a solution.

linked a pull request that will close this issue on Jan 17, 2024
linked a pull request that will close this issue[BUG] Doubled app after installing #4286on Jan 17, 2024
added this to the 4.3 - Future milestone on Jan 19, 2024
Aitorbp

Aitorbp commented on Feb 7, 2024

@Aitorbp
Contributor

We are facing a problem with task management in the Recents Screen. By adding android:excludeFromRecents="true"
in the SplashScreen the behaviour of the application is not as expected. That is to say, if we are in the Recents Screen and we find a task from onwCloud and another from another application, when we open this second application, the ownCloud application will close from Recents.
To avoid this we have tried different formulas, from some conventional ones playing with the flags to manually delete the tasks we don't want and leave only the LoginActivity task, but the application is still closed.
The ideal option, following the documentation, would be to leave android:excludeFromRecents="true" in the Manifest and when we make the intent to LoginActivity add the following tags: FLAG_ACTIVITY_MULTIPLE_TASK and FLAG_ACTIVITY_RETAIN_IN_RECENTS.
FLAG_ACTIVITY_MULTIPLE_TASK: If you set this flag, when creating a new document, the system will always create a new task with the target activity as root. This setting allows to open the same document in several tasks.
FLAG_ACTIVITY_RETAIN_IN_RECENTS: If you want to retain a task in the Recent screen, even if the activity is already finished, pass this flag to the addFlags() method of the intent that starts the activity.

This method did not work.

Similarly, the FLAG_ACTIVITY_NEW_DOCUMENT tag was also used, but this did not work either.

The use of the android:documentLaunchMode and android:launchMode tags and its various properties has also been managed. We have tried to follow some logic of the app to set these tags, but they did not give the expected result either.

Documentation: https://developer.android.com/guide/components/activities/recents

JuancaG05

JuancaG05 commented on Mar 1, 2024

@JuancaG05
Collaborator

Hi @hannesa2, we would like to know if you have any ideas regarding this issue? We were trying several stuff as you can see in previous comments, but we didn't get to a valid solution. Any suggestions are welcome 😄

hannesa2

hannesa2 commented on Mar 1, 2024

@hannesa2
Contributor

Can you reproduce it ? I didn't investigated.

With this https://github.com/owncloud/android/blob/master/owncloudApp/src/main/AndroidManifest.xml#L82 you see an icon in launcher, and having more then one, you would see more.
This would be my first shot when I would investigate it.

hannesa2

hannesa2 commented on Mar 1, 2024

@hannesa2
Contributor

Open the apk directly in Android Studio and look into the given manifest ....

JuancaG05

JuancaG05 commented on Mar 4, 2024

@JuancaG05
Collaborator

Can you reproduce it ? I didn't investigated.

Hi @hannesa2, yes, we can reproduce it, just as you can see in the video of the first comment.

With this https://github.com/owncloud/android/blob/master/owncloudApp/src/main/AndroidManifest.xml#L82 you see an icon in launcher, and having more then one, you would see more. This would be my first shot when I would investigate it.

It's not that we have several icons for the app, the title of the issue may be misleading. The problem here is that when the app is opened (with the single icon we have for it), we have like 2 instances of the app because 2 different activities appear in the Recents screen, and we expect just 1.

10 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    [BUG] Doubled app after installing · Issue #4262 · owncloud/android