android 菜单不显示auto time zone菜单
packages\apps\Settings\res\xml\date_time_prefs.xml
有对应的xml
packages\apps\Settings\src\com\android\settings\datetime\AutoTimeZonePreferenceController.java
@Override
public boolean isAvailable() {
if (mIsFromSUW) {
return false;
}
TimeZoneCapabilities timeZoneCapabilities =
getTimeZoneCapabilitiesAndConfig().getCapabilities();
int capability = timeZoneCapabilities.getConfigureAutoDetectionEnabledCapability();
// The preference only has two states: present and not present. The preference is never
// present but disabled.
if (capability == CAPABILITY_NOT_SUPPORTED
|| capability == CAPABILITY_NOT_ALLOWED
|| capability == CAPABILITY_NOT_APPLICABLE) {
return false;
} else if (capability == CAPABILITY_POSSESSED) {
return true;
} else {
throw new IllegalStateException("Unknown capability=" + capability);
}
}
打印 日志发现,capability == CAPABILITY_NOT_SUPPORTED
查看哪里设置了CAPABILITY_NOT_SUPPORTED
frameworks\base\services\core\java\com\android\server\timezonedetector\ConfigurationInternal.java
/** Returns true if the device supports any form of auto time zone detection. */
public boolean isAutoDetectionSupported() {
return mTelephonyDetectionSupported || mGeoDetectionSupported;
}
/** Returns true if the device supports telephony time zone detection. */
public boolean isTelephonyDetectionSupported() {
return mTelephonyDetectionSupported;
}
/** Returns true if the device supports geolocation time zone detection. */
public boolean isGeoDetectionSupported() {
return mGeoDetectionSupported;
}
原文地址:https://blog.csdn.net/xiaowang_lj/article/details/142761768
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!