Loading services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerMiddlewareImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ public class SoundTriggerMiddlewareImpl implements ISoundTriggerMiddlewareServic try { modules.add(new SoundTriggerModule(service, audioSessionProvider)); } catch (Exception e) { Log.e(TAG, "Failed to a SoundTriggerModule instance", e); Log.e(TAG, "Failed to add a SoundTriggerModule instance", e); } } Loading services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerMiddlewareService.java +14 −15 Original line number Diff line number Diff line Loading @@ -113,9 +113,9 @@ import java.util.Set; public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareService.Stub { static private final String TAG = "SoundTriggerMiddlewareService"; final ISoundTriggerMiddlewareService mDelegate; final Context mContext; Set<Integer> mModuleHandles; private final ISoundTriggerMiddlewareService mDelegate; private final Context mContext; private Set<Integer> mModuleHandles; /** * Constructor for internal use only. Could be exposed for testing purposes in the future. Loading Loading @@ -280,7 +280,7 @@ public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareServic } /** Activity state. */ public Activity activityState = Activity.LOADED; Activity activityState = Activity.LOADED; /** * A map of known parameter support. A missing key means we don't know yet whether the Loading @@ -294,7 +294,7 @@ public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareServic * * @param modelParam The parameter key. */ public void checkSupported(int modelParam) { void checkSupported(int modelParam) { if (!parameterSupport.containsKey(modelParam)) { throw new IllegalStateException("Parameter has not been checked for support."); } Loading @@ -311,7 +311,7 @@ public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareServic * @param modelParam The parameter key. * @param value The value. */ public void checkSupported(int modelParam, int value) { void checkSupported(int modelParam, int value) { if (!parameterSupport.containsKey(modelParam)) { throw new IllegalStateException("Parameter has not been checked for support."); } Loading @@ -329,7 +329,7 @@ public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareServic * @param modelParam The parameter key. * @param range The parameter value range, or null if not supported. */ public void updateParameterSupport(int modelParam, @Nullable ModelParameterRange range) { void updateParameterSupport(int modelParam, @Nullable ModelParameterRange range) { parameterSupport.put(modelParam, range); } } Loading @@ -338,8 +338,6 @@ public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareServic * Entry-point to this module: exposes the module as a {@link SystemService}. */ public static final class Lifecycle extends SystemService { private SoundTriggerMiddlewareService mService; public Lifecycle(Context context) { super(context); } Loading @@ -355,10 +353,11 @@ public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareServic services = new ISoundTriggerHw[0]; } mService = new SoundTriggerMiddlewareService( new SoundTriggerMiddlewareImpl(services, new AudioSessionProviderImpl()), getContext()); publishBinderService(Context.SOUND_TRIGGER_MIDDLEWARE_SERVICE, mService); publishBinderService(Context.SOUND_TRIGGER_MIDDLEWARE_SERVICE, new SoundTriggerMiddlewareService( new SoundTriggerMiddlewareImpl(services, new AudioSessionProviderImpl()), getContext())); } } Loading @@ -370,7 +369,7 @@ public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareServic DeathRecipient { private final ISoundTriggerCallback mCallback; private ISoundTriggerModule mDelegate; private Map<Integer, ModelState> mLoadedModels = new HashMap<>(); private @NonNull Map<Integer, ModelState> mLoadedModels = new HashMap<>(); ModuleService(@NonNull ISoundTriggerCallback callback) { mCallback = callback; Loading Loading @@ -702,7 +701,7 @@ public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareServic } @Override public void onRecognitionAvailabilityChange(boolean available) throws RemoteException { public void onRecognitionAvailabilityChange(boolean available) { synchronized (this) { try { mCallback.onRecognitionAvailabilityChange(available); Loading services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerModule.java +4 −9 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ class SoundTriggerModule { @NonNull private final SoundTriggerMiddlewareImpl.AudioSessionProvider mAudioSessionProvider; private final Set<Session> mActiveSessions = new HashSet<>(); private int mNumLoadedModels = 0; private SoundTriggerModuleProperties mProperties = null; private SoundTriggerModuleProperties mProperties; private boolean mRecognitionAvailable; /** Loading Loading @@ -117,7 +117,7 @@ class SoundTriggerModule { * @return The interface through which this module can be controlled. */ synchronized @NonNull Session attach(@NonNull ISoundTriggerCallback callback) { ISoundTriggerModule attach(@NonNull ISoundTriggerCallback callback) { Log.d(TAG, "attach()"); Session session = new Session(callback); mActiveSessions.add(session); Loading Loading @@ -274,8 +274,7 @@ class SoundTriggerModule { } @Override public void setModelParameter(int modelHandle, int modelParam, int value) throws RemoteException { public void setModelParameter(int modelHandle, int modelParam, int value) { Log.d(TAG, String.format("setModelParameter(handle=%d, param=%d, value=%d)", modelHandle, modelParam, value)); Loading @@ -285,7 +284,7 @@ class SoundTriggerModule { } @Override public int getModelParameter(int modelHandle, int modelParam) throws RemoteException { public int getModelParameter(int modelHandle, int modelParam) { Log.d(TAG, String.format("getModelParameter(handle=%d, param=%d)", modelHandle, modelParam)); synchronized (SoundTriggerModule.this) { Loading Loading @@ -350,10 +349,6 @@ class SoundTriggerModule { SoundTriggerModule.this.notifyAll(); } private void waitStateChange() throws InterruptedException { SoundTriggerModule.this.wait(); } private int load(@NonNull SoundModel model) { mModelType = model.type; ISoundTriggerHw.SoundModel hidlModel = ConversionUtil.aidl2hidlSoundModel(model); Loading Loading
services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerMiddlewareImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ public class SoundTriggerMiddlewareImpl implements ISoundTriggerMiddlewareServic try { modules.add(new SoundTriggerModule(service, audioSessionProvider)); } catch (Exception e) { Log.e(TAG, "Failed to a SoundTriggerModule instance", e); Log.e(TAG, "Failed to add a SoundTriggerModule instance", e); } } Loading
services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerMiddlewareService.java +14 −15 Original line number Diff line number Diff line Loading @@ -113,9 +113,9 @@ import java.util.Set; public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareService.Stub { static private final String TAG = "SoundTriggerMiddlewareService"; final ISoundTriggerMiddlewareService mDelegate; final Context mContext; Set<Integer> mModuleHandles; private final ISoundTriggerMiddlewareService mDelegate; private final Context mContext; private Set<Integer> mModuleHandles; /** * Constructor for internal use only. Could be exposed for testing purposes in the future. Loading Loading @@ -280,7 +280,7 @@ public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareServic } /** Activity state. */ public Activity activityState = Activity.LOADED; Activity activityState = Activity.LOADED; /** * A map of known parameter support. A missing key means we don't know yet whether the Loading @@ -294,7 +294,7 @@ public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareServic * * @param modelParam The parameter key. */ public void checkSupported(int modelParam) { void checkSupported(int modelParam) { if (!parameterSupport.containsKey(modelParam)) { throw new IllegalStateException("Parameter has not been checked for support."); } Loading @@ -311,7 +311,7 @@ public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareServic * @param modelParam The parameter key. * @param value The value. */ public void checkSupported(int modelParam, int value) { void checkSupported(int modelParam, int value) { if (!parameterSupport.containsKey(modelParam)) { throw new IllegalStateException("Parameter has not been checked for support."); } Loading @@ -329,7 +329,7 @@ public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareServic * @param modelParam The parameter key. * @param range The parameter value range, or null if not supported. */ public void updateParameterSupport(int modelParam, @Nullable ModelParameterRange range) { void updateParameterSupport(int modelParam, @Nullable ModelParameterRange range) { parameterSupport.put(modelParam, range); } } Loading @@ -338,8 +338,6 @@ public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareServic * Entry-point to this module: exposes the module as a {@link SystemService}. */ public static final class Lifecycle extends SystemService { private SoundTriggerMiddlewareService mService; public Lifecycle(Context context) { super(context); } Loading @@ -355,10 +353,11 @@ public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareServic services = new ISoundTriggerHw[0]; } mService = new SoundTriggerMiddlewareService( new SoundTriggerMiddlewareImpl(services, new AudioSessionProviderImpl()), getContext()); publishBinderService(Context.SOUND_TRIGGER_MIDDLEWARE_SERVICE, mService); publishBinderService(Context.SOUND_TRIGGER_MIDDLEWARE_SERVICE, new SoundTriggerMiddlewareService( new SoundTriggerMiddlewareImpl(services, new AudioSessionProviderImpl()), getContext())); } } Loading @@ -370,7 +369,7 @@ public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareServic DeathRecipient { private final ISoundTriggerCallback mCallback; private ISoundTriggerModule mDelegate; private Map<Integer, ModelState> mLoadedModels = new HashMap<>(); private @NonNull Map<Integer, ModelState> mLoadedModels = new HashMap<>(); ModuleService(@NonNull ISoundTriggerCallback callback) { mCallback = callback; Loading Loading @@ -702,7 +701,7 @@ public class SoundTriggerMiddlewareService extends ISoundTriggerMiddlewareServic } @Override public void onRecognitionAvailabilityChange(boolean available) throws RemoteException { public void onRecognitionAvailabilityChange(boolean available) { synchronized (this) { try { mCallback.onRecognitionAvailabilityChange(available); Loading
services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerModule.java +4 −9 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ class SoundTriggerModule { @NonNull private final SoundTriggerMiddlewareImpl.AudioSessionProvider mAudioSessionProvider; private final Set<Session> mActiveSessions = new HashSet<>(); private int mNumLoadedModels = 0; private SoundTriggerModuleProperties mProperties = null; private SoundTriggerModuleProperties mProperties; private boolean mRecognitionAvailable; /** Loading Loading @@ -117,7 +117,7 @@ class SoundTriggerModule { * @return The interface through which this module can be controlled. */ synchronized @NonNull Session attach(@NonNull ISoundTriggerCallback callback) { ISoundTriggerModule attach(@NonNull ISoundTriggerCallback callback) { Log.d(TAG, "attach()"); Session session = new Session(callback); mActiveSessions.add(session); Loading Loading @@ -274,8 +274,7 @@ class SoundTriggerModule { } @Override public void setModelParameter(int modelHandle, int modelParam, int value) throws RemoteException { public void setModelParameter(int modelHandle, int modelParam, int value) { Log.d(TAG, String.format("setModelParameter(handle=%d, param=%d, value=%d)", modelHandle, modelParam, value)); Loading @@ -285,7 +284,7 @@ class SoundTriggerModule { } @Override public int getModelParameter(int modelHandle, int modelParam) throws RemoteException { public int getModelParameter(int modelHandle, int modelParam) { Log.d(TAG, String.format("getModelParameter(handle=%d, param=%d)", modelHandle, modelParam)); synchronized (SoundTriggerModule.this) { Loading Loading @@ -350,10 +349,6 @@ class SoundTriggerModule { SoundTriggerModule.this.notifyAll(); } private void waitStateChange() throws InterruptedException { SoundTriggerModule.this.wait(); } private int load(@NonNull SoundModel model) { mModelType = model.type; ISoundTriggerHw.SoundModel hidlModel = ConversionUtil.aidl2hidlSoundModel(model); Loading