-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.1","enabled":true,"outputFile":"IcL02WorkService_V57_202101221525_release.apk","fullName":"IcL02WorkServiceRelease","baseName":"IcL02WorkService-release"},"path":"IcL02WorkService_V57_202101221525_release.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.1","enabled":true,"outputFile":"IcL02WorkService_V57_202102011415_release.apk","fullName":"IcL02WorkServiceRelease","baseName":"IcL02WorkService-release"},"path":"IcL02WorkService_V57_202102011415_release.apk","properties":{}}]
\ No newline at end of file
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
+ <service android:name=".weather.WhiteListService">
+ <intent-filter>
+ <!--白名单服务-->
+ <action android:name="com.ic.action.WHITE_LIST" />
+ </intent-filter>
+ </service>
</application>
</manifest>
\ No newline at end of file
--- /dev/null
+// IWhiteListTriggerService.aidl
+package com.ic.work;
+
+interface IWhiteListTriggerService {
+ //trigger white list open
+ //isOpen:true --> open white list filtter or would not block number income.
+ //packageName ---> is call from app packageName
+ //return value is result.
+ boolean setWhiteListOpen(boolean isOpen,String packageName);
+
+ //get current block state
+ boolean getCurrentBlockState();
+}
\ No newline at end of file
// 掌育会startService的方式来启动服务,如果已经启动了
// 不走onCreate,则会走这里
//可以获取到相关的值,然后去获取心率/体温
+ if (intent == null) {
+ return super.onStartCommand(null, flags, startId);
+ }
String action = intent.getAction();
IcLog.d(TAG, "onStartCommand action == > " + action);
//可以通过action来判断
IcLog.d(TAG, "deviceState[0] == > " + deviceState[0]);
//TODO:这个后面再处理,得给我机器再去处理,没有文档,没有数据
//sendTipsEventBus(BLOOD_NULL_TIPS, BLOOD_NOT_DEVICE);
+ if (mListener != null) {
+ mListener.onHeartRateResult(0, 0, 0, 0);
+ mListener.onHeartRateTestFinished();
+ }
return;
}
import android.os.SystemClock;
+import com.ic.jni.ICJniUtils;
import com.ic.work.domain.TemperatureItem;
import com.ic.work.utils.HardwareUtils;
import com.ic.work.utils.ICLogger;
lastBodyTemp = 0.0;
lastWristTemp = 0.0;
delayTimesInSeconds = 20;
- boolean[] state = HardwareUtils.isTemperatureDevAvailable();
- IcLog.i(TAG, "TemperatureRunnable :" + state[0] + " state[1]:" + state[1]);
- if (state[0]) { //have temp
+ int typeOrder = HardwareUtils.isTemperatureDevAvailable();
+ IcLog.i(TAG, "TemperatureRunnable type order:" + typeOrder);
+ if (typeOrder > ICJniUtils.TempSensorType.TEMPSENSOR_TYPE_NONE.ordinal()) { //have temp
try {
IcLog.i(TAG, "getNdkTemperatureValue enableTemperature");
HardwareUtils.disablePedometer();
IcLog.d(TAG, "do temperature....");
SystemClock.sleep(1000);
long getStartTime = System.currentTimeMillis();
- lastWristTemp = HardwareUtils.getNdkTemperatureOutValue();
- TemperatureItem temperatureItem = TemperatureUtil.doTempTest();
- if (temperatureItem != null) {
- lastWristTemp = Double.parseDouble(temperatureItem.getBodyTemp());
- lastTempOut = Double.parseDouble(temperatureItem.getEvnTemp());
-
- if (lastTempOut > 60 || lastTempOut < 1) {
- lastTempOut = 0.0f;
- }
- if (lastTempOut > 0.0f) {
- lastBodyTemp = TemperatureUtil.getBodyTemp(lastWristTemp, lastTempOut);
- } else {
- lastBodyTemp = TemperatureUtil.getBodyTemp(lastWristTemp, 26.0f);
+ TemperatureItem temperatureItem = null;
+ if (typeOrder == ICJniUtils.TempSensorType.TEMPSENSOR_TYPE_IC68.ordinal()) {
+ //IC68走这个
+ IcLog.d(TAG, "type is == > IC68");
+ temperatureItem = TemperatureUtil.doTempTest();
+ if (temperatureItem != null) {
+ lastWristTemp = Double.parseDouble(temperatureItem.getBodyTemp());
+ lastTempOut = Double.parseDouble(temperatureItem.getEvnTemp());
}
- IcLog.d(TAG, "testing..." + lastWristTemp + " " + lastBodyTemp + " " + lastTempOut);
- //前10秒不更新内容,后10秒再更新数据
- if (delayTimesInSeconds <= 10 && mListener != null) {
- IcLog.d(TAG, "update temperature info..thread name is ." + Thread.currentThread().getName());
- //获取
- IcLog.d(TAG, "lastWristTemp == > " + lastWristTemp);
- IcLog.d(TAG, "lastBodyTemp == > " + lastBodyTemp);
- IcLog.d(TAG, "lastTempOut == > " + lastTempOut);
- mListener.onTemperatureUpdate(lastWristTemp, lastBodyTemp, lastTempOut);
- }
- ICLogger.d("get temperature data use time == > " + (System.currentTimeMillis() - getStartTime));
+ } else if (typeOrder == ICJniUtils.TempSensorType.TEMPSENSOR_TYPE_EM7068.ordinal()) {
+ IcLog.d(TAG, "type is == > 7068");
+ lastWristTemp = HardwareUtils.getNdkTemperatureValue();
+ lastTempOut = HardwareUtils.getNdkTemperatureOutValue();
+ }
+ if (lastTempOut > 60 || lastTempOut < 1) {
+ lastTempOut = 0.0f;
}
+ if (lastTempOut > 0.0f) {
+ lastBodyTemp = TemperatureUtil.getBodyTemp(lastWristTemp, lastTempOut);
+ } else {
+ lastBodyTemp = TemperatureUtil.getBodyTemp(lastWristTemp, 26.0f);
+ }
+ IcLog.d(TAG, "testing..." + lastWristTemp + " " + lastBodyTemp + " " + lastTempOut);
+ //前10秒不更新内容,后10秒再更新数据
+ if (delayTimesInSeconds <= 10 && mListener != null) {
+ IcLog.d(TAG, "update temperature info..thread name is ." + Thread.currentThread().getName());
+ //获取
+ IcLog.d(TAG, "lastWristTemp == > " + lastWristTemp);
+ IcLog.d(TAG, "lastBodyTemp == > " + lastBodyTemp);
+ IcLog.d(TAG, "lastTempOut == > " + lastTempOut);
+ mListener.onTemperatureUpdate(lastWristTemp, lastBodyTemp, lastTempOut);
+ }
+ ICLogger.d("get temperature data use time == > " + (System.currentTimeMillis() - getStartTime));
+
delayTimesInSeconds--;
IcLog.d(TAG, "delayTimesInSeconds " + delayTimesInSeconds);
//延时delay_times_in_seconds秒后停止检测。
}
}
- public static boolean[] isTemperatureDevAvailable() {
-
- boolean[] temp = new boolean[]{false, false};
+ public static int isTemperatureDevAvailable() {
try {
- int type = ICJniUtils.isTemperatureDevAvailable();
- temp[0] = type > ICJniUtils.TempSensorType.TEMPSENSOR_TYPE_NONE.ordinal();
- if (temp[0]) {
- temp[1] = type == ICJniUtils.TempSensorType.TEMPSENSOR_TYPE_IC68.ordinal();
- }
- return temp;
+ return ICJniUtils.isTemperatureDevAvailable();
} catch (Exception e) {
e.printStackTrace();
- return temp;
+ return ICJniUtils.TempSensorType.TEMPSENSOR_TYPE_NONE.ordinal();
}
}
public static double getNdkTemperatureOutValue() {
try {
- return ICJniUtils.getTemperatureOrigin();
+ double temperatureOrigin = ICJniUtils.getTemperatureOrigin();
+ IcLog.d(TAG, "getNdkTemperatureOutValue... " + temperatureOrigin);
+ return temperatureOrigin;
} catch (Exception e) {
IcLog.e(TAG, "", e);
return 0;
double cpuTemp/*cpu温度*/ = 0.0f;
double evnTemp/*环境温度*/ = 0.0f;
double gpuTemp/*gpu温度*/ = 0.0f;
- double chargeTemp/*充电板的温度*/ = 0.0f;
- double paTemp/*射频的温度*/ = 0.0f;
+ //double chargeTemp/*充电板的温度*/ = 0.0f;
+ // double paTemp/*射频的温度*/ = 0.0f;
double boardTemp/*主板的温度*/ = 0.0f;
try {
String cpuTempType = TempFileUtils.readFile(CMD_CPU_TYPE);
String cpuTempStr = TempFileUtils.readFile(CMD_CPU_TEM);
String gpuTempType = TempFileUtils.readFile(CMD_GPU_TYPE);
String gpuTempStr = TempFileUtils.readFile(CMD_GPU_TEM);
- String chargeTempType = TempFileUtils.readFile(CMD_CHARGE_TYPE);
- String chargeTempStr = TempFileUtils.readFile(CMD_CHARGE_TEM);
+ //String chargeTempType = TempFileUtils.readFile(CMD_CHARGE_TYPE);
+ //String chargeTempStr = TempFileUtils.readFile(CMD_CHARGE_TEM);
String paTempType = TempFileUtils.readFile(CMD_PA_TYPE);
String paTempStr = TempFileUtils.readFile(CMD_PA_TEM);
String boardTempType = TempFileUtils.readFile(CMD_BOARD_TYPE);
"\n | " +
" gpuTempType == > " + gpuTempType +
" gpuTempStr == > " + gpuTempStr
- + "\n | "
- + "chargeTempType == > " + chargeTempType +
- " chargeTempStr == > " + chargeTempStr
+ // + "\n | "
+ //+ "chargeTempType == > " + chargeTempType +
+ // " chargeTempStr == > " + chargeTempStr
+ "\n | "
+ "paTempType == > " + paTempType +
" paTempStr == > " + paTempStr
//数据处理一下
cpuTemp = Integer.parseInt(cpuTempStr) / 1000.0f;
gpuTemp = Integer.parseInt(gpuTempStr) / 1000.0f;
- try {
- chargeTemp = Integer.parseInt(chargeTempStr) / 1000.0f;
- } catch (Exception e) {
- chargeTemp = 0.0f;
- }
- try {
- paTemp = Integer.parseInt(paTempStr) / 1000.0f;
- } catch (Exception e) {
- paTemp = 0.0f;
- }
+ // try {
+ // chargeTemp = Integer.parseInt(chargeTempStr) / 1000.0f;
+ // } catch (Exception e) {
+ // chargeTemp = 0.0f;
+ // }
+ // try {
+ // paTemp = Integer.parseInt(paTempStr) / 1000.0f;
+ // } catch (Exception e) {
+ // paTemp = 0.0f;
+ // }
boardTemp = Integer.parseInt(boardTempStr) / 1000.0f;
} catch (Exception e) {
- //no crash is okay.
+ //no crash is okay.
}
evnTemp = get_tempOut_value_origin();
bodyTemp = get_temp_value_adjusted();
String.format("%.01f", cpuTemp),
String.format("%.01f", resultEnvTemp),
String.format("%.01f", gpuTemp),
- String.format("%.01f", chargeTemp),
+ "0.00",
String.format("%.01f", boardTemp),
- String.format("%.01f", paTemp));
+ "0.00");
return temperatureItem;
} catch (Exception e) {
e.printStackTrace();
--- /dev/null
+package com.ic.work.weather;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+
+import androidx.annotation.Nullable;
+
+import com.ic.work.IWhiteListTriggerService;
+import com.ic.work.utils.ICLogger;
+import com.ic.work.utils.IcSystemProperty;
+
+/**
+ * 这个服务供远程开始和关闭白名单的功能,解决权限的问题
+ */
+public class WhiteListService extends Service {
+
+
+ public static final String ACTION = "com.ic.action.WHITE_LIST";
+ public static final String KEY_PROP_WHITE_LIST_TRIGGER = "persist.sys.isBlockPhone";
+
+ @Nullable
+ @Override
+ public IBinder onBind(Intent intent) {
+ String action = intent.getAction();
+ ICLogger.d("action is == > " + action);
+ if (ACTION.equals(action)) {
+ return mService;
+ }
+ return null;
+ }
+
+ private IWhiteListTriggerService.Stub mService = new IWhiteListTriggerService.Stub() {
+ @Override
+ public boolean setWhiteListOpen(boolean isOpen, String packageName) {
+ ICLogger.d("remote package is == > " + packageName);
+ try {
+ IcSystemProperty.setSystemProperties(KEY_PROP_WHITE_LIST_TRIGGER, isOpen + "");
+ String result = IcSystemProperty.getSystemProperties(KEY_PROP_WHITE_LIST_TRIGGER, "false");
+ ICLogger.d("result == > " + result);
+ return Boolean.parseBoolean(result);
+ } catch (Exception e) {
+ ICLogger.e("exception == > ", e);
+ }
+ return false;
+ }
+
+ @Override
+ public boolean getCurrentBlockState() {
+ String result = IcSystemProperty.getSystemProperties(KEY_PROP_WHITE_LIST_TRIGGER, "false");
+ return Boolean.parseBoolean(result);
+ }
+ };
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ mService = null;
+ }
+}
<resources>
<!-- Base application theme. -->
- <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+ <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>