Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 909abff5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Visualizer: mark listerner arguments as @Nullable"

parents 9caf9cc1 54efee93
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -24311,7 +24311,7 @@ package android.media.audiofx {
    method public int getWaveForm(byte[]) throws java.lang.IllegalStateException;
    method public int getWaveForm(byte[]) throws java.lang.IllegalStateException;
    method public void release();
    method public void release();
    method public int setCaptureSize(int) throws java.lang.IllegalStateException;
    method public int setCaptureSize(int) throws java.lang.IllegalStateException;
    method public int setDataCaptureListener(android.media.audiofx.Visualizer.OnDataCaptureListener, int, boolean, boolean);
    method public int setDataCaptureListener(@Nullable android.media.audiofx.Visualizer.OnDataCaptureListener, int, boolean, boolean);
    method public int setEnabled(boolean) throws java.lang.IllegalStateException;
    method public int setEnabled(boolean) throws java.lang.IllegalStateException;
    method public int setMeasurementMode(int) throws java.lang.IllegalStateException;
    method public int setMeasurementMode(int) throws java.lang.IllegalStateException;
    method public int setScalingMode(int) throws java.lang.IllegalStateException;
    method public int setScalingMode(int) throws java.lang.IllegalStateException;
+6 −5
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package android.media.audiofx;
package android.media.audiofx;


import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.AttributionSource;
import android.content.AttributionSource;
import android.content.AttributionSource.ScopedParcelState;
import android.content.AttributionSource.ScopedParcelState;
@@ -191,17 +192,17 @@ public class Visualizer {
     * Handler for events coming from the native code
     * Handler for events coming from the native code
     */
     */
    @GuardedBy("mListenerLock")
    @GuardedBy("mListenerLock")
    private Handler mNativeEventHandler = null;
    @Nullable private Handler mNativeEventHandler = null;
    /**
    /**
     *  PCM and FFT capture listener registered by client
     *  PCM and FFT capture listener registered by client
     */
     */
    @GuardedBy("mListenerLock")
    @GuardedBy("mListenerLock")
    private OnDataCaptureListener mCaptureListener = null;
    @Nullable private OnDataCaptureListener mCaptureListener = null;
    /**
    /**
     *  Server Died listener registered by client
     *  Server Died listener registered by client
     */
     */
    @GuardedBy("mListenerLock")
    @GuardedBy("mListenerLock")
    private OnServerDiedListener mServerDiedListener = null;
    @Nullable private OnServerDiedListener mServerDiedListener = null;


    // accessed by native methods
    // accessed by native methods
    private long mNativeVisualizer;  // guarded by a static lock in native code
    private long mNativeVisualizer;  // guarded by a static lock in native code
@@ -626,7 +627,7 @@ public class Visualizer {
     * @return {@link #SUCCESS} in case of success,
     * @return {@link #SUCCESS} in case of success,
     * {@link #ERROR_NO_INIT} or {@link #ERROR_BAD_VALUE} in case of failure.
     * {@link #ERROR_NO_INIT} or {@link #ERROR_BAD_VALUE} in case of failure.
     */
     */
    public int setDataCaptureListener(OnDataCaptureListener listener,
    public int setDataCaptureListener(@Nullable OnDataCaptureListener listener,
            int rate, boolean waveform, boolean fft) {
            int rate, boolean waveform, boolean fft) {
        if (listener == null) {
        if (listener == null) {
            // make sure capture callback is stopped in native code
            // make sure capture callback is stopped in native code
@@ -686,7 +687,7 @@ public class Visualizer {
     * <p>Call this method with a null listener to stop receiving server death notifications.
     * <p>Call this method with a null listener to stop receiving server death notifications.
     * @return {@link #SUCCESS} in case of success,
     * @return {@link #SUCCESS} in case of success,
     */
     */
    public int setServerDiedListener(OnServerDiedListener listener) {
    public int setServerDiedListener(@Nullable OnServerDiedListener listener) {
        synchronized (mListenerLock) {
        synchronized (mListenerLock) {
            mServerDiedListener = listener;
            mServerDiedListener = listener;
        }
        }