Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release thay vì aosp-main để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
Triển khai hiệu ứng chuyển đổi ứng dụng được đồng bộ hoá
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Chuyển đổi ứng dụng được đồng bộ hoá là một tính năng trong Android 9 giúp nâng cao cấu trúc chuyển đổi ứng dụng hiện có. Khi người dùng mở, đóng hoặc chuyển đổi giữa các ứng dụng, quy trình SystemUI hoặc Trình chạy (màn hình chính) sẽ gửi một yêu cầu để kiểm soát ảnh động từng khung hình với tính năng đồng bộ hoá được đảm bảo giữa ảnh động khung hiển thị và ảnh động cửa sổ. Khi SystemUI hoặc Trình chạy vẽ một khung mới trong một ảnh động, nó sẽ yêu cầu một phép biến đổi khác trên giao diện ứng dụng ảnh động để xác định cách ứng dụng được kết hợp trên màn hình và đánh dấu yêu cầu, một giao dịch trên giao diện, để đồng bộ hoá với khung mà ứng dụng đang vẽ.
Điều này cho phép tạo ảnh động chuyển đổi ứng dụng mới không thể thực hiện được trên Android 8.x trở xuống. Ví dụ: ảnh động khởi chạy ứng dụng có thể chuyển đổi liền mạch các biểu tượng trên màn hình chính thành giao diện ứng dụng và ảnh động khởi chạy thông báo có thể chuyển đổi thông báo thành giao diện ứng dụng.
Ví dụ và nguồn
Hãy xem các tài liệu tham khảo sau đây về tính năng này.
Bạn có thể triển khai tính năng này trên Trình chạy/Giao diện người dùng hệ thống nếu cần hoặc bạn có thể sử dụng cách triển khai AOSP trong SystemUI/Launcher3.
Xác nhận kết quả
Để xác thực hiệu suất của ảnh động, hãy đo lường hiệu suất của ứng dụng điều khiển, tức là SystemUI hoặc Trình chạy, trong ảnh động như mô tả trong phần Kiểm thử hiệu suất giao diện người dùng.
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 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)."]]