Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Doubled app after installing #4262

Open
jesmrec opened this issue Dec 15, 2023 · 10 comments · May be fixed by #4286
Open

[BUG] Doubled app after installing #4262

jesmrec opened this issue Dec 15, 2023 · 10 comments · May be fixed by #4286

Comments

@jesmrec
Copy link
Collaborator

jesmrec commented Dec 15, 2023

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

@Aitorbp Aitorbp self-assigned this Jan 12, 2024
@Aitorbp
Copy link
Contributor

Aitorbp commented Jan 16, 2024

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.

@Aitorbp Aitorbp linked a pull request Jan 17, 2024 that will close this issue
1 task
@Aitorbp Aitorbp linked a pull request Jan 17, 2024 that will close this issue
1 task
@jesmrec jesmrec added this to the 4.3 - Future milestone Jan 19, 2024
@Aitorbp
Copy link
Contributor

Aitorbp commented Feb 7, 2024

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
Copy link
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
Copy link
Contributor

hannesa2 commented Mar 1, 2024

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
Copy link
Contributor

hannesa2 commented Mar 1, 2024

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

@JuancaG05
Copy link
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.

@jesmrec
Copy link
Collaborator Author

jesmrec commented Mar 4, 2024

As clue, we think this one could be a solution: #3391, but it has more issues to take in account (MDM regards).

@hannesa2
Copy link
Contributor

hannesa2 commented Mar 4, 2024

I checkout out latest master and I only see one ownCloud.
image

Sorry, it's a local issue on your side

@JuancaG05
Copy link
Collaborator

Hi @hannesa2, as I commented, there is only a single icon on our side as well, so that is NOT the problem. The problem can be seen in the Recents screen (pressing the square button from the device's bottom bar in case of Pixels, as shown in the video in #4262 (comment)), where there are 2 different elements for ownCloud, when there should be just 1.

@Aitorbp
Copy link
Contributor

Aitorbp commented Mar 13, 2024

I have try to implement SplashScreenApi to see if the splash screen is excluded from recents. But It isn't changed the behaviour. Unfortunately, the splash screen is showing in the Recents Apps.

@Aitorbp Aitorbp removed the Sprint label Mar 22, 2024
@JuancaG05 JuancaG05 modified the milestones: 4.3 - Current, 4.4 - Future May 3, 2024
@jesmrec jesmrec modified the milestones: 4.4 - Current, Backlog Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants