Merge "Fixing a couple crashes in the SoundTriggerTestApp" into pi-dev

This commit is contained in:
TreeHugger Robot
2018-05-10 06:57:32 +00:00
committed by Android (Google) Code Review
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) {