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

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

Merge "Add package name when initializing ToneGenerator."

parents be727bf1 b5daf797
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "ToneGenerator"

#include <utility>

#include <math.h>
#include <utils/Log.h>
#include <cutils/properties.h>
@@ -984,7 +986,9 @@ const unsigned char /*tone_type*/ ToneGenerator::sToneMappingTable[NUM_REGIONS-1
//        none
//
////////////////////////////////////////////////////////////////////////////////
ToneGenerator::ToneGenerator(audio_stream_type_t streamType, float volume, bool threadCanCallJava) {
ToneGenerator::ToneGenerator(audio_stream_type_t streamType, float volume, bool threadCanCallJava,
        std::string opPackageName)
        : mOpPackageName(std::move(opPackageName)) {

    ALOGV("ToneGenerator constructor: streamType=%d, volume=%f", streamType, volume);

@@ -1255,7 +1259,7 @@ void ToneGenerator::stopTone() {
////////////////////////////////////////////////////////////////////////////////
bool ToneGenerator::initAudioTrack() {
    // Open audio track in mono, PCM 16bit, default sampling rate.
    mpAudioTrack = new AudioTrack();
    mpAudioTrack = new AudioTrack(mOpPackageName);
    ALOGV("AudioTrack(%p) created", mpAudioTrack.get());

    audio_attributes_t attr;
+6 −1
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
#ifndef ANDROID_TONEGENERATOR_H_
#define ANDROID_TONEGENERATOR_H_

#include <string>

#include <media/AudioSystem.h>
#include <media/AudioTrack.h>
#include <utils/Compat.h>
@@ -152,7 +154,8 @@ public:
        NUM_SUP_TONES = LAST_SUP_TONE-FIRST_SUP_TONE+1
    };

    ToneGenerator(audio_stream_type_t streamType, float volume, bool threadCanCallJava = false);
    ToneGenerator(audio_stream_type_t streamType, float volume, bool threadCanCallJava = false,
            std::string opPackageName = {});
    ~ToneGenerator();

    bool startTone(tone_type toneType, int durationMs = -1);
@@ -344,6 +347,8 @@ private:
    };

    KeyedVector<uint16_t, WaveGenerator *> mWaveGens;  // list of active wave generators.

    std::string mOpPackageName;
};

}