From: TrillGates Date: Mon, 25 Oct 2021 08:44:20 +0000 (+0800) Subject: S123静音设置,防止重复设置 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=710a515a3e64337460038b0b2e3eaeadbd5cd021;p=icsupport.git S123静音设置,防止重复设置 --- diff --git a/app/release/ICSer_V979_2110201800_release.apk b/app/release/ICSer_V981_2110251558_release.apk similarity index 77% rename from app/release/ICSer_V979_2110201800_release.apk rename to app/release/ICSer_V981_2110251558_release.apk index a7f936b1..a2fb69b4 100644 Binary files a/app/release/ICSer_V979_2110201800_release.apk and b/app/release/ICSer_V981_2110251558_release.apk differ diff --git a/app/release/output.json b/app/release/output.json index 3df6eace..0b09e335 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":979,"versionName":"2110201800","enabled":true,"outputFile":"ICSer_V979_2110201800_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V979_2110201800_release.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":981,"versionName":"2110251558","enabled":true,"outputFile":"ICSer_V981_2110251558_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V981_2110251558_release.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/java/com/enqualcomm/support/CoreService.java b/app/src/main/java/com/enqualcomm/support/CoreService.java index 30805842..5ae9100b 100644 --- a/app/src/main/java/com/enqualcomm/support/CoreService.java +++ b/app/src/main/java/com/enqualcomm/support/CoreService.java @@ -371,10 +371,17 @@ public class CoreService extends Service { private void trigger_SOS_Call() { try { - Intent intent = new Intent("com.eqc.shutdown_sos"); - intent.putExtra("type", 1); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - this.startActivity(intent); + //查询有没有IC的sos,如果有就用IC的SOS + Intent icIntent = getPackageManager().getLaunchIntentForPackage("com.ic.sos"); + if (icIntent != null) { + icIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(icIntent); + } else { + Intent intent = new Intent("com.eqc.shutdown_sos"); + intent.putExtra("type", 1); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + this.startActivity(intent); + } } catch (Exception e) { e.printStackTrace(); } @@ -450,7 +457,6 @@ public class CoreService extends Service { coreService.getFZDWeatherInfo(); coreService.sendAntiStatus(); }, 30 * 1000); - } public void onReceive(StringMessage param1StringMessage) { diff --git a/app/src/main/java/com/ic/protocols/protocol_s123.java b/app/src/main/java/com/ic/protocols/protocol_s123.java index e26d72c2..2a656581 100644 --- a/app/src/main/java/com/ic/protocols/protocol_s123.java +++ b/app/src/main/java/com/ic/protocols/protocol_s123.java @@ -7,7 +7,6 @@ import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.database.Cursor; -import android.media.AudioManager; import android.net.Uri; import android.os.Environment; import android.os.Handler; @@ -49,7 +48,6 @@ import com.enqualcomm.support.utils.CameraUtil; import com.enqualcomm.support.utils.Connection; import com.enqualcomm.support.utils.ICAudioManager; import com.enqualcomm.support.utils.ICLogger; -import com.enqualcomm.support.utils.ProfileManager; import com.enqualcomm.support.utils.SharePreferenceUtil; import com.enqualcomm.support.utils.TemperatureUtil; import com.enqualcomm.support.utils.TimeUtil; @@ -4024,14 +4022,6 @@ public class protocol_s123 { if (split.length == 4) { String indexId = split[2]; String value = split[3]; - Context context = mRuntime.getContextProxy().context; - AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); - //更新设置 - if ("1".equals(value)) { - ProfileManager.silentAll(context, audioManager); - } else { - ProfileManager.restoreSilent(context, audioManager); - } //修改数据库 updateSettingValue("key_silent", value); //返回消息 @@ -4321,11 +4311,24 @@ public class protocol_s123 { private void updateSettingValue(String key, String value) { ContentResolver resolver = mRuntime.getContextProxy().getResolver(); + //先查询,如果已经是当前值了,就不要去更新了 + Uri parse = Uri.parse(ICGlobalSettingsProvider.SETTINGS); + Cursor query = resolver.query(parse, new String[]{"s_value"}, "s_key=?", new String[]{key}, null); + if (query != null) { + if (query.moveToNext()) { + String string = query.getString(0); + if (value.equals(string)) { + ICLogger.d("值一样,不做修改."); + return; + } + query.close(); + } + } ContentValues values = new ContentValues(); values.put(ICDatabaseHelper.sKey, key); //把值保存到数据库中,相机会就监听数据库值的变化,做出响应 values.put(ICDatabaseHelper.sValue, value); - resolver.insert(Uri.parse(ICGlobalSettingsProvider.SETTINGS), values); + resolver.insert(parse, values); } /** diff --git a/app/version_code.properties b/app/version_code.properties index ce820e17..7808bfca 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Wed Oct 20 18:00:38 CST 2021 -VERSION_CODE=979 +#Mon Oct 25 15:58:30 CST 2021 +VERSION_CODE=981