Updater: Add property that allows us to downgrade
Change-Id: I6916639f05c52ae198f0d1656deb23ee5186907f
This commit is contained in:
@@ -39,6 +39,7 @@ public final class Constants {
|
||||
public static final String PROP_DEVICE = "ro.lineage.device";
|
||||
public static final String PROP_NEXT_DEVICE = "ro.updater.next_device";
|
||||
public static final String PROP_RELEASE_TYPE = "ro.lineage.releasetype";
|
||||
public static final String PROP_UPDATER_ALLOW_DOWNGRADING = "lineage.updater.allow_downgrading";
|
||||
public static final String PROP_UPDATER_URI = "lineage.updater.uri";
|
||||
|
||||
public static final String PREF_INSTALL_OLD_TIMESTAMP = "install_old_timestamp";
|
||||
|
||||
@@ -94,7 +94,8 @@ public class Utils {
|
||||
}
|
||||
|
||||
public static boolean isCompatible(UpdateBaseInfo update) {
|
||||
if (update.getTimestamp() < SystemProperties.getLong(Constants.PROP_BUILD_DATE, 0)) {
|
||||
if (!SystemProperties.getBoolean(Constants.PROP_UPDATER_ALLOW_DOWNGRADING, false) &&
|
||||
update.getTimestamp() < SystemProperties.getLong(Constants.PROP_BUILD_DATE, 0)) {
|
||||
Log.d(TAG, update.getName() + " is older than current build");
|
||||
return false;
|
||||
}
|
||||
@@ -106,7 +107,8 @@ public class Utils {
|
||||
}
|
||||
|
||||
public static boolean canInstall(UpdateBaseInfo update) {
|
||||
return update.getTimestamp() >= SystemProperties.getLong(Constants.PROP_BUILD_DATE, 0) &&
|
||||
return (SystemProperties.getBoolean(Constants.PROP_UPDATER_ALLOW_DOWNGRADING, false) ||
|
||||
update.getTimestamp() >= SystemProperties.getLong(Constants.PROP_BUILD_DATE, 0)) &&
|
||||
update.getVersion().equalsIgnoreCase(
|
||||
SystemProperties.get(Constants.PROP_BUILD_VERSION));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user