fixed charge tips cover urgent call page issues.
authorTrillGates <williamtrillgates@gmail.com>
Fri, 24 Sep 2021 02:56:28 +0000 (10:56 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Fri, 24 Sep 2021 02:56:28 +0000 (10:56 +0800)
app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java
app/src/main/java/com/ic/view/battery/ChargeTipsView.java

index 3f5fd82..0bf6655 100644 (file)
@@ -24,6 +24,7 @@ import com.enqualcomm.support.provider.WarningItemProvider;
 import com.enqualcomm.support.service.AntiMonitorService;
 import com.enqualcomm.support.service.AudioService;
 import com.enqualcomm.support.service.Deliver;
+import com.enqualcomm.support.service.SilentManager;
 import com.ic.protocols.protocolAPIHelper;
 import com.ic.protocols.protocol_s123;
 import com.ic.view.battery.BatteryLowLevTipsView;
@@ -146,13 +147,25 @@ public class BatteryUtil {
             mRuntime.setHaveBatteryChange(false);
             mRuntime.setBatteryLow(false);
         } else if (batLevel < 25 && batLevel > 15) {
-            ChargeTipsView.getInstance().dismiss();
+            //ChargeTipsView.getInstance().dismiss();
+            Intent intent = new Intent();
+            intent.putExtra("openOrClose", "close");
+            mRuntime.getContextProxy().sendBroadcast("com.ic.action.TOAST_CHARGE_TIPS", intent);
             mRuntime.setBattery(String.format("%03d", batLevel));
             mRuntime.setBattery(batLevel);
             mRuntime.setHaveBatteryChange(true);
             mRuntime.setBatteryLow(false);
         } else if (batLevel <= 15 && batLevel > 10) {
-            ChargeTipsView.getInstance().showDialog();
+            //提示充电界面
+            //ChargeTipsView.getInstance().showDialog();
+            //以上由Launcher去完成,因为需要跳转到拨号,不可以为顶级弹窗,否则就盖住了
+            boolean idle = SilentManager.getInstance().isIdle(mRuntime.getContextProxy().context);
+            Intent intent = new Intent();
+            //如果是上课禁用状态,则不可以紧急拨号
+            intent.putExtra("idle", idle);
+            intent.putExtra("openOrClose", "open");
+            mRuntime.getContextProxy().sendBroadcast("com.ic.action.TOAST_CHARGE_TIPS", intent);
+            //以上在Launcher接收,然后弹出
             BatteryLowLevTipsView.getInstance().dismiss();
             ICLogger.d("on lower power please get charge...");
             if (Config.LOG_TOFILE) ICLogger.logToFile("Battery", "BatteryLow  less than 15%!");
index 7af0054..c492088 100644 (file)
@@ -89,8 +89,6 @@ public class ChargeTipsView {
         btnView.setOnClickListener(v -> {
             //打开拨号界面
             Context context = v.getContext();
-            //这里有个bug,即时打开了界面,也无法进行拨号,被顶级的dialog盖住了
-            //TODO:要解决这个问题
             Intent targetIntent = context.getPackageManager().getLaunchIntentForPackage("com.ic.dial");
             if (targetIntent != null) {
                 targetIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);