关于OMACP本身的概念,首先解释下相应名词:
OMA :Open Mobile Alliance
CP : Client Provisioning
OTA:Over the Air
比较官方一点的解释是:手机里OMACP应用是 OMA(Open Mobile Alliance) Client Provisioning 协议实例
但是这个貌似没很直观的感受,从我自己之前做需求和阅读源码的经验来看,OMACP起源于三星,后来发展成一个独立的系统通用接口模块,主要给运营商提供通过短信,OTA等形式发送涉及到更新APN,SPN等手机网络相关的配置修改请求,从而达到一种热修复更新的效果。
下面是我自己写的一个模拟发送OMACP消息的功能类,通过发广播的形式,可以结合系统设置模块相应的修改去接受这个广播,从而测试客制化效果(后续再提及相应客制化这一块):
private void createAndSendBroadcast1() { String fail_reason = "test"; String broadcastIntent = ACTION_OMACP;//自己自定义 Intent intent = new Intent(broadcastIntent); ArrayList<Intent> intentList = new ArrayList<Intent>(); HashMap<String,String> portMap = new HashMap<String,String> (); HashMap<String,String> NapMap = new HashMap<String,String> (); ArrayList<HashMap<String,String>> portList = new ArrayList<HashMap<String,String>>(); ArrayList<HashMap<String,String>> NapList = new ArrayList<HashMap<String,String>>(); Intent intentSim1 = new Intent(); Intent intentSim2 = new Intent(); intentSim1.putExtra(APN_NAME, "ADAT"); intentSim1.putExtra(APN_APN, "biz.immix.com"); intentSim1.putExtra(APN_PROXY, fail_reason); intentSim1.putExtra(APN_SERVER, fail_reason); intentSim1.putExtra(APN_MMSC, "http://mms.immix.csky.us:6672/"); intentSim1.putExtra(APN_PROXY, "209.4.229.79"); intentSim1.putExtra(APN_MMS_PROXY, "209.4.229.79"); intentSim1.putExtra(APN_MMS_PORT, "9402"); intentSim1.putExtra(APN_TYPE, "default,mms"); intentSim1.putExtra(APN_ID, "apnid1"); intentSim1.putExtra(APN_NAP_ID, fail_reason); intentSim1.putExtra(APN_PROXY_ID, fail_reason); intentSim1.putExtra("simId", 0); portMap.put(APN_PORT, "9402"); portList.add(portMap); intentSim1.putExtra(PORT, portList); NapMap.put(APN_USERNAME,"username1"); NapMap.put(APN_PASSWORD,"password"); NapMap.put(APN_AUTH_TYPE,"1"); NapList.add(NapMap); intentSim1.putExtra(NAP_AUTH_INFO, NapList); HashMap<String,String> portMap1 = new HashMap<String,String> (); HashMap<String,String> NapMap1 = new HashMap<String,String> (); ArrayList<HashMap<String,String>> portList1 = new ArrayList<HashMap<String,String>>(); ArrayList<HashMap<String,String>> NapList1 = new ArrayList<HashMap<String,String>>(); intentSim2.putExtra(APN_NAME, "Airfire"); intentSim2.putExtra(APN_APN, "internet.air.net"); intentSim2.putExtra(APN_PROXY, fail_reason); intentSim2.putExtra(APN_SERVER, fail_reason); intentSim2.putExtra(APN_MMSC, "http://mms.airfiremobile.com/"); intentSim2.putExtra(APN_PROXY, "209.4.229.11"); intentSim2.putExtra(APN_MMS_PROXY, "209.4.229.11"); intentSim2.putExtra(APN_MMS_PORT, "9402"); intentSim2.putExtra(APN_TYPE, "default,mms"); intentSim2.putExtra(APN_ID, "apnid2"); intentSim2.putExtra(APN_NAP_ID, fail_reason); intentSim2.putExtra(APN_PROXY_ID, fail_reason); intentSim2.putExtra("simId", 1); portMap1.put(APN_PORT, "9402"); portList1.add(portMap1); intentSim2.putExtra(PORT, portList1); NapMap1.put(APN_USERNAME,"username1"); NapMap1.put(APN_PASSWORD,"password1"); NapMap1.put(APN_AUTH_TYPE,"2"); NapList1.add(NapMap1); intentSim2.putExtra(NAP_AUTH_INFO, NapList1); intentList.add(intentSim1); intentList.add(intentSim2); intent.putParcelableArrayListExtra(APN_SETTING_INTENT, intentList); intent.setType("application/com.mediatek.omacp-apn"); //intent.setType("application/com.mediatek.omacp-ap0004"); Log.d(TAG, "sendBroadcast: 1"); mContext.sendBroadcast(intent); }