À partir du 27 mars 2025, nous vous recommandons d'utiliser android-latest-release au lieu de aosp-main pour créer et contribuer à AOSP. Pour en savoir plus, consultez la section Modifications apportées à AOSP.
Implémenter des transitions d'application synchronisées
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Les transitions d'application synchronisées sont une fonctionnalité d'Android 9 qui améliore l'architecture de transition d'application existante. Lorsqu'un utilisateur ouvre, ferme ou bascule entre des applications, le processus SystemUI ou Launcher (écran d'accueil) envoie une requête pour contrôler l'animation image par image avec une synchronisation garantie entre les animations de vue et les animations de fenêtre. Lorsque SystemUI ou le lanceur d'applications dessine un nouveau frame dans le cadre d'une animation, il demande une transformation différente sur la surface de l'application animée qui détermine la composition de l'application à l'écran, et marque la requête, une transaction de surface, pour qu'elle soit synchronisée avec le frame qu'il dessine actuellement.
Cela permet de créer de nouvelles animations de transition d'application qui ne sont pas possibles sur Android 8.x ou version antérieure. Par exemple, l'animation de lancement de l'application peut transformer les icônes de l'écran d'accueil en surface d'application, et l'animation de lancement de la notification peut transformer les notifications en surface d'application.
Exemples et source
Pour en savoir plus sur cette fonctionnalité, consultez les références suivantes.
Pour une implémentation de référence de l'animation de lancement de la notification, consultez ActivityLaunchAnimator.kt.
Implémentation
Vous pouvez implémenter cette fonctionnalité sur le lanceur/l'UI système si nécessaire, ou utiliser l'implémentation AOSP dans SystemUI/Launcher3.
Validation
Pour valider les performances des animations, mesurez les performances de l'application de contrôle, c'est-à-dire SystemUI ou Launcher, pendant les animations, comme décrit dans la section Tester les performances de l'UI.
Le contenu et les exemples de code de cette page sont soumis aux licences décrites dans la Licence de contenu. Java et OpenJDK sont des marques ou des marques déposées d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/27 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Il n'y a pas l'information dont j'ai besoin","missingTheInformationINeed","thumb-down"],["Trop compliqué/Trop d'étapes","tooComplicatedTooManySteps","thumb-down"],["Obsolète","outOfDate","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Mauvais exemple/Erreur de code","samplesCodeIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/07/27 (UTC)."],[],[],null,["# Implement synchronized app transitions\n\nSynchronized App Transitions is a feature in Android 9\nthat enhances the existing app transition architecture. When a user opens,\ncloses, or switches between apps, the SystemUI or Launcher (homescreen) process\nsends a request to control the animation frame-by-frame with guaranteed\nsynchronization between view animations and window animations. When the SystemUI\nor Launcher draws a new frame as part of an animation, it requests a different\ntransform on the animating app surface that determines how the app is composed\non the screen, and marks the request, a surface transaction, to be synchronized\nwith the frame it's currently drawing.\n\nThis allows for new app transition animations that are not possible on Android\n8.x and lower. For example, the\n[app launch animation](/static/docs/core/display/images/app-launch-animation.mp4)\ncan transform homescreen icons seamlessly into the app surface and the\n[notification launch animation](/static/docs/core/display/images/notification-launch-animation.mp4)\ncan transform notifications into the app surface.\n\nExamples and source\n-------------------\n\nSee the following references for this feature.\n\n- [`ActivityOptions.makeRemoteAnimation`](https://android.googlesource.com/platform/frameworks/base/+/33a701a55c28dd20390acee1ba7881a500830d7d/core/java/android/app/ActivityOptions.java#843)\n- [`RemoteAnimationAdapter`](https://android.googlesource.com/platform/frameworks/base/+/android16-release/core/java/android/view/RemoteAnimationAdapter.java)\n- [`RemoteAnimationRunner`](https://android.googlesource.com/platform/frameworks/base/+/android16-release/core/java/android/view/IRemoteAnimationRunner.aidl)\n- [`Activity.registerRemoteAnimations`](https://android.googlesource.com/platform/frameworks/base/+/f84e2f60fec6f6d2ecfb3b90ddf075101f4b902f/core/java/android/app/Activity.java#7672)\n\nFor a reference implementation for the notification launch animation, see\n[`ActivityLaunchAnimator.kt`](https://android.googlesource.com/platform/frameworks/base/+/android16-release/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityLaunchAnimator.kt).\n\nImplementation\n--------------\n\nYou can implement this feature on Launcher/System UI as required or you can use\nthe AOSP implementation in SystemUI/Launcher3.\n| **Note:** This feature increases the load on the GPU and CPU during animations.\n\nValidation\n----------\n\nTo validate the performance of the animations, measure the performance of the\ncontrolling app, i.e. SystemUI or Launcher, during the animations as described\nin\n[Test UI performance](https://developer.android.com/training/testing/performance)."]]