1.在源码中的路径:

\device\generic\goldfish\data\etc\apns-conf.xml

2.在手机中的路径:

当下载新的版本到手机后,在手机的目录\/system\/etc\/里面存在对应的apns-conf.xml文件.

3.telephony.db的创建:

在第一次开机的时候会用手机中的 \/system\/etc\/apns-conf.xml 文件进行创建数据库.TelephonyProvider.java中创建数据库.

4.carries表:

carries表即是TelephonyProvider.java通过apns-conf.xml创建的关于apn的表,这里顺便提下在telephony.db中还包括siminfo表

5.关于carriers表的创建过程:

    private static final String PARTNER_APNS_PATH = "etc/apns-conf.xml";

    private static final String OEM_APNS_PATH = "telephony/apns-conf.xml";

    private static final String OTA_UPDATED_APNS_PATH = "misc/apns-conf.xml";

    private File getApnConfFile() {
        // Environment.getRootDirectory() is a fancy way of saying ANDROID_ROOT or "/system".
        //分别判断etc/telephony/misc下面的apns-conf.xml文件的修改时间,用最新修改的文件作为telephony.db的原始文件.
        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);
        return confFile;
    }

    private File getNewerFile(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;
            }
        } 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");
        }
        return sysApnFile;
    }

results matching ""

    No results matching ""