v6.1.2.500
Fix unpairHeadset bug... flag checked wrongly Added logcat build (release with logcat) Added logger service
This commit is contained in:
parent
44e485b442
commit
fda221cd8c
9 changed files with 185 additions and 147 deletions
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
|
@ -35,7 +35,7 @@
|
|||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ android {
|
|||
dimension "HubOne"
|
||||
signingConfig signingConfigs.full
|
||||
versionCode 1
|
||||
versionName VERSION
|
||||
versionName VERSION + " (log)"
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt') \
|
||||
, 'proguard-rules-log-cat.pro'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
-keepattributes SourceFile,LineNumberTable
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.voixtreme.calibrate">
|
||||
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ package com.voixtreme.calibrate;
|
|||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import com.dixitmobile.common.BroadcastParams;
|
||||
import com.dixitmobile.common.Lg;
|
||||
import com.dixitmobile.common.voixtreme.VxtCommon;
|
||||
import com.dixitmobile.common.voixtreme.json.JsonCalibrateSettings;
|
||||
import com.dixitmobile.common.voixtreme.json.JsonMain;
|
||||
|
|
@ -150,7 +150,7 @@ class Configuration {
|
|||
return false;
|
||||
}
|
||||
else if (asrContent.length() == 0) {
|
||||
Log.w(TAG, "ASR configuration file empty: " + asrConfigFile);
|
||||
Lg.w(TAG, "ASR configuration file empty: " + asrConfigFile);
|
||||
}
|
||||
|
||||
mASRLines = randomizeStrings(asrContent, mCalibrateSettings.sequenceMode == SEQUENCE_MODE_RANDOM);
|
||||
|
|
@ -179,12 +179,12 @@ class Configuration {
|
|||
|
||||
String tmp[] = l.split(";", -1);
|
||||
if (tmp.length != 4) {
|
||||
Log.e(TAG, "calibratelist line error: #" + (i+1) + ": " + l);
|
||||
Lg.e(TAG, "calibratelist line error: #" + (i+1) + ": " + l);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tmp[2].trim().isEmpty() || tmp[3].trim().isEmpty()) {
|
||||
Log.w(TAG, "calibratelist line ignored: #" + (i+1) + ": " + l);
|
||||
Lg.w(TAG, "calibratelist line ignored: #" + (i+1) + ": " + l);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -280,6 +280,6 @@ class Configuration {
|
|||
void setStatusAction(String statusAction) {
|
||||
|
||||
this.mStatusAction = statusAction;
|
||||
Log.i(TAG, "eml: statusAction: " + statusAction);
|
||||
Lg.i(TAG, "eml: statusAction: " + statusAction);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.voixtreme.calibrate;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import com.dixitmobile.common.Lg;
|
||||
|
||||
/**
|
||||
* Created by jima on 4/03/17.
|
||||
|
|
@ -39,7 +39,7 @@ class LicensePOSTResponse {
|
|||
}
|
||||
|
||||
if (error != null) {
|
||||
Log.e(TAG, "html parse error: " + html);
|
||||
Lg.e(TAG, "html parse error: " + html);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
|
@ -25,6 +24,7 @@ import com.android.volley.toolbox.StringRequest;
|
|||
import com.android.volley.toolbox.Volley;
|
||||
import com.dixitmobile.common.BroadcastParams;
|
||||
import com.dixitmobile.common.Common;
|
||||
import com.dixitmobile.common.Lg;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
@ -185,7 +185,7 @@ class LicenseRegistration {
|
|||
*/
|
||||
private void registerCleanUp(Dialog dialog) {
|
||||
|
||||
Log.d(TAG, "eml: registerCleanUp() -1");
|
||||
Lg.d(TAG, "eml: registerCleanUp() -1");
|
||||
|
||||
mRegistrationCodeDialog = null;
|
||||
dialog.cancel();
|
||||
|
|
@ -319,10 +319,10 @@ class LicenseRegistration {
|
|||
mProgressBar.setVisibility(ProgressBar.GONE);
|
||||
|
||||
if (error.networkResponse != null) {
|
||||
Log.e(TAG, "html err: " + error.networkResponse.statusCode);
|
||||
Lg.e(TAG, "html err: " + error.networkResponse.statusCode);
|
||||
}
|
||||
Log.e(TAG, "html msg: " + error.getMessage());
|
||||
Log.e(TAG, "html url: " + URL_ACTIVATION_KEY);
|
||||
Lg.e(TAG, "html msg: " + error.getMessage());
|
||||
Lg.e(TAG, "html url: " + URL_ACTIVATION_KEY);
|
||||
|
||||
displayError(mContext.getString(R.string.html_request_error));
|
||||
}
|
||||
|
|
@ -376,10 +376,10 @@ class LicenseRegistration {
|
|||
mProgressBar.setVisibility(ProgressBar.GONE);
|
||||
|
||||
if (error.networkResponse != null) {
|
||||
Log.e(TAG, "html err: " + error.networkResponse.statusCode);
|
||||
Lg.e(TAG, "html err: " + error.networkResponse.statusCode);
|
||||
}
|
||||
Log.e(TAG, "html msg: " + error.getMessage());
|
||||
Log.e(TAG, "html url: " + URL_REG_CODE);
|
||||
Lg.e(TAG, "html msg: " + error.getMessage());
|
||||
Lg.e(TAG, "html url: " + URL_REG_CODE);
|
||||
|
||||
displayError(mContext.getString(R.string.html_request_error));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import android.content.IntentFilter;
|
|||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
|
|
@ -18,6 +17,7 @@ import android.widget.ProgressBar;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.dixitmobile.common.BroadcastParams;
|
||||
import com.dixitmobile.common.Lg;
|
||||
import com.dixitmobile.common.ToastHelper;
|
||||
import com.dixitmobile.common.voixtreme.VxtCommon;
|
||||
import com.dixitmobile.common.voixtreme.json.JsonCalibrateSettings;
|
||||
|
|
@ -171,7 +171,7 @@ public class MainActivity extends Activity {
|
|||
reset(null);
|
||||
|
||||
synchronized (mMessageListLock) {
|
||||
Log.i(TAG, "eml: clearing mSayList");
|
||||
Lg.i(TAG, "eml: clearing mSayList");
|
||||
mSayList.clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -203,7 +203,7 @@ public class MainActivity extends Activity {
|
|||
@Override
|
||||
protected void onPause() {
|
||||
|
||||
Log.i(TAG, "eml: onPause()");
|
||||
Lg.i(TAG, "eml: onPause()");
|
||||
|
||||
mHandler.removeCallbacksAndMessages(null); // This line must come before the sayGoodbye() method
|
||||
sayGoodbye(true);
|
||||
|
|
@ -215,7 +215,7 @@ public class MainActivity extends Activity {
|
|||
@Override
|
||||
protected void onDestroy() {
|
||||
|
||||
Log.i(TAG, "eml: onDestroy()");
|
||||
Lg.i(TAG, "eml: onDestroy()");
|
||||
|
||||
if (mReceiver != null) {
|
||||
unregisterReceiver(mReceiver);
|
||||
|
|
@ -240,14 +240,14 @@ public class MainActivity extends Activity {
|
|||
mPlayPause.setEnabled(false);
|
||||
|
||||
if (mCalibrateSettings.goodbye.trim().isEmpty()) {
|
||||
Log.e(TAG, "eml: goodbye is empty");
|
||||
Lg.e(TAG, "eml: goodbye is empty");
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (reset) {
|
||||
synchronized (mMessageListLock) {
|
||||
Log.i(TAG, "eml: sayGoodBye(): clearing mSayList");
|
||||
Lg.i(TAG, "eml: sayGoodBye(): clearing mSayList");
|
||||
mSayList.clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -292,7 +292,7 @@ public class MainActivity extends Activity {
|
|||
reset(sayData);
|
||||
} else {
|
||||
synchronized (mMessageListLock) {
|
||||
Log.d(TAG, "eml: adding: " + sayData.id + " / " + sayData.text);
|
||||
Lg.d(TAG, "eml: adding: " + sayData.id + " / " + sayData.text);
|
||||
mSayList.add(sayData);
|
||||
}
|
||||
|
||||
|
|
@ -357,27 +357,27 @@ public class MainActivity extends Activity {
|
|||
|
||||
private void speak() {
|
||||
|
||||
Log.i(TAG, "eml: speak() #1");
|
||||
Lg.i(TAG, "eml: speak() #1");
|
||||
|
||||
synchronized (mMessageListLock) {
|
||||
|
||||
if (mSayList.size() == 0) {
|
||||
Log.i(TAG, "eml: speak() #2");
|
||||
Lg.i(TAG, "eml: speak() #2");
|
||||
return;
|
||||
}
|
||||
|
||||
Log.i(TAG, "eml: speak() size: " + mSayList.size());
|
||||
Lg.i(TAG, "eml: speak() size: " + mSayList.size());
|
||||
|
||||
for (SayData data : mSayList) {
|
||||
if (data.active) {
|
||||
Log.i(TAG, "eml: speak() #3: already active: " + data.id + " / " + data.text);
|
||||
Lg.i(TAG, "eml: speak() #3: already active: " + data.id + " / " + data.text);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SayData sayData = mSayList.get(0);
|
||||
sayData.active = true;
|
||||
Log.i(TAG, "eml: speak() activating: " + sayData.id + " / " + sayData.text);
|
||||
Lg.i(TAG, "eml: speak() activating: " + sayData.id + " / " + sayData.text);
|
||||
|
||||
Intent intent = new Intent(BroadcastParams.INTENT_ACTION_VOIXTREME);
|
||||
intent.putExtra(BroadcastParams.EXTRAS_ACTION, BroadcastParams.COMMAND_SPEECH);
|
||||
|
|
@ -399,18 +399,18 @@ public class MainActivity extends Activity {
|
|||
|
||||
SayData sayData = mSayList.removeFirst();
|
||||
if (sayData == null) {
|
||||
Log.e(TAG, "eml: NOTHING TO REMOVE");
|
||||
Lg.e(TAG, "eml: NOTHING TO REMOVE");
|
||||
return;
|
||||
} else {
|
||||
Log.i(TAG, "eml: removing: " + sayData.id + " / " + sayData.text);
|
||||
Lg.i(TAG, "eml: removing: " + sayData.id + " / " + sayData.text);
|
||||
|
||||
if (sayData.terminateWhenDone) {
|
||||
Log.i(TAG, "eml: finishing: " + sayData.id);
|
||||
Lg.i(TAG, "eml: finishing: " + sayData.id);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
else if (sayData.startCalibrating) {
|
||||
Log.i(TAG, "eml: start calibrating: " + sayData.id);
|
||||
Lg.i(TAG, "eml: start calibrating: " + sayData.id);
|
||||
mPlayPause.performClick();
|
||||
return;
|
||||
}
|
||||
|
|
@ -425,12 +425,12 @@ public class MainActivity extends Activity {
|
|||
@Override
|
||||
public void run() {
|
||||
|
||||
Log.w(TAG, "*********************************************************");
|
||||
Log.w(TAG, "*********************************************************");
|
||||
Log.w(TAG, "Waited for " + (SAY_FAIL_SAFE_TIMEOUT/1000)
|
||||
Lg.w(TAG, "*********************************************************");
|
||||
Lg.w(TAG, "*********************************************************");
|
||||
Lg.w(TAG, "Waited for " + (SAY_FAIL_SAFE_TIMEOUT/1000)
|
||||
+ " seconds but never heard back from the voiXtreme engine.");
|
||||
Log.w(TAG, "*********************************************************");
|
||||
Log.w(TAG, "*********************************************************");
|
||||
Lg.w(TAG, "*********************************************************");
|
||||
Lg.w(TAG, "*********************************************************");
|
||||
|
||||
if (!informStatus(VxtCommon.Calibrate.CALIBRATE_STATUS_INTERNAL_ERROR)) {
|
||||
ToastHelper.toastErrorLong(MainActivity.this
|
||||
|
|
@ -448,7 +448,7 @@ public class MainActivity extends Activity {
|
|||
*/
|
||||
private void reset(SayData sayData) {
|
||||
|
||||
Log.v(TAG, "eml: resetting: " + (sayData == null ? "ONLY RESET" : sayData.id));
|
||||
Lg.v(TAG, "eml: resetting: " + (sayData == null ? "ONLY RESET" : sayData.id));
|
||||
|
||||
Intent intent = new Intent(BroadcastParams.INTENT_ACTION_VOIXTREME);
|
||||
intent.putExtra(BroadcastParams.EXTRAS_ACTION, BroadcastParams.COMMAND_SPEECH);
|
||||
|
|
@ -466,7 +466,7 @@ public class MainActivity extends Activity {
|
|||
synchronized (mMessageListLock) {
|
||||
for (SayData data : mSayList) {
|
||||
if (data.active) {
|
||||
Log.w(TAG, "eml: removing object: " + data.id + " / " + data.text);
|
||||
Lg.w(TAG, "eml: removing object: " + data.id + " / " + data.text);
|
||||
mSayList.remove(data);
|
||||
break;
|
||||
}
|
||||
|
|
@ -494,8 +494,8 @@ public class MainActivity extends Activity {
|
|||
return;
|
||||
}
|
||||
|
||||
Log.d(TAG, "received: -------------------------------------------");
|
||||
Log.d(TAG, "received: ACTION: " + intent.getAction());
|
||||
Lg.d(TAG, "received: -------------------------------------------");
|
||||
Lg.d(TAG, "received: ACTION: " + intent.getAction());
|
||||
|
||||
Bundle bundle = intent.getExtras();
|
||||
int reliability = bundle.getInt(BroadcastParams.EXTRAS_RELIABILITY, 0);
|
||||
|
|
@ -505,13 +505,13 @@ public class MainActivity extends Activity {
|
|||
String text = bundle.getString(BroadcastParams.EXTRAS_TEXT, "");
|
||||
|
||||
if (command != MY_COMMAND_EVENT) {
|
||||
Log.d(TAG, "received: COMMAND: " + bundle.getInt(BroadcastParams.EXTRAS_ACTION, -1));
|
||||
Log.d(TAG, "received: TEXT: " + text);
|
||||
Log.d(TAG, "received: ID: " + id);
|
||||
Log.d(TAG, "received: VOICES: " + bundle.getString(BroadcastParams.EXTRAS_VOICES, "nada"));
|
||||
Log.d(TAG, "received: COMMAND_SPEECH: " + bundle.getInt("COMMAND_SPEECH", -1));
|
||||
Log.d(TAG, "received: ASR_STATE: " + asrState);
|
||||
Log.d(TAG, "received: RELIABILITY: " + reliability);
|
||||
Lg.d(TAG, "received: COMMAND: " + bundle.getInt(BroadcastParams.EXTRAS_ACTION, -1));
|
||||
Lg.d(TAG, "received: TEXT: " + text);
|
||||
Lg.d(TAG, "received: ID: " + id);
|
||||
Lg.d(TAG, "received: VOICES: " + bundle.getString(BroadcastParams.EXTRAS_VOICES, "nada"));
|
||||
Lg.d(TAG, "received: COMMAND_SPEECH: " + bundle.getInt("COMMAND_SPEECH", -1));
|
||||
Lg.d(TAG, "received: ASR_STATE: " + asrState);
|
||||
Lg.d(TAG, "received: RELIABILITY: " + reliability);
|
||||
}
|
||||
|
||||
SayData sayData = null;
|
||||
|
|
@ -534,14 +534,14 @@ public class MainActivity extends Activity {
|
|||
return;
|
||||
}
|
||||
|
||||
Log.d(TAG, "removing callbacks to: runnableSayFailSafe");
|
||||
Lg.d(TAG, "removing callbacks to: runnableSayFailSafe");
|
||||
mHandler.removeCallbacks(runnableSayFailSafe);
|
||||
|
||||
/*
|
||||
* SAY finished (no input)
|
||||
*/
|
||||
if (command == BroadcastParams.COMMAND_SPEECH && reliability == 0 && text.isEmpty()) {
|
||||
Log.w(TAG, "eml: receiver: command = 3 and reliability = 0 && text = empty: " + sayData.id + " / " + id);
|
||||
Lg.w(TAG, "eml: receiver: command = 3 and reliability = 0 && text = empty: " + sayData.id + " / " + id);
|
||||
|
||||
if (sayData.startCalibrating) {
|
||||
mPlayPause.setEnabled(true);
|
||||
|
|
@ -555,10 +555,10 @@ public class MainActivity extends Activity {
|
|||
* SAY with INPUT
|
||||
*/
|
||||
if (command == 3) {
|
||||
Log.w(TAG, "eml: receiver: command = 3 and mCommand != null");
|
||||
Lg.w(TAG, "eml: receiver: command = 3 and mCommand != null");
|
||||
mResult.setText(text + " (" + reliability + ")");
|
||||
|
||||
Log.i(TAG, "eml: comparing: " + text + " / " + sayData.validateText);
|
||||
Lg.i(TAG, "eml: comparing: " + text + " / " + sayData.validateText);
|
||||
if (!text.equals(sayData.validateText)) {
|
||||
mStatus.setImageResource(R.drawable.ic_sphere_red);
|
||||
|
||||
|
|
@ -597,7 +597,7 @@ public class MainActivity extends Activity {
|
|||
}
|
||||
|
||||
if (command == MY_COMMAND_EVENT) {
|
||||
Log.w(TAG, "eml: receiver: command = 4 (icon update)");
|
||||
Lg.w(TAG, "eml: receiver: command = 4 (icon update)");
|
||||
|
||||
switch (asrState) {
|
||||
case 0: // NOL (NO Listen X)
|
||||
|
|
@ -632,7 +632,7 @@ public class MainActivity extends Activity {
|
|||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
Log.d(TAG, "Pressed BACK key");
|
||||
Lg.d(TAG, "Pressed BACK key");
|
||||
|
||||
// fail safe
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
|
|
@ -660,7 +660,7 @@ public class MainActivity extends Activity {
|
|||
*/
|
||||
private boolean informStatus(int status) {
|
||||
|
||||
Log.v(TAG, "Sending status: " + status);
|
||||
Lg.v(TAG, "Sending status: " + status);
|
||||
|
||||
if (mConfig.hasStatusPackage()) {
|
||||
Intent intent = new Intent(mConfig.getStatusPackage());
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import android.preference.PreferenceManager;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
|
|
@ -83,8 +82,10 @@ import java.util.List;
|
|||
public class StartupActivity extends Activity {
|
||||
private static final String TAG = "StartupActivity";
|
||||
|
||||
private static final int MAX_PING = 16; // Desired value +1
|
||||
private static final int PING_DELAY = 913;
|
||||
private static final int MAX_PING = 15+1; // Desired value +1
|
||||
private static final int PING_DELAY = 913;
|
||||
private static final int FORCE_BACK_KEY_TIMEOUT = 2511;
|
||||
private static final int FORCE_BACK_KEY_PRESSES = 5;
|
||||
|
||||
private Handler mHandler = new Handler(Looper.getMainLooper());
|
||||
private VoiXtremeStartupReceiver mReceiver;
|
||||
|
|
@ -108,6 +109,8 @@ public class StartupActivity extends Activity {
|
|||
private String mNFCHeadsetMAC;
|
||||
private boolean mBluetoothHeadsetRequested;
|
||||
private boolean mKillVxtEngine;
|
||||
private long mBackKeyTimeout;
|
||||
private int mBackKeyPresses;
|
||||
|
||||
private Configuration mConfig;
|
||||
private VerifyPermissions mVerifyPermissions;
|
||||
|
|
@ -126,7 +129,7 @@ public class StartupActivity extends Activity {
|
|||
super.onCreate(savedInstanceState);
|
||||
|
||||
android.content.res.Configuration androidConfig = getResources().getConfiguration();
|
||||
Log.d(TAG, "eml: sw: " + androidConfig.smallestScreenWidthDp);
|
||||
Lg.d(TAG, "eml: sw: " + androidConfig.smallestScreenWidthDp);
|
||||
|
||||
mStopApp = true;
|
||||
mTimeoutRunnable = null;
|
||||
|
|
@ -134,14 +137,29 @@ public class StartupActivity extends Activity {
|
|||
mCopyOBB = false;
|
||||
mBluetoothHeadsetRequested = false;
|
||||
mKillVxtEngine = false;
|
||||
mBackKeyTimeout = 0;
|
||||
mBackKeyPresses = 0;
|
||||
|
||||
mVerifyPermissions = new VerifyPermissions(this);
|
||||
mVerifyPermissions.addPermission(Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
mVerifyPermissions.addPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
if (mVerifyPermissions.checkPermissions()) {
|
||||
startLoggerService();
|
||||
startApplication();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the NextLog Service
|
||||
*/
|
||||
private void startLoggerService() {
|
||||
|
||||
final LoggerService.LogNextTypes logType = LoggerService.LogNextTypes.CALIBRATE;
|
||||
final LoggerService.LogNextMode logMode = (BuildConfig.DEBUG ? LoggerService.LogNextMode.LOGCAT_ONLY
|
||||
: LoggerService.LogNextMode.NONE);
|
||||
|
||||
LoggerService.startLoggerService(getApplicationContext(), logType, logMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* If phone orientation is wrong we switch to the correct one and re-starts the application,
|
||||
* otherwise we start the application
|
||||
|
|
@ -151,6 +169,7 @@ public class StartupActivity extends Activity {
|
|||
/*
|
||||
* Make sure the VoiXtreme engine is turned off
|
||||
*/
|
||||
Lg.e(TAG, "eml: CALLING terminateVoiXtremeService(): COMMAND_FINALIZE ----> #1");
|
||||
terminateVoiXtremeService(true);
|
||||
|
||||
mKillVxtEngine = true;
|
||||
|
|
@ -247,13 +266,14 @@ public class StartupActivity extends Activity {
|
|||
@Override
|
||||
public void run() {
|
||||
|
||||
Log.i(TAG, "sending: COMMAND_VERIFY_INPUT_TYPE");
|
||||
Lg.i(TAG, "sending: COMMAND_VERIFY_INPUT_TYPE");
|
||||
|
||||
Intent intent = new Intent(BroadcastParams.INTENT_ACTION_VOIXTREME);
|
||||
intent.putExtra(BroadcastParams.EXTRAS_ACTION, BroadcastParams.COMMAND_VERIFY_INPUT_TYPE);
|
||||
intent.putExtra(BroadcastParams.EXTRAS_DATA, mConfig.getInputType());
|
||||
intent.putExtra(BroadcastParams.EXTRAS_RESPONSE_ACTION, BroadcastParams.INTENT_ACTION_RESPONSE);
|
||||
Log.w(TAG, "eml: send: COMMAND_VERIFY_INPUT_TYPE");
|
||||
|
||||
Lg.w(TAG, "eml: send: COMMAND_VERIFY_INPUT_TYPE");
|
||||
sendBroadcast(intent);
|
||||
}
|
||||
}, 3500);
|
||||
|
|
@ -261,7 +281,7 @@ public class StartupActivity extends Activity {
|
|||
|
||||
private void terminateVoiXtremeService(boolean sleep) {
|
||||
|
||||
Log.i(TAG, "eml: terminateVoiXtremeService(): COMMAND_FINALIZE");
|
||||
Lg.e(TAG, "eml: terminateVoiXtremeService(): COMMAND_FINALIZE");
|
||||
|
||||
Intent intent = new Intent(BroadcastParams.INTENT_ACTION_VOIXTREME);
|
||||
intent.putExtra(BroadcastParams.EXTRAS_ACTION, BroadcastParams.COMMAND_FINALIZE);
|
||||
|
|
@ -269,12 +289,8 @@ public class StartupActivity extends Activity {
|
|||
sendBroadcast(intent);
|
||||
|
||||
if (sleep) {
|
||||
try {
|
||||
Thread.sleep(513);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
Common.sleep(513);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void requestLicenseCode() {
|
||||
|
|
@ -282,7 +298,7 @@ public class StartupActivity extends Activity {
|
|||
Intent intent = new Intent(BroadcastParams.INTENT_ACTION_VOIXTREME);
|
||||
intent.putExtra(BroadcastParams.EXTRAS_ACTION, BroadcastParams.COMMAND_VERIFY_LICENSE);
|
||||
intent.putExtra(BroadcastParams.EXTRAS_RESPONSE_ACTION, BroadcastParams.INTENT_ACTION_RESPONSE);
|
||||
Log.w(TAG, "eml: send: COMMAND_VERIFY_LICENSE");
|
||||
Lg.w(TAG, "eml: send: COMMAND_VERIFY_LICENSE");
|
||||
sendBroadcast(intent);
|
||||
}
|
||||
|
||||
|
|
@ -291,7 +307,7 @@ public class StartupActivity extends Activity {
|
|||
Intent intent = new Intent(BroadcastParams.INTENT_ACTION_VOIXTREME);
|
||||
intent.putExtra(BroadcastParams.EXTRAS_ACTION, BroadcastParams.COMMAND_INITIALIZE_ASR);
|
||||
intent.putExtra(BroadcastParams.EXTRAS_RESPONSE_ACTION, BroadcastParams.INTENT_ACTION_RESPONSE);
|
||||
Log.w(TAG, "eml: send: COMMAND_INITIALIZE_ASR");
|
||||
Lg.w(TAG, "eml: send: COMMAND_INITIALIZE_ASR");
|
||||
sendBroadcast(intent);
|
||||
|
||||
updateStatus(getString(R.string.status_init_asr));
|
||||
|
|
@ -303,10 +319,12 @@ public class StartupActivity extends Activity {
|
|||
@Override
|
||||
public void run() {
|
||||
if (mCopyOBB) {
|
||||
Log.i(TAG, "eml: copying/copied obb, removing fail safe");
|
||||
Lg.i(TAG, "eml: copying/copied obb, removing fail safe");
|
||||
return;
|
||||
}
|
||||
|
||||
Lg.e(TAG, "eml: error_no_engine #1");
|
||||
unpairHeadsets(true);
|
||||
showErrorMessage(R.string.error_no_engine, true
|
||||
, VxtCommon.Calibrate.CALIBRATE_STATUS_VOIXTREME_SERVICE_MISSING);
|
||||
}
|
||||
|
|
@ -338,7 +356,7 @@ public class StartupActivity extends Activity {
|
|||
intent.putExtra(BroadcastParams.EXTRAS_ACTION, BroadcastParams.COMMAND_INITIALIZE_TTS);
|
||||
intent.putExtra(BroadcastParams.EXTRAS_RESPONSE_ACTION, BroadcastParams.INTENT_ACTION_RESPONSE);
|
||||
intent.putExtra(BroadcastParams.EXTRAS_VOICES, voiceToUse);
|
||||
Log.w(TAG, "eml: send: COMMAND_INITIALIZE_TTS");
|
||||
Lg.w(TAG, "eml: send: COMMAND_INITIALIZE_TTS");
|
||||
sendBroadcast(intent);
|
||||
}
|
||||
|
||||
|
|
@ -350,6 +368,8 @@ public class StartupActivity extends Activity {
|
|||
public void run() {
|
||||
|
||||
if (informStatus(VxtCommon.Calibrate.CALIBRATE_STATUS_VOIXTREME_SERVICE_MISSING)) {
|
||||
Lg.e(TAG, "eml: error_no_engine #2");
|
||||
unpairHeadsets(true);
|
||||
showErrorMessage(R.string.error_no_engine, true);
|
||||
} else {
|
||||
finish();
|
||||
|
|
@ -363,10 +383,10 @@ public class StartupActivity extends Activity {
|
|||
@Override
|
||||
protected void onPause() {
|
||||
|
||||
Log.v(TAG, "eml: onPause()");
|
||||
Lg.v(TAG, "eml: onPause()");
|
||||
|
||||
if (mReceiver != null) {
|
||||
Log.d(TAG, "eml: un-registering broadcast receiver");
|
||||
Lg.d(TAG, "eml: un-registering broadcast receiver");
|
||||
unregisterReceiver(mReceiver);
|
||||
mReceiver = null;
|
||||
}
|
||||
|
|
@ -379,13 +399,14 @@ public class StartupActivity extends Activity {
|
|||
@Override
|
||||
protected void onResume() {
|
||||
|
||||
Log.v(TAG, "eml: onResume()");
|
||||
Lg.v(TAG, "eml: onResume()");
|
||||
super.onResume();
|
||||
|
||||
if (!mStopApp && mReceiver == null) {
|
||||
// if (!mStopApp && mReceiver == null) {
|
||||
if (mReceiver == null) {
|
||||
mReceiver = new VoiXtremeStartupReceiver();
|
||||
IntentFilter intentFilter = new IntentFilter(BroadcastParams.INTENT_ACTION_RESPONSE);
|
||||
Log.d(TAG, "eml: registering broadcast receiver #1");
|
||||
Lg.d(TAG, "eml: registering broadcast receiver #1");
|
||||
registerReceiver(mReceiver, intentFilter);
|
||||
}
|
||||
|
||||
|
|
@ -402,14 +423,14 @@ public class StartupActivity extends Activity {
|
|||
|
||||
beepTest();
|
||||
}
|
||||
}, 3000);
|
||||
}, 5999); //jima 2999
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
|
||||
Log.v(TAG, "eml: onStop()");
|
||||
Lg.v(TAG, "eml: onStop()");
|
||||
|
||||
if (mStopApp) {
|
||||
finish();
|
||||
|
|
@ -450,13 +471,13 @@ public class StartupActivity extends Activity {
|
|||
int command = bundle.getInt(BroadcastParams.EXTRAS_ACTION, -1);
|
||||
String voices = bundle.getString(BroadcastParams.EXTRAS_VOICES);
|
||||
String data = bundle.getString(BroadcastParams.EXTRAS_DATA);
|
||||
Log.i(TAG, "received: COMMAND: " + command);
|
||||
Log.i(TAG, "received: TEXT: " + bundle.getString(BroadcastParams.EXTRAS_TEXT));
|
||||
Log.i(TAG, "received: VOICES: " + voices);
|
||||
Log.i(TAG, "received: DATA: " + data);
|
||||
Lg.i(TAG, "received: COMMAND: " + command);
|
||||
Lg.i(TAG, "received: TEXT: " + bundle.getString(BroadcastParams.EXTRAS_TEXT));
|
||||
Lg.i(TAG, "received: VOICES: " + voices);
|
||||
Lg.i(TAG, "received: DATA: " + data);
|
||||
|
||||
if (command == BroadcastParams.COMMAND_PING) {
|
||||
Log.e(TAG, "eml: command: COMMAND_PING");
|
||||
Lg.e(TAG, "eml: command: COMMAND_PING");
|
||||
if (!mPingOK) {
|
||||
mPingOK = true;
|
||||
requestLicenseCode();
|
||||
|
|
@ -466,22 +487,22 @@ public class StartupActivity extends Activity {
|
|||
}
|
||||
|
||||
if (command == BroadcastParams.COMMAND_VERIFY_LICENSE) {
|
||||
Log.e(TAG, "eml: command: COMMAND_VERIFY_LICENSE");
|
||||
Lg.e(TAG, "eml: command: COMMAND_VERIFY_LICENSE");
|
||||
verifyLicense(data);
|
||||
mASREngine = intent.getIntExtra(BroadcastParams.EXTRAS_ASR_ENGINE
|
||||
, BroadcastParams.ASR_ENGINE_NUANCE);
|
||||
}
|
||||
|
||||
if (command == BroadcastParams.COMMAND_REGISTER_LICENSE) {
|
||||
Log.e(TAG, "eml: command: COMMAND_REGISTER_LICENSE");
|
||||
Lg.e(TAG, "eml: command: COMMAND_REGISTER_LICENSE");
|
||||
checkRegistrationStatus(bundle.getBoolean(BroadcastParams.EXTRAS_DATA, false));
|
||||
return;
|
||||
}
|
||||
|
||||
if (command == BroadcastParams.COMMAND_VERIFY_INPUT_TYPE) {
|
||||
Log.e(TAG, "eml: command: COMMAND_VERIFY_INPUT_TYPE");
|
||||
Lg.e(TAG, "eml: command: COMMAND_VERIFY_INPUT_TYPE");
|
||||
if (data != null && data.equals("fail")) {
|
||||
Log.i(TAG, "got input info: fail");
|
||||
Lg.i(TAG, "got input info: fail");
|
||||
showErrorInputDevice();
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
|
|
@ -491,8 +512,8 @@ public class StartupActivity extends Activity {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
Log.i(TAG, "got input info: ok");
|
||||
unpairHeadsets();
|
||||
Lg.i(TAG, "got input info: ok");
|
||||
unpairHeadsets(false);
|
||||
initializeVoiXtremeEngine();
|
||||
}
|
||||
|
||||
|
|
@ -503,7 +524,7 @@ public class StartupActivity extends Activity {
|
|||
* Response from the voiXtreme service when the Initialize TTS has finished speaking
|
||||
*/
|
||||
if (command == BroadcastParams.COMMAND_INITIALIZE_TTS) {
|
||||
Log.e(TAG, "eml: command: COMMAND_INITIALIZE_TTS");
|
||||
Lg.e(TAG, "eml: command: COMMAND_INITIALIZE_TTS");
|
||||
mHandler.removeCallbacksAndMessages(null);
|
||||
|
||||
final boolean skipCalibrate = mConfig.getCalibrateSettings().targetOK == 0;
|
||||
|
|
@ -514,7 +535,7 @@ public class StartupActivity extends Activity {
|
|||
startActivity(startupIntent);
|
||||
} else {
|
||||
if (skipCalibrate) {
|
||||
Log.w(TAG, "eml: TargetOK = 0, skipping calibrate");
|
||||
Lg.w(TAG, "eml: TargetOK = 0, skipping calibrate");
|
||||
}
|
||||
|
||||
informStatus(VxtCommon.Calibrate.CALIBRATE_STATUS_TERMINATED);
|
||||
|
|
@ -536,13 +557,13 @@ public class StartupActivity extends Activity {
|
|||
}
|
||||
|
||||
if (command == BroadcastParams.COMMAND_START_OBB_COPY) {
|
||||
Log.i(TAG, "eml: COMMAND_START_OBB_COPY");
|
||||
Lg.i(TAG, "eml: COMMAND_START_OBB_COPY");
|
||||
updateStatus(getString(R.string.status_updating_obb));
|
||||
mCopyOBB = true;
|
||||
}
|
||||
|
||||
if (command == BroadcastParams.COMMAND_FINISHED_OBB_COPY) {
|
||||
Log.i(TAG, "eml: COMMAND_FINISHED_OBB_COPY");
|
||||
Lg.i(TAG, "eml: COMMAND_FINISHED_OBB_COPY");
|
||||
updateStatus("");
|
||||
}
|
||||
|
||||
|
|
@ -550,7 +571,7 @@ public class StartupActivity extends Activity {
|
|||
* What voices are available for the user to choose from
|
||||
*/
|
||||
if (command == BroadcastParams.COMMAND_INITIALIZE_ASR) {
|
||||
Log.e(TAG, "eml: command: COMMAND_INITIALIZE_ASR");
|
||||
Lg.e(TAG, "eml: command: COMMAND_INITIALIZE_ASR");
|
||||
mHandler.removeCallbacksAndMessages(null);
|
||||
|
||||
if (voices == null || voices.trim().isEmpty()) {
|
||||
|
|
@ -559,14 +580,14 @@ public class StartupActivity extends Activity {
|
|||
/*
|
||||
* If there is only one choice we start the activity straight away
|
||||
*/
|
||||
Log.i(TAG, "eml: init asr #1");
|
||||
Lg.i(TAG, "eml: init asr #1");
|
||||
if (!fillListView(bundle.getString(BroadcastParams.EXTRAS_VOICES))) {
|
||||
Log.i(TAG, "eml: init asr #2");
|
||||
Lg.i(TAG, "eml: init asr #2");
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Log.i(TAG, "eml: init asr #3");
|
||||
Lg.i(TAG, "eml: init asr #3");
|
||||
prepareStartMainActivity(bundle.getString(BroadcastParams.EXTRAS_VOICES));
|
||||
}
|
||||
}, 1000);
|
||||
|
|
@ -579,32 +600,36 @@ public class StartupActivity extends Activity {
|
|||
/**
|
||||
* Unpair all headsets except the last used one
|
||||
*/
|
||||
private void unpairHeadsets() {
|
||||
private void unpairHeadsets(boolean forceUnpairAll) {
|
||||
|
||||
JsonMicrophone microphone = mConfig.getMicrophoneSettings();
|
||||
if (!mBluetoothHeadsetRequested || (microphone == null || !microphone.bluetooth.unpairAll)) {
|
||||
Log.i(TAG, "eml: unpairHeadsets(): FALSE");
|
||||
if (!forceUnpairAll && (!mBluetoothHeadsetRequested
|
||||
|| (microphone == null || !microphone.bluetooth.unpairAll))) {
|
||||
|
||||
Lg.i(TAG, "eml: unpairHeadsets(): FALSE");
|
||||
return;
|
||||
}
|
||||
|
||||
Lg.d(TAG, "eml: unpairHeadsets(): forceUnpairAll: " + forceUnpairAll);
|
||||
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
String lastMAC = sp.getString("lastMAC", "#eml#");
|
||||
BluetoothDevice currentDevice = null;
|
||||
|
||||
Log.d(TAG, "eml: unpairHeadsets(): #1: " + lastMAC);
|
||||
Lg.d(TAG, "eml: unpairHeadsets(): #1: " + lastMAC);
|
||||
ArrayList<BluetoothDevice> devs = new ArrayList<>();
|
||||
|
||||
for (BluetoothDevice device : BluetoothAdapter.getDefaultAdapter().getBondedDevices()) {
|
||||
if (BluetoothHelper.isMajorHeadset(device)) {
|
||||
if (currentDevice == null || BluetoothHelper.isConnected(device)) {
|
||||
currentDevice = device;
|
||||
Log.i(TAG, "eml: unpairHeadsets(): NEW headset: " + currentDevice.getAddress()
|
||||
Lg.i(TAG, "eml: unpairHeadsets(): NEW headset: " + currentDevice.getAddress()
|
||||
+ " ///: " + currentDevice.getName());
|
||||
}
|
||||
|
||||
devs.add(device);
|
||||
} else {
|
||||
Log.i(TAG, "not headset: device ignored: " + device.getAddress()
|
||||
Lg.i(TAG, "not headset: device ignored: " + device.getAddress()
|
||||
+ " ///: " + device.getName());
|
||||
}
|
||||
}
|
||||
|
|
@ -614,16 +639,16 @@ public class StartupActivity extends Activity {
|
|||
}
|
||||
|
||||
for (BluetoothDevice device : devs) {
|
||||
if (!device.getAddress().equals(lastMAC)) {
|
||||
BluetoothHelper.unpairDevice(device);
|
||||
Log.d(TAG, "eml: unpairHeadsets(): unpairing: " + device.getAddress());
|
||||
if (forceUnpairAll || !device.getAddress().equals(lastMAC)) {
|
||||
BluetoothHelper.unpairDevice(device);
|
||||
Lg.d(TAG, "eml: unpairHeadsets(): unpairing: " + device.getAddress());
|
||||
}
|
||||
}
|
||||
|
||||
if (currentDevice == null) {
|
||||
Log.d(TAG, "eml: unpairHeadsets(): #2: current MAC empty, not saving");
|
||||
Lg.d(TAG, "eml: unpairHeadsets(): #2: current MAC empty, not saving");
|
||||
} else {
|
||||
Log.d(TAG, "eml: unpairHeadsets(): #2: saving current MAC: " + currentDevice.getAddress());
|
||||
Lg.d(TAG, "eml: unpairHeadsets(): #2: saving current MAC: " + currentDevice.getAddress());
|
||||
sp.edit().putString("lastMAC", currentDevice.getAddress()).apply();
|
||||
}
|
||||
}
|
||||
|
|
@ -644,7 +669,7 @@ public class StartupActivity extends Activity {
|
|||
};
|
||||
|
||||
|
||||
Log.w(TAG, "eml: showing dialog #13");
|
||||
Lg.w(TAG, "eml: showing dialog #13");
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage(getString(R.string.error_no_voices))
|
||||
|
|
@ -668,7 +693,7 @@ public class StartupActivity extends Activity {
|
|||
showRegistrationView(arr[1]);
|
||||
return;
|
||||
} else if (arr.length == 3 && !arr[0].trim().isEmpty() && !arr[2].trim().isEmpty()) {
|
||||
Log.i(TAG, "waiting...");
|
||||
Lg.i(TAG, "waiting...");
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
@ -680,7 +705,7 @@ public class StartupActivity extends Activity {
|
|||
}
|
||||
}
|
||||
|
||||
Log.e(TAG, "license error");
|
||||
Lg.e(TAG, "license error");
|
||||
finish();
|
||||
}
|
||||
|
||||
|
|
@ -714,7 +739,7 @@ public class StartupActivity extends Activity {
|
|||
*/
|
||||
private boolean fillListView(String voices) {
|
||||
|
||||
Log.i(TAG, "eml: fillListView: " + voices);
|
||||
Lg.i(TAG, "eml: fillListView: " + voices);
|
||||
|
||||
if (voices == null) {
|
||||
return false;
|
||||
|
|
@ -833,7 +858,16 @@ public class StartupActivity extends Activity {
|
|||
|
||||
if (mConfig.getInputType() == BroadcastParams.INPUT_TYPE_BLUETOOTH
|
||||
|| mConfig.getInputType() == BroadcastParams.INPUT_TYPE_NFC) {
|
||||
beepTest();
|
||||
|
||||
// If we enter directly, lets give some time for the headset to re-connect if any.
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
beepTest();
|
||||
}
|
||||
}, 3111);
|
||||
} else {
|
||||
verifyInputConnection();
|
||||
}
|
||||
|
|
@ -869,7 +903,7 @@ public class StartupActivity extends Activity {
|
|||
verifyInputConnection();
|
||||
}
|
||||
else if (type.equals(getString(R.string.input_type_wireless))) {
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION); //jima
|
||||
mConfig.setInputType(BroadcastParams.INPUT_TYPE_BLUETOOTH);
|
||||
beepTest();
|
||||
}
|
||||
|
|
@ -894,6 +928,9 @@ public class StartupActivity extends Activity {
|
|||
private void beepTest() {
|
||||
|
||||
mBluetoothHeadsetRequested = true;
|
||||
if (!BluetoothAdapter.getDefaultAdapter().isEnabled()) {
|
||||
BluetoothAdapter.getDefaultAdapter().enable();
|
||||
}
|
||||
|
||||
DialogInterface.OnClickListener dialogClickListener;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
|
|
@ -910,7 +947,7 @@ public class StartupActivity extends Activity {
|
|||
return;
|
||||
} else {
|
||||
if (Build.MODEL.equals("TC51") && Build.MANUFACTURER.equals("Zebra Technologies")) {
|
||||
Log.w(TAG, "eml: Zebra TC51 found...");
|
||||
Lg.w(TAG, "eml: Zebra TC51 found...");
|
||||
} else {
|
||||
checkHeadsetStatus();
|
||||
return;
|
||||
|
|
@ -948,7 +985,7 @@ public class StartupActivity extends Activity {
|
|||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Log.w(TAG, "eml: showing dialog #5");
|
||||
Lg.w(TAG, "eml: showing dialog #5");
|
||||
|
||||
builder.setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.yes), dialogClickListener)
|
||||
|
|
@ -985,7 +1022,7 @@ public class StartupActivity extends Activity {
|
|||
public void run() {
|
||||
|
||||
if (!receiver.gotResponse) {
|
||||
Log.e(TAG, "eml: checkHeadsetStatus() timeout");
|
||||
Lg.e(TAG, "eml: checkHeadsetStatus() timeout");
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
openBTPairing();
|
||||
}
|
||||
|
|
@ -1053,7 +1090,7 @@ public class StartupActivity extends Activity {
|
|||
}
|
||||
};
|
||||
|
||||
Log.w(TAG, "eml: showing dialog #3");
|
||||
Lg.w(TAG, "eml: showing dialog #3");
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage(getString(R.string.no_nfc))
|
||||
|
|
@ -1086,7 +1123,7 @@ public class StartupActivity extends Activity {
|
|||
break;
|
||||
|
||||
default:
|
||||
Log.e(TAG, "wrong input type: " + mConfig.getInputType());
|
||||
Lg.e(TAG, "wrong input type: " + mConfig.getInputType());
|
||||
ToastHelper.toastErrorLong(this, R.string.error_internal);
|
||||
finish();
|
||||
break;
|
||||
|
|
@ -1124,7 +1161,7 @@ public class StartupActivity extends Activity {
|
|||
};
|
||||
|
||||
|
||||
Log.w(TAG, "eml: showing dialog #4");
|
||||
Lg.w(TAG, "eml: showing dialog #4");
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage(getString(R.string.error_no_headset))
|
||||
|
|
@ -1149,6 +1186,7 @@ public class StartupActivity extends Activity {
|
|||
switch (which) {
|
||||
case DialogInterface.BUTTON_POSITIVE:
|
||||
mShowingInputErrorDialog = false;
|
||||
Lg.e(TAG, "eml: CALLING terminateVoiXtremeService(): COMMAND_FINALIZE ----> #2");
|
||||
terminateVoiXtremeService(true);
|
||||
mProgressBar.setVisibility(ProgressBar.VISIBLE);
|
||||
|
||||
|
|
@ -1180,7 +1218,7 @@ public class StartupActivity extends Activity {
|
|||
}
|
||||
};
|
||||
|
||||
Log.w(TAG, "eml: showing dialog #2");
|
||||
Lg.w(TAG, "eml: showing dialog #2");
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage(getString(R.string.error_no_bt_sco))
|
||||
|
|
@ -1215,7 +1253,7 @@ public class StartupActivity extends Activity {
|
|||
}
|
||||
};
|
||||
|
||||
Log.w(TAG, "eml: showing dialog #1");
|
||||
Lg.w(TAG, "eml: showing dialog #1");
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage(getString(R.string.restart_headset_msg))
|
||||
|
|
@ -1305,10 +1343,10 @@ public class StartupActivity extends Activity {
|
|||
}
|
||||
}
|
||||
|
||||
Log.w(TAG, "eml: IntentScanner Package: " + pkg);
|
||||
Log.w(TAG, "eml: IntentScanner Extra: " + extra);
|
||||
Log.w(TAG, "eml: IntentScanner HasCategory: " + hasCategory);
|
||||
Log.w(TAG, "eml: IntentScanner Category: " + category);
|
||||
Lg.w(TAG, "eml: IntentScanner Package: " + pkg);
|
||||
Lg.w(TAG, "eml: IntentScanner Extra: " + extra);
|
||||
Lg.w(TAG, "eml: IntentScanner HasCategory: " + hasCategory);
|
||||
Lg.w(TAG, "eml: IntentScanner Category: " + category);
|
||||
|
||||
intent.putExtra(BroadcastParams.EXTRAS_PACKAGE, pkg);
|
||||
intent.putExtra(BroadcastParams.EXTRAS_DATA, extra);
|
||||
|
|
@ -1324,17 +1362,6 @@ public class StartupActivity extends Activity {
|
|||
*/
|
||||
private void startVoiXtremeService(boolean pingServer) {
|
||||
|
||||
/*
|
||||
* We need to be able to receive messages from the voiXtreme service
|
||||
*/
|
||||
Log.d(TAG, "eml: registering broadcast receiver #2.1");
|
||||
if (mReceiver == null) {
|
||||
mReceiver = new VoiXtremeStartupReceiver();
|
||||
IntentFilter intentFilter = new IntentFilter(BroadcastParams.INTENT_ACTION_RESPONSE);
|
||||
Log.d(TAG, "eml: registering broadcast receiver #2.2");
|
||||
registerReceiver(mReceiver, intentFilter);
|
||||
}
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName(Configuration.VOIXTREME_PACKAGE_NAME, Configuration.VOIXTREME_SERVICE_NAME);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
|
@ -1361,13 +1388,13 @@ public class StartupActivity extends Activity {
|
|||
Intent intent = new Intent(BroadcastParams.INTENT_ACTION_VOIXTREME);
|
||||
intent.putExtra(BroadcastParams.EXTRAS_ACTION, BroadcastParams.COMMAND_PING);
|
||||
intent.putExtra(BroadcastParams.EXTRAS_RESPONSE_ACTION, BroadcastParams.INTENT_ACTION_RESPONSE);
|
||||
Log.w(TAG, "eml: send: COMMAND_PING: " + mPingCounter);
|
||||
Lg.w(TAG, "eml: send: COMMAND_PING: " + mPingCounter);
|
||||
sendBroadcast(intent);
|
||||
|
||||
updateStatus(getString(R.string.status_ping) + --mPingCounter);
|
||||
if (mPingCounter > 0) {
|
||||
if (mPingCounter == (MAX_PING/2)+1) {
|
||||
Log.i(TAG, "eml: stopping and restarting VoiXtreme Service");
|
||||
Lg.i(TAG, "eml: stopping and restarting VoiXtreme Service");
|
||||
intent = new Intent();
|
||||
intent.setClassName(Configuration.VOIXTREME_PACKAGE_NAME, Configuration.VOIXTREME_SERVICE_NAME);
|
||||
stopService(intent);
|
||||
|
|
@ -1376,7 +1403,7 @@ public class StartupActivity extends Activity {
|
|||
@Override
|
||||
public void run() {
|
||||
|
||||
Log.i(TAG, "eml: restart VoiXtreme Service");
|
||||
Lg.i(TAG, "eml: restart VoiXtreme Service");
|
||||
startVoiXtremeService(false);
|
||||
}
|
||||
}, 777);
|
||||
|
|
@ -1385,6 +1412,8 @@ public class StartupActivity extends Activity {
|
|||
mHandler.postDelayed(this, PING_DELAY);
|
||||
}
|
||||
} else {
|
||||
Lg.e(TAG, "eml: error_no_engine #3");
|
||||
unpairHeadsets(true);
|
||||
showErrorMessage(R.string.error_no_engine, true
|
||||
, VxtCommon.Calibrate.CALIBRATE_STATUS_VOIXTREME_SERVICE_MISSING);
|
||||
}
|
||||
|
|
@ -1399,6 +1428,14 @@ public class StartupActivity extends Activity {
|
|||
*/
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
if (mConfig != null && mConfig.getStatusPackage() != null) {
|
||||
if (System.currentTimeMillis() - mBackKeyTimeout < FORCE_BACK_KEY_TIMEOUT) {
|
||||
if (mBackKeyPresses++ >= FORCE_BACK_KEY_PRESSES) {
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
}
|
||||
|
||||
mBackKeyPresses++;
|
||||
mBackKeyTimeout = System.currentTimeMillis();
|
||||
return true;
|
||||
} else {
|
||||
informStatus(VxtCommon.Calibrate.CALIBRATE_STATUS_TERMINATED);
|
||||
|
|
@ -1418,6 +1455,7 @@ public class StartupActivity extends Activity {
|
|||
|
||||
if (mKillVxtEngine) {
|
||||
informStatus(VxtCommon.Calibrate.CALIBRATE_STATUS_TERMINATED_WITH_ERROR);
|
||||
Lg.e(TAG, "eml: CALLING terminateVoiXtremeService(): COMMAND_FINALIZE ----> #3");
|
||||
terminateVoiXtremeService(false);
|
||||
}
|
||||
|
||||
|
|
@ -1425,7 +1463,7 @@ public class StartupActivity extends Activity {
|
|||
}
|
||||
|
||||
/**
|
||||
* Inform calling app about our exit status. If any error occured.. the VoiXtreme engine will be shut down.
|
||||
* Inform calling app about our exit status. If any error occurred.. the VoiXtreme engine will be shut down.
|
||||
*
|
||||
* @param status Status to be sent (Check VxtCommon.Calibrate)
|
||||
* @return true if message could be sent or false...
|
||||
|
|
@ -1433,14 +1471,14 @@ public class StartupActivity extends Activity {
|
|||
private boolean informStatus(int status) {
|
||||
|
||||
if (status >= 1 && status <= 50) {
|
||||
Log.e(TAG, "eml: killing VoiXtreme engine");
|
||||
Lg.e(TAG, "eml: CALLING terminateVoiXtremeService(): COMMAND_FINALIZE ----> #4");
|
||||
terminateVoiXtremeService(false);
|
||||
}
|
||||
|
||||
if (mConfig.hasStatusPackage()) {
|
||||
Intent intent = new Intent(mConfig.getStatusPackage());
|
||||
intent.putExtra(BroadcastParams.EXTRAS_STATUS, status);
|
||||
Log.w(TAG, "eml: send: inform status: " + status);
|
||||
Lg.w(TAG, "eml: send: inform status: " + status);
|
||||
sendBroadcast(intent);
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue