android 菜单不显示auto time zone菜单

发布于:2024-10-15 ⋅ 阅读:(71) ⋅ 点赞:(0)

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;
    }


网站公告

今日签到

点亮在社区的每一天
去签到