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

Commit 8374f8fc authored by Jean-Baptiste Queru's avatar Jean-Baptiste Queru
Browse files

Merge commit 'remotes/korg/cupcake' into merge

Conflicts:
	core/java/android/view/animation/TranslateAnimation.java
	core/jni/Android.mk
	core/res/res/values-en-rGB/strings.xml
	libs/audioflinger/AudioFlinger.cpp
	libs/surfaceflinger/LayerScreenshot.cpp
	packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
parents eb7dc893 c048cae0
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -125,7 +125,8 @@ public:
     * channelCount:       Number of PCM channels (e.g 2 for stereo).
     * frameCount:         Total size of track PCM buffer in frames. This defines the
     *                     latency of the track.
     * flags:              Reserved for future use.
     * flags:              A bitmask of acoustic values from enum record_flags.  It enables
     *                     AGC, NS, and IIR.
     * cbf:                Callback function. If not null, this function is called periodically
     *                     to provide new PCM data.
     * notificationFrames: The callback function is called each time notificationFrames PCM
@@ -133,6 +134,12 @@ public:
     * user                Context for use by the callback receiver.
     */

     enum record_flags {
         RECORD_AGC_ENABLE = AudioSystem::AGC_ENABLE,
         RECORD_NS_ENABLE  = AudioSystem::NS_ENABLE,
         RECORD_IIR_ENABLE = AudioSystem::TX_IIR_ENABLE
     };

                        AudioRecord(int streamType,
                                    uint32_t sampleRate = 0,
                                    int format          = 0,
+59 −12
Original line number Diff line number Diff line
@@ -29,8 +29,27 @@ class AudioSystem
{
public:

    enum stream_type {
        DEFAULT         =-1,
        VOICE_CALL      = 0,
        SYSTEM          = 1,
        RING            = 2,
        MUSIC           = 3,
        ALARM           = 4,
        NOTIFICATION    = 5,
        BLUETOOTH_SCO   = 6,
        NUM_STREAM_TYPES
    };

    enum audio_output_type {
        AUDIO_OUTPUT_DEFAULT      =-1,
        AUDIO_OUTPUT_HARDWARE     = 0,
        AUDIO_OUTPUT_A2DP         = 1,
        NUM_AUDIO_OUTPUT_TYPES
    };

    enum audio_format {
        DEFAULT = 0,
        FORMAT_DEFAULT = 0,
        PCM_16_BIT,
        PCM_8_BIT,
        INVALID_FORMAT
@@ -51,7 +70,16 @@ public:
        ROUTE_BLUETOOTH_SCO  = (1 << 2),
        ROUTE_HEADSET        = (1 << 3),
        ROUTE_BLUETOOTH_A2DP = (1 << 4),
        ROUTE_ALL       = 0xFFFFFFFF
        ROUTE_ALL            = -1UL,
    };

    enum audio_in_acoustics {
        AGC_ENABLE    = 0x0001,
        AGC_DISABLE   = 0,
        NS_ENABLE     = 0x0002,
        NS_DISABLE    = 0,
        TX_IIR_ENABLE = 0x0004,
        TX_DISABLE    = 0
    };

    /* These are static methods to control the system-wide AudioFlinger
@@ -96,33 +124,52 @@ public:
    static float linearToLog(int volume);
    static int logToLinear(float volume);

    static status_t getOutputSamplingRate(int* samplingRate);
    static status_t getOutputFrameCount(int* frameCount);
    static status_t getOutputLatency(uint32_t* latency);
    static status_t getOutputSamplingRate(int* samplingRate, int stream = DEFAULT);
    static status_t getOutputFrameCount(int* frameCount, int stream = DEFAULT);
    static status_t getOutputLatency(uint32_t* latency, int stream = DEFAULT);

    static bool routedToA2dpOutput(int streamType);
    
    static status_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount, 
        size_t* buffSize);

    // ----------------------------------------------------------------------------

private:

    class DeathNotifier: public IBinder::DeathRecipient
    class AudioFlingerClient: public IBinder::DeathRecipient, public BnAudioFlingerClient
    {
    public:
        DeathNotifier() {      
        AudioFlingerClient() {      
        }
        
        // DeathRecipient
        virtual void binderDied(const wp<IBinder>& who);
        
        // IAudioFlingerClient
        virtual void a2dpEnabledChanged(bool enabled);
        
    };
    static int getOutput(int streamType);

    static sp<DeathNotifier> gDeathNotifier;
    static sp<AudioFlingerClient> gAudioFlingerClient;

    friend class DeathNotifier;
    friend class AudioFlingerClient;

    static Mutex gLock;
    static sp<IAudioFlinger> gAudioFlinger;
    static audio_error_callback gAudioErrorCallback;
    static int gOutSamplingRate;
    static int gOutFrameCount;
    static uint32_t gOutLatency;
    static int gOutSamplingRate[NUM_AUDIO_OUTPUT_TYPES];
    static int gOutFrameCount[NUM_AUDIO_OUTPUT_TYPES];
    static uint32_t gOutLatency[NUM_AUDIO_OUTPUT_TYPES];
    static bool gA2dpEnabled;
    
    static size_t gInBuffSize;
    // previous parameters for recording buffer size queries
    static uint32_t gPrevInSamplingRate;
    static int gPrevInFormat;
    static int gPrevInChannelCount;

};

};  // namespace android
+1 −13
Original line number Diff line number Diff line
@@ -42,18 +42,6 @@ class audio_track_cblk_t;
class AudioTrack
{
public:

    enum stream_type {
        DEFAULT         =-1,
        VOICE_CALL      = 0,
        SYSTEM          = 1,
        RING            = 2,
        MUSIC           = 3,
        ALARM           = 4,
        NOTIFICATION    = 5,
        NUM_STREAM_TYPES
    };

    enum channel_index {
        MONO   = 0,
        LEFT   = 0,
@@ -127,7 +115,7 @@ public:
     * Parameters:
     *
     * streamType:         Select the type of audio stream this track is attached to
     *                     (e.g. AudioTrack::MUSIC).
     *                     (e.g. AudioSystem::MUSIC).
     * sampleRate:         Track sampling rate in Hz.
     * format:             PCM sample format (e.g AudioSystem::PCM_16_BIT for signed
     *                     16 bits per sample).
+18 −5
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include <utils/IInterface.h>
#include <media/IAudioTrack.h>
#include <media/IAudioRecord.h>
#include <media/IAudioFlingerClient.h>


namespace android {
@@ -64,11 +65,11 @@ public:
    /* query the audio hardware state. This state never changes,
     * and therefore can be cached.
     */
    virtual     uint32_t    sampleRate() const = 0;
    virtual     int         channelCount() const = 0;
    virtual     int         format() const = 0;
    virtual     size_t      frameCount() const = 0;
    virtual     uint32_t    latency() const = 0;
    virtual     uint32_t    sampleRate(int output) const = 0;
    virtual     int         channelCount(int output) const = 0;
    virtual     int         format(int output) const = 0;
    virtual     size_t      frameCount(int output) const = 0;
    virtual     uint32_t    latency(int output) const = 0;

    /* set/get the audio hardware state. This will probably be used by
     * the preference panel, mostly.
@@ -107,6 +108,18 @@ public:
    // Temporary interface, do not use
    // TODO: Replace with a more generic key:value get/set mechanism
    virtual     status_t  setParameter(const char* key, const char* value) = 0;
    
    // register a current process for audio output change notifications
    virtual void registerClient(const sp<IAudioFlingerClient>& client) = 0;
    
    // retrieve the audio recording buffer size
    virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount) = 0;
    
    // force AudioFlinger thread out of standby
    virtual     void        wakeUp() = 0;

    // is A2DP output enabled
    virtual     bool        isA2dpEnabled() const = 0;
};


+55 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ANDROID_IAUDIOFLINGERCLIENT_H
#define ANDROID_IAUDIOFLINGERCLIENT_H


#include <utils/RefBase.h>
#include <utils/IInterface.h>


namespace android {

// ----------------------------------------------------------------------------

class IAudioFlingerClient : public IInterface
{
public:
    DECLARE_META_INTERFACE(AudioFlingerClient);

    // Notifies a change of audio output from/to hardware to/from A2DP.
    virtual void a2dpEnabledChanged(bool enabled) = 0;

};


// ----------------------------------------------------------------------------

class BnAudioFlingerClient : public BnInterface<IAudioFlingerClient>
{
public:
    virtual status_t    onTransact( uint32_t code,
                                    const Parcel& data,
                                    Parcel* reply,
                                    uint32_t flags = 0);
};

// ----------------------------------------------------------------------------

}; // namespace android

#endif // ANDROID_IAUDIOFLINGERCLIENT_H
Loading