文章目录
- 【RK3288 Android10 C30 支持sim卡拔掉不弹窗,及热插拔】
- 需求
- 方案
- patch
- framework
【RK3288 Android10 C30 支持sim卡拔掉不弹窗,及热插拔】
需求
由于3288 硬件上的sim卡座不支持热插拔,是没有顶针来识别sim卡是否被拔掉的。所以在sim被拔掉或者松动的时候,会弹窗出现无sim卡,同时要求你重启。
需要修改系统,来实现取消提示重启的消息弹窗,以及sim卡丢失后,自动重新识别
方案
通过向供应商询问,可以通过在无sim卡的情况下,进入飞行模式,然后退出,sim卡就可以重新进行识别。如果此时wifi连接,那么就不需要进入飞行模式。
patch
framework
From fa7b479a925607574a6c0bc4f2b072317b11b60d Mon Sep 17 00:00:00 2001
From: liangji <liangji@keenon.com>
Date: Mon, 4 Dec 2023 09:58:45 +0800
Subject: [PATCH 2/4] feat: support set airplane mode on when sim card plug outChange-Id: I7bf0179032983ed3ed67c31208e5cf6034c18991
Signed-off-by: liangji <liangji@keenon.com>
---.../android/internal/telephony/uicc/UiccCard.java | 52 ++++++++++++++++++++++1 file changed, 52 insertions(+)diff --git a/opt/telephony/src/java/com/android/internal/telephony/uicc/UiccCard.java b/opt/telephony/src/java/com/android/internal/telephony/uicc/UiccCard.java
index f40e7a8..5afc7b3 100644
--- a/opt/telephony/src/java/com/android/internal/telephony/uicc/UiccCard.java
+++ b/opt/telephony/src/java/com/android/internal/telephony/uicc/UiccCard.java
@@ -39,6 +39,8 @@ import android.telephony.TelephonyManager;import android.text.TextUtils;import android.util.LocalLog;import android.view.WindowManager;
+import android.provider.Settings;
+import android.net.wifi.WifiManager;import com.android.internal.telephony.CommandsInterface;import com.android.internal.telephony.PhoneBase;
@@ -307,6 +309,56 @@ public class UiccCard {}log("onIccSwap: isHotSwapSupported is false, prompt for rebooting");+ /*
+ * keenon liangji add
+ * if sim card removed, set airplane mode to re-detect sim card
+ */
+ if(!isAdded) {
+ /*
+ * check wifi status, if wifi connected, do nothing,
+ * else set airplane mode
+ */
+ log("onIccSwap: isAdded is false, sim card has been removed");
+ WifiManager wifiManager = (WifiManager) mContext
+ .getSystemService(Context.WIFI_SERVICE);
+
+ if (wifiManager.isWifiEnabled() &&
+ wifiManager.getConnectionInfo().getNetworkId() != -1) {
+ /* now wifi connected */
+ log("wifi has connected, do nothing");
+ } else {
+ log("wifi has not connected, set airplane mode");
+
+ /*
+ * airplane mode reset 4G
+ * */
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.AIRPLANE_MODE_ON, 1);
+
+ Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
+ intent.putExtra("state", true);
+ mContext.sendBroadcast(intent);
+ log("send broadcast to change airplane mode");
+
+ Handler handler = new Handler();
+ handler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.AIRPLANE_MODE_ON, 0);
+
+ Intent intent = new
+ Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
+ intent.putExtra("state", false);
+ mContext.sendBroadcast(intent);
+ }
+ /* disable airplane mode 5s after enable it */
+ }, 5000);
+ }
+ return;
+ }
+ /* keenon liangji add end */
+synchronized (mLock) {// TODO: Here we assume the device can't handle SIM hot-swap// and has to reboot. We may want to add a property,
--
2.7.4
From 674bd7a9d63c2d325d4cb3eef05673a41a596c5a Mon Sep 17 00:00:00 2001
From: liangji <liangji@keenon.com>
Date: Wed, 13 Dec 2023 15:01:46 +0800
Subject: [PATCH 3/4] fix: solve sim_added_title windows issueChange-Id: I2426c46d676aa2c00b3c8c034793fee18cd5cf6c
Signed-off-by: liangji <liangji@keenon.com>
---.../src/java/com/android/internal/telephony/uicc/UiccCard.java | 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)diff --git a/opt/telephony/src/java/com/android/internal/telephony/uicc/UiccCard.java b/opt/telephony/src/java/com/android/internal/telephony/uicc/UiccCard.java
index 5afc7b3..dffa75a 100644
--- a/opt/telephony/src/java/com/android/internal/telephony/uicc/UiccCard.java
+++ b/opt/telephony/src/java/com/android/internal/telephony/uicc/UiccCard.java
@@ -355,8 +355,9 @@ public class UiccCard {/* disable airplane mode 5s after enable it */}, 5000);}
- return;}
+
+ return;/* keenon liangji add end */synchronized (mLock) {
--
2.7.4
From f81bc2ee3f6a9d659f9d1ac65b83563efc38d511 Mon Sep 17 00:00:00 2001
From: liangji <liangji@keenon.com>
Date: Wed, 13 Dec 2023 16:04:25 +0800
Subject: [PATCH 4/4] fix: solve build issueChange-Id: I287c9e4c7cecc0572bfa437b68db3f5b5eb9127e
Signed-off-by: liangji <liangji@keenon.com>
---.../src/java/com/android/internal/telephony/uicc/UiccCard.java | 2 ++1 file changed, 2 insertions(+)diff --git a/opt/telephony/src/java/com/android/internal/telephony/uicc/UiccCard.java b/opt/telephony/src/java/com/android/internal/telephony/uicc/UiccCard.java
index dffa75a..7f5f053 100644
--- a/opt/telephony/src/java/com/android/internal/telephony/uicc/UiccCard.java
+++ b/opt/telephony/src/java/com/android/internal/telephony/uicc/UiccCard.java
@@ -360,6 +360,7 @@ public class UiccCard {return;/* keenon liangji add end */+ /* keenon liangji disabled because unusedsynchronized (mLock) {// TODO: Here we assume the device can't handle SIM hot-swap// and has to reboot. We may want to add a property,
@@ -402,6 +403,7 @@ public class UiccCard {dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);dialog.show();}
+ */}protected Handler mHandler = new Handler() {
--
2.7.4