@@ -9,7 +9,7 @@ android { | |||
minSdkVersion 26 | |||
targetSdkVersion 30 | |||
versionCode 3 | |||
versionName "A.1.0.6.4_20230904_base" | |||
versionName "A.1.0.6.5_20230908_base" | |||
sourceSets { | |||
main { //这个配置是必须的,如果你的so文件放在了libs/armeabi/下,则下面srcDir = libs即可 | |||
@@ -12,7 +12,7 @@ | |||
"filters": [], | |||
"attributes": [], | |||
"versionCode": 3, | |||
"versionName": "A.1.0.6.4_20230904_base", | |||
"versionName": "A.1.0.6.5_20230908_base", | |||
"outputFile": "app-release.apk" | |||
} | |||
], | |||
@@ -347,6 +347,7 @@ public class MainActivity extends Activity implements DuiUpdateObserver.UpdateCa | |||
if(mWebView.getBackground() != null){ | |||
mWebView.getBackground().setAlpha(0); | |||
} | |||
mWebView.setWebViewClient(); | |||
//声明WebSettings子类 | |||
WebSettings webSettings = mWebView.getSettings(); | |||
@@ -371,37 +372,37 @@ public class MainActivity extends Activity implements DuiUpdateObserver.UpdateCa | |||
webSettings.setDomStorageEnabled(true); | |||
webSettings.setMediaPlaybackRequiresUserGesture(false); | |||
mWebView.loadUrl("http://192.168.137.1"); | |||
mWebView2 = findViewById(R.id.webview2); | |||
mWebView2.setBackgroundColor(0); | |||
if(mWebView2.getBackground() != null){ | |||
mWebView2.getBackground().setAlpha(0); | |||
} | |||
//声明WebSettings子类 | |||
webSettings = mWebView2.getSettings(); | |||
//如果访问的页面中要与Javascript交互,则webview必须设置支持Javascript | |||
webSettings.setJavaScriptEnabled(true); | |||
//设置自适应屏幕,两者合用 | |||
webSettings.setUseWideViewPort(true); //将图片调整到适合webview的大小 | |||
webSettings.setLoadWithOverviewMode(true); // 缩放至屏幕的大小 | |||
//缩放操作 | |||
webSettings.setSupportZoom(true); //支持缩放,默认为true。是下面那个的前提。 | |||
webSettings.setBuiltInZoomControls(true); //设置内置的缩放控件。若为false,则该WebView不可缩放 | |||
webSettings.setDisplayZoomControls(false); //隐藏原生的缩放控件 | |||
//其他细节操作 | |||
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); //关闭webview中缓存 | |||
webSettings.setAllowFileAccess(true); //设置可以访问文件 | |||
webSettings.setJavaScriptCanOpenWindowsAutomatically(true); //支持通过JS打开新窗口 | |||
webSettings.setLoadsImagesAutomatically(true); //支持自动加载图片 | |||
webSettings.setDefaultTextEncodingName("utf-8");//设置编码格式 | |||
webSettings.setDomStorageEnabled(true); | |||
mWebView2.loadUrl("http://192.168.10.244:48089?devId=93c5f6c31a1255cd"); | |||
// mWebView.loadUrl("http://192.168.137.1"); | |||
// | |||
// mWebView2 = findViewById(R.id.webview2); | |||
// mWebView2.setBackgroundColor(0); | |||
// if(mWebView2.getBackground() != null){ | |||
// mWebView2.getBackground().setAlpha(0); | |||
// } | |||
// //声明WebSettings子类 | |||
// webSettings = mWebView2.getSettings(); | |||
// | |||
// //如果访问的页面中要与Javascript交互,则webview必须设置支持Javascript | |||
// webSettings.setJavaScriptEnabled(true); | |||
// | |||
// //设置自适应屏幕,两者合用 | |||
// webSettings.setUseWideViewPort(true); //将图片调整到适合webview的大小 | |||
// webSettings.setLoadWithOverviewMode(true); // 缩放至屏幕的大小 | |||
// | |||
// //缩放操作 | |||
// webSettings.setSupportZoom(true); //支持缩放,默认为true。是下面那个的前提。 | |||
// webSettings.setBuiltInZoomControls(true); //设置内置的缩放控件。若为false,则该WebView不可缩放 | |||
// webSettings.setDisplayZoomControls(false); //隐藏原生的缩放控件 | |||
// | |||
// //其他细节操作 | |||
// webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); //关闭webview中缓存 | |||
// webSettings.setAllowFileAccess(true); //设置可以访问文件 | |||
// webSettings.setJavaScriptCanOpenWindowsAutomatically(true); //支持通过JS打开新窗口 | |||
// webSettings.setLoadsImagesAutomatically(true); //支持自动加载图片 | |||
// webSettings.setDefaultTextEncodingName("utf-8");//设置编码格式 | |||
// webSettings.setDomStorageEnabled(true); | |||
// | |||
// mWebView2.loadUrl("http://192.168.10.244:48089?devId=93c5f6c31a1255cd"); | |||
} | |||
private WebSocketManager mWSManager; | |||
@@ -565,8 +566,6 @@ public class MainActivity extends Activity implements DuiUpdateObserver.UpdateCa | |||
backgroundHandler.post(periodicDetect); | |||
} | |||
private long mUploadInterval = 0; | |||
/** | |||
* 闲聊模式 | |||
*/ | |||
@@ -577,15 +576,6 @@ public class MainActivity extends Activity implements DuiUpdateObserver.UpdateCa | |||
Log.e(TAG, "-----------------detect face----------------"); | |||
textureBitmap = mTextureView.getBitmap(); | |||
if(mUploadInterval == 0){ | |||
mUploadInterval = System.currentTimeMillis(); | |||
} else{ | |||
if(System.currentTimeMillis() - mUploadInterval > 2 * 60 * 1000){ | |||
FaceChatMode.uploadPic(textureBitmap); | |||
mUploadInterval = System.currentTimeMillis(); | |||
} | |||
} | |||
//删除过期人员 | |||
FaceChatMode.deleteExpirePerson(); | |||
List<MultiAtt> results = FaceChatMode.detectMultiAtt(textureBitmap); | |||
@@ -608,10 +598,10 @@ public class MainActivity extends Activity implements DuiUpdateObserver.UpdateCa | |||
FaceChatMode.mInterval = System.currentTimeMillis(); | |||
} | |||
Log.e(TAG, "---------------thread execute over-------------"); | |||
loopDetect(); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
loopDetect(); | |||
} | |||
}; | |||
@@ -73,35 +73,35 @@ public class DuiMessageObserver implements MessageObserver { | |||
Log.e(Tag, display); | |||
Log.e(Tag, nlg); | |||
String readText = nlg; | |||
if (JSONUtils.isJson(display)) { | |||
readText = MessageUtils.sendSkill(sessionId, display, dmInput); | |||
try { | |||
jsonObject.put("nlg", ""); | |||
jsonObject.put("display", ""); | |||
MessageUtils.sendTtsNlpText(readText); | |||
} catch (JSONException e) { | |||
e.printStackTrace(); | |||
} | |||
} else { | |||
try { | |||
jsonObject.put("nlg", ""); | |||
jsonObject.put("display", ""); | |||
MessageUtils.sendTtsNlpText(readText); | |||
} catch (JSONException e) { | |||
e.printStackTrace(); | |||
} | |||
} | |||
// if (JSONUtils.isJson(display)) { | |||
// MessageUtils.sendSkill(sessionId, display, dmInput); | |||
// readText = MessageUtils.sendSkill(sessionId, display, dmInput); | |||
// try { | |||
// jsonObject.put("nlg", ""); | |||
// jsonObject.put("display", ""); | |||
// MessageUtils.sendTtsNlpText(readText); | |||
// } catch (JSONException e) { | |||
// e.printStackTrace(); | |||
// } | |||
// } else { | |||
// MessageUtils.sendNlpResult(sessionId, display, dmInput); | |||
// } | |||
// try { | |||
// jsonObject.put("nlg", ""); | |||
// jsonObject.put("display", ""); | |||
// } catch (JSONException e) { | |||
// e.printStackTrace(); | |||
// try { | |||
// jsonObject.put("nlg", ""); | |||
// jsonObject.put("display", ""); | |||
// MessageUtils.sendTtsNlpText(readText); | |||
// } catch (JSONException e) { | |||
// e.printStackTrace(); | |||
// } | |||
// } | |||
if (JSONUtils.isJson(display)) { | |||
MessageUtils.sendSkill(sessionId, display, dmInput); | |||
} else { | |||
MessageUtils.sendNlpResult(sessionId, display, dmInput); | |||
} | |||
try { | |||
jsonObject.put("nlg", ""); | |||
jsonObject.put("display", ""); | |||
} catch (JSONException e) { | |||
e.printStackTrace(); | |||
} | |||
} | |||
return jsonObject; | |||
} | |||
@@ -34,6 +34,7 @@ import androidx.core.app.ActivityCompat; | |||
import com.aispeech.nativedemo.log.Logger; | |||
import com.aispeech.nativedemo.utils.BitmapUtil; | |||
import com.aispeech.nativedemo.utils.CommandExecution; | |||
import java.nio.ByteBuffer; | |||
import java.util.Arrays; | |||
@@ -88,6 +89,11 @@ public class CameraController implements ICamera{ | |||
@Override | |||
public void onError(@NonNull CameraDevice camera, int error) { | |||
Logger.e("camera error " + error); | |||
if (error == ERROR_MAX_CAMERAS_IN_USE) { | |||
String[] commons = new String[1]; | |||
commons[0] = "reboot"; | |||
CommandExecution.execCommand(commons, true); | |||
} | |||
camera.close(); | |||
} | |||
}; | |||
@@ -9,7 +9,7 @@ public class Config { | |||
public static final String PROD_BASE_URL= "http://123.57.75.177:8080/"; | |||
public static final String TEST_BASE_URL= "http://39.107.77.235:8080/"; | |||
public static final String DEV_BASE_URL= "http://192.168.10.244:8080/"; | |||
public static final String CURRENT_URL= PROD_BASE_URL; | |||
public static final String CURRENT_URL= TEST_BASE_URL; | |||
public static final long ONE_SECOND = 1000L; | |||
public static final long ONE_MINUTE = 60 * ONE_SECOND; | |||
@@ -98,7 +98,7 @@ public class StrangerDbHelper extends IDbHelper<Stranger> { | |||
Cursor cursor = null; | |||
try { | |||
database = DatabaseImpl.getDatabase().getDb(); | |||
cursor = database.rawQuery("select * from new_user_faces where eid = ?", | |||
cursor = database.rawQuery("select * from new_user_faces where user_id = ?", | |||
new String[]{String.valueOf(stranger.id)}); | |||
return cursor.getCount() > 0; | |||
} catch (Exception e) { | |||
@@ -881,6 +881,7 @@ public class FaceChatMode { | |||
} | |||
} | |||
@Override | |||
public void onFail(String error) { | |||
Log.e(TAG, "sendStrangerToServer onFail: " + error); | |||
@@ -889,6 +890,9 @@ public class FaceChatMode { | |||
} | |||
public static Stranger saveStranger(PersonInfo personInfo) { | |||
if(personInfo.dfeatures == null || personInfo.dfeatures.length != 256){ | |||
return null; | |||
} | |||
long id = System.currentTimeMillis(); | |||
Utils.userNewFaces.put(id + "_1", personInfo.dfeatures); | |||
Stranger stranger = new Stranger(); | |||
@@ -19,7 +19,7 @@ public class MqttConfig { | |||
public static final String ENV_PROD = "/prod"; | |||
public static final String ENV_TEST = "/test"; | |||
public static final String ENV_DEV = "/dev"; | |||
public static final String ENV_CURRENT = ENV_PROD; | |||
public static final String ENV_CURRENT = ENV_TEST; | |||
/** | |||
* 心跳 | |||
@@ -22,18 +22,20 @@ | |||
<WebView | |||
android:id="@+id/webview" | |||
android:layout_width="2160px" | |||
android:layout_height="3840px" /> | |||
android:layout_height="3840px" | |||
android:visibility="gone"/> | |||
<WebView | |||
android:id="@+id/webview2" | |||
android:layout_width="2160px" | |||
android:layout_height="3840px" /> | |||
android:layout_height="3840px" | |||
android:visibility="gone"/> | |||
<com.aispeech.nativedemo.widget.CameraTextureView | |||
android:id="@+id/texture" | |||
android:layout_width="2048px" | |||
android:layout_height="1536px" | |||
app:layout_constraintTop_toBottomOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent"/> | |||