# If you keep the line number information, uncomment this to
# hide the original source file name.
-#-renamesourcefileattribute SourceFile
\ No newline at end of file
+#-renamesourcefileattribute SourceFile
+
+-keep class com.ic.** { *; }
+-keep class com.android.** { *; }
+-keep class android.** { *; }
+
+-dontwarn android.**
\ No newline at end of file
{
"type": "SINGLE",
"filters": [],
- "versionCode": 2,
- "versionName": "202012081519",
- "outputFile": "ICL02Temperature_V2_202012081519_release.apk"
+ "versionCode": 8,
+ "versionName": "202012161145",
+ "outputFile": "ICL02Temperature_V8_202012161145_release.apk"
}
]
}
\ No newline at end of file
* public static String KEY_ANTI_EVENT="eventID";
*/
class MainActivity : AppCompatActivity() {
+
+
private val viewModel by lazy {
ViewModelProvider(
this,
private var wakeLock: PowerManager.WakeLock? = null
-
private fun initWakeLock() {
+ println("init wake lock...")
val powerManager: PowerManager = getSystemService(Context.POWER_SERVICE) as PowerManager
if (wakeLock == null) {
wakeLock = powerManager.newWakeLock(
PowerManager.ACQUIRE_CAUSES_WAKEUP or PowerManager.SCREEN_DIM_WAKE_LOCK,
"ic:temperatureWakeLock"
)
+
wakeLock?.setReferenceCounted(false)
}
- wakeLock?.acquire(10 * 60)
+ //10分钟不释放自己灭屏
+ wakeLock?.acquire(10 * 60 * 1000)
}
override fun onPause() {
import android.util.Log
-import com.ic.temperature.BuildConfig;
-
object IcLog {
private val DOT = "."
- private var isDebug: Boolean = BuildConfig.DEBUG
+
+ //private var isDebug: Boolean = BuildConfig.DEBUG
+ private var isDebug: Boolean = true
private var tagHead = ""
fun v(tag: String, msg: String?) {
}
fun unBindServiceUtil(context: Context, connection: ServiceConnection?) {
- if (connection != null) {
- context.unbindService(connection)
+ try {
+ if (connection != null) {
+ context.unbindService(connection)
+ }
+ } catch (e: Exception) {
+ e.printStackTrace()
}
}
override fun handleMessage(msg: Message) {
val viewModelValue = this.viewModel?.get() ?: return
+ val isWearEnoughTime = viewModelValue.checkWearTimeEnough()
when (msg.what) {
UPDATE_TEMPERATURE_FINAL_DATA -> {
println("UPDATE_TEMPERATURE_FINAL_DATA...")
//最终结果
//结束一些loading和文字提示
viewModelValue.mShowLoading.postValue(false)
- viewModelValue.mCheckTips.postValue(viewModelValue.mContext.getString(R.string.activity_temp_tips_end))
+ if (isWearEnoughTime) {
+ viewModelValue.mCheckTips.postValue(viewModelValue.mContext.getString(R.string.activity_temp_tips_end))
+ } else {
+ viewModelValue.mCheckTips.postValue(viewModelValue.mContext.getString(R.string.activity_temp_tips_wear_too_short))
+ }
val temperature = msg.obj as Temperature
viewModelValue.updateUIData(temperature)
}
)
}
+ /**
+ * 检查佩戴时间,如果时间不够长的话
+ * 提示用户佩戴过短,影响测试结果
+ */
+ private fun checkWearTimeEnough(): Boolean {
+ //persist.sys.ic.antioff_time
+ val isEnough = SystemUtils.getSystemPropertiesString("persist.sys.ic_antiWearEnough", "")
+ IcLog.i(TAG, "isEnough === > $isEnough")
+ return "true".equals(isEnough) || "".equals(isEnough)
+
+ }
+
/**
* 是否支持环境温度检测
*/
private fun getRemoteData() {
IcLog.d(TAG, "getRemoteData...")
+ checkWearTimeEnough()
repository.getTemperature()
}
<string name="no_wearing_device_tips_text">未配戴设备</string>
<string name="activity_temp_tips_check">正在测量</string>
<string name="activity_temp_tips_end">测量完成</string>
+ <string name="activity_temp_tips_wear_too_short">佩戴时间过短\n可能影响结果</string>
<string name="temperature_default_text">"--.- "</string>
</resources>
\ No newline at end of file
-#Tue Dec 08 15:19:45 CST 2020
-VERSION_CODE=2
+#Wed Dec 16 11:45:35 CST 2020
+VERSION_CODE=8