예제 #1
0
        /// <summary>
        /// 初始化 ROM 信息
        /// </summary>
        public static void Initialize()
        {
            if (isInit)
            {
                return;
            }
            string?version        = null;
            var    firstOrDefault = identify_keywords_rule_a
                                    .FirstOrDefault(x => SystemProperties.TryGet(x.Key, out version));

            if (firstOrDefault.Key != null)
            {
                mCurrent = new Info(firstOrDefault.Value, version);
            }
            else
            {
                if (SystemProperties.TryGet(RO_BUILD_DISPLAY_ID, out var value))
                {
                    foreach (var item in identify_keywords_rule_b)
                    {
                        if (value.Contains(item.Key, StringComparison.OrdinalIgnoreCase))
                        {
                            mCurrent = new Info(item.Value, value);
                            break;
                        }
                    }
                }
            }
            if (mCurrent == null)
            {
                mCurrent = Info.Unknown;
            }
            isInit = true;
        }
예제 #2
0
        static int GetroSecureProp()
        {
            string?roSecureObj = null;

            try
            {
                if (SystemProperties.TryGet("ro.secure", out var value))
                {
                    roSecureObj = value;
                }
            }
            catch
            {
            }
            return(string.IsNullOrWhiteSpace(roSecureObj) ? 1 : (roSecureObj == "0" ? 0 : 1));
        }
예제 #3
0
 /// <summary>
 /// (仅适用于<see cref="BuildVersionCodes.O"/>)判断设备为 Notch 机型
 /// <para><see langword="true"/>:是刘海屏;<see langword="false"/>:非刘海屏。</para>
 /// </summary>
 /// <returns></returns>
 public static bool IsNotch()
 {
     SystemProperties.TryGet("ro.miui.notch", out var value);
     return(value == "1");
 }