Merge "Telephony: simplify apns-conf.xml loading logic"
diff --git a/src/com/android/providers/telephony/TelephonyProvider.java b/src/com/android/providers/telephony/TelephonyProvider.java
index 58ca56e..feccfdc 100644
--- a/src/com/android/providers/telephony/TelephonyProvider.java
+++ b/src/com/android/providers/telephony/TelephonyProvider.java
@@ -582,8 +582,8 @@
File confFile = new File(Environment.getRootDirectory(), PARTNER_APNS_PATH);
File oemConfFile = new File(Environment.getOemDirectory(), OEM_APNS_PATH);
File updatedConfFile = new File(Environment.getDataDirectory(), OTA_UPDATED_APNS_PATH);
- confFile = getNewerFile(confFile, oemConfFile);
- confFile = getNewerFile(confFile, updatedConfFile);
+ confFile = pickSecondIfExists(confFile, oemConfFile);
+ confFile = pickSecondIfExists(confFile, updatedConfFile);
return confFile;
}
@@ -693,26 +693,16 @@
}
- private File getNewerFile(File sysApnFile, File altApnFile) {
+ private File pickSecondIfExists(File sysApnFile, File altApnFile) {
if (altApnFile.exists()) {
- // Alternate file exists. Use the newer one.
- long altFileTime = altApnFile.lastModified();
- long currFileTime = sysApnFile.lastModified();
- if (DBG) log("APNs Timestamp: altFileTime = " + altFileTime + " currFileTime = "
- + currFileTime);
-
- // To get the latest version from OEM or System image
- if (altFileTime > currFileTime) {
- if (DBG) log("APNs Timestamp: Alternate image " + altApnFile.getPath() +
- " is greater than System image");
- return altApnFile;
- }
+ if (DBG) log("Load APNs from " + altApnFile.getPath() +
+ " instead of " + sysApnFile.getPath());
+ return altApnFile;
} else {
- // No Apn in alternate image, so load it from system image.
- if (DBG) log("No APNs in OEM image = " + altApnFile.getPath() +
- " Load APNs from system image");
+ if (DBG) log("Load APNs from " + sysApnFile.getPath() +
+ " instead of " + altApnFile.getPath());
+ return sysApnFile;
}
- return sysApnFile;
}
@Override