Remove APN-db flush if conf file changes
bug:10916762
Change-Id: I65c457da89dbdbde35971a00e7056409c4a57227
diff --git a/src/com/android/providers/telephony/TelephonyProvider.java b/src/com/android/providers/telephony/TelephonyProvider.java
index f68ac51..b67aac0 100644
--- a/src/com/android/providers/telephony/TelephonyProvider.java
+++ b/src/com/android/providers/telephony/TelephonyProvider.java
@@ -32,9 +32,7 @@
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.os.Environment;
-import android.os.FileUtils;
import android.provider.Telephony;
-import android.telephony.TelephonyManager;
import android.util.Log;
import android.util.Xml;
@@ -70,7 +68,6 @@
private static final String PREF_FILE = "preferred-apn";
private static final String COLUMN_APN_ID = "apn_id";
- private static final String APN_CONFIG_CHECKSUM = "apn_conf_checksum";
private static final String PARTNER_APNS_PATH = "etc/apns-conf.xml";
@@ -393,44 +390,10 @@
@Override
public boolean onCreate() {
- long oldCheckSum = getAPNConfigCheckSum();
- File confFile = new File(Environment.getRootDirectory(), PARTNER_APNS_PATH);
- long newCheckSum = -1L;
-
- if (DBG) {
- Log.w(TAG, "onCreate: confFile=" + confFile.getAbsolutePath() +
- " oldCheckSum=" + oldCheckSum);
- }
mOpenHelper = new DatabaseHelper(getContext());
-
- if (isLteOnCdma()) {
- // Check to see if apns-conf.xml file changed. If so, generate db again.
- //
- // TODO: Generalize so we can handle apns-conf.xml updates
- // and preserve any modifications the user might make. For
- // now its safe on LteOnCdma devices because the user cannot
- // make changes.
- try {
- newCheckSum = FileUtils.checksumCrc32(confFile);
- if (DBG) Log.w(TAG, "onCreate: newCheckSum=" + newCheckSum);
- if (oldCheckSum != newCheckSum) {
- Log.w(TAG, "Rebuilding Telephony.db");
- restoreDefaultAPN();
- setAPNConfigCheckSum(newCheckSum);
- }
- } catch (FileNotFoundException e) {
- Log.e(TAG, "FileNotFoundException: '" + confFile.getAbsolutePath() + "'", e);
- } catch (IOException e) {
- Log.e(TAG, "IOException: '" + confFile.getAbsolutePath() + "'", e);
- }
- }
return true;
}
- private boolean isLteOnCdma() {
- return TelephonyManager.getLteOnCdmaModeStatic() == PhoneConstants.LTE_ON_CDMA_TRUE;
- }
-
private void setPreferredApnId(Long id) {
SharedPreferences sp = getContext().getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
@@ -443,18 +406,6 @@
return sp.getLong(COLUMN_APN_ID, -1);
}
- private long getAPNConfigCheckSum() {
- SharedPreferences sp = getContext().getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE);
- return sp.getLong(APN_CONFIG_CHECKSUM, -1);
- }
-
- private void setAPNConfigCheckSum(long id) {
- SharedPreferences sp = getContext().getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE);
- SharedPreferences.Editor editor = sp.edit();
- editor.putLong(APN_CONFIG_CHECKSUM, id);
- editor.apply();
- }
-
@Override
public Cursor query(Uri url, String[] projectionIn, String selection,
String[] selectionArgs, String sort) {