Status Update
Comments
ra...@google.com <ra...@google.com> #2
Branch: androidx-master-dev
commit b55fe68edc02b253b908a1c7c2e98350ba67afe4
Author: Ian Lake <ilake@google.com>
Date: Wed Aug 12 14:21:57 2020
Ignore Animations/Animator when Transitions run
For a given Fragment, a single owner for its
transition from visible to non-visible is needed
to avoid conflicts as different systems try to
influence the same set of properties.
This has two consequences:
- Animations (which work at the parent container level)
will interfere if there are *any* Transitions run.
- Animators will interfere if there are any Transitions
run on that specific Fragment.
By tracking which Transitions were started and using
that information to selectively ignore conflicting
Animations/Animators, we can avoid visual artifacts.
Test: updated tests pass
BUG: 149569323
Change-Id: I9e5169ffd36853c3dfbd7f217837a74674a9508d
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentTransitionAnimTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/DefaultSpecialEffectsController.java
st...@deliveroo.co.uk <st...@deliveroo.co.uk> #3
There are two parallel systems in Android - the Animation
system and the Animator
system (which the Transition
system is built on top of). With this change and Fragment 1.3.0-alpha08, no Animation
will run if there are any Transitions kicked off at the same time and no Animator
will run on Fragments that have Transitions directly associated with them (either via an enter/exit transition or as part of a shared element transition).
da...@google.com <da...@google.com> #4
Branch: androidx-master-dev
commit fa55358f7f2870bf05ef5cce12d2b4e2d86732aa
Author: Ian Lake <ilake@google.com>
Date: Mon Sep 14 11:30:52 2020
Ignore Animations when Animators run
As a continuation of the work in
we now prioritize running Animators over running
Animations. This avoids cases where both are
running simultaneously.
As Animations and Animators are now properly
decoupled, we can use animator.cancel() when
our CancelationSignal is triggered instead of
using clearAnimation().
Test: all tests pass, updated FragmentAnimatorTest passes
BUG: 167579557
Change-Id: I7b3f5c1cc1355e02ff770838cb485d659dfb1619
M fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimatorTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/DefaultSpecialEffectsController.java
ra...@google.com <ra...@google.com> #5
Sorry, I just re-read the changes for Android 14, and for this to work elegantly, we will need to change the implementation of SystemForegroundService
to do the right thing.
Will try to land this in the next WorkManager release.
st...@deliveroo.co.uk <st...@deliveroo.co.uk> #6
st...@deliveroo.co.uk <st...@deliveroo.co.uk> #7
va...@gmail.com <va...@gmail.com> #8
da...@google.com <da...@google.com> #9
Hey - We are working on a fix that will prevent WorkManager from crashing when the foreground worker is restarted due to permission loss. Be aware though that WorkManager won't be able to set the app in a foreground state and it is expected for the worker to self check the required permissions and to probably return a Result.failure()
from the work override.
ap...@google.com <ap...@google.com> #10
Branch: androidx-main
commit 4616a739983e6316819dc515057677edf40a41c1
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Wed Jul 24 08:59:34 2024
Catch SecurityException in startForeground
In API 34, startForeground() will throw SecurityException if the service type prerequisites are not met. WorkManager won't be able to start the foreground service but the worker is likely to continue and ideally fail once it checks the permission needed to do the actual work. The worker will also be subject to JobScheduler limitations.
This change mitigates the crashing issue of a foreground worker running and the app losing the prerequisite permission, causing the app to restart and due to SystemForegroundService being sticky, it restarting too but failing at startForeground() due to missing permissions.
Bug: 333957914
Test: Manual
Change-Id: I96607f62fdd456290163ee6f2774f9d31c64e79e
M work/work-runtime/src/main/java/androidx/work/impl/foreground/SystemForegroundService.java
ap...@google.com <ap...@google.com> #11
Branch: androidx-main
commit c540fa0564df85fa4e3cfd2d98f532f4120e12d8
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Wed Jul 24 09:48:38 2024
Add foreground worker with location
Updates WorkManager integration app to validate Android 14 foreground service type requirements, including the addition for a foreground worker who uses location APIs.
Bug: 333957914
Test: n/a
Change-Id: I9ac76d029ab0f0e4d1256145bdc2e3cb20b27c36
M work/integration-tests/testapp/lint-baseline.xml
M work/integration-tests/testapp/src/main/AndroidManifest.xml
A work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/ForegroundLocationWorker.kt
M work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/ForegroundWorker.kt
M work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/MainActivity.kt
M work/integration-tests/testapp/src/main/res/layout/activity_main.xml
M work/integration-tests/testapp/src/main/res/values/donottranslate-strings.xml
rw...@gmail.com <rw...@gmail.com> #12
<[ https://android-review.googlesource.com/3190158 :// = > https://android-X-review.android-X-source. com/3190158 and I didn't get my addresses I need <[ Android-X-Developer.com ]> <[Android-X-GloblaleWaybandTelcomPrivateGovSecurityServices.com ] [ Android-X-GlobaleEcosystemEnterprise ]
:// I need everything of this to be Android-X Object script because they are trying to say it's their's and they can't even run it and I need it back ]>
Description
Version used: 2.9.0
Devices/Android versions reproduced on: API 34
When we target API 34, WorkManager is crashing our application on startup if the "location" permissions are removed whilst the application is running.
Everything works fine whilst the application has the "location" permissions. When the "location" permissions are removed (whilst the application is running), the OS is killing the application (OS behaviour) and because SystemForegroundService is a STICKY service, the OS tries to restart the service which causes a security exception because the "location" permissions are no longer present.
This is a realistic user scenario which will happen many times in our production app. We can not prevent our application from crashing as this relates to the STICKY SystemForegroundService. Our application, can check the "location" permissions before scheduling the "worker", but we have no control over the user removing the "location" permissions after the "worker" has been scheduled by the WorkManager.
This behaviour only happens with WorkManager when targeting API 34 as per the restrictions documented here:
Here is the crash we are seeing on application startup:
Java.lang.SecurityException: Starting FGS with type location callerApp=ProcessRecord{34bbf76 32120:com.deliveroo.driverapp.test/u0a190} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_LOCATION] any of the permissions allOf=false [android.permission.ACCESS_COARSE_LOCATION, android.permission.ACCESS_FINE_LOCATION] and the app must be in the eligible state/exemptions to access the foreground only permission
We are using the WorkManager to run a CoroutineWorker which accesses the device location. We are scheduling the Worker as follows:
val request = OneTimeWorkRequest.Builder(worker.java)
.setExpedited(OutOfQuotaPolicy.RUN_AS_NON_EXPEDITED_WORK_REQUEST)
.build()
WorkManager.getInstance(context).enqueueUniqueWork(
ExistingWorkPolicy.KEEP,
request,
)
We are specifying FOREGROUND_SERVICE_TYPE_LOCATION in the ForegroundInfo:
ForegroundInfo(ONLINE_NOTIFICATION_ID, notificationsManager.onlineNotification, ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION)
Our Android manifest specifies the "location" foregroundServiceType:
<service
android:name="androidx.work.impl.foreground.SystemForegroundService"
android:foregroundServiceType="location"/>
As stated above, everything works fine until the user removes the "location" permissions after the "worker" has started. Then the OS kills our application and the OS tries to recover the STICKY SystemForegroundService which crashes because the app no longer as "location" permissions.
Please can you advise how we can avoid WorkManager crashing our application in the above scenario.