gpt4 book ai didi

com.facebook.device.yearclass.YearClass.categorizeByYear2014Method()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 17:23:31 25 4
gpt4 key购买 nike

本文整理了Java中com.facebook.device.yearclass.YearClass.categorizeByYear2014Method()方法的一些代码示例,展示了YearClass.categorizeByYear2014Method()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearClass.categorizeByYear2014Method()方法的具体详情如下:
包路径:com.facebook.device.yearclass.YearClass
类名称:YearClass
方法名:categorizeByYear2014Method

YearClass.categorizeByYear2014Method介绍

[英]Calculates the "best-in-class year" of the device. This represents the top-end or flagship devices of that year, not the actual release year of the phone. For example, the Galaxy Duos S was released in 2012, but its specs are very similar to the Galaxy S that was released in 2010 as a then top-of-the-line phone, so it is a 2010 device.
[中]计算设备的“最佳年度”。这代表了当年的高端或旗舰设备,而不是手机的实际发布年份。例如,Galaxy Duos S于2012年发布,但其规格与Galaxy S非常相似,Galaxy S在2010年作为当时的顶级手机发布,因此它是2010年的一款设备。

代码示例

代码示例来源:origin: facebook/device-year-class

/**
 * This formulation of year class smooths out the distribution of devices in the field
 * in early 2016 so that the buckets are a bit more even in size and performance metrics
 * (specifically app startup time, scrolling perf, animations) are more uniform within
 * the buckets than with the 2014 calculations.
 */
private static int categorizeByYear2016Method(Context c) {
 long totalRam = DeviceInfo.getTotalMemory(c);
 if (totalRam == DeviceInfo.DEVICEINFO_UNKNOWN) {
  return categorizeByYear2014Method(c);
 }
 if (totalRam <= 768 * MB) {
  return DeviceInfo.getNumberOfCPUCores() <= 1 ? CLASS_2009 : CLASS_2010;
 }
 if (totalRam <= 1024 * MB) {
  return DeviceInfo.getCPUMaxFreqKHz() < 1300 * MHZ_IN_KHZ ? CLASS_2011 : CLASS_2012;
 }
 if (totalRam <= 1536 * MB) {
  return DeviceInfo.getCPUMaxFreqKHz() < 1800 * MHZ_IN_KHZ ? CLASS_2012 : CLASS_2013;
 }
 if (totalRam <= 2048 * MB) {
  return CLASS_2013;
 }
 if (totalRam <= 3 * 1024 * MB) {
  return CLASS_2014;
 }
 return totalRam <= 5 * 1024 * MB ? CLASS_2015 : CLASS_2016;
}

代码示例来源:origin: com.facebook.device.yearclass/yearclass

/**
 * This formulation of year class smooths out the distribution of devices in the field
 * in early 2016 so that the buckets are a bit more even in size and performance metrics
 * (specifically app startup time, scrolling perf, animations) are more uniform within
 * the buckets than with the 2014 calculations.
 */
private static int categorizeByYear2016Method(Context c) {
 long totalRam = DeviceInfo.getTotalMemory(c);
 if (totalRam == DeviceInfo.DEVICEINFO_UNKNOWN) {
  return categorizeByYear2014Method(c);
 }
 if (totalRam <= 768 * MB) {
  return DeviceInfo.getNumberOfCPUCores() <= 1 ? CLASS_2009 : CLASS_2010;
 }
 if (totalRam <= 1024 * MB) {
  return DeviceInfo.getCPUMaxFreqKHz() < 1300 * MHZ_IN_KHZ ? CLASS_2011 : CLASS_2012;
 }
 if (totalRam <= 1536 * MB) {
  return DeviceInfo.getCPUMaxFreqKHz() < 1800 * MHZ_IN_KHZ ? CLASS_2012 : CLASS_2013;
 }
 if (totalRam <= 2048 * MB) {
  return CLASS_2013;
 }
 if (totalRam <= 3 * 1024 * MB) {
  return CLASS_2014;
 }
 return totalRam <= 5 * 1024 * MB ? CLASS_2015 : CLASS_2016;
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com