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

Commit c2263ae9 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

Merge branch '3969-main-unified' into 'main'

Fix android version checks

See merge request !207
parents 245ec849 076eeb6e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -247,7 +247,7 @@ public class UpdateImporter {
            case Build.VERSION_CODES.TIRAMISU -> "13";
            case Build.VERSION_CODES.UPSIDE_DOWN_CAKE -> "14";
            case Build.VERSION_CODES.VANILLA_ICE_CREAM -> "15";
            case Build.VERSION_CODES.BAKLAVA -> "16";
            case 36 -> "16"; // Build.VERSION_CODES.BAKLAVA
            default -> Build.VERSION.RELEASE;
        };
    }
+4 −0
Original line number Diff line number Diff line
@@ -26,6 +26,10 @@ public final class BuildInfoUtils {
        return SystemProperties.getLong(Constants.PROP_BUILD_DATE, 0);
    }

    public static String getBuildId() {
        return SystemProperties.get(Constants.PROP_BUILD_ID);
    }

    public static String getBuildVersion() {
        return SystemProperties.get(Constants.PROP_BUILD_VERSION);
    }
+1 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ public final class Constants {
    public static final String PROP_AB_DEVICE = "ro.build.ab_update";
    public static final String PROP_ALLOW_MAJOR_UPGRADES = "lineage.updater.allow_major_upgrades";
    public static final String PROP_BUILD_DATE = "ro.build.date.utc";
    public static final String PROP_BUILD_ID = "ro.build.id";
    public static final String PROP_BUILD_VERSION = "ro.lineage.build.version";
    public static final String PROP_BUILD_DISPLAY_VERSION = "ro.lineage.display.version";
    public static final String PROP_BUILD_VERSION_INCREMENTAL = "ro.build.version.incremental";
+16 −1
Original line number Diff line number Diff line
@@ -307,7 +307,22 @@ public class Utils {

    public static String getChangelogURL(Context context) {
        String buildVersion = SystemProperties.get(Constants.PROP_BUILD_VERSION);
        return context.getString(R.string.e_menu_changelog_url, buildVersion, Build.VERSION.RELEASE);
        return context.getString(R.string.e_menu_changelog_url, buildVersion, getChangeLogVersion());
    }

    private static String getChangeLogVersion() {
        if (Build.VERSION.SDK_INT == 36) { // Build.VERSION_CODES.BAKLAVA
            String buildId = BuildInfoUtils.getBuildId().toLowerCase();
            if (buildId.startsWith("bp4a")) {
                return "a16.2";
            } else if (buildId.startsWith("bp3a")) {
                return "a16.1";
            } else {
                return "a16"; // first release
            }
        }

        return "a" + Build.VERSION.RELEASE;
    }

    public static void triggerUpdate(Context context, String downloadId) {
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
    <!-- URLs -->
    <string name="e_updater_server_url" translatable="false">https://ota.ecloud.global/api/v1/{device}/{type}/{incr}</string>
    <string name="e_ota_staging_server_url" translatable="false">https://test.ota.ecloud.global/api/v1/{device}/{type}/{incr}</string>
    <string name="e_menu_changelog_url" translatable="false">https://gitlab.e.foundation/e/os/releases/-/releases/v<xliff:g id="build_version">%1$s</xliff:g>-a<xliff:g id="android_version">%2$s</xliff:g></string>
    <string name="e_menu_changelog_url" translatable="false">https://gitlab.e.foundation/e/os/releases/-/releases/v<xliff:g id="build_version">%1$s</xliff:g>-<xliff:g id="android_version">%2$s</xliff:g></string>

    <!-- Notifications -->
    <string name="e_download_completed_notification">Update is ready to be installed</string>