Fixing a couple crashes in the SoundTriggerTestApp

Bug: 78269975
Test: built and ran the SoundTriggerTestApp
Change-Id: I966550a3d64e9f6a66c40e062a89f39b897aaea2
This commit is contained in:
mike dooley
2018-04-17 17:19:04 +02:00
parent d7cea28bbc
commit cabbb11c01
2 changed files with 9 additions and 3 deletions

View File

@@ -828,7 +828,12 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
// internalClearGlobalStateLocked() cleans up the telephony and power save listeners.
private void internalClearGlobalStateLocked() {
// Unregister from call state changes.
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
long token = Binder.clearCallingIdentity();
try {
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
} finally {
Binder.restoreCallingIdentity(token);
}
// Unregister from power save mode changes.
if (mPowerSaveModeListener != null) {

View File

@@ -435,9 +435,10 @@ public class SoundTriggerTestService extends Service {
if (!file.getName().endsWith(".properties")) {
continue;
}
try {
try (FileInputStream in = new FileInputStream(file)) {
Properties properties = new Properties();
properties.load(new FileInputStream(file));
properties.load(in);
createModelInfo(properties);
loadedModel = true;
} catch (Exception e) {