Git Product home page Git Product logo

delayedactivitylaunch's Introduction

This project demonstrates an issue launching an activity "from the background", on Android 10.

Context: Android 10 introduces new restrictions launching activities "from the background":

https://developer.android.com/guide/components/activities/background-starts

One exemption is noted:

The app has an activity in the back stack of an existing task on the Recents screen

Note: When such an app attempts to start a new activity, the system places that activity on top of the app's existing task but doesn't navigate away from the currently-visible task. When the user later returns to the app's task, the system starts the new activity instead of the activity that had previously been on top of the app's task.

This app demonstrates that this exemption doesn't work as described:

  • when putting the app in the background with "home": an activity cannot be launched from the background, even if it's in the list of recent apps.
  • when putting the app in the background with "recents": when the app launches the second activity, it takes over the currently-visible task

This app has the following functionality: the first screen has a button, which, when pressed, opens a second screen after a 5 second delay.

Steps to reproduce the problem:

Pressing "Home"

On < Android 10:

  • Launch the app
  • Tap on the button
  • Before 5 seconds pass, press on home to bring the app in the background
  • Wait for 5 seconds to pass
  • ✅ The app becomes visible again, opened in the second activity
  • Screen recording

On Android 10:

  • Launch the app
  • Tap on the button
  • Before 5 seconds pass, press on home to bring the app in the background
  • Wait for 5 seconds to pass
  • Reopen the app from the recents list
  • Expected behavior: the second screen appears
  • ❌ Actual behavior: On Android 10, the second screen isn't launched. The sample app is still on the first screen.
  • Screen recording

Pressing recents

On < Android 10:

  • Launch the app
  • Tap on the button
  • Before 5 seconds pass, press on recents to navigate to another app.
  • Wait for 5 seconds to pass
  • ✅ The sample app becomes visible again, opened in the second activity
  • Screen recording

On Android 10:

  • Launch the app
  • Tap on the button
  • Before 5 seconds pass, press on recents to navigate to a different app
  • Wait for 5 seconds to pass
  • Expected behavior: The user doesn't notice anything. The second activity should be launched silently inside the sample app's task, but the currently-visible task remains visible.
  • ❌ Actual behavior: The sample app becomes visible again, opened in the second activity
  • Screen recording

Note, during some tests, this scenario actually worked. I didn't figure out what made it work sometimes and not work sometimes. Here's the screen recording of it working.

delayedactivitylaunch's People

Contributors

calvarez-ov avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.