• 這個頁面中的內容
  • 權限

保持行車工作階段之間的熱點

  • 這個頁面中的內容
  • 權限

本頁說明如何設定使用者以保持裝置間有熱點 與 AAOS 的 Wi-Fi 行車體驗類似。

public class CarSettings {
 
...

 
@SystemApi
 
public static final class Global {
   
...

   
/**
     * Enables persistent tethering when set to {@code "true"}.
     *
     * <p>When enabled, tethering is started when the car is started given
     * that the hotspot was enabled at shutdown and all tethering sessions
     * will remain on even if no devices are connected to it.
     *
     * <p>When disabled, hotspot will turn off automatically if no devices
     * are connected and will no longer persist through drives.
     *
     * @hide
     */

   
@SystemApi
   
public static final String ENABLE_PERSISTENT_TETHERING =
           
"android.car.ENABLE_PERSISTENT_TETHERING";
 
}
}

如要繼續使用網路共用功能,請透過以下方式使用 ENABLE_PERSISTENT_TETHERINGSettings API、 這也可用來查詢

權限

CarWifiManager API 的使用限制。這個新權限是建立於 並守護存取權

public boolean canControlPersistApSettings() { ... }

這項權限的防護等級如下:

新權限 權限 防護等級
READ_PERSIST_TETHERING_SETTINGS 簽名 |專屬權限

持續行為預設為「不支援」。資源重疊 (config_enablePersistTetheringCapabilities) 已設為封鎖 保持網路共用的穩定性如要刻意保留網路共用功能,請設定 將值設為 true,即可在使用者偏好設定上方啟用這項功能 因為其他具有 WRITE_SECURE_SETTINGS 權限的系統應用程式皆可選擇加入 也可以控管這項設定

下列 API 會決定是否啟用該行為。在此之前呼叫這個 API: 你變更 ENABLE_PERSISTENT_TETHERING

/**
 * CarWifiManager provides API to allow for applications to perform Wi-Fi specific
 * operations.
 *
 * @hide
 */

@SystemApi
public final class CarWifiManager extends CarManagerBase {
 
/**
  * Returns {@code true} if the persist tethering settings are able to be
  * changed.
  *
  * @hide
  */

 
@SystemApi
 
@RequiresPermission(Car.PERMISSION_READ_PERSIST_TETHERING_SETTINGS)
 
public boolean canControlPersistApSettings() { ... }
}