您的位置:首页 > 教育 > 锐评 > 网站搭建排名优化_牡丹江百度贴吧_国外seo大神_企点qq官网

网站搭建排名优化_牡丹江百度贴吧_国外seo大神_企点qq官网

2024/10/5 20:27:28 来源:https://blog.csdn.net/u010307522/article/details/142550865  浏览:    关键词:网站搭建排名优化_牡丹江百度贴吧_国外seo大神_企点qq官网
网站搭建排名优化_牡丹江百度贴吧_国外seo大神_企点qq官网

调试过程中发现,
插入SIM卡会出现弹窗:SIM ADD: Restart your device to access the mobilenetwork.
拔掉SIM卡也会出现弹窗:SIM REMOVE: Restart your device to access the mobilenetwork.

分析下这块的实现,然后准备去掉:

通过排查代码,发现主要实现是在 frameworks/opt/telephony/src/java/com/android/internal/telephony/uicc/UiccSlot.java 这个文件中:

    private void onIccSwap(boolean isAdded) {boolean isHotSwapSupported = mContext.getResources().getBoolean(R.bool.config_hotswapCapable);if (isHotSwapSupported) {log("onIccSwap: isHotSwapSupported is true, don't prompt for rebooting");return;}//....log("onIccSwap: isHotSwapSupported is false, prompt for rebooting");promptForRestart(isAdded);}private void promptForRestart(boolean isAdded) {synchronized (mLock) {// 监听弹窗的确认事件,重启设备// TODO: SimRecords is not reset while SIM ABSENT (only reset while//       Radio_off_or_not_available). Have to reset in both both//       added or removed situation.listener = new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int which) {synchronized (mLock) {if (which == DialogInterface.BUTTON_POSITIVE) {if (DBG) log("Reboot due to SIM swap");PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);pm.reboot("SIM is added.");}}}};// 下面的代码主要是弹窗显示的处理Resources r = Resources.getSystem();// 弹窗显示的信息组装String title = (isAdded) ? r.getString(R.string.sim_added_title) :r.getString(R.string.sim_removed_title);String message = (isAdded) ? r.getString(R.string.sim_added_message) :r.getString(R.string.sim_removed_message);String buttonTxt = r.getString(R.string.sim_restart_button);// new 一个 dialog出来AlertDialog dialog = new AlertDialog.Builder(mContext).setTitle(title).setMessage(message).setPositiveButton(buttonTxt, listener).create();//设置类型dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);//显示 dialogdialog.show();}}@Overridepublic void handleMessage(Message msg) {switch (msg.what) {case EVENT_CARD_REMOVED:onIccSwap(false);break;case EVENT_CARD_ADDED:onIccSwap(true);break;default:loge("Unknown Event " + msg.what);}}

触发 handleMessage 的是在 UiccSlot.java 文件中的 update 函数。

看代码中有一个 isHotSwapSupported 的变量判断。可以开启或者屏蔽这个弹窗的处理,找下代码:

        boolean isHotSwapSupported = mContext.getResources().getBoolean(R.bool.config_hotswapCapable);

接下来就简单了,只需要从配置文件中关闭这个选项即可:

    <!-- Is the device capable of hot swapping an UICC Card --><bool name="config_hotswapCapable">true</bool>

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com