1、优化音量调大过程,只有通话开始时才会进行音量调整
authorsnickersun <scy@incartech.cn>
Wed, 26 Aug 2020 13:25:41 +0000 (21:25 +0800)
committersnickersun <scy@incartech.cn>
Wed, 26 Aug 2020 13:25:41 +0000 (21:25 +0800)
2、在 AndroidManifest.xml 中添加 mqtt service 定义

app/app.iml
app/src/main/AndroidManifest.xml
app/src/main/java/com/enqualcomm/support/service/SilentManager.java

index 2ccae5d..77c19ca 100644 (file)
@@ -18,8 +18,8 @@
         <option name="ALLOW_USER_CONFIGURATION" value="false"/>\r
         <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml"/>\r
         <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res"/>\r
-        <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/resValues/debug"/>\r
-        <option name="TEST_RES_FOLDERS_RELATIVE_PATH" value=""/>\r
+        <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/src/debug/res;file://$MODULE_DIR$/build/generated/res/rs/debug;file://$MODULE_DIR$/build/generated/res/resValues/debug"/>\r
+        <option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/androidTest/res;file://$MODULE_DIR$/src/test/res;file://$MODULE_DIR$/src/androidTestDebug/res;file://$MODULE_DIR$/src/testDebug/res;file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug;file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug"/>\r
         <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets"/>\r
       </configuration>\r
     </facet>\r
     <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:runner:0.5@aar" level="project"/>\r
     <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:exposed-instrumentation-api-publish:0.5@aar" level="project"/>\r
     <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test.espresso:espresso-idling-resource:2.2.2@aar" level="project"/>\r
-    <orderEntry type="library" name="Gradle: __local_aars__:D.\workspace\icsupport\app\libs\android-logging-log4j-1.0.3.jar:unspecified@jar" level="project"/>\r
-    <orderEntry type="library" name="Gradle: __local_aars__:D.\workspace\icsupport\app\libs\ftp4j-1.7.2.jar:unspecified@jar" level="project"/>\r
-    <orderEntry type="library" name="Gradle: __local_aars__:D.\workspace\icsupport\app\libs\log4j-1.2.17.jar:unspecified@jar" level="project"/>\r
-    <orderEntry type="library" name="Gradle: __local_aars__:D.\workspace\icsupport\app\libs\okio-2.4.3.jar:unspecified@jar" level="project"/>\r
-    <orderEntry type="library" name="Gradle: __local_aars__:D.\workspace\icsupport\app\libs\mail.jar:unspecified@jar" level="project"/>\r
-    <orderEntry type="library" name="Gradle: __local_aars__:D.\workspace\icsupport\app\libs\activation.jar:unspecified@jar" level="project"/>\r
-    <orderEntry type="library" name="Gradle: __local_aars__:D.\workspace\icsupport\app\libs\additionnal.jar:unspecified@jar" level="project"/>\r
-    <orderEntry type="library" name="Gradle: __local_aars__:D.\workspace\icsupport\app\libs\frameworks-full-debug.jar:unspecified@jar" level="project"/>\r
-    <orderEntry type="library" name="Gradle: __local_aars__:D.\workspace\icsupport\app\libs\telephony_common-full-debug.jar:unspecified@jar" level="project"/>\r
+    <orderEntry type="library" name="Gradle: ./app/libs/android-logging-log4j-1.0.3.jar" level="project"/>\r
+    <orderEntry type="library" name="Gradle: ./app/libs/ftp4j-1.7.2.jar" level="project"/>\r
+    <orderEntry type="library" name="Gradle: ./app/libs/log4j-1.2.17.jar" level="project"/>\r
+    <orderEntry type="library" name="Gradle: ./app/libs/okio-2.4.3.jar" level="project"/>\r
+    <orderEntry type="library" name="Gradle: ./app/libs/mail.jar" level="project"/>\r
+    <orderEntry type="library" name="Gradle: ./app/libs/activation.jar" level="project"/>\r
+    <orderEntry type="library" name="Gradle: ./app/libs/additionnal.jar" level="project"/>\r
+    <orderEntry type="library" name="Gradle: ./app/libs/frameworks-full-debug.jar" level="project"/>\r
+    <orderEntry type="library" name="Gradle: ./app/libs/telephony_common-full-debug.jar" level="project"/>\r
     <orderEntry type="library" name="Gradle: com.android.support.constraint:constraint-layout-solver:1.1.3@jar" level="project"/>\r
     <orderEntry type="library" name="Gradle: com.android.support:support-annotations:25.1.0@jar" level="project"/>\r
     <orderEntry type="library" name="Gradle: io.reactivex:rxjava:1.1.0@jar" level="project"/>\r
index 05c4691..757f37d 100644 (file)
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
-
+        <service android:name="se.wetcat.qatja.android.QatjaService"> <!-- MQTT协议通讯服务 -->
+            <intent-filter>
+                <action android:name="com.ic.mqtt.startsrv" />
+            </intent-filter>
+        </service>
         <service android:name=".CoreService"> <!-- 协议通讯服务 -->
             <intent-filter>
                 <action android:name="com.enqualcomm.support.startsrv" />
index a5d5dd5..4bb6997 100644 (file)
@@ -13,6 +13,7 @@ import android.os.Handler;
 import android.os.Message;\r
 import android.os.Messenger;\r
 import android.telephony.PhoneStateListener;\r
+import android.telephony.PreciseCallState;\r
 import android.telephony.TelephonyManager;\r
 \r
 import com.enqualcomm.support.Config;\r
@@ -85,6 +86,16 @@ public class SilentManager extends AbstractInvokeHandlerService {
   private int mTodayWeek;\r
   private boolean mValue_isSilence;\r
 \r
+  public static final int PRECISE_CALL_STATE_NOT_VALID = -1;\r
+  public static final int PRECISE_CALL_STATE_IDLE = 0;  //空闲\r
+  public static final int PRECISE_CALL_STATE_ACTIVE = 1; //正在通话\r
+  public static final int PRECISE_CALL_STATE_HOLDING = 2; //通话挂起\r
+  public static final int PRECISE_CALL_STATE_DIALING = 3; //拨号开始\r
+  public static final int PRECISE_CALL_STATE_ALERTING = 4; //正在呼出\r
+  public static final int PRECISE_CALL_STATE_INCOMING = 5; //对方来电\r
+  public static final int PRECISE_CALL_STATE_WAITING = 6; //第三方来电等待\r
+  public static final int PRECISE_CALL_STATE_DISCONNECTED = 7; //挂断完成\r
+  public static final int PRECISE_CALL_STATE_DISCONNECTING = 8; //正在挂断\r
 \r
   private static SilentManager mSilentManger=null;\r
 \r
@@ -96,13 +107,11 @@ public class SilentManager extends AbstractInvokeHandlerService {
   private PhoneStateListener phoneStateListener = new PhoneStateListener() {\r
     public void onCallStateChanged(int state, String incomingNumber) {\r
       super.onCallStateChanged(state, incomingNumber);\r
-        if (ICAudioManager.needMute == false){\r
-          if (Config.custom_branch_name.equals("AK"))\r
-            ICAudioManager.setVoiceCallMaxVolumn(mContext); //设置最大音量\r
-        }\r
-        ICLogger.i("========onCallStateChanged state "+state+", incomingNumber "+incomingNumber);\r
+\r
+      ICLogger.i("========onCallStateChanged state "+state+", incomingNumber "+incomingNumber);\r
       switch(state) {\r
-        case 0: //挂电话\r
+        case PRECISE_CALL_STATE_DISCONNECTING: //挂电话\r
+        case PRECISE_CALL_STATE_DISCONNECTED: //挂电话\r
           isCalling = false;\r
 //          if (SilentManager.this.haveHandSilence) {\r
 //            SilentManager.this.handSilence(SilentManager.this.mContext, SilentManager.this.mValue_isSilence);\r
@@ -118,15 +127,17 @@ public class SilentManager extends AbstractInvokeHandlerService {
             });\r
 \r
           }\r
-          ICLogger.i("========Ring!");\r
+          ICLogger.i("========Hung up!");\r
           break;\r
-        case 1: //来电\r
+        case PRECISE_CALL_STATE_INCOMING: //来电\r
+        case PRECISE_CALL_STATE_ALERTING:\r
+        case PRECISE_CALL_STATE_DIALING:\r
           isCalling = true;\r
           Intent var3 = new Intent();\r
           var3.setAction(ACTION_CLOSE_UNREAD_MSG);\r
           mContext.sendBroadcast(var3);\r
 \r
-          ICLogger.i("========Hung up!");\r
+          ICLogger.i("========Ring!");\r
           if(ICAudioManager.needMute==true)\r
           {\r
             ICAudioManager.setVolumnMute(mContext);\r
@@ -138,8 +149,15 @@ public class SilentManager extends AbstractInvokeHandlerService {
 \r
           }\r
           break;\r
-        case 2://接电话\r
-        case 8://接电话\r
+        case PRECISE_CALL_STATE_ACTIVE://接电话\r
+        {\r
+          if (ICAudioManager.needMute == false){\r
+            if (Config.custom_branch_name.equals("AK"))\r
+              ICAudioManager.setVoiceCallMaxVolumn(mContext); //设置最大音量\r
+          }\r
+        }\r
+        case PRECISE_CALL_STATE_HOLDING://接电话\r
+        case PRECISE_CALL_STATE_WAITING:\r
           isCalling = true;\r
           ICLogger.i("========Answer Call !");\r
           if(ICAudioManager.needMute==true)\r