1.去掉电量充满后声音和震动。
authorkfl_614 <kfl_614@163.com>
Sat, 11 Apr 2020 02:45:46 +0000 (10:45 +0800)
committerkfl_614 <kfl_614@163.com>
Sat, 11 Apr 2020 02:45:46 +0000 (10:45 +0800)
2.加入2G。3g 信号值的处理。

Signed-off-by: kfl_614 <kfl_614@163.com>
app/src/main/java/com/ic/launcher/presenter/BatteryPresenter.java
app/src/main/java/com/ic/launcher/presenter/QueryPhoneState.java

index c496cfc..afde9d9 100644 (file)
@@ -182,11 +182,12 @@ public class BatteryPresenter extends PresenterCycle {
 
     private void updateBatteryFullValue() {
         mObsBatteryCharging.setValue(false);
-        if (!isPlayFullSound) {
+        /*if (!isPlayFullSound) {
             showShockAndAudio(2);
             isPlayFullSound = true;
         }
         isPlayFullSound = false;
+        */
     }
 
     private int getBatteryLevel(int level) {
@@ -212,6 +213,7 @@ public class BatteryPresenter extends PresenterCycle {
         if (phoneIsInUse()) return;
         if (isFactoryTestTopActivity(mContext)) return;
         getHome();
+
         mObsLowPower.setValue(true);
         //更新低电量的值
         mObsLowPowerValue.setValue(level + "%");
index 00d96c3..8e526a5 100644 (file)
@@ -3,9 +3,15 @@ package com.ic.launcher.presenter;
 import android.content.Context;
 import android.net.TrafficStats;
 import android.os.Message;
+import android.telephony.CellIdentityCdma;
 import android.telephony.CellInfo;
+import android.telephony.CellInfoCdma;
+import android.telephony.CellInfoGsm;
 import android.telephony.CellInfoLte;
+import android.telephony.CellInfoWcdma;
+import android.telephony.CellSignalStrengthGsm;
 import android.telephony.TelephonyManager;
+import android.telephony.gsm.GsmCellLocation;
 
 import androidx.lifecycle.MediatorLiveData;
 
@@ -123,18 +129,25 @@ public class QueryPhoneState extends QueryThread {
         if (cellInfoList == null || cellInfoList.size() == 0) {
             return;
         }
+
+        int level=1;
+
         for (CellInfo cellInfo : cellInfoList) {
             if (cellInfo instanceof CellInfoLte) {
-                // cast to CellInfoLte and call all the CellInfoLte methods you need
-                int level = ((CellInfoLte) cellInfo).getCellSignalStrength().getLevel() + 1;
-                //IcLog.i(TAG, "Signal Strength level:" + level);
-                if (level != oldSignalLevel) {
-                    oldSignalLevel = level;
-                    mObsPhoneSignalID.postValue(l02SignalResId[level + 1]);
-                }
-
+                level = ((CellInfoLte) cellInfo).getCellSignalStrength().getLevel() + 1;
+            }else if (cellInfo instanceof CellInfoCdma){
+                level = ((CellInfoCdma) cellInfo).getCellSignalStrength().getLevel()+1;
+            }else if (cellInfo instanceof CellInfoGsm){
+                level = ((CellInfoGsm) cellInfo).getCellSignalStrength().getLevel()+1;
+            }else if (cellInfo instanceof CellInfoWcdma){
+                level = ((CellInfoWcdma) cellInfo).getCellSignalStrength().getLevel()+1;
             }
         }
+
+        if (level != oldSignalLevel) {
+            oldSignalLevel = level;
+            mObsPhoneSignalID.postValue(l02SignalResId[level + 1]);
+        }
     }
 
     private int queryPhoneNetworkTypeResId(TelephonyManager tm) {