الحفاظ على نقاط الاتصال بين جلسات القيادة

توضّح هذه الصفحة كيفية إعداد المستخدمين للحفاظ على نقاط الاتصال بين الخاصة بجلسات القيادة، على غرار تجربة القيادة عبر Wi-Fi في نظام التشغيل Android Automotive.

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_TETHERING من خلال واجهة برمجة التطبيقات للإعدادات، والتي يمكن استخدامها أيضًا للاستعلام.

الأذونات

يتم فرض قيود على استخدام واجهة برمجة تطبيقات CarWifiManager. تم إنشاء هذا الإذن الجديد لـ الوصول عن طريق الحراسة.

public boolean canControlPersistApSettings() { ... }

مستويات الحماية لهذا الإذن هي:

إذن جديد الإذن مستوى الحماية
نعم READ_PERSIST_TETHERING_SETTINGS التوقيع | خاص

وتكون القيمة التلقائية لسلوك السمة مستمرة هي غير متاح. تراكب الموارد (config_enablePersistTetheringCapabilities) تم إعداده لحظر القدرة على الاستمرار في التوصيل. للحفاظ على التوصيل عمدًا، يمكنك تعيين في true لتفعيل الميزة أعلى إعدادات المستخدم المفضّلة أوافق على ذلك لأنّ تطبيقات النظام الأخرى التي لديها إذن WRITE_SECURE_SETTINGS يمكنها ذلك أيضًا التحكم في هذا الإعداد.

تحدِّد واجهة برمجة التطبيقات التالية ما إذا كان سيتم تفعيل السلوك أم لا. طلب واجهة برمجة التطبيقات هذه قبل تغيير 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() { ... }
}