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

Commit 9c0a1003 authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "Fix issue 3371080" into honeycomb

parents 8138fc1f 25101b0b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -64,10 +64,10 @@ android_media_AudioSystem_isMicrophoneMuted(JNIEnv *env, jobject thiz)
}

static jboolean
android_media_AudioSystem_isStreamActive(JNIEnv *env, jobject thiz, jint stream)
android_media_AudioSystem_isStreamActive(JNIEnv *env, jobject thiz, jint stream, jint inPastMs)
{
    bool state = false;
    AudioSystem::isStreamActive(stream, &state);
    AudioSystem::isStreamActive(stream, &state, inPastMs);
    return state;
}

@@ -199,7 +199,7 @@ static JNINativeMethod gMethods[] = {
    {"getParameters",        "(Ljava/lang/String;)Ljava/lang/String;", (void *)android_media_AudioSystem_getParameters},
    {"muteMicrophone",      "(Z)I",     (void *)android_media_AudioSystem_muteMicrophone},
    {"isMicrophoneMuted",   "()Z",      (void *)android_media_AudioSystem_isMicrophoneMuted},
    {"isStreamActive",      "(I)Z",     (void *)android_media_AudioSystem_isStreamActive},
    {"isStreamActive",      "(II)Z",     (void *)android_media_AudioSystem_isStreamActive},
    {"setDeviceConnectionState", "(IILjava/lang/String;)I", (void *)android_media_AudioSystem_setDeviceConnectionState},
    {"getDeviceConnectionState", "(ILjava/lang/String;)I",  (void *)android_media_AudioSystem_getDeviceConnectionState},
    {"setPhoneState",       "(I)I",     (void *)android_media_AudioSystem_setPhoneState},
+3 −2
Original line number Diff line number Diff line
@@ -204,8 +204,9 @@ public:
    // set audio mode in audio hardware (see AudioSystem::audio_mode)
    static status_t setMode(int mode);

    // returns true in *state if tracks are active on the specified stream
    static status_t isStreamActive(int stream, bool *state);
    // returns true in *state if tracks are active on the specified stream or has been active
    // in the past inPastMs milliseconds
    static status_t isStreamActive(int stream, bool *state, uint32_t inPastMs = 0);

    // set/get audio hardware parameters. The function accepts a list of parameters
    // key value pairs in the form: key1=value1;key2=value2;...
+0 −3
Original line number Diff line number Diff line
@@ -102,9 +102,6 @@ public:
    virtual     status_t    setMicMute(bool state) = 0;
    virtual     bool        getMicMute() const = 0;

    // is any track active on this stream?
    virtual     bool        isStreamActive(int stream) const = 0;

    virtual     status_t    setParameters(int ioHandle, const String8& keyValuePairs) = 0;
    virtual     String8     getParameters(int ioHandle, const String8& keys) = 0;

+1 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ public:
                                    int session,
                                    int id) = 0;
    virtual status_t unregisterEffect(int id) = 0;
    virtual bool     isStreamActive(int stream, uint32_t inPastMs = 0) const = 0;
};


+39 −5
Original line number Diff line number Diff line
@@ -394,10 +394,10 @@ public class AudioManager {
                 */
                adjustSuggestedStreamVolume(
                        keyCode == KeyEvent.KEYCODE_VOLUME_UP
                                ? AudioManager.ADJUST_RAISE
                                : AudioManager.ADJUST_LOWER,
                                ? ADJUST_RAISE
                                : ADJUST_LOWER,
                        stream,
                        AudioManager.FLAG_SHOW_UI | AudioManager.FLAG_VIBRATE);
                        FLAG_SHOW_UI | FLAG_VIBRATE);
                break;
            case KeyEvent.KEYCODE_VOLUME_MUTE:
                // TODO: Actually handle MUTE.
@@ -416,7 +416,11 @@ public class AudioManager {
                 * Play a sound. This is done on key up since we don't want the
                 * sound to play when a user holds down volume down to mute.
                 */
                adjustSuggestedStreamVolume(ADJUST_SAME, stream, FLAG_PLAY_SOUND);
                adjustSuggestedStreamVolume(
                        ADJUST_SAME,
                        stream,
                        FLAG_PLAY_SOUND);

                mVolumeKeyUpTime = SystemClock.uptimeMillis();
                break;
            case KeyEvent.KEYCODE_VOLUME_MUTE:
@@ -554,6 +558,21 @@ public class AudioManager {
        }
    }

    /**
     * Get last audible volume before stream was muted.
     *
     * @hide
     */
    public int getLastAudibleStreamVolume(int streamType) {
        IAudioService service = getService();
        try {
            return service.getLastAudibleStreamVolume(streamType);
        } catch (RemoteException e) {
            Log.e(TAG, "Dead object in getLastAudibleStreamVolume", e);
            return 0;
        }
    }

    /**
     * Sets the ringer mode.
     * <p>
@@ -648,6 +667,21 @@ public class AudioManager {
        }
    }

    /**
     * get stream mute state.
     *
     * @hide
     */
    public boolean isStreamMute(int streamType) {
        IAudioService service = getService();
        try {
            return service.isStreamMute(streamType);
        } catch (RemoteException e) {
            Log.e(TAG, "Dead object in isStreamMute", e);
            return false;
        }
    }

    /**
     * Returns whether a particular type should vibrate according to user
     * settings and the current ringer mode.
@@ -1124,7 +1158,7 @@ public class AudioManager {
     * @return true if any music tracks are active.
     */
    public boolean isMusicActive() {
        return AudioSystem.isStreamActive(STREAM_MUSIC);
        return AudioSystem.isStreamActive(STREAM_MUSIC, 0);
    }

    /*
Loading