اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release بدلاً من aosp-main لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يضيف نظام التشغيل Android 10 واجهة برمجة التطبيقات Wi-Fi lock API للسماح
للتطبيقات الحساسة للوقت الاستجابة بضبط Wi-Fi على
وضع وقت استجابة منخفض.
يبدأ وضع وقت الاستجابة المنخفض عند استيفاء جميع الشروط التالية:
شبكة Wi-Fi مفعَّلة والجهاز متصل بالإنترنت.
أنشأ التطبيق قفل Wi-Fi وحصل عليه، وهو يعمل في
المقدمة.
تكون الشاشة قيد التفعيل.
لتفعيل وضع الاستجابة المنخفضة على الأجهزة، على الشركات المصنّعة للأجهزة تحديث
برنامج تشغيل WLAN وواجهة HAL الخاصة بالمورّد. في وضع الاستجابة المنخفضة، يتم إيقاف ميزة "توفير الطاقة" (المعروفة أيضًا باسم
حالة السكون في معيار IEEE 802.11) صراحةً من خلال الإطار.
يمكن تحسين مَعلمات البحث والتجوال في طبقتَي برنامج التشغيل والبرامج الثابتة
لخفض وقت استجابة Wi-Fi بشكل أكبر. ترتبط التحسينات الدقيقة
بطريقة التنفيذ.
يتضمّن Android
وضع قفل Wi-Fi عالي الأداء
(تم طرحه في المستوى 12 لواجهة برمجة التطبيقات) وهو منفصل عن وضع وقت الاستجابة المنخفض.
التنفيذ
لتفعيل ميزة "وضع Wi-Fi بوقت استجابة منخفض"، يجب توفير عمليات تنفيذ لوظائف IWifiChip التالية.
في وضع الاستجابة المنخفضة، يتم إيقاف ميزة "توفير الطاقة" صراحةً من خلال
WifiLockManager
في إطار عمل Android.
ولتفعيل هذه الميزة، يجب أن يتيح برنامج تشغيل WLAN الأمر NL80211،
NL80211_CMD_SET_POWER_SAVE، لتفعيل ميزة "توفير الطاقة" وإيقافها. عند إيقاف ميزة "توفير طاقة Wi-Fi"، يجب أن يظل نظام Wi-Fi في حالة "التشغيل" وأن يكون جاهزًا لتلقّي الحِزم أو إرسالها بأقل قدر من التأخير.
إيقاف الميزة
لإيقاف ميزة وضع وقت الاستجابة المنخفض، عدِّل الرمز الأساسي لملف getFeatureSet() لواجهة HAL لبروتوكول AIDL أو ملف getCapabilities_1_3() لواجهة HAL لبروتوكول HIDL،
بحيث يكون capabilities & SET_LATENCY_MODE = 0، حيث يتم تعريف SET_LATENCY_MODE في تعريف IWifiChip AIDL أو HIDL.
عند إيقاف هذه الميزة،
لا يوقف إطار العمل ميزة "توفير الطاقة" إلا عندما يكون وضع "وقت الاستجابة المنخفض" مفعّلاً.
التحقُّق
لاختبار عمل وضع وقت الاستجابة المنخفض عند تفعيله، يمكنك إجراء الاختبارَين المبرمَجَين التاليَين واختبارَي وقت استجابة طلب فحص الاتصال يدويًا.
تأكَّد من اتصال الكمبيوتر بالهاتف من خلال ADB. من ملف ADB shell، يمكنك إرسال طلبات فحص الاتصال بالبوابة باستمرار لمدة 3 ساعات بفواصل زمنية تبلغ ثانية واحدة.
احفظ نتيجة الاختبار في ملف نصي واستخدِم جدول بيانات أو ملف نصي بتنسيق Python لإنشاء رسم بياني هرمي لنتائج اختبار وقت استجابة طلب الاتصال.
كرِّر الخطوات من 1 إلى 3 مع إيقاف وضع "وقت الاستجابة".
قارِن نتائج الاختبار للتأكّد من انخفاض متوسط قيمة وقت استجابة طلب البيانات عند تفعيل وضع وقت الاستجابة المنخفض.
الاختبارات الأخرى
كرِّر الاختبارات أعلاه في بيئات مختلفة. على سبيل المثال،
في المنزل أو المكتب
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Wi-Fi low-latency mode\n\nAndroid 10 extends the Wi-Fi lock API to allow\nlatency-sensitive apps to configure Wi-Fi to a\n[low-latency\nmode](https://developer.android.com/reference/android/net/wifi/WifiManager#WIFI_MODE_FULL_LOW_LATENCY).\nThe low-latency mode starts when all of the following conditions are met:\n\n- Wi-Fi is enabled and the device has internet access.\n- The app has created and acquired a Wi-Fi lock, and is running in the foreground.\n- The screen is on.\n\nTo support low-latency mode on devices, device manufacturers must update the\nWLAN driver and vendor HAL. In low-latency mode, power save (also known as\ndoze state in the IEEE 802.11 standard) is explicitly disabled by the framework.\nThe scanning and roaming parameters in the driver and firmware layers can be\noptimized to further reduce Wi-Fi latency. The exact optimizations are\nimplementation specific.\n\nAndroid has a\n[high-performance Wi-Fi lock mode](https://developer.android.com/reference/android/net/wifi/WifiManager#WIFI_MODE_FULL_HIGH_PERF)\n(introduced in API level 12) that is separate from the low-latency mode.\n\nImplementation\n--------------\n\nTo support the Wi-Fi low-latency mode feature, provide implementations for\nthe following `IWifiChip` functions.\n\nIn the AIDL HAL:\n\n- `int getFeatureSet()`\n- `void setLatencyMode(in LatencyMode mode)`\n\nIn the HIDL HAL (1.3 or newer):\n\n- `getCapabilities_1_3() generates (WifiStatus status,\n bitfield\u003cChipCapabilityMask\u003e capabilities)`\n- `setLatencyMode(LatencyMode mode) generates (WifiStatus status)`\n\nA reference implementation can be found in\n[`wifi_legacy_hal.cpp`](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/wifi/aidl/default/wifi_legacy_hal.cpp)\nwith the following functions:\n\n- `wifi_error wifi_get_supported_feature_set(wifi_interface_handle\n iface, feature_set *set)`\n- `wifi_error wifi_set_latency_mode(wifi_interface_handle handle,\n wifi_latency_mode mode)`\n\nIn low-latency mode, power save is explicitly disabled by\n[`WifiLockManager`](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/modules/Wifi/service/java/com/android/server/wifi/WifiLockManager.java)\nin the Android framework.\nTo support this, the WLAN driver must support the NL80211 command,\n`NL80211_CMD_SET_POWER_SAVE`, to enable and disable power save. When Wi-Fi power\nsave is disabled, the Wi-Fi system must stay in the awake state and be ready to\nsend or receive packets with minimum delay.\n| **Note:** Low-latency mode is fully supported on devices that support the AIDL HAL, or the HIDL HAL (1.3 or newer). For devices running Android 10 that don't support `android.hardware.wifi@1.3`, `WifiLockManager` only disables power save when the low-latency mode Wi-Fi lock is acquired by the app and is active.\n\nDisable the feature\n-------------------\n\nTo turn off the low-latency mode feature, update the underlying code of\n`getFeatureSet()` for the AIDL HAL or\n`getCapabilities_1_3()` for the HIDL HAL,\nsuch that `capabilities & SET_LATENCY_MODE = 0`, where\n`SET_LATENCY_MODE` is defined in the `IWifiChip` AIDL or HIDL definition.\nWhen this feature is disabled,\nthe framework disables power save only when the low-latency mode is active.\n\nValidation\n----------\n\nTo test that low-latency mode works when enabled, run the following automated\ntests and manual ping latency tests.\n\n### Automated testing\n\nRun the following VTS and CTS tests:\n\n- VTS (AIDL): [`hardware/interfaces/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp`](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp)\n- VTS (HIDL): [`hardware/interfaces/wifi/1.3/vts/functional/wifi_chip_hidl_test.cpp`](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/wifi/1.3/vts/functional/wifi_chip_hidl_test.cpp)\n- CTS: [`cts/tests/tests/net/src/android/net/wifi/cts/WifiLockTest.java`](https://cs.android.com/android/platform/superproject/+/android-latest-release:cts/tests/tests/wifi/src/android/net/wifi/cts/WifiLockTest.java)\n\n### Manual testing\n\n#### Required test equipment and environment\n\nFor manual testing, the following setup is required:\n\n- Wi-Fi access point (AP)\n- Device-under-test (DUT) phone and test computer\n\n - The DUT must be connected to the access point over Wi-Fi.\n - The test computer must be connected to the access point over Wi-Fi or Ethernet.\n - The test computer must be connected to the DUT over USB.\n\n#### Uplink ping test\n\n1. Enable low latency mode.\n\n adb root\n adb shell cmd wifi force-low-latency-mode enabled\n\n2. Make sure your computer is connected with the phone through ADB. From\n the ADB shell, ping the gateway continuously for 3 hours at 1 second\n intervals.\n\n3. Save the test output in a text file and use a spreadsheet or a Python\n script to generate a histogram of the ping latency test results.\n\n4. Repeat steps 1 through 3 with latency mode disabled.\n\n adb root\n adb shell cmd wifi force-low-latency-mode disabled\n\n5. Compare the test results to ensure that the average ping latency value is\n reduced when the low-latency mode is enabled.\n\n| **Note:** Optionally, to determine whether end-to-end latency has improved overall, repeat the test using a well-known host address such as google.com.\n\n#### Downlink ping test\n\n1. Enable low-latency mode.\n\n adb root\n adb shell cmd wifi force-low-latency-mode enabled\n\n2. From the command line of the test computer, ping the phone's IP\n address continuously for 3 hours at 1 second intervals.\n\n3. Save the test output in a text file and use a spreadsheet or a Python\n script to generate a histogram of the ping latency test results.\n\n4. Repeat steps 1 through 3 with latency mode disabled.\n\n adb root\n adb shell cmd wifi force-low-latency-mode disabled\n\n5. Compare the test results to ensure that the average ping latency value is\n reduced when the low-latency mode is enabled.\n\n| **Note:** Optionally, to determine whether end-to-end latency is improved, repeat the ping test with a well-known host address such as google.com.\n\n#### Other tests\n\nRepeat the above tests in different environments. For example, at\nhome or in the office."]]