自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
5G 非獨立式 (NSA)
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
搭載 Android 10 以上版本的裝置可支援 5G 非獨立 (NSA) 模式。5G NSA 是 5G 網路的解決方案,這類網路由現有的 4G 基礎架構提供支援。在 Android 10 中,裝置連上 5G 網路時,可在狀態列上顯示 5G 圖示。
實作
系統業者設定
如要設定狀態列顯示 5G 圖示的方式,電信業者可以使用 CarrierConfig
中的 KEY_5G_ICON_CONFIGURATION_STRING
鍵。
5G NSA 支援以下情境:
- 裝置以次要小區的形式連線至 5G 小區,並使用毫米波。
- 裝置以次要小區的形式連線至 5G 小區,但未使用毫米波。
- 裝置連線至具備 5G 功能的網路 (裝置不必以次要小格連線至 5G 小格),且 5G 使用未受限,無線電資源控制 (RRC) 處於
IDLE
狀態 (未連線)。
- 裝置連線至具備 5G 功能的網路 (裝置不必以次要小格連線至 5G 小格),且 5G 使用未受限,無線電資源控制 (RRC) 處於
CONNECTED
狀態。
- 裝置連線至支援 5G 的網路 (裝置不必連線至 5G 小區作為次要小區),但 5G 使用受到限制。
設定字串包含多個以半形逗號分隔的鍵/值組合。每個組合中的鍵和值會以半形冒號分隔。設定字串中的鍵對應至上述 5G 情境,且必須為下列任一值:
connected_mmwave
connected
not_restricted_rrc_idle
not_restricted_rrc_con
restricted
設定字串中的值必須是有效的圖示名稱,且必須與 /packages/SettingsLib/res/
目錄中的圖示名稱相符。5G NSA 有兩個預設圖示:5G
和 5G_PLUS
。
圖 1. 預設 5G 和 5G_PLUS 5G 圖示
只有在裝置有真實的 5G 連線時,才顯示 5G 圖示 (情境 1:connected_mmwave
和情境 2:connected
)。在情境 1 中使用 5G_PLUS
圖示,在情境 2 中使用 5G
圖示。以下是 CarrierConfig
中的設定字串範例。
connected_mmwave:5G_PLUS,connected:5G
系統 UI
如要自訂電信業者可用於特定狀態的圖示,請在 TelephonyIcons.java
中新增 MobileIconGroup
物件。MobileIconGroup
中的圖示名稱必須與 CarrierConfig
中使用的圖示名稱相符。以下範例說明如何將名為「5G_PLUS」的自訂圖示新增至 MobileIconGroup
。
static final MobileIconGroup NR_5G_PLUS = new MobileIconGroup(
"5G_PLUS",
null,
null,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
0,
0,
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.data_connection_5g_plus,
TelephonyIcons.ICON_5G_PLUS,
true);
驗證
如要驗證實作方式,請確認裝置連上 5G 小區時,狀態列會顯示 5G 圖示。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[[["容易理解","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-26 (世界標準時間)。"],[],[],null,["# 5G non-standalone (NSA)\n\nDevices running Android 10 or higher can support 5G\nnon-standalone (NSA). 5G NSA\nis a solution for 5G networks where the network is supported by the existing 4G\ninfrastructure. On Android 10, devices can display a\n5G icon on the status bar\nwhen a device connects to a 5G network.\n\nImplementation\n--------------\n\n### Carrier configuration\n\nTo configure how 5G icons are displayed on the status bar, carriers can use the\n[`KEY_5G_ICON_CONFIGURATION_STRING`](https://android.googlesource.com/platform/frameworks/base/+/refs/heads/android16-release/telephony/java/android/telephony/CarrierConfigManager.java#2459)\nkey in `CarrierConfig`.\n\nThese scenarios are available in 5G NSA:\n\n1. Device connected to 5G cell as the secondary cell and using millimeter wave.\n2. Device connected to 5G cell as the secondary cell but not using millimeter wave.\n3. Device camped on a network that has 5G capability (device doesn't have to be connected to a 5G cell as a secondary cell) and the use of 5G isn't restricted and radio resource control (RRC) is in the `IDLE` state (no connection).\n4. Device camped on a network that has 5G capability (device doesn't have to be connected to a 5G cell as a secondary cell) and the use of 5G isn't restricted and radio resource control (RRC) is in the `CONNECTED` state.\n5. Device camped on a network that has 5G capability (device doesn't have to be connected to a 5G cell as a secondary cell) but the use of 5G is restricted.\n\nThe configuration string contains multiple key-value pairs separated by commas.\nFor each pair, the key and value are separated by a colon. The keys in the\nconfiguration string correspond to the 5G scenarios described above\nand must be one of the following:\n\n1. `connected_mmwave`\n2. `connected`\n3. `not_restricted_rrc_idle`\n4. `not_restricted_rrc_con`\n5. `restricted`\n\nThe values in the configuration string must be valid icon names that match the\nnames of icons in the `/packages/SettingsLib/res/` directory. Two default icons\nfor 5G NSA are available: `5G` and `5G_PLUS`.\n\n**Figure 1.** Default 5G and 5G_PLUS 5G icons\n\nDisplay the 5G icons only for scenario 1 (`connected_mmwave`) and\nscenario 2 (`connected`), where the device has a true 5G connection. Use the\n`5G_PLUS` icon for scenario 1 and the `5G` icon for scenario 2. The\nfollowing is an example of a configuration string in `CarrierConfig`. \n\n connected_mmwave:5G_PLUS,connected:5G\n\n### System UI\n\nTo customize the icons that carriers can use for a specific status, add a\n`MobileIconGroup` object in\n[`TelephonyIcons.java`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/packages/SettingsLib/src/com/android/settingslib/mobile/TelephonyIcons.java).\nThe icon name in `MobileIconGroup` must match the icon name used in\n`CarrierConfig`. The following shows an example of how to add a customized icon\nwith the name \"5G_PLUS\" to `MobileIconGroup`. \n\n static final MobileIconGroup NR_5G_PLUS = new MobileIconGroup(\n \"5G_PLUS\",\n null,\n null,\n AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,\n 0,\n 0,\n 0,\n 0,\n\n AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],\n R.string.data_connection_5g_plus,\n TelephonyIcons.ICON_5G_PLUS,\n true);\n\nValidation\n----------\n\nTo validate your implementation, make sure a 5G icon is displayed on the status\nbar when the device is connected to a 5G cell."]]