首页 > 编程知识 正文

airpods飞行模式可以用吗,飞行模式能连airpods吗

时间:2023-05-04 17:23:26 阅读:257146 作者:939

AIRPLANE_MODE_RADIOS如下面的描述,该值表示在飞行模式打开时,需要关闭的Radios列表,

列表内的Items以逗号区分;例如:"bluetooth,wifi"

6014 /**6015 * A comma separated list of radios that need to be disabled when airplane mode6016 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are6017 * included in the comma separated list.6018 */6019 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";


AIRPLANE_MODE_TOGGLEABLE_RADIOS如下面的描述,该值表示在飞行模式打开时,列表中的Radios需要被关闭,但用户可以重新打开,例如,从Settings APP重新打开。列表内的Items以逗号区分;例如:"bluetooth,wifi"

6021 /**6022 * A comma separated list of radios that should to be disabled when airplane mode6023 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is6024 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi6025 * will be turned off when entering airplane mode, but the user will be able to reenable6026 * Wifi in the Settings app.6027 *6028 * {@hide}6029 */6030 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";

 

Radios列表项包括如下:

5990 /**5991 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.5992 */5993 public static final String RADIO_BLUETOOTH = "bluetooth";59945995 /**5996 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.5997 */5998 public static final String RADIO_WIFI = "wifi";59996000 /**6001 * {@hide}6002 */6003 public static final String RADIO_WIMAX = "wimax";6004 /**6005 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.6006 */6007 public static final String RADIO_CELL = "cell";60086009 /**6010 * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio.6011 */6012 public static final String RADIO_NFC = "nfc";


【默认值】

默认值配置的位置如下:如下图所示,进入飞行模式时,cell/Bluetooth/wifi/nfc/wimax都会关闭,但bluetooth/wifi/nfc可以通过APP再次打开,而cell/wimax则无法在飞行模式下打开。

xref: /frameworks/base/packages/SettingsProvider/res/values/defaults.xml

23 <bool name="def_airplane_mode_on">false</bool>24 <bool name="def_theater_mode_on">false</bool>25 <!-- Comma-separated list of bluetooth, wifi, and cell. -->26 <string name="def_airplane_mode_radios" translatable="false">cell,bluetooth,wifi,nfc,wimax</string>27 <string name="airplane_mode_toggleable_radios" translatable="false">bluetooth,wifi,nfc</string>

 

【加载】

通过loadGlobalSettings将默认值最终加载到/data/system/users/0下的settings_global.xml文件。

2552 private void loadGlobalSettings(SQLiteDatabase db) {2553 SQLiteStatement stmt = null;2554 try {2555 stmt = db.compileStatement("INSERT OR IGNORE INTO global(name,value)"2556 + " VALUES(?,?);");25572558 // --- Previously in 'system'2559 loadBooleanSetting(stmt, Settings.Global.AIRPLANE_MODE_ON,2560 R.bool.def_airplane_mode_on);25612562 loadBooleanSetting(stmt, Settings.Global.THEATER_MODE_ON,2563 R.bool.def_theater_mode_on);25642565 loadStringSetting(stmt, Settings.Global.AIRPLANE_MODE_RADIOS,2566 R.string.def_airplane_mode_radios);25672568 loadStringSetting(stmt, Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS,2569 R.string.airplane_mode_toggleable_radios);


【访问】

APP或framework便可通过访问Settings数据库的Global表进行读取,例如Bluetooth的应用如下:

160 private void registerForAirplaneMode(IntentFilter filter) {161 final ContentResolver resolver = mContext.getContentResolver();162 final String airplaneModeRadios = Settings.Global.getString(resolver,163 Settings.Global.AIRPLANE_MODE_RADIOS);164 final String toggleableRadios = Settings.Global.getString(resolver,165 Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);166 boolean mIsAirplaneSensitive = airplaneModeRadios == null ? true :167 airplaneModeRadios.contains(Settings.Global.RADIO_BLUETOOTH);168 if (mIsAirplaneSensitive) {169 filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);170 }171 }

 


版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。