Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2173e654 authored by Alix Espino's avatar Alix Espino Committed by Gerrit Code Review
Browse files

Merge "Simplify logic in Soong ApiLevelFromUserWithConfig"

parents 1c102d34 fb502512
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -344,14 +344,17 @@ func ApiLevelFromUserWithConfig(config Config, raw string) (ApiLevel, error) {
		}
	}

	canonical := ReplaceFinalizedCodenames(config, raw)
	asInt, err := strconv.Atoi(canonical)
	canonical, ok := getApiLevelsMapReleasedVersions()[raw]
	if !ok {
		asInt, err := strconv.Atoi(raw)
		if err != nil {
		return NoneApiLevel, fmt.Errorf("%q could not be parsed as an integer and is not a recognized codename", canonical)
			return NoneApiLevel, fmt.Errorf("%q could not be parsed as an integer and is not a recognized codename", raw)
		}
		return uncheckedFinalApiLevel(asInt), nil
	}

	apiLevel := uncheckedFinalApiLevel(asInt)
	return apiLevel, nil
	return uncheckedFinalApiLevel(canonical), nil

}

// ApiLevelForTest returns an ApiLevel constructed from the supplied raw string.