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.
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.
DeviceMonitorMultiplexer
public
class
DeviceMonitorMultiplexer
extends Object
implements
IDeviceMonitor
java.lang.Object
|
↳ |
com.android.tradefed.device.DeviceMonitorMultiplexer
|
Một lớp proxy để truyền yêu cầu đến nhiều IDeviceMonitor
.
Tóm tắt
Hàm khởi tạo công khai
DeviceMonitorMultiplexer
public DeviceMonitorMultiplexer ()
Phương thức công khai
addMonitor
public void addMonitor (IDeviceMonitor globalDeviceMonitor)
Tham số |
globalDeviceMonitor |
IDeviceMonitor |
addMonitors
public void addMonitors ( globalDeviceMonitors)
Tham số |
globalDeviceMonitors |
|
notifyDeviceStateChange
public void notifyDeviceStateChange (String serial,
DeviceAllocationState oldState,
DeviceAllocationState newState)
Báo hiệu cho IDeviceMonitor
rằng trạng thái thiết bị đã thay đổi.
Việc triển khai giám sát phải giới hạn lượng dữ liệu xử lý và tương tác IDeviceManager/DeviceLister mà chúng thực hiện trong phương thức này.
Tham số |
serial |
String |
oldState |
DeviceAllocationState |
newState |
DeviceAllocationState |
removeMonitor
public void removeMonitor (IDeviceMonitor mon)
Tham số |
mon |
IDeviceMonitor |
chạy
public void run ()
Một phương thức sẽ được gọi sau khi tất cả các trường @Option của Monitor đã được đặt.
setDeviceLister
public void setDeviceLister (IDeviceMonitor.DeviceLister lister)
Cho phép đặt DeviceLister
. Sau khi thiết lập thành công Lister, các hoạt động triển khai có thể loại bỏ tất cả các lần thử tiếp theo.
Tham số |
lister |
IDeviceMonitor.DeviceLister |
điểm dừng
public void stop ()
Một phương thức sẽ được gọi khi cần dừng Trình theo dõi.
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,["# DeviceMonitorMultiplexer\n========================\n\n\n`\npublic\n\n\nclass\nDeviceMonitorMultiplexer\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\nimplements\n\n`[IDeviceMonitor](../../../../../../reference/tradefed/com/android/tradefed/device/IDeviceMonitor.html)`\n\n\n`\n\n|---|------------------------------------------------------|\n| java.lang.Object ||\n| ↳ | com.android.tradefed.device.DeviceMonitorMultiplexer |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA proxy class to propagate requests to multiple [IDeviceMonitor](../../../../../../reference/tradefed/com/android/tradefed/device/IDeviceMonitor.html)s.\n\nSummary\n-------\n\n| ### Public constructors ||\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[DeviceMonitorMultiplexer](../../../../../../reference/tradefed/com/android/tradefed/device/DeviceMonitorMultiplexer.html#DeviceMonitorMultiplexer())`() ` |\n\n| ### Public methods ||\n|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` void` | ` `[addMonitor](../../../../../../reference/tradefed/com/android/tradefed/device/DeviceMonitorMultiplexer.html#addMonitor(com.android.tradefed.device.IDeviceMonitor))`(`[IDeviceMonitor](../../../../../../reference/tradefed/com/android/tradefed/device/IDeviceMonitor.html)` globalDeviceMonitor) ` |\n| ` void` | ` `[addMonitors](../../../../../../reference/tradefed/com/android/tradefed/device/DeviceMonitorMultiplexer.html#addMonitors(\u003cany\u003e))`(` globalDeviceMonitors) |\n| ` void` | ` `[notifyDeviceStateChange](../../../../../../reference/tradefed/com/android/tradefed/device/DeviceMonitorMultiplexer.html#notifyDeviceStateChange(java.lang.String,%20com.android.tradefed.device.DeviceAllocationState,%20com.android.tradefed.device.DeviceAllocationState))`(String serial, `[DeviceAllocationState](../../../../../../reference/tradefed/com/android/tradefed/device/DeviceAllocationState.html)` oldState, `[DeviceAllocationState](../../../../../../reference/tradefed/com/android/tradefed/device/DeviceAllocationState.html)` newState) ` Signals the [IDeviceMonitor](../../../../../../reference/tradefed/com/android/tradefed/device/IDeviceMonitor.html) that a device state has been changed. |\n| ` void` | ` `[removeMonitor](../../../../../../reference/tradefed/com/android/tradefed/device/DeviceMonitorMultiplexer.html#removeMonitor(com.android.tradefed.device.IDeviceMonitor))`(`[IDeviceMonitor](../../../../../../reference/tradefed/com/android/tradefed/device/IDeviceMonitor.html)` mon) ` |\n| ` void` | ` `[run](../../../../../../reference/tradefed/com/android/tradefed/device/DeviceMonitorMultiplexer.html#run())`() ` A method that will be called after all of the Monitor's @Option fields have been set. |\n| ` void` | ` `[setDeviceLister](../../../../../../reference/tradefed/com/android/tradefed/device/DeviceMonitorMultiplexer.html#setDeviceLister(com.android.tradefed.device.IDeviceMonitor.DeviceLister))`(`[IDeviceMonitor.DeviceLister](../../../../../../reference/tradefed/com/android/tradefed/device/IDeviceMonitor.DeviceLister.html)` lister) ` Allows the [DeviceLister](../../../../../../reference/tradefed/com/android/tradefed/device/IDeviceMonitor.DeviceLister.html) to be set. |\n| ` void` | ` `[stop](../../../../../../reference/tradefed/com/android/tradefed/device/DeviceMonitorMultiplexer.html#stop())`() ` A method that will be called when the Monitor need to be stopped. |\n\nPublic constructors\n-------------------\n\n### DeviceMonitorMultiplexer\n\n```\npublic DeviceMonitorMultiplexer ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### addMonitor\n\n```\npublic void addMonitor (IDeviceMonitor globalDeviceMonitor)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------------------|-------------------------|\n| `globalDeviceMonitor` | `IDeviceMonitor` \u003cbr /\u003e |\n\n### addMonitors\n\n```\npublic void addMonitors ( globalDeviceMonitors)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------------------|--------|\n| `globalDeviceMonitors` | \u003cbr /\u003e |\n\n### notifyDeviceStateChange\n\n```\npublic void notifyDeviceStateChange (String serial, \n DeviceAllocationState oldState, \n DeviceAllocationState newState)\n```\n\nSignals the [IDeviceMonitor](../../../../../../reference/tradefed/com/android/tradefed/device/IDeviceMonitor.html) that a device state has been changed.\nMonitor implementations should limit the amount of processing and\nIDeviceManager/DeviceLister interaction they do in this method.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|--------------------------------|\n| `serial` | `String` \u003cbr /\u003e |\n| `oldState` | `DeviceAllocationState` \u003cbr /\u003e |\n| `newState` | `DeviceAllocationState` \u003cbr /\u003e |\n\n### removeMonitor\n\n```\npublic void removeMonitor (IDeviceMonitor mon)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------|-------------------------|\n| `mon` | `IDeviceMonitor` \u003cbr /\u003e |\n\n### run\n\n```\npublic void run ()\n```\n\nA method that will be called after all of the Monitor's @Option fields have been set.\n\n\u003cbr /\u003e\n\n### setDeviceLister\n\n```\npublic void setDeviceLister (IDeviceMonitor.DeviceLister lister)\n```\n\nAllows the [DeviceLister](../../../../../../reference/tradefed/com/android/tradefed/device/IDeviceMonitor.DeviceLister.html) to be set. After a successful attempt to set the Lister,\nimplementations may discard all subsequent attempts.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------|--------------------------------------|\n| `lister` | `IDeviceMonitor.DeviceLister` \u003cbr /\u003e |\n\n### stop\n\n```\npublic void stop ()\n```\n\nA method that will be called when the Monitor need to be stopped.\n\n\u003cbr /\u003e"]]