use alloc::{string::String, vec}; use core::convert::TryFrom;
fn get_property(name: &'static [u8]) -> Option<String> { letmut value = vec![0u8; libc::PROP_VALUE_MAX as usize]; // SAFETY: `name` is valid to read from and `value` is valid to write to. let len = unsafe { libc::__system_property_get(name.as_ptr().cast(), value.as_mut_ptr().cast()) };
// Android 4.0 and below iflet Some(mut language) = get_property(LANG_KEY) { // The details of this functionality are not publically available, so this is just // adapted "best effort" from the original code. match get_property(COUNTRY_KEY) {
Some(country) => {
language.push('-');
language.push_str(&country);
}
None => { iflet Some(variant) = get_property(LOCALEVAR_KEY) {
language.push('-');
language.push_str(&variant);
}
}
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.