analyze method

Map<String, dynamic> analyze()

Implementation

Map<String, dynamic> analyze() {
  int score = 0;
  final resultMap = <String, dynamic>{};

  final checks = <String, CheckResult>{
    "Hardware": checkFeaturesByHardware(),
    "Host": checkFeaturesByHost(),
    "Flavor": checkFeaturesByFlavor(),
    "Model": checkFeaturesByModel(),
    "Manufacturer": checkFeaturesByManufacturer(),
    "Board": checkFeaturesByBoard(),
    "Platform": checkFeaturesByPlatform(),
    "BaseBand": checkFeaturesByBaseBand(),
    "Cgroup": checkFeaturesByCgroup(),
  };

  for (var entry in checks.entries) {
    resultMap[entry.key] = entry.value.value;
    int valueScore = evaluateCheckResult(entry.value);
    if (entry.key == "BaseBand") {
      final manufacturer = properties['Manufacturer']?.toString().toLowerCase();
      if(manufacturer == "Xiaomi".toLowerCase()){

      }else{
        score += valueScore * 4; // weighted
      }
    } else {
      score += valueScore;
    }
  }


  // Camera support
  final hasCamera = properties['CameraSupport']?.toString() == 'true';
  resultMap['CameraSupport'] = hasCamera;
  if (!hasCamera) score += 2;

  // Bluetooth support
  final hasBluetooth = properties['BluetoothSupport']?.toString() == 'true';
  resultMap['BluetoothSupport'] = hasBluetooth;
  if (!hasBluetooth) score += 2;

  resultMap['EmulatorScore'] = score;
  resultMap['IsEmulator'] = score >= THRESHOLD_SCORE;

  return resultMap;
}