liboboe: rename Oboe to AAudio

All of the edits were done using scripts in media/liboboe/scripts.
The conversion is done using SED, which is called from
convert_oboe_aaudio.sh
The conversion can be reverted when debugging using revert_all_aaudio.sh
The string substitutions are in oboe_to_aaudio.sed

Bug: 34749573
Test: cts/tests/tests/nativemedia/aaudio

Change-Id: Ia10b34472a90df2652b87607c99156e9084e57aa
Signed-off-by: Phil Burk <philburk@google.com>
diff --git a/media/liboboe/src/Android.mk b/media/liboboe/src/Android.mk
index 59edcb2..a508be3 100644
--- a/media/liboboe/src/Android.mk
+++ b/media/liboboe/src/Android.mk
@@ -1,15 +1,15 @@
 LOCAL_PATH:= $(call my-dir)
 
 # ======================= STATIC LIBRARY ==========================
-# This is being built because it make Oboe testing very easy with a complete executable.
+# This is being built because it make AAudio testing very easy with a complete executable.
 # TODO Remove this target later, when not needed.
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := liboboe
 LOCAL_MODULE_TAGS := optional
 
-LIBOBOE_DIR := $(TOP)/frameworks/av/media/liboboe
-LIBOBOE_SRC_DIR := $(LIBOBOE_DIR)/src
+LIBAAUDIO_DIR := $(TOP)/frameworks/av/media/liboboe
+LIBAAUDIO_SRC_DIR := $(LIBAAUDIO_DIR)/src
 
 LOCAL_C_INCLUDES := \
     $(call include-path-for, audio-utils) \
@@ -29,11 +29,11 @@
 LOCAL_SRC_FILES = \
     core/AudioStream.cpp \
     core/AudioStreamBuilder.cpp \
-    core/OboeAudio.cpp \
+    core/AAudioAudio.cpp \
     legacy/AudioStreamRecord.cpp \
     legacy/AudioStreamTrack.cpp \
     utility/HandleTracker.cpp \
-    utility/OboeUtilities.cpp \
+    utility/AAudioUtilities.cpp \
     fifo/FifoBuffer.cpp \
     fifo/FifoControllerBase.cpp \
     client/AudioEndpoint.cpp \
@@ -43,16 +43,16 @@
     binding/SharedRegionParcelable.cpp \
     binding/RingBufferParcelable.cpp \
     binding/AudioEndpointParcelable.cpp \
-    binding/OboeStreamRequest.cpp \
-    binding/OboeStreamConfiguration.cpp \
-    binding/IOboeAudioService.cpp
+    binding/AAudioStreamRequest.cpp \
+    binding/AAudioStreamConfiguration.cpp \
+    binding/IAAudioService.cpp
 
 LOCAL_CFLAGS += -Wno-unused-parameter -Wall -Werror
 
 # By default, all symbols are hidden.
 # LOCAL_CFLAGS += -fvisibility=hidden
-# OBOE_API is used to explicitly export a function or a variable as a visible symbol.
-LOCAL_CFLAGS += -DOBOE_API='__attribute__((visibility("default")))'
+# AAUDIO_API is used to explicitly export a function or a variable as a visible symbol.
+LOCAL_CFLAGS += -DAAUDIO_API='__attribute__((visibility("default")))'
 
 include $(BUILD_STATIC_LIBRARY)
 
@@ -78,11 +78,11 @@
 
 LOCAL_SRC_FILES = core/AudioStream.cpp \
     core/AudioStreamBuilder.cpp \
-    core/OboeAudio.cpp \
+    core/AAudioAudio.cpp \
     legacy/AudioStreamRecord.cpp \
     legacy/AudioStreamTrack.cpp \
     utility/HandleTracker.cpp \
-    utility/OboeUtilities.cpp \
+    utility/AAudioUtilities.cpp \
     fifo/FifoBuffer.cpp \
     fifo/FifoControllerBase.cpp \
     client/AudioEndpoint.cpp \
@@ -92,16 +92,16 @@
     binding/SharedRegionParcelable.cpp \
     binding/RingBufferParcelable.cpp \
     binding/AudioEndpointParcelable.cpp \
-    binding/OboeStreamRequest.cpp \
-    binding/OboeStreamConfiguration.cpp \
-    binding/IOboeAudioService.cpp
+    binding/AAudioStreamRequest.cpp \
+    binding/AAudioStreamConfiguration.cpp \
+    binding/IAAudioService.cpp
 
 LOCAL_CFLAGS += -Wno-unused-parameter -Wall -Werror
 
 # By default, all symbols are hidden.
 # LOCAL_CFLAGS += -fvisibility=hidden
-# OBOE_API is used to explicitly export a function or a variable as a visible symbol.
-LOCAL_CFLAGS += -DOBOE_API='__attribute__((visibility("default")))'
+# AAUDIO_API is used to explicitly export a function or a variable as a visible symbol.
+LOCAL_CFLAGS += -DAAUDIO_API='__attribute__((visibility("default")))'
 
 LOCAL_SHARED_LIBRARIES := libaudioclient liblog libcutils libutils libbinder
 
diff --git a/media/liboboe/src/binding/OboeServiceDefinitions.h b/media/liboboe/src/binding/AAudioServiceDefinitions.h
similarity index 87%
rename from media/liboboe/src/binding/OboeServiceDefinitions.h
rename to media/liboboe/src/binding/AAudioServiceDefinitions.h
index 33a192f..ca637ef 100644
--- a/media/liboboe/src/binding/OboeServiceDefinitions.h
+++ b/media/liboboe/src/binding/AAudioServiceDefinitions.h
@@ -14,22 +14,22 @@
  * limitations under the License.
  */
 
-#ifndef BINDING_OBOESERVICEDEFINITIONS_H
-#define BINDING_OBOESERVICEDEFINITIONS_H
+#ifndef BINDING_AAUDIOSERVICEDEFINITIONS_H
+#define BINDING_AAUDIOSERVICEDEFINITIONS_H
 
 #include <stdint.h>
 #include <utils/RefBase.h>
 #include <binder/TextOutput.h>
 #include <binder/IInterface.h>
 
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudio.h>
 
 using android::NO_ERROR;
 using android::IBinder;
 
 namespace android {
 
-enum oboe_commands_t {
+enum aaudio_commands_t {
     OPEN_STREAM = IBinder::FIRST_CALL_TRANSACTION,
     CLOSE_STREAM,
     GET_STREAM_DESCRIPTION,
@@ -42,9 +42,9 @@
 
 } // namespace android
 
-namespace oboe {
+namespace aaudio {
 
-enum oboe_commands_t {
+enum aaudio_commands_t {
     OPEN_STREAM = IBinder::FIRST_CALL_TRANSACTION,
     CLOSE_STREAM,
     GET_STREAM_DESCRIPTION,
@@ -56,12 +56,12 @@
 };
 
 // TODO Expand this to include all the open parameters.
-typedef struct OboeServiceStreamInfo_s {
+typedef struct AAudioServiceStreamInfo_s {
     int32_t             deviceId;
     int32_t             samplesPerFrame;  // number of channels
-    oboe_sample_rate_t  sampleRate;
-    oboe_audio_format_t audioFormat;
-} OboeServiceStreamInfo;
+    aaudio_sample_rate_t  sampleRate;
+    aaudio_audio_format_t audioFormat;
+} AAudioServiceStreamInfo;
 
 // This must be a fixed width so it can be in shared memory.
 enum RingbufferFlags : uint32_t {
@@ -95,6 +95,6 @@
     RingBufferDescriptor downDataQueueDescriptor;    // eg. playback
 } EndpointDescriptor;
 
-} // namespace oboe
+} // namespace aaudio
 
-#endif //BINDING_OBOESERVICEDEFINITIONS_H
+#endif //BINDING_AAUDIOSERVICEDEFINITIONS_H
diff --git a/media/liboboe/src/binding/AAudioServiceMessage.h b/media/liboboe/src/binding/AAudioServiceMessage.h
new file mode 100644
index 0000000..16cb5eb
--- /dev/null
+++ b/media/liboboe/src/binding/AAudioServiceMessage.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2016 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 AAUDIO_AAUDIO_SERVICE_MESSAGE_H
+#define AAUDIO_AAUDIO_SERVICE_MESSAGE_H
+
+#include <stdint.h>
+
+#include <aaudio/AAudioDefinitions.h>
+
+namespace aaudio {
+
+// TODO move this an "include" folder for the service.
+
+struct AAudioMessageTimestamp {
+    aaudio_position_frames_t position;
+    int64_t                deviceOffset; // add to client position to get device position
+    aaudio_nanoseconds_t     timestamp;
+};
+
+typedef enum aaudio_service_event_e : uint32_t {
+    AAUDIO_SERVICE_EVENT_STARTED,
+    AAUDIO_SERVICE_EVENT_PAUSED,
+    AAUDIO_SERVICE_EVENT_FLUSHED,
+    AAUDIO_SERVICE_EVENT_CLOSED,
+    AAUDIO_SERVICE_EVENT_DISCONNECTED
+} aaudio_service_event_t;
+
+struct AAudioMessageEvent {
+    aaudio_service_event_t event;
+    int32_t data1;
+    int64_t data2;
+};
+
+typedef struct AAudioServiceMessage_s {
+    enum class code : uint32_t {
+        NOTHING,
+        TIMESTAMP,
+        EVENT,
+    };
+
+    code what;
+    union {
+        AAudioMessageTimestamp timestamp;
+        AAudioMessageEvent event;
+    };
+} AAudioServiceMessage;
+
+
+} /* namespace aaudio */
+
+#endif //AAUDIO_AAUDIO_SERVICE_MESSAGE_H
diff --git a/media/liboboe/src/binding/AAudioStreamConfiguration.cpp b/media/liboboe/src/binding/AAudioStreamConfiguration.cpp
new file mode 100644
index 0000000..1cb2bfa
--- /dev/null
+++ b/media/liboboe/src/binding/AAudioStreamConfiguration.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2016 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.
+ */
+
+#include <stdint.h>
+
+#include <sys/mman.h>
+#include <binder/Parcel.h>
+#include <binder/Parcelable.h>
+
+#include <aaudio/AAudioDefinitions.h>
+
+#include "binding/AAudioStreamConfiguration.h"
+
+using android::NO_ERROR;
+using android::status_t;
+using android::Parcel;
+using android::Parcelable;
+
+using namespace aaudio;
+
+AAudioStreamConfiguration::AAudioStreamConfiguration() {}
+AAudioStreamConfiguration::~AAudioStreamConfiguration() {}
+
+status_t AAudioStreamConfiguration::writeToParcel(Parcel* parcel) const {
+    parcel->writeInt32(mDeviceId);
+    parcel->writeInt32(mSampleRate);
+    parcel->writeInt32(mSamplesPerFrame);
+    parcel->writeInt32((int32_t) mAudioFormat);
+    return NO_ERROR; // TODO check for errors above
+}
+
+status_t AAudioStreamConfiguration::readFromParcel(const Parcel* parcel) {
+    int32_t temp;
+    parcel->readInt32(&mDeviceId);
+    parcel->readInt32(&mSampleRate);
+    parcel->readInt32(&mSamplesPerFrame);
+    parcel->readInt32(&temp);
+    mAudioFormat = (aaudio_audio_format_t) temp;
+    return NO_ERROR; // TODO check for errors above
+}
+
+aaudio_result_t AAudioStreamConfiguration::validate() {
+    // Validate results of the open.
+    if (mSampleRate < 0 || mSampleRate >= 8 * 48000) { // TODO review limits
+        ALOGE("AAudioStreamConfiguration.validate(): invalid sampleRate = %d", mSampleRate);
+        return AAUDIO_ERROR_INTERNAL;
+    }
+
+    if (mSamplesPerFrame < 1 || mSamplesPerFrame >= 32) { // TODO review limits
+        ALOGE("AAudioStreamConfiguration.validate() invalid samplesPerFrame = %d", mSamplesPerFrame);
+        return AAUDIO_ERROR_INTERNAL;
+    }
+
+    switch (mAudioFormat) {
+    case AAUDIO_FORMAT_PCM_I16:
+    case AAUDIO_FORMAT_PCM_FLOAT:
+    case AAUDIO_FORMAT_PCM_I8_24:
+    case AAUDIO_FORMAT_PCM_I32:
+        break;
+    default:
+        ALOGE("AAudioStreamConfiguration.validate() invalid audioFormat = %d", mAudioFormat);
+        return AAUDIO_ERROR_INTERNAL;
+    }
+    return AAUDIO_OK;
+}
+
+void AAudioStreamConfiguration::dump() {
+    ALOGD("AAudioStreamConfiguration mSampleRate = %d -----", mSampleRate);
+    ALOGD("AAudioStreamConfiguration mSamplesPerFrame = %d", mSamplesPerFrame);
+    ALOGD("AAudioStreamConfiguration mAudioFormat = %d", (int)mAudioFormat);
+}
diff --git a/media/liboboe/src/binding/AAudioStreamConfiguration.h b/media/liboboe/src/binding/AAudioStreamConfiguration.h
new file mode 100644
index 0000000..ef21443
--- /dev/null
+++ b/media/liboboe/src/binding/AAudioStreamConfiguration.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2016 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 BINDING_AAUDIO_STREAM_CONFIGURATION_H
+#define BINDING_AAUDIO_STREAM_CONFIGURATION_H
+
+#include <stdint.h>
+
+#include <binder/Parcel.h>
+#include <binder/Parcelable.h>
+#include <aaudio/AAudioDefinitions.h>
+
+using android::status_t;
+using android::Parcel;
+using android::Parcelable;
+
+namespace aaudio {
+
+class AAudioStreamConfiguration : public Parcelable {
+public:
+    AAudioStreamConfiguration();
+    virtual ~AAudioStreamConfiguration();
+
+    aaudio_device_id_t getDeviceId() const {
+        return mDeviceId;
+    }
+
+    void setDeviceId(aaudio_device_id_t deviceId) {
+        mDeviceId = deviceId;
+    }
+
+    aaudio_sample_rate_t getSampleRate() const {
+        return mSampleRate;
+    }
+
+    void setSampleRate(aaudio_sample_rate_t sampleRate) {
+        mSampleRate = sampleRate;
+    }
+
+    int32_t getSamplesPerFrame() const {
+        return mSamplesPerFrame;
+    }
+
+    void setSamplesPerFrame(int32_t samplesPerFrame) {
+        mSamplesPerFrame = samplesPerFrame;
+    }
+
+    aaudio_audio_format_t getAudioFormat() const {
+        return mAudioFormat;
+    }
+
+    void setAudioFormat(aaudio_audio_format_t audioFormat) {
+        mAudioFormat = audioFormat;
+    }
+
+    virtual status_t writeToParcel(Parcel* parcel) const override;
+
+    virtual status_t readFromParcel(const Parcel* parcel) override;
+
+    aaudio_result_t validate();
+
+    void dump();
+
+protected:
+    aaudio_device_id_t    mDeviceId        = AAUDIO_DEVICE_UNSPECIFIED;
+    aaudio_sample_rate_t  mSampleRate      = AAUDIO_UNSPECIFIED;
+    int32_t             mSamplesPerFrame = AAUDIO_UNSPECIFIED;
+    aaudio_audio_format_t mAudioFormat     = AAUDIO_FORMAT_UNSPECIFIED;
+};
+
+} /* namespace aaudio */
+
+#endif //BINDING_AAUDIO_STREAM_CONFIGURATION_H
diff --git a/media/liboboe/src/binding/OboeStreamRequest.cpp b/media/liboboe/src/binding/AAudioStreamRequest.cpp
similarity index 69%
rename from media/liboboe/src/binding/OboeStreamRequest.cpp
rename to media/liboboe/src/binding/AAudioStreamRequest.cpp
index 5d521d0..5202b73 100644
--- a/media/liboboe/src/binding/OboeStreamRequest.cpp
+++ b/media/liboboe/src/binding/AAudioStreamRequest.cpp
@@ -20,32 +20,32 @@
 #include <binder/Parcel.h>
 #include <binder/Parcelable.h>
 
-#include <oboe/OboeDefinitions.h>
+#include <aaudio/AAudioDefinitions.h>
 
-#include "binding/OboeStreamConfiguration.h"
-#include "binding/OboeStreamRequest.h"
+#include "binding/AAudioStreamConfiguration.h"
+#include "binding/AAudioStreamRequest.h"
 
 using android::NO_ERROR;
 using android::status_t;
 using android::Parcel;
 using android::Parcelable;
 
-using namespace oboe;
+using namespace aaudio;
 
-OboeStreamRequest::OboeStreamRequest()
+AAudioStreamRequest::AAudioStreamRequest()
     : mConfiguration()
     {}
 
-OboeStreamRequest::~OboeStreamRequest() {}
+AAudioStreamRequest::~AAudioStreamRequest() {}
 
-status_t OboeStreamRequest::writeToParcel(Parcel* parcel) const {
+status_t AAudioStreamRequest::writeToParcel(Parcel* parcel) const {
     parcel->writeInt32((int32_t) mUserId);
     parcel->writeInt32((int32_t) mProcessId);
     mConfiguration.writeToParcel(parcel);
     return NO_ERROR; // TODO check for errors above
 }
 
-status_t OboeStreamRequest::readFromParcel(const Parcel* parcel) {
+status_t AAudioStreamRequest::readFromParcel(const Parcel* parcel) {
     int32_t temp;
     parcel->readInt32(&temp);
     mUserId = (uid_t) temp;
@@ -55,12 +55,12 @@
     return NO_ERROR; // TODO check for errors above
 }
 
-oboe_result_t OboeStreamRequest::validate() {
+aaudio_result_t AAudioStreamRequest::validate() {
     return mConfiguration.validate();
 }
 
-void OboeStreamRequest::dump() {
-    ALOGD("OboeStreamRequest mUserId = %d -----", mUserId);
-    ALOGD("OboeStreamRequest mProcessId = %d", mProcessId);
+void AAudioStreamRequest::dump() {
+    ALOGD("AAudioStreamRequest mUserId = %d -----", mUserId);
+    ALOGD("AAudioStreamRequest mProcessId = %d", mProcessId);
     mConfiguration.dump();
 }
diff --git a/media/liboboe/src/binding/OboeStreamRequest.h b/media/liboboe/src/binding/AAudioStreamRequest.h
similarity index 72%
rename from media/liboboe/src/binding/OboeStreamRequest.h
rename to media/liboboe/src/binding/AAudioStreamRequest.h
index aab3c97..0fd28ba 100644
--- a/media/liboboe/src/binding/OboeStreamRequest.h
+++ b/media/liboboe/src/binding/AAudioStreamRequest.h
@@ -14,27 +14,27 @@
  * limitations under the License.
  */
 
-#ifndef BINDING_OBOE_STREAM_REQUEST_H
-#define BINDING_OBOE_STREAM_REQUEST_H
+#ifndef BINDING_AAUDIO_STREAM_REQUEST_H
+#define BINDING_AAUDIO_STREAM_REQUEST_H
 
 #include <stdint.h>
 
 #include <binder/Parcel.h>
 #include <binder/Parcelable.h>
-#include <oboe/OboeDefinitions.h>
+#include <aaudio/AAudioDefinitions.h>
 
-#include "binding/OboeStreamConfiguration.h"
+#include "binding/AAudioStreamConfiguration.h"
 
 using android::status_t;
 using android::Parcel;
 using android::Parcelable;
 
-namespace oboe {
+namespace aaudio {
 
-class OboeStreamRequest : public Parcelable {
+class AAudioStreamRequest : public Parcelable {
 public:
-    OboeStreamRequest();
-    virtual ~OboeStreamRequest();
+    AAudioStreamRequest();
+    virtual ~AAudioStreamRequest();
 
     uid_t getUserId() const {
         return mUserId;
@@ -52,7 +52,7 @@
         mProcessId = processId;
     }
 
-    OboeStreamConfiguration &getConfiguration() {
+    AAudioStreamConfiguration &getConfiguration() {
         return mConfiguration;
     }
 
@@ -60,16 +60,16 @@
 
     virtual status_t readFromParcel(const Parcel* parcel) override;
 
-    oboe_result_t validate();
+    aaudio_result_t validate();
 
     void dump();
 
 protected:
-    OboeStreamConfiguration  mConfiguration;
+    AAudioStreamConfiguration  mConfiguration;
     uid_t    mUserId;
     pid_t    mProcessId;
 };
 
-} /* namespace oboe */
+} /* namespace aaudio */
 
-#endif //BINDING_OBOE_STREAM_REQUEST_H
+#endif //BINDING_AAUDIO_STREAM_REQUEST_H
diff --git a/media/liboboe/src/binding/AudioEndpointParcelable.cpp b/media/liboboe/src/binding/AudioEndpointParcelable.cpp
index 096a819..f40ee02 100644
--- a/media/liboboe/src/binding/AudioEndpointParcelable.cpp
+++ b/media/liboboe/src/binding/AudioEndpointParcelable.cpp
@@ -20,7 +20,7 @@
 #include <binder/Parcel.h>
 #include <binder/Parcelable.h>
 
-#include "binding/OboeServiceDefinitions.h"
+#include "binding/AAudioServiceDefinitions.h"
 #include "binding/RingBufferParcelable.h"
 #include "binding/AudioEndpointParcelable.h"
 
@@ -29,11 +29,11 @@
 using android::Parcel;
 using android::Parcelable;
 
-using namespace oboe;
+using namespace aaudio;
 
 /**
  * Container for information about the message queues plus
- * general stream information needed by Oboe clients.
+ * general stream information needed by AAudio clients.
  * It contains no addresses, just sizes, offsets and file descriptors for
  * shared memory that can be passed through Binder.
  */
@@ -47,7 +47,7 @@
  */
 int32_t AudioEndpointParcelable::addFileDescriptor(int fd, int32_t sizeInBytes) {
     if (mNumSharedMemories >= MAX_SHARED_MEMORIES) {
-        return OBOE_ERROR_OUT_OF_RANGE;
+        return AAUDIO_ERROR_OUT_OF_RANGE;
     }
     int32_t index = mNumSharedMemories++;
     mSharedMemories[index].setup(fd, sizeInBytes);
@@ -81,45 +81,45 @@
     return NO_ERROR; // TODO check for errors above
 }
 
-oboe_result_t AudioEndpointParcelable::resolve(EndpointDescriptor *descriptor) {
+aaudio_result_t AudioEndpointParcelable::resolve(EndpointDescriptor *descriptor) {
     // TODO error check
     mUpMessageQueueParcelable.resolve(mSharedMemories, &descriptor->upMessageQueueDescriptor);
     mDownMessageQueueParcelable.resolve(mSharedMemories,
                                         &descriptor->downMessageQueueDescriptor);
     mUpDataQueueParcelable.resolve(mSharedMemories, &descriptor->upDataQueueDescriptor);
     mDownDataQueueParcelable.resolve(mSharedMemories, &descriptor->downDataQueueDescriptor);
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
-oboe_result_t AudioEndpointParcelable::validate() {
-    oboe_result_t result;
+aaudio_result_t AudioEndpointParcelable::validate() {
+    aaudio_result_t result;
     if (mNumSharedMemories < 0 || mNumSharedMemories >= MAX_SHARED_MEMORIES) {
         ALOGE("AudioEndpointParcelable invalid mNumSharedMemories = %d", mNumSharedMemories);
-        return OBOE_ERROR_INTERNAL;
+        return AAUDIO_ERROR_INTERNAL;
     }
     for (int i = 0; i < mNumSharedMemories; i++) {
         result = mSharedMemories[i].validate();
-        if (result != OBOE_OK) {
+        if (result != AAUDIO_OK) {
             return result;
         }
     }
-    if ((result = mUpMessageQueueParcelable.validate()) != OBOE_OK) {
+    if ((result = mUpMessageQueueParcelable.validate()) != AAUDIO_OK) {
         ALOGE("AudioEndpointParcelable invalid mUpMessageQueueParcelable = %d", result);
         return result;
     }
-    if ((result = mDownMessageQueueParcelable.validate()) != OBOE_OK) {
+    if ((result = mDownMessageQueueParcelable.validate()) != AAUDIO_OK) {
         ALOGE("AudioEndpointParcelable invalid mDownMessageQueueParcelable = %d", result);
         return result;
     }
-    if ((result = mUpDataQueueParcelable.validate()) != OBOE_OK) {
+    if ((result = mUpDataQueueParcelable.validate()) != AAUDIO_OK) {
         ALOGE("AudioEndpointParcelable invalid mUpDataQueueParcelable = %d", result);
         return result;
     }
-    if ((result = mDownDataQueueParcelable.validate()) != OBOE_OK) {
+    if ((result = mDownDataQueueParcelable.validate()) != AAUDIO_OK) {
         ALOGE("AudioEndpointParcelable invalid mDownDataQueueParcelable = %d", result);
         return result;
     }
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
 void AudioEndpointParcelable::dump() {
diff --git a/media/liboboe/src/binding/AudioEndpointParcelable.h b/media/liboboe/src/binding/AudioEndpointParcelable.h
index 6bdd8a4..d4646d0 100644
--- a/media/liboboe/src/binding/AudioEndpointParcelable.h
+++ b/media/liboboe/src/binding/AudioEndpointParcelable.h
@@ -23,18 +23,18 @@
 #include <binder/Parcel.h>
 #include <binder/Parcelable.h>
 
-#include "binding/OboeServiceDefinitions.h"
+#include "binding/AAudioServiceDefinitions.h"
 #include "binding/RingBufferParcelable.h"
 
 using android::status_t;
 using android::Parcel;
 using android::Parcelable;
 
-namespace oboe {
+namespace aaudio {
 
 /**
  * Container for information about the message queues plus
- * general stream information needed by Oboe clients.
+ * general stream information needed by AAudio clients.
  * It contains no addresses, just sizes, offsets and file descriptors for
  * shared memory that can be passed through Binder.
  */
@@ -53,9 +53,9 @@
 
     virtual status_t readFromParcel(const Parcel* parcel) override;
 
-    oboe_result_t resolve(EndpointDescriptor *descriptor);
+    aaudio_result_t resolve(EndpointDescriptor *descriptor);
 
-    oboe_result_t validate();
+    aaudio_result_t validate();
 
     void dump();
 
@@ -71,6 +71,6 @@
     SharedMemoryParcelable  mSharedMemories[MAX_SHARED_MEMORIES];
 };
 
-} /* namespace oboe */
+} /* namespace aaudio */
 
 #endif //BINDING_AUDIOENDPOINTPARCELABLE_H
diff --git a/media/liboboe/src/binding/IAAudioService.cpp b/media/liboboe/src/binding/IAAudioService.cpp
new file mode 100644
index 0000000..899ebc0
--- /dev/null
+++ b/media/liboboe/src/binding/IAAudioService.cpp
@@ -0,0 +1,284 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include <aaudio/AAudioDefinitions.h>
+
+#include "binding/AudioEndpointParcelable.h"
+#include "binding/AAudioStreamRequest.h"
+#include "binding/AAudioStreamConfiguration.h"
+#include "binding/IAAudioService.h"
+#include "utility/AAudioUtilities.h"
+
+namespace android {
+
+/**
+ * This is used by the AAudio Client to talk to the AAudio Service.
+ *
+ * The order of parameters in the Parcels must match with code in AAudioService.cpp.
+ */
+class BpAAudioService : public BpInterface<IAAudioService>
+{
+public:
+    explicit BpAAudioService(const sp<IBinder>& impl)
+        : BpInterface<IAAudioService>(impl)
+    {
+    }
+
+    virtual aaudio_handle_t openStream(aaudio::AAudioStreamRequest &request,
+                                     aaudio::AAudioStreamConfiguration &configuration) override {
+        Parcel data, reply;
+        // send command
+        data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor());
+        request.writeToParcel(&data);
+        status_t err = remote()->transact(OPEN_STREAM, data, &reply);
+        if (err != NO_ERROR) {
+            return AAudioConvert_androidToAAudioResult(err);
+        }
+        // parse reply
+        aaudio_handle_t stream;
+        reply.readInt32(&stream);
+        configuration.readFromParcel(&reply);
+        return stream;
+    }
+
+    virtual aaudio_result_t closeStream(aaudio_handle_t streamHandle) override {
+        Parcel data, reply;
+        // send command
+        data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor());
+        data.writeInt32(streamHandle);
+        status_t err = remote()->transact(CLOSE_STREAM, data, &reply);
+        if (err != NO_ERROR) {
+            return AAudioConvert_androidToAAudioResult(err);
+        }
+        // parse reply
+        aaudio_result_t res;
+        reply.readInt32(&res);
+        return res;
+    }
+
+    virtual aaudio_result_t getStreamDescription(aaudio_handle_t streamHandle,
+                                               aaudio::AudioEndpointParcelable &parcelable)   {
+        Parcel data, reply;
+        // send command
+        data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor());
+        data.writeInt32(streamHandle);
+        status_t err = remote()->transact(GET_STREAM_DESCRIPTION, data, &reply);
+        if (err != NO_ERROR) {
+            return AAudioConvert_androidToAAudioResult(err);
+        }
+        // parse reply
+        parcelable.readFromParcel(&reply);
+        parcelable.dump();
+        aaudio_result_t result = parcelable.validate();
+        if (result != AAUDIO_OK) {
+            return result;
+        }
+        reply.readInt32(&result);
+        return result;
+    }
+
+    // TODO should we wait for a reply?
+    virtual aaudio_result_t startStream(aaudio_handle_t streamHandle) override {
+        Parcel data, reply;
+        // send command
+        data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor());
+        data.writeInt32(streamHandle);
+        status_t err = remote()->transact(START_STREAM, data, &reply);
+        if (err != NO_ERROR) {
+            return AAudioConvert_androidToAAudioResult(err);
+        }
+        // parse reply
+        aaudio_result_t res;
+        reply.readInt32(&res);
+        return res;
+    }
+
+    virtual aaudio_result_t pauseStream(aaudio_handle_t streamHandle) override {
+        Parcel data, reply;
+        // send command
+        data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor());
+        data.writeInt32(streamHandle);
+        status_t err = remote()->transact(PAUSE_STREAM, data, &reply);
+        if (err != NO_ERROR) {
+            return AAudioConvert_androidToAAudioResult(err);
+        }
+        // parse reply
+        aaudio_result_t res;
+        reply.readInt32(&res);
+        return res;
+    }
+
+    virtual aaudio_result_t flushStream(aaudio_handle_t streamHandle) override {
+        Parcel data, reply;
+        // send command
+        data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor());
+        data.writeInt32(streamHandle);
+        status_t err = remote()->transact(FLUSH_STREAM, data, &reply);
+        if (err != NO_ERROR) {
+            return AAudioConvert_androidToAAudioResult(err);
+        }
+        // parse reply
+        aaudio_result_t res;
+        reply.readInt32(&res);
+        return res;
+    }
+
+    virtual aaudio_result_t registerAudioThread(aaudio_handle_t streamHandle, pid_t clientThreadId,
+                                              aaudio_nanoseconds_t periodNanoseconds)
+    override {
+        Parcel data, reply;
+        // send command
+        data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor());
+        data.writeInt32(streamHandle);
+        data.writeInt32((int32_t) clientThreadId);
+        data.writeInt64(periodNanoseconds);
+        status_t err = remote()->transact(REGISTER_AUDIO_THREAD, data, &reply);
+        if (err != NO_ERROR) {
+            return AAudioConvert_androidToAAudioResult(err);
+        }
+        // parse reply
+        aaudio_result_t res;
+        reply.readInt32(&res);
+        return res;
+    }
+
+    virtual aaudio_result_t unregisterAudioThread(aaudio_handle_t streamHandle, pid_t clientThreadId)
+    override {
+        Parcel data, reply;
+        // send command
+        data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor());
+        data.writeInt32(streamHandle);
+        data.writeInt32((int32_t) clientThreadId);
+        status_t err = remote()->transact(UNREGISTER_AUDIO_THREAD, data, &reply);
+        if (err != NO_ERROR) {
+            return AAudioConvert_androidToAAudioResult(err);
+        }
+        // parse reply
+        aaudio_result_t res;
+        reply.readInt32(&res);
+        return res;
+    }
+
+};
+
+// Implement an interface to the service.
+// This is here so that you don't have to link with liboboe static library.
+IMPLEMENT_META_INTERFACE(AAudioService, "IAAudioService");
+
+// The order of parameters in the Parcels must match with code in BpAAudioService
+
+status_t BnAAudioService::onTransact(uint32_t code, const Parcel& data,
+                                        Parcel* reply, uint32_t flags) {
+    AAudioStream stream;
+    aaudio::AAudioStreamRequest request;
+    aaudio::AAudioStreamConfiguration configuration;
+    pid_t pid;
+    aaudio_nanoseconds_t nanoseconds;
+    aaudio_result_t result;
+    ALOGV("BnAAudioService::onTransact(%i) %i", code, flags);
+    data.checkInterface(this);
+
+    switch(code) {
+        case OPEN_STREAM: {
+            request.readFromParcel(&data);
+            stream = openStream(request, configuration);
+            ALOGD("BnAAudioService::onTransact OPEN_STREAM server handle = 0x%08X", stream);
+            reply->writeInt32(stream);
+            configuration.writeToParcel(reply);
+            return NO_ERROR;
+        } break;
+
+        case CLOSE_STREAM: {
+            data.readInt32(&stream);
+            ALOGD("BnAAudioService::onTransact CLOSE_STREAM 0x%08X", stream);
+            result = closeStream(stream);
+            reply->writeInt32(result);
+            return NO_ERROR;
+        } break;
+
+        case GET_STREAM_DESCRIPTION: {
+            data.readInt32(&stream);
+            ALOGD("BnAAudioService::onTransact GET_STREAM_DESCRIPTION 0x%08X", stream);
+            aaudio::AudioEndpointParcelable parcelable;
+            result = getStreamDescription(stream, parcelable);
+            if (result != AAUDIO_OK) {
+                return AAudioConvert_aaudioToAndroidStatus(result);
+            }
+            parcelable.dump();
+            result = parcelable.validate();
+            if (result != AAUDIO_OK) {
+                return AAudioConvert_aaudioToAndroidStatus(result);
+            }
+            parcelable.writeToParcel(reply);
+            reply->writeInt32(result);
+            return NO_ERROR;
+        } break;
+
+        case START_STREAM: {
+            data.readInt32(&stream);
+            result = startStream(stream);
+            ALOGD("BnAAudioService::onTransact START_STREAM 0x%08X, result = %d",
+                    stream, result);
+            reply->writeInt32(result);
+            return NO_ERROR;
+        } break;
+
+        case PAUSE_STREAM: {
+            data.readInt32(&stream);
+            result = pauseStream(stream);
+            ALOGD("BnAAudioService::onTransact PAUSE_STREAM 0x%08X, result = %d",
+                    stream, result);
+            reply->writeInt32(result);
+            return NO_ERROR;
+        } break;
+
+        case FLUSH_STREAM: {
+            data.readInt32(&stream);
+            result = flushStream(stream);
+            ALOGD("BnAAudioService::onTransact FLUSH_STREAM 0x%08X, result = %d",
+                    stream, result);
+            reply->writeInt32(result);
+            return NO_ERROR;
+        } break;
+
+        case REGISTER_AUDIO_THREAD: {
+            data.readInt32(&stream);
+            data.readInt32(&pid);
+            data.readInt64(&nanoseconds);
+            result = registerAudioThread(stream, pid, nanoseconds);
+            ALOGD("BnAAudioService::onTransact REGISTER_AUDIO_THREAD 0x%08X, result = %d",
+                    stream, result);
+            reply->writeInt32(result);
+            return NO_ERROR;
+        } break;
+
+        case UNREGISTER_AUDIO_THREAD: {
+            data.readInt32(&stream);
+            data.readInt32(&pid);
+            result = unregisterAudioThread(stream, pid);
+            ALOGD("BnAAudioService::onTransact UNREGISTER_AUDIO_THREAD 0x%08X, result = %d",
+                    stream, result);
+            reply->writeInt32(result);
+            return NO_ERROR;
+        } break;
+
+        default:
+            // ALOGW("BnAAudioService::onTransact not handled %u", code);
+            return BBinder::onTransact(code, data, reply, flags);
+    }
+}
+
+} /* namespace android */
diff --git a/media/liboboe/src/binding/IAAudioService.h b/media/liboboe/src/binding/IAAudioService.h
new file mode 100644
index 0000000..7d2fd29
--- /dev/null
+++ b/media/liboboe/src/binding/IAAudioService.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2016 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 BINDING_IAAUDIOSERVICE_H
+#define BINDING_IAAUDIOSERVICE_H
+
+#include <stdint.h>
+#include <utils/RefBase.h>
+#include <binder/TextOutput.h>
+#include <binder/IInterface.h>
+
+#include <aaudio/AAudio.h>
+
+#include "binding/AAudioServiceDefinitions.h"
+#include "binding/AudioEndpointParcelable.h"
+#include "binding/AAudioStreamRequest.h"
+#include "binding/AAudioStreamConfiguration.h"
+
+
+namespace android {
+
+// Interface (our AIDL) - Shared by server and client
+class IAAudioService : public IInterface {
+public:
+
+    DECLARE_META_INTERFACE(AAudioService);
+
+    virtual aaudio_handle_t openStream(aaudio::AAudioStreamRequest &request,
+                                     aaudio::AAudioStreamConfiguration &configuration) = 0;
+
+    virtual aaudio_result_t closeStream(aaudio_handle_t streamHandle) = 0;
+
+    /* Get an immutable description of the in-memory queues
+    * used to communicate with the underlying HAL or Service.
+    */
+    virtual aaudio_result_t getStreamDescription(aaudio_handle_t streamHandle,
+                                               aaudio::AudioEndpointParcelable &parcelable) = 0;
+
+    /**
+     * Start the flow of data.
+     */
+    virtual aaudio_result_t startStream(aaudio_handle_t streamHandle) = 0;
+
+    /**
+     * Stop the flow of data such that start() can resume without loss of data.
+     */
+    virtual aaudio_result_t pauseStream(aaudio_handle_t streamHandle) = 0;
+
+    /**
+     *  Discard any data held by the underlying HAL or Service.
+     */
+    virtual aaudio_result_t flushStream(aaudio_handle_t streamHandle) = 0;
+
+    /**
+     * Manage the specified thread as a low latency audio thread.
+     */
+    virtual aaudio_result_t registerAudioThread(aaudio_handle_t streamHandle, pid_t clientThreadId,
+                                              aaudio_nanoseconds_t periodNanoseconds) = 0;
+
+    virtual aaudio_result_t unregisterAudioThread(aaudio_handle_t streamHandle,
+                                                pid_t clientThreadId) = 0;
+};
+
+class BnAAudioService : public BnInterface<IAAudioService> {
+public:
+    virtual status_t onTransact(uint32_t code, const Parcel& data,
+                                Parcel* reply, uint32_t flags = 0);
+
+};
+
+} /* namespace android */
+
+#endif //BINDING_IAAUDIOSERVICE_H
diff --git a/media/liboboe/src/binding/IOboeAudioService.cpp b/media/liboboe/src/binding/IOboeAudioService.cpp
deleted file mode 100644
index 2584bc9..0000000
--- a/media/liboboe/src/binding/IOboeAudioService.cpp
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright (C) 2016 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.
- */
-
-#include <oboe/OboeDefinitions.h>
-
-#include "binding/AudioEndpointParcelable.h"
-#include "binding/OboeStreamRequest.h"
-#include "binding/OboeStreamConfiguration.h"
-#include "binding/IOboeAudioService.h"
-#include "utility/OboeUtilities.h"
-
-namespace android {
-
-/**
- * This is used by the Oboe Client to talk to the Oboe Service.
- *
- * The order of parameters in the Parcels must match with code in OboeAudioService.cpp.
- */
-class BpOboeAudioService : public BpInterface<IOboeAudioService>
-{
-public:
-    explicit BpOboeAudioService(const sp<IBinder>& impl)
-        : BpInterface<IOboeAudioService>(impl)
-    {
-    }
-
-    virtual oboe_handle_t openStream(oboe::OboeStreamRequest &request,
-                                     oboe::OboeStreamConfiguration &configuration) override {
-        Parcel data, reply;
-        // send command
-        data.writeInterfaceToken(IOboeAudioService::getInterfaceDescriptor());
-        request.writeToParcel(&data);
-        status_t err = remote()->transact(OPEN_STREAM, data, &reply);
-        if (err != NO_ERROR) {
-            return OboeConvert_androidToOboeResult(err);
-        }
-        // parse reply
-        oboe_handle_t stream;
-        reply.readInt32(&stream);
-        configuration.readFromParcel(&reply);
-        return stream;
-    }
-
-    virtual oboe_result_t closeStream(oboe_handle_t streamHandle) override {
-        Parcel data, reply;
-        // send command
-        data.writeInterfaceToken(IOboeAudioService::getInterfaceDescriptor());
-        data.writeInt32(streamHandle);
-        status_t err = remote()->transact(CLOSE_STREAM, data, &reply);
-        if (err != NO_ERROR) {
-            return OboeConvert_androidToOboeResult(err);
-        }
-        // parse reply
-        oboe_result_t res;
-        reply.readInt32(&res);
-        return res;
-    }
-
-    virtual oboe_result_t getStreamDescription(oboe_handle_t streamHandle,
-                                               oboe::AudioEndpointParcelable &parcelable)   {
-        Parcel data, reply;
-        // send command
-        data.writeInterfaceToken(IOboeAudioService::getInterfaceDescriptor());
-        data.writeInt32(streamHandle);
-        status_t err = remote()->transact(GET_STREAM_DESCRIPTION, data, &reply);
-        if (err != NO_ERROR) {
-            return OboeConvert_androidToOboeResult(err);
-        }
-        // parse reply
-        parcelable.readFromParcel(&reply);
-        parcelable.dump();
-        oboe_result_t result = parcelable.validate();
-        if (result != OBOE_OK) {
-            return result;
-        }
-        reply.readInt32(&result);
-        return result;
-    }
-
-    // TODO should we wait for a reply?
-    virtual oboe_result_t startStream(oboe_handle_t streamHandle) override {
-        Parcel data, reply;
-        // send command
-        data.writeInterfaceToken(IOboeAudioService::getInterfaceDescriptor());
-        data.writeInt32(streamHandle);
-        status_t err = remote()->transact(START_STREAM, data, &reply);
-        if (err != NO_ERROR) {
-            return OboeConvert_androidToOboeResult(err);
-        }
-        // parse reply
-        oboe_result_t res;
-        reply.readInt32(&res);
-        return res;
-    }
-
-    virtual oboe_result_t pauseStream(oboe_handle_t streamHandle) override {
-        Parcel data, reply;
-        // send command
-        data.writeInterfaceToken(IOboeAudioService::getInterfaceDescriptor());
-        data.writeInt32(streamHandle);
-        status_t err = remote()->transact(PAUSE_STREAM, data, &reply);
-        if (err != NO_ERROR) {
-            return OboeConvert_androidToOboeResult(err);
-        }
-        // parse reply
-        oboe_result_t res;
-        reply.readInt32(&res);
-        return res;
-    }
-
-    virtual oboe_result_t flushStream(oboe_handle_t streamHandle) override {
-        Parcel data, reply;
-        // send command
-        data.writeInterfaceToken(IOboeAudioService::getInterfaceDescriptor());
-        data.writeInt32(streamHandle);
-        status_t err = remote()->transact(FLUSH_STREAM, data, &reply);
-        if (err != NO_ERROR) {
-            return OboeConvert_androidToOboeResult(err);
-        }
-        // parse reply
-        oboe_result_t res;
-        reply.readInt32(&res);
-        return res;
-    }
-
-    virtual oboe_result_t registerAudioThread(oboe_handle_t streamHandle, pid_t clientThreadId,
-                                              oboe_nanoseconds_t periodNanoseconds)
-    override {
-        Parcel data, reply;
-        // send command
-        data.writeInterfaceToken(IOboeAudioService::getInterfaceDescriptor());
-        data.writeInt32(streamHandle);
-        data.writeInt32((int32_t) clientThreadId);
-        data.writeInt64(periodNanoseconds);
-        status_t err = remote()->transact(REGISTER_AUDIO_THREAD, data, &reply);
-        if (err != NO_ERROR) {
-            return OboeConvert_androidToOboeResult(err);
-        }
-        // parse reply
-        oboe_result_t res;
-        reply.readInt32(&res);
-        return res;
-    }
-
-    virtual oboe_result_t unregisterAudioThread(oboe_handle_t streamHandle, pid_t clientThreadId)
-    override {
-        Parcel data, reply;
-        // send command
-        data.writeInterfaceToken(IOboeAudioService::getInterfaceDescriptor());
-        data.writeInt32(streamHandle);
-        data.writeInt32((int32_t) clientThreadId);
-        status_t err = remote()->transact(UNREGISTER_AUDIO_THREAD, data, &reply);
-        if (err != NO_ERROR) {
-            return OboeConvert_androidToOboeResult(err);
-        }
-        // parse reply
-        oboe_result_t res;
-        reply.readInt32(&res);
-        return res;
-    }
-
-};
-
-// Implement an interface to the service.
-// This is here so that you don't have to link with liboboe static library.
-IMPLEMENT_META_INTERFACE(OboeAudioService, "IOboeAudioService");
-
-// The order of parameters in the Parcels must match with code in BpOboeAudioService
-
-status_t BnOboeAudioService::onTransact(uint32_t code, const Parcel& data,
-                                        Parcel* reply, uint32_t flags) {
-    OboeStream stream;
-    oboe::OboeStreamRequest request;
-    oboe::OboeStreamConfiguration configuration;
-    pid_t pid;
-    oboe_nanoseconds_t nanoseconds;
-    oboe_result_t result;
-    ALOGV("BnOboeAudioService::onTransact(%i) %i", code, flags);
-    data.checkInterface(this);
-
-    switch(code) {
-        case OPEN_STREAM: {
-            request.readFromParcel(&data);
-            stream = openStream(request, configuration);
-            ALOGD("BnOboeAudioService::onTransact OPEN_STREAM server handle = 0x%08X", stream);
-            reply->writeInt32(stream);
-            configuration.writeToParcel(reply);
-            return NO_ERROR;
-        } break;
-
-        case CLOSE_STREAM: {
-            data.readInt32(&stream);
-            ALOGD("BnOboeAudioService::onTransact CLOSE_STREAM 0x%08X", stream);
-            result = closeStream(stream);
-            reply->writeInt32(result);
-            return NO_ERROR;
-        } break;
-
-        case GET_STREAM_DESCRIPTION: {
-            data.readInt32(&stream);
-            ALOGD("BnOboeAudioService::onTransact GET_STREAM_DESCRIPTION 0x%08X", stream);
-            oboe::AudioEndpointParcelable parcelable;
-            result = getStreamDescription(stream, parcelable);
-            if (result != OBOE_OK) {
-                return OboeConvert_oboeToAndroidStatus(result);
-            }
-            parcelable.dump();
-            result = parcelable.validate();
-            if (result != OBOE_OK) {
-                return OboeConvert_oboeToAndroidStatus(result);
-            }
-            parcelable.writeToParcel(reply);
-            reply->writeInt32(result);
-            return NO_ERROR;
-        } break;
-
-        case START_STREAM: {
-            data.readInt32(&stream);
-            result = startStream(stream);
-            ALOGD("BnOboeAudioService::onTransact START_STREAM 0x%08X, result = %d",
-                    stream, result);
-            reply->writeInt32(result);
-            return NO_ERROR;
-        } break;
-
-        case PAUSE_STREAM: {
-            data.readInt32(&stream);
-            result = pauseStream(stream);
-            ALOGD("BnOboeAudioService::onTransact PAUSE_STREAM 0x%08X, result = %d",
-                    stream, result);
-            reply->writeInt32(result);
-            return NO_ERROR;
-        } break;
-
-        case FLUSH_STREAM: {
-            data.readInt32(&stream);
-            result = flushStream(stream);
-            ALOGD("BnOboeAudioService::onTransact FLUSH_STREAM 0x%08X, result = %d",
-                    stream, result);
-            reply->writeInt32(result);
-            return NO_ERROR;
-        } break;
-
-        case REGISTER_AUDIO_THREAD: {
-            data.readInt32(&stream);
-            data.readInt32(&pid);
-            data.readInt64(&nanoseconds);
-            result = registerAudioThread(stream, pid, nanoseconds);
-            ALOGD("BnOboeAudioService::onTransact REGISTER_AUDIO_THREAD 0x%08X, result = %d",
-                    stream, result);
-            reply->writeInt32(result);
-            return NO_ERROR;
-        } break;
-
-        case UNREGISTER_AUDIO_THREAD: {
-            data.readInt32(&stream);
-            data.readInt32(&pid);
-            result = unregisterAudioThread(stream, pid);
-            ALOGD("BnOboeAudioService::onTransact UNREGISTER_AUDIO_THREAD 0x%08X, result = %d",
-                    stream, result);
-            reply->writeInt32(result);
-            return NO_ERROR;
-        } break;
-
-        default:
-            // ALOGW("BnOboeAudioService::onTransact not handled %u", code);
-            return BBinder::onTransact(code, data, reply, flags);
-    }
-}
-
-} /* namespace android */
diff --git a/media/liboboe/src/binding/IOboeAudioService.h b/media/liboboe/src/binding/IOboeAudioService.h
deleted file mode 100644
index e2a9c15..0000000
--- a/media/liboboe/src/binding/IOboeAudioService.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2016 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 BINDING_IOBOEAUDIOSERVICE_H
-#define BINDING_IOBOEAUDIOSERVICE_H
-
-#include <stdint.h>
-#include <utils/RefBase.h>
-#include <binder/TextOutput.h>
-#include <binder/IInterface.h>
-
-#include <oboe/OboeAudio.h>
-
-#include "binding/OboeServiceDefinitions.h"
-#include "binding/AudioEndpointParcelable.h"
-#include "binding/OboeStreamRequest.h"
-#include "binding/OboeStreamConfiguration.h"
-
-
-namespace android {
-
-// Interface (our AIDL) - Shared by server and client
-class IOboeAudioService : public IInterface {
-public:
-
-    DECLARE_META_INTERFACE(OboeAudioService);
-
-    virtual oboe_handle_t openStream(oboe::OboeStreamRequest &request,
-                                     oboe::OboeStreamConfiguration &configuration) = 0;
-
-    virtual oboe_result_t closeStream(oboe_handle_t streamHandle) = 0;
-
-    /* Get an immutable description of the in-memory queues
-    * used to communicate with the underlying HAL or Service.
-    */
-    virtual oboe_result_t getStreamDescription(oboe_handle_t streamHandle,
-                                               oboe::AudioEndpointParcelable &parcelable) = 0;
-
-    /**
-     * Start the flow of data.
-     */
-    virtual oboe_result_t startStream(oboe_handle_t streamHandle) = 0;
-
-    /**
-     * Stop the flow of data such that start() can resume without loss of data.
-     */
-    virtual oboe_result_t pauseStream(oboe_handle_t streamHandle) = 0;
-
-    /**
-     *  Discard any data held by the underlying HAL or Service.
-     */
-    virtual oboe_result_t flushStream(oboe_handle_t streamHandle) = 0;
-
-    /**
-     * Manage the specified thread as a low latency audio thread.
-     */
-    virtual oboe_result_t registerAudioThread(oboe_handle_t streamHandle, pid_t clientThreadId,
-                                              oboe_nanoseconds_t periodNanoseconds) = 0;
-
-    virtual oboe_result_t unregisterAudioThread(oboe_handle_t streamHandle,
-                                                pid_t clientThreadId) = 0;
-};
-
-class BnOboeAudioService : public BnInterface<IOboeAudioService> {
-public:
-    virtual status_t onTransact(uint32_t code, const Parcel& data,
-                                Parcel* reply, uint32_t flags = 0);
-
-};
-
-} /* namespace android */
-
-#endif //BINDING_IOBOEAUDIOSERVICE_H
diff --git a/media/liboboe/src/binding/OboeServiceMessage.h b/media/liboboe/src/binding/OboeServiceMessage.h
deleted file mode 100644
index aa13571..0000000
--- a/media/liboboe/src/binding/OboeServiceMessage.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2016 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 OBOE_OBOE_SERVICE_MESSAGE_H
-#define OBOE_OBOE_SERVICE_MESSAGE_H
-
-#include <stdint.h>
-
-#include <oboe/OboeDefinitions.h>
-
-namespace oboe {
-
-// TODO move this an "include" folder for the service.
-
-struct OboeMessageTimestamp {
-    oboe_position_frames_t position;
-    int64_t                deviceOffset; // add to client position to get device position
-    oboe_nanoseconds_t     timestamp;
-};
-
-typedef enum oboe_service_event_e : uint32_t {
-    OBOE_SERVICE_EVENT_STARTED,
-    OBOE_SERVICE_EVENT_PAUSED,
-    OBOE_SERVICE_EVENT_FLUSHED,
-    OBOE_SERVICE_EVENT_CLOSED,
-    OBOE_SERVICE_EVENT_DISCONNECTED
-} oboe_service_event_t;
-
-struct OboeMessageEvent {
-    oboe_service_event_t event;
-    int32_t data1;
-    int64_t data2;
-};
-
-typedef struct OboeServiceMessage_s {
-    enum class code : uint32_t {
-        NOTHING,
-        TIMESTAMP,
-        EVENT,
-    };
-
-    code what;
-    union {
-        OboeMessageTimestamp timestamp;
-        OboeMessageEvent event;
-    };
-} OboeServiceMessage;
-
-
-} /* namespace oboe */
-
-#endif //OBOE_OBOE_SERVICE_MESSAGE_H
diff --git a/media/liboboe/src/binding/OboeStreamConfiguration.cpp b/media/liboboe/src/binding/OboeStreamConfiguration.cpp
deleted file mode 100644
index 124e964..0000000
--- a/media/liboboe/src/binding/OboeStreamConfiguration.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2016 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.
- */
-
-#include <stdint.h>
-
-#include <sys/mman.h>
-#include <binder/Parcel.h>
-#include <binder/Parcelable.h>
-
-#include <oboe/OboeDefinitions.h>
-
-#include "binding/OboeStreamConfiguration.h"
-
-using android::NO_ERROR;
-using android::status_t;
-using android::Parcel;
-using android::Parcelable;
-
-using namespace oboe;
-
-OboeStreamConfiguration::OboeStreamConfiguration() {}
-OboeStreamConfiguration::~OboeStreamConfiguration() {}
-
-status_t OboeStreamConfiguration::writeToParcel(Parcel* parcel) const {
-    parcel->writeInt32(mDeviceId);
-    parcel->writeInt32(mSampleRate);
-    parcel->writeInt32(mSamplesPerFrame);
-    parcel->writeInt32((int32_t) mAudioFormat);
-    return NO_ERROR; // TODO check for errors above
-}
-
-status_t OboeStreamConfiguration::readFromParcel(const Parcel* parcel) {
-    int32_t temp;
-    parcel->readInt32(&mDeviceId);
-    parcel->readInt32(&mSampleRate);
-    parcel->readInt32(&mSamplesPerFrame);
-    parcel->readInt32(&temp);
-    mAudioFormat = (oboe_audio_format_t) temp;
-    return NO_ERROR; // TODO check for errors above
-}
-
-oboe_result_t OboeStreamConfiguration::validate() {
-    // Validate results of the open.
-    if (mSampleRate < 0 || mSampleRate >= 8 * 48000) { // TODO review limits
-        ALOGE("OboeStreamConfiguration.validate(): invalid sampleRate = %d", mSampleRate);
-        return OBOE_ERROR_INTERNAL;
-    }
-
-    if (mSamplesPerFrame < 1 || mSamplesPerFrame >= 32) { // TODO review limits
-        ALOGE("OboeStreamConfiguration.validate() invalid samplesPerFrame = %d", mSamplesPerFrame);
-        return OBOE_ERROR_INTERNAL;
-    }
-
-    switch (mAudioFormat) {
-    case OBOE_AUDIO_FORMAT_PCM_I16:
-    case OBOE_AUDIO_FORMAT_PCM_FLOAT:
-    case OBOE_AUDIO_FORMAT_PCM_I8_24:
-    case OBOE_AUDIO_FORMAT_PCM_I32:
-        break;
-    default:
-        ALOGE("OboeStreamConfiguration.validate() invalid audioFormat = %d", mAudioFormat);
-        return OBOE_ERROR_INTERNAL;
-    }
-    return OBOE_OK;
-}
-
-void OboeStreamConfiguration::dump() {
-    ALOGD("OboeStreamConfiguration mSampleRate = %d -----", mSampleRate);
-    ALOGD("OboeStreamConfiguration mSamplesPerFrame = %d", mSamplesPerFrame);
-    ALOGD("OboeStreamConfiguration mAudioFormat = %d", (int)mAudioFormat);
-}
diff --git a/media/liboboe/src/binding/OboeStreamConfiguration.h b/media/liboboe/src/binding/OboeStreamConfiguration.h
deleted file mode 100644
index 6bc1924..0000000
--- a/media/liboboe/src/binding/OboeStreamConfiguration.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2016 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 BINDING_OBOE_STREAM_CONFIGURATION_H
-#define BINDING_OBOE_STREAM_CONFIGURATION_H
-
-#include <stdint.h>
-
-#include <binder/Parcel.h>
-#include <binder/Parcelable.h>
-#include <oboe/OboeDefinitions.h>
-
-using android::status_t;
-using android::Parcel;
-using android::Parcelable;
-
-namespace oboe {
-
-class OboeStreamConfiguration : public Parcelable {
-public:
-    OboeStreamConfiguration();
-    virtual ~OboeStreamConfiguration();
-
-    oboe_device_id_t getDeviceId() const {
-        return mDeviceId;
-    }
-
-    void setDeviceId(oboe_device_id_t deviceId) {
-        mDeviceId = deviceId;
-    }
-
-    oboe_sample_rate_t getSampleRate() const {
-        return mSampleRate;
-    }
-
-    void setSampleRate(oboe_sample_rate_t sampleRate) {
-        mSampleRate = sampleRate;
-    }
-
-    int32_t getSamplesPerFrame() const {
-        return mSamplesPerFrame;
-    }
-
-    void setSamplesPerFrame(int32_t samplesPerFrame) {
-        mSamplesPerFrame = samplesPerFrame;
-    }
-
-    oboe_audio_format_t getAudioFormat() const {
-        return mAudioFormat;
-    }
-
-    void setAudioFormat(oboe_audio_format_t audioFormat) {
-        mAudioFormat = audioFormat;
-    }
-
-    virtual status_t writeToParcel(Parcel* parcel) const override;
-
-    virtual status_t readFromParcel(const Parcel* parcel) override;
-
-    oboe_result_t validate();
-
-    void dump();
-
-protected:
-    oboe_device_id_t    mDeviceId        = OBOE_DEVICE_UNSPECIFIED;
-    oboe_sample_rate_t  mSampleRate      = OBOE_UNSPECIFIED;
-    int32_t             mSamplesPerFrame = OBOE_UNSPECIFIED;
-    oboe_audio_format_t mAudioFormat     = OBOE_AUDIO_FORMAT_UNSPECIFIED;
-};
-
-} /* namespace oboe */
-
-#endif //BINDING_OBOE_STREAM_CONFIGURATION_H
diff --git a/media/liboboe/src/binding/RingBufferParcelable.cpp b/media/liboboe/src/binding/RingBufferParcelable.cpp
index f097655..3a92929 100644
--- a/media/liboboe/src/binding/RingBufferParcelable.cpp
+++ b/media/liboboe/src/binding/RingBufferParcelable.cpp
@@ -18,11 +18,11 @@
 
 #include <binder/Parcelable.h>
 
-#include "binding/OboeServiceDefinitions.h"
+#include "binding/AAudioServiceDefinitions.h"
 #include "binding/SharedRegionParcelable.h"
 #include "binding/RingBufferParcelable.h"
 
-using namespace oboe;
+using namespace aaudio;
 
 RingBufferParcelable::RingBufferParcelable() {}
 RingBufferParcelable::~RingBufferParcelable() {}
@@ -100,23 +100,23 @@
     return NO_ERROR; // TODO check for errors above
 }
 
-oboe_result_t RingBufferParcelable::resolve(SharedMemoryParcelable *memoryParcels, RingBufferDescriptor *descriptor) {
-    oboe_result_t result;
+aaudio_result_t RingBufferParcelable::resolve(SharedMemoryParcelable *memoryParcels, RingBufferDescriptor *descriptor) {
+    aaudio_result_t result;
 
     result = mReadCounterParcelable.resolve(memoryParcels,
                                             (void **) &descriptor->readCounterAddress);
-    if (result != OBOE_OK) {
+    if (result != AAUDIO_OK) {
         return result;
     }
 
     result = mWriteCounterParcelable.resolve(memoryParcels,
                                              (void **) &descriptor->writeCounterAddress);
-    if (result != OBOE_OK) {
+    if (result != AAUDIO_OK) {
         return result;
     }
 
     result = mDataParcelable.resolve(memoryParcels, (void **) &descriptor->dataAddress);
-    if (result != OBOE_OK) {
+    if (result != AAUDIO_OK) {
         return result;
     }
 
@@ -124,36 +124,36 @@
     descriptor->framesPerBurst = mFramesPerBurst;
     descriptor->capacityInFrames = mCapacityInFrames;
     descriptor->flags = mFlags;
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
-oboe_result_t RingBufferParcelable::validate() {
-    oboe_result_t result;
+aaudio_result_t RingBufferParcelable::validate() {
+    aaudio_result_t result;
     if (mCapacityInFrames < 0 || mCapacityInFrames >= 32 * 1024) {
         ALOGE("RingBufferParcelable invalid mCapacityInFrames = %d", mCapacityInFrames);
-        return OBOE_ERROR_INTERNAL;
+        return AAUDIO_ERROR_INTERNAL;
     }
     if (mBytesPerFrame < 0 || mBytesPerFrame >= 256) {
         ALOGE("RingBufferParcelable invalid mBytesPerFrame = %d", mBytesPerFrame);
-        return OBOE_ERROR_INTERNAL;
+        return AAUDIO_ERROR_INTERNAL;
     }
     if (mFramesPerBurst < 0 || mFramesPerBurst >= 1024) {
         ALOGE("RingBufferParcelable invalid mFramesPerBurst = %d", mFramesPerBurst);
-        return OBOE_ERROR_INTERNAL;
+        return AAUDIO_ERROR_INTERNAL;
     }
-    if ((result = mReadCounterParcelable.validate()) != OBOE_OK) {
+    if ((result = mReadCounterParcelable.validate()) != AAUDIO_OK) {
         ALOGE("RingBufferParcelable invalid mReadCounterParcelable = %d", result);
         return result;
     }
-    if ((result = mWriteCounterParcelable.validate()) != OBOE_OK) {
+    if ((result = mWriteCounterParcelable.validate()) != AAUDIO_OK) {
         ALOGE("RingBufferParcelable invalid mWriteCounterParcelable = %d", result);
         return result;
     }
-    if ((result = mDataParcelable.validate()) != OBOE_OK) {
+    if ((result = mDataParcelable.validate()) != AAUDIO_OK) {
         ALOGE("RingBufferParcelable invalid mDataParcelable = %d", result);
         return result;
     }
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
 
diff --git a/media/liboboe/src/binding/RingBufferParcelable.h b/media/liboboe/src/binding/RingBufferParcelable.h
index 9bb695a..3f82c79 100644
--- a/media/liboboe/src/binding/RingBufferParcelable.h
+++ b/media/liboboe/src/binding/RingBufferParcelable.h
@@ -21,10 +21,10 @@
 
 #include <binder/Parcelable.h>
 
-#include "binding/OboeServiceDefinitions.h"
+#include "binding/AAudioServiceDefinitions.h"
 #include "binding/SharedRegionParcelable.h"
 
-namespace oboe {
+namespace aaudio {
 
 class RingBufferParcelable : public Parcelable {
 public:
@@ -62,9 +62,9 @@
 
     virtual status_t readFromParcel(const Parcel* parcel) override;
 
-    oboe_result_t resolve(SharedMemoryParcelable *memoryParcels, RingBufferDescriptor *descriptor);
+    aaudio_result_t resolve(SharedMemoryParcelable *memoryParcels, RingBufferDescriptor *descriptor);
 
-    oboe_result_t validate();
+    aaudio_result_t validate();
 
     void dump();
 
@@ -78,6 +78,6 @@
     RingbufferFlags         mFlags = RingbufferFlags::NONE;
 };
 
-} /* namespace oboe */
+} /* namespace aaudio */
 
 #endif //BINDING_RINGBUFFER_PARCELABLE_H
diff --git a/media/liboboe/src/binding/SharedMemoryParcelable.cpp b/media/liboboe/src/binding/SharedMemoryParcelable.cpp
index 5b739c0..277a992 100644
--- a/media/liboboe/src/binding/SharedMemoryParcelable.cpp
+++ b/media/liboboe/src/binding/SharedMemoryParcelable.cpp
@@ -17,7 +17,7 @@
 #include <stdint.h>
 
 #include <sys/mman.h>
-#include <oboe/OboeDefinitions.h>
+#include <aaudio/AAudioDefinitions.h>
 
 #include <binder/Parcelable.h>
 
@@ -28,7 +28,7 @@
 using android::Parcel;
 using android::Parcelable;
 
-using namespace oboe;
+using namespace aaudio;
 
 SharedMemoryParcelable::SharedMemoryParcelable() {}
 SharedMemoryParcelable::~SharedMemoryParcelable() {};
@@ -56,48 +56,48 @@
 
 // TODO Add code to unmmap()
 
-oboe_result_t SharedMemoryParcelable::resolve(int32_t offsetInBytes, int32_t sizeInBytes,
+aaudio_result_t SharedMemoryParcelable::resolve(int32_t offsetInBytes, int32_t sizeInBytes,
                                               void **regionAddressPtr) {
     if (offsetInBytes < 0) {
         ALOGE("SharedMemoryParcelable illegal offsetInBytes = %d", offsetInBytes);
-        return OBOE_ERROR_OUT_OF_RANGE;
+        return AAUDIO_ERROR_OUT_OF_RANGE;
     } else if ((offsetInBytes + sizeInBytes) > mSizeInBytes) {
         ALOGE("SharedMemoryParcelable out of range, offsetInBytes = %d, "
               "sizeInBytes = %d, mSizeInBytes = %d",
               offsetInBytes, sizeInBytes, mSizeInBytes);
-        return OBOE_ERROR_OUT_OF_RANGE;
+        return AAUDIO_ERROR_OUT_OF_RANGE;
     }
     if (mResolvedAddress == nullptr) {
         mResolvedAddress = (uint8_t *) mmap(0, mSizeInBytes, PROT_READ|PROT_WRITE,
                                           MAP_SHARED, mFd, 0);
         if (mResolvedAddress == nullptr) {
             ALOGE("SharedMemoryParcelable mmap failed for fd = %d", mFd);
-            return OBOE_ERROR_INTERNAL;
+            return AAUDIO_ERROR_INTERNAL;
         }
     }
     *regionAddressPtr = mResolvedAddress + offsetInBytes;
     ALOGD("SharedMemoryParcelable mResolvedAddress = %p", mResolvedAddress);
     ALOGD("SharedMemoryParcelable offset by %d, *regionAddressPtr = %p",
           offsetInBytes, *regionAddressPtr);
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
 int32_t SharedMemoryParcelable::getSizeInBytes() {
     return mSizeInBytes;
 }
 
-oboe_result_t SharedMemoryParcelable::validate() {
+aaudio_result_t SharedMemoryParcelable::validate() {
     if (mSizeInBytes < 0 || mSizeInBytes >= MAX_MMAP_SIZE) {
         ALOGE("SharedMemoryParcelable invalid mSizeInBytes = %d", mSizeInBytes);
-        return OBOE_ERROR_INTERNAL;
+        return AAUDIO_ERROR_INTERNAL;
     }
     if (mSizeInBytes > 0) {
         if (mFd == -1) {
             ALOGE("SharedMemoryParcelable uninitialized mFd = %d", mFd);
-            return OBOE_ERROR_INTERNAL;
+            return AAUDIO_ERROR_INTERNAL;
         }
     }
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
 void SharedMemoryParcelable::dump() {
diff --git a/media/liboboe/src/binding/SharedMemoryParcelable.h b/media/liboboe/src/binding/SharedMemoryParcelable.h
index 9585779..5768ea9 100644
--- a/media/liboboe/src/binding/SharedMemoryParcelable.h
+++ b/media/liboboe/src/binding/SharedMemoryParcelable.h
@@ -27,7 +27,7 @@
 using android::Parcel;
 using android::Parcelable;
 
-namespace oboe {
+namespace aaudio {
 
 // Arbitrary limits for sanity checks. TODO remove after debugging.
 #define MAX_SHARED_MEMORIES (32)
@@ -49,11 +49,11 @@
 
     virtual status_t readFromParcel(const Parcel* parcel) override;
 
-    oboe_result_t resolve(int32_t offsetInBytes, int32_t sizeInBytes, void **regionAddressPtr);
+    aaudio_result_t resolve(int32_t offsetInBytes, int32_t sizeInBytes, void **regionAddressPtr);
 
     int32_t getSizeInBytes();
 
-    oboe_result_t validate();
+    aaudio_result_t validate();
 
     void dump();
 
@@ -63,6 +63,6 @@
     uint8_t *mResolvedAddress = nullptr;
 };
 
-} /* namespace oboe */
+} /* namespace aaudio */
 
 #endif //BINDING_SHAREDMEMORYPARCELABLE_H
diff --git a/media/liboboe/src/binding/SharedRegionParcelable.cpp b/media/liboboe/src/binding/SharedRegionParcelable.cpp
index 86ce8f3..a3e0111 100644
--- a/media/liboboe/src/binding/SharedRegionParcelable.cpp
+++ b/media/liboboe/src/binding/SharedRegionParcelable.cpp
@@ -19,7 +19,7 @@
 #include <sys/mman.h>
 #include <binder/Parcelable.h>
 
-#include <oboe/OboeDefinitions.h>
+#include <aaudio/AAudioDefinitions.h>
 
 #include "binding/SharedMemoryParcelable.h"
 #include "binding/SharedRegionParcelable.h"
@@ -29,7 +29,7 @@
 using android::Parcel;
 using android::Parcelable;
 
-using namespace oboe;
+using namespace aaudio;
 
 SharedRegionParcelable::SharedRegionParcelable() {}
 SharedRegionParcelable::~SharedRegionParcelable() {}
@@ -60,36 +60,36 @@
     return NO_ERROR; // TODO check for errors above
 }
 
-oboe_result_t SharedRegionParcelable::resolve(SharedMemoryParcelable *memoryParcels,
+aaudio_result_t SharedRegionParcelable::resolve(SharedMemoryParcelable *memoryParcels,
                                               void **regionAddressPtr) {
     if (mSizeInBytes == 0) {
         *regionAddressPtr = nullptr;
-        return OBOE_OK;
+        return AAUDIO_OK;
     }
     if (mSharedMemoryIndex < 0) {
         ALOGE("SharedRegionParcelable invalid mSharedMemoryIndex = %d", mSharedMemoryIndex);
-        return OBOE_ERROR_INTERNAL;
+        return AAUDIO_ERROR_INTERNAL;
     }
     SharedMemoryParcelable *memoryParcel = &memoryParcels[mSharedMemoryIndex];
     return memoryParcel->resolve(mOffsetInBytes, mSizeInBytes, regionAddressPtr);
 }
 
-oboe_result_t SharedRegionParcelable::validate() {
+aaudio_result_t SharedRegionParcelable::validate() {
     if (mSizeInBytes < 0 || mSizeInBytes >= MAX_MMAP_SIZE) {
         ALOGE("SharedRegionParcelable invalid mSizeInBytes = %d", mSizeInBytes);
-        return OBOE_ERROR_INTERNAL;
+        return AAUDIO_ERROR_INTERNAL;
     }
     if (mSizeInBytes > 0) {
         if (mOffsetInBytes < 0 || mOffsetInBytes >= MAX_MMAP_OFFSET) {
             ALOGE("SharedRegionParcelable invalid mOffsetInBytes = %d", mOffsetInBytes);
-            return OBOE_ERROR_INTERNAL;
+            return AAUDIO_ERROR_INTERNAL;
         }
         if (mSharedMemoryIndex < 0 || mSharedMemoryIndex >= MAX_SHARED_MEMORIES) {
             ALOGE("SharedRegionParcelable invalid mSharedMemoryIndex = %d", mSharedMemoryIndex);
-            return OBOE_ERROR_INTERNAL;
+            return AAUDIO_ERROR_INTERNAL;
         }
     }
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
 void SharedRegionParcelable::dump() {
diff --git a/media/liboboe/src/binding/SharedRegionParcelable.h b/media/liboboe/src/binding/SharedRegionParcelable.h
index bccdaa8..d6c2281 100644
--- a/media/liboboe/src/binding/SharedRegionParcelable.h
+++ b/media/liboboe/src/binding/SharedRegionParcelable.h
@@ -22,7 +22,7 @@
 #include <sys/mman.h>
 #include <binder/Parcelable.h>
 
-#include <oboe/OboeDefinitions.h>
+#include <aaudio/AAudioDefinitions.h>
 
 #include "binding/SharedMemoryParcelable.h"
 
@@ -30,7 +30,7 @@
 using android::Parcel;
 using android::Parcelable;
 
-namespace oboe {
+namespace aaudio {
 
 class SharedRegionParcelable : public Parcelable {
 public:
@@ -43,9 +43,9 @@
 
     virtual status_t readFromParcel(const Parcel* parcel) override;
 
-    oboe_result_t resolve(SharedMemoryParcelable *memoryParcels, void **regionAddressPtr);
+    aaudio_result_t resolve(SharedMemoryParcelable *memoryParcels, void **regionAddressPtr);
 
-    oboe_result_t validate();
+    aaudio_result_t validate();
 
     void dump();
 
@@ -55,6 +55,6 @@
     int32_t mSizeInBytes       = 0;
 };
 
-} /* namespace oboe */
+} /* namespace aaudio */
 
 #endif //BINDING_SHAREDREGIONPARCELABLE_H
diff --git a/media/liboboe/src/client/AudioEndpoint.cpp b/media/liboboe/src/client/AudioEndpoint.cpp
index 160c37e..5cd9782 100644
--- a/media/liboboe/src/client/AudioEndpoint.cpp
+++ b/media/liboboe/src/client/AudioEndpoint.cpp
@@ -14,19 +14,19 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "OboeAudio"
+#define LOG_TAG "AAudio"
 //#define LOG_NDEBUG 0
 #include <utils/Log.h>
 
 #include <cassert>
-#include <oboe/OboeDefinitions.h>
+#include <aaudio/AAudioDefinitions.h>
 
 #include "AudioEndpointParcelable.h"
 #include "AudioEndpoint.h"
-#include "OboeServiceMessage.h"
+#include "AAudioServiceMessage.h"
 
 using namespace android;
-using namespace oboe;
+using namespace aaudio;
 
 AudioEndpoint::AudioEndpoint()
     : mOutputFreeRunning(false)
@@ -80,13 +80,13 @@
     AudioEndpoint_validateQueueDescriptor("data", &pEndpointDescriptor->downDataQueueDescriptor);
 }
 
-oboe_result_t AudioEndpoint::configure(const EndpointDescriptor *pEndpointDescriptor)
+aaudio_result_t AudioEndpoint::configure(const EndpointDescriptor *pEndpointDescriptor)
 {
-    oboe_result_t result = OBOE_OK;
+    aaudio_result_t result = AAUDIO_OK;
     AudioEndpoint_validateDescriptor(pEndpointDescriptor); // FIXME remove after debugging
 
     const RingBufferDescriptor *descriptor = &pEndpointDescriptor->upMessageQueueDescriptor;
-    assert(descriptor->bytesPerFrame == sizeof(OboeServiceMessage));
+    assert(descriptor->bytesPerFrame == sizeof(AAudioServiceMessage));
     assert(descriptor->readCounterAddress != nullptr);
     assert(descriptor->writeCounterAddress != nullptr);
     mUpCommandQueue = new FifoBuffer(
@@ -137,12 +137,12 @@
     return result;
 }
 
-oboe_result_t AudioEndpoint::readUpCommand(OboeServiceMessage *commandPtr)
+aaudio_result_t AudioEndpoint::readUpCommand(AAudioServiceMessage *commandPtr)
 {
     return mUpCommandQueue->read(commandPtr, 1);
 }
 
-oboe_result_t AudioEndpoint::writeDataNow(const void *buffer, int32_t numFrames)
+aaudio_result_t AudioEndpoint::writeDataNow(const void *buffer, int32_t numFrames)
 {
     return mDownDataQueue->write(buffer, numFrames);
 }
@@ -167,15 +167,15 @@
     return mDownDataQueue->getWriteCounter();
 }
 
-oboe_size_frames_t AudioEndpoint::setBufferSizeInFrames(oboe_size_frames_t requestedFrames,
-                                            oboe_size_frames_t *actualFrames)
+aaudio_size_frames_t AudioEndpoint::setBufferSizeInFrames(aaudio_size_frames_t requestedFrames,
+                                            aaudio_size_frames_t *actualFrames)
 {
     if (requestedFrames < ENDPOINT_DATA_QUEUE_SIZE_MIN) {
         requestedFrames = ENDPOINT_DATA_QUEUE_SIZE_MIN;
     }
     mDownDataQueue->setThreshold(requestedFrames);
     *actualFrames = mDownDataQueue->getThreshold();
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
 int32_t AudioEndpoint::getBufferSizeInFrames() const
diff --git a/media/liboboe/src/client/AudioEndpoint.h b/media/liboboe/src/client/AudioEndpoint.h
index 6ae8b72..e786513 100644
--- a/media/liboboe/src/client/AudioEndpoint.h
+++ b/media/liboboe/src/client/AudioEndpoint.h
@@ -14,16 +14,16 @@
  * limitations under the License.
  */
 
-#ifndef OBOE_AUDIO_ENDPOINT_H
-#define OBOE_AUDIO_ENDPOINT_H
+#ifndef AAUDIO_AUDIO_ENDPOINT_H
+#define AAUDIO_AUDIO_ENDPOINT_H
 
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudio.h>
 
-#include "OboeServiceMessage.h"
+#include "AAudioServiceMessage.h"
 #include "AudioEndpointParcelable.h"
 #include "fifo/FifoBuffer.h"
 
-namespace oboe {
+namespace aaudio {
 
 #define ENDPOINT_DATA_QUEUE_SIZE_MIN   64
 
@@ -40,19 +40,19 @@
     /**
      * Configure based on the EndPointDescriptor_t.
      */
-    oboe_result_t configure(const EndpointDescriptor *pEndpointDescriptor);
+    aaudio_result_t configure(const EndpointDescriptor *pEndpointDescriptor);
 
     /**
      * Read from a command passed up from the Server.
      * @return 1 if command received, 0 for no command, or negative error.
      */
-    oboe_result_t readUpCommand(OboeServiceMessage *commandPtr);
+    aaudio_result_t readUpCommand(AAudioServiceMessage *commandPtr);
 
     /**
      * Non-blocking write.
      * @return framesWritten or a negative error code.
      */
-    oboe_result_t writeDataNow(const void *buffer, int32_t numFrames);
+    aaudio_result_t writeDataNow(const void *buffer, int32_t numFrames);
 
     /**
      * Set the read index in the downData queue.
@@ -71,13 +71,13 @@
      */
     bool isOutputFreeRunning() const { return mOutputFreeRunning; }
 
-    int32_t setBufferSizeInFrames(oboe_size_frames_t requestedFrames,
-                                  oboe_size_frames_t *actualFrames);
-    oboe_size_frames_t getBufferSizeInFrames() const;
+    int32_t setBufferSizeInFrames(aaudio_size_frames_t requestedFrames,
+                                  aaudio_size_frames_t *actualFrames);
+    aaudio_size_frames_t getBufferSizeInFrames() const;
 
-    oboe_size_frames_t getBufferCapacityInFrames() const;
+    aaudio_size_frames_t getBufferCapacityInFrames() const;
 
-    oboe_size_frames_t getFullFramesAvailable();
+    aaudio_size_frames_t getFullFramesAvailable();
 
 private:
     FifoBuffer   * mUpCommandQueue;
@@ -87,6 +87,6 @@
     fifo_counter_t mDataWriteCounter; // only used if free-running
 };
 
-} // namespace oboe
+} // namespace aaudio
 
-#endif //OBOE_AUDIO_ENDPOINT_H
+#endif //AAUDIO_AUDIO_ENDPOINT_H
diff --git a/media/liboboe/src/client/AudioStreamInternal.cpp b/media/liboboe/src/client/AudioStreamInternal.cpp
index dc6fe90..8d7e93f 100644
--- a/media/liboboe/src/client/AudioStreamInternal.cpp
+++ b/media/liboboe/src/client/AudioStreamInternal.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "OboeAudio"
+#define LOG_TAG "AAudio"
 //#define LOG_NDEBUG 0
 #include <utils/Log.h>
 
@@ -24,14 +24,14 @@
 #include <binder/IServiceManager.h>
 #include <utils/Mutex.h>
 
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudio.h>
 
 #include "AudioClock.h"
 #include "AudioEndpointParcelable.h"
-#include "binding/OboeStreamRequest.h"
-#include "binding/OboeStreamConfiguration.h"
-#include "binding/IOboeAudioService.h"
-#include "binding/OboeServiceMessage.h"
+#include "binding/AAudioStreamRequest.h"
+#include "binding/AAudioStreamConfiguration.h"
+#include "binding/IAAudioService.h"
+#include "binding/AAudioServiceMessage.h"
 
 #include "AudioStreamInternal.h"
 
@@ -43,24 +43,24 @@
 using android::interface_cast;
 using android::Mutex;
 
-using namespace oboe;
+using namespace aaudio;
 
 static android::Mutex gServiceLock;
-static sp<IOboeAudioService>  gOboeService;
+static sp<IAAudioService>  gAAudioService;
 
-#define OBOE_SERVICE_NAME   "OboeAudioService"
+#define AAUDIO_SERVICE_NAME   "AAudioService"
 
-// Helper function to get access to the "OboeAudioService" service.
+// Helper function to get access to the "AAudioService" service.
 // This code was modeled after frameworks/av/media/libaudioclient/AudioSystem.cpp
-static const sp<IOboeAudioService> getOboeAudioService() {
+static const sp<IAAudioService> getAAudioService() {
     sp<IBinder> binder;
     Mutex::Autolock _l(gServiceLock);
-    if (gOboeService == 0) {
+    if (gAAudioService == 0) {
         sp<IServiceManager> sm = defaultServiceManager();
         // Try several times to get the service.
         int retries = 4;
         do {
-            binder = sm->getService(String16(OBOE_SERVICE_NAME)); // This will wait a while.
+            binder = sm->getService(String16(AAUDIO_SERVICE_NAME)); // This will wait a while.
             if (binder != 0) {
                 break;
             }
@@ -69,19 +69,19 @@
         if (binder != 0) {
             // TODO Add linkToDeath() like in frameworks/av/media/libaudioclient/AudioSystem.cpp
             // TODO Create a DeathRecipient that disconnects all active streams.
-            gOboeService = interface_cast<IOboeAudioService>(binder);
+            gAAudioService = interface_cast<IAAudioService>(binder);
         } else {
-            ALOGE("AudioStreamInternal could not get %s", OBOE_SERVICE_NAME);
+            ALOGE("AudioStreamInternal could not get %s", AAUDIO_SERVICE_NAME);
         }
     }
-    return gOboeService;
+    return gAAudioService;
 }
 
 AudioStreamInternal::AudioStreamInternal()
         : AudioStream()
         , mClockModel()
         , mAudioEndpoint()
-        , mServiceStreamHandle(OBOE_HANDLE_INVALID)
+        , mServiceStreamHandle(AAUDIO_HANDLE_INVALID)
         , mFramesPerBurst(16)
 {
 }
@@ -89,14 +89,14 @@
 AudioStreamInternal::~AudioStreamInternal() {
 }
 
-oboe_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) {
+aaudio_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) {
 
-    const sp<IOboeAudioService>& service = getOboeAudioService();
-    if (service == 0) return OBOE_ERROR_NO_SERVICE;
+    const sp<IAAudioService>& service = getAAudioService();
+    if (service == 0) return AAUDIO_ERROR_NO_SERVICE;
 
-    oboe_result_t result = OBOE_OK;
-    OboeStreamRequest request;
-    OboeStreamConfiguration configuration;
+    aaudio_result_t result = AAUDIO_OK;
+    AAudioStreamRequest request;
+    AAudioStreamConfiguration configuration;
 
     result = AudioStream::open(builder);
     if (result < 0) {
@@ -117,10 +117,10 @@
          (unsigned int)mServiceStreamHandle);
     if (mServiceStreamHandle < 0) {
         result = mServiceStreamHandle;
-        ALOGE("AudioStreamInternal.open(): acquireRealtimeStream oboe_result_t = 0x%08X", result);
+        ALOGE("AudioStreamInternal.open(): acquireRealtimeStream aaudio_result_t = 0x%08X", result);
     } else {
         result = configuration.validate();
-        if (result != OBOE_OK) {
+        if (result != AAUDIO_OK) {
             close();
             return result;
         }
@@ -129,9 +129,9 @@
         setSamplesPerFrame(configuration.getSamplesPerFrame());
         setFormat(configuration.getAudioFormat());
 
-        oboe::AudioEndpointParcelable parcelable;
+        aaudio::AudioEndpointParcelable parcelable;
         result = service->getStreamDescription(mServiceStreamHandle, parcelable);
-        if (result != OBOE_OK) {
+        if (result != AAUDIO_OK) {
             ALOGE("AudioStreamInternal.open(): getStreamDescriptor returns %d", result);
             service->closeStream(mServiceStreamHandle);
             return result;
@@ -150,143 +150,143 @@
         mClockModel.setSampleRate(getSampleRate());
         mClockModel.setFramesPerBurst(mFramesPerBurst);
 
-        setState(OBOE_STREAM_STATE_OPEN);
+        setState(AAUDIO_STREAM_STATE_OPEN);
     }
     return result;
 }
 
-oboe_result_t AudioStreamInternal::close() {
+aaudio_result_t AudioStreamInternal::close() {
     ALOGD("AudioStreamInternal.close(): mServiceStreamHandle = 0x%08X", mServiceStreamHandle);
-    if (mServiceStreamHandle != OBOE_HANDLE_INVALID) {
-        oboe_handle_t serviceStreamHandle = mServiceStreamHandle;
-        mServiceStreamHandle = OBOE_HANDLE_INVALID;
-        const sp<IOboeAudioService>& oboeService = getOboeAudioService();
-        if (oboeService == 0) return OBOE_ERROR_NO_SERVICE;
-        oboeService->closeStream(serviceStreamHandle);
-        return OBOE_OK;
+    if (mServiceStreamHandle != AAUDIO_HANDLE_INVALID) {
+        aaudio_handle_t serviceStreamHandle = mServiceStreamHandle;
+        mServiceStreamHandle = AAUDIO_HANDLE_INVALID;
+        const sp<IAAudioService>& aaudioService = getAAudioService();
+        if (aaudioService == 0) return AAUDIO_ERROR_NO_SERVICE;
+        aaudioService->closeStream(serviceStreamHandle);
+        return AAUDIO_OK;
     } else {
-        return OBOE_ERROR_INVALID_HANDLE;
+        return AAUDIO_ERROR_INVALID_HANDLE;
     }
 }
 
-oboe_result_t AudioStreamInternal::requestStart()
+aaudio_result_t AudioStreamInternal::requestStart()
 {
-    oboe_nanoseconds_t startTime;
+    aaudio_nanoseconds_t startTime;
     ALOGD("AudioStreamInternal(): start()");
-    if (mServiceStreamHandle == OBOE_HANDLE_INVALID) {
-        return OBOE_ERROR_INVALID_STATE;
+    if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
+        return AAUDIO_ERROR_INVALID_STATE;
     }
-    const sp<IOboeAudioService>& oboeService = getOboeAudioService();
-    if (oboeService == 0) return OBOE_ERROR_NO_SERVICE;
-    startTime = Oboe_getNanoseconds(OBOE_CLOCK_MONOTONIC);
+    const sp<IAAudioService>& aaudioService = getAAudioService();
+    if (aaudioService == 0) return AAUDIO_ERROR_NO_SERVICE;
+    startTime = AAudio_getNanoseconds(AAUDIO_CLOCK_MONOTONIC);
     mClockModel.start(startTime);
     processTimestamp(0, startTime);
-    setState(OBOE_STREAM_STATE_STARTING);
-    return oboeService->startStream(mServiceStreamHandle);
+    setState(AAUDIO_STREAM_STATE_STARTING);
+    return aaudioService->startStream(mServiceStreamHandle);
 }
 
-oboe_result_t AudioStreamInternal::requestPause()
+aaudio_result_t AudioStreamInternal::requestPause()
 {
     ALOGD("AudioStreamInternal(): pause()");
-    if (mServiceStreamHandle == OBOE_HANDLE_INVALID) {
-        return OBOE_ERROR_INVALID_STATE;
+    if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
+        return AAUDIO_ERROR_INVALID_STATE;
     }
-    const sp<IOboeAudioService>& oboeService = getOboeAudioService();
-    if (oboeService == 0) return OBOE_ERROR_NO_SERVICE;
-    mClockModel.stop(Oboe_getNanoseconds(OBOE_CLOCK_MONOTONIC));
-    setState(OBOE_STREAM_STATE_PAUSING);
-    return oboeService->pauseStream(mServiceStreamHandle);
+    const sp<IAAudioService>& aaudioService = getAAudioService();
+    if (aaudioService == 0) return AAUDIO_ERROR_NO_SERVICE;
+    mClockModel.stop(AAudio_getNanoseconds(AAUDIO_CLOCK_MONOTONIC));
+    setState(AAUDIO_STREAM_STATE_PAUSING);
+    return aaudioService->pauseStream(mServiceStreamHandle);
 }
 
-oboe_result_t AudioStreamInternal::requestFlush() {
+aaudio_result_t AudioStreamInternal::requestFlush() {
     ALOGD("AudioStreamInternal(): flush()");
-    if (mServiceStreamHandle == OBOE_HANDLE_INVALID) {
-        return OBOE_ERROR_INVALID_STATE;
+    if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
+        return AAUDIO_ERROR_INVALID_STATE;
     }
-    const sp<IOboeAudioService>& oboeService = getOboeAudioService();
-    if (oboeService == 0) return OBOE_ERROR_NO_SERVICE;
-setState(OBOE_STREAM_STATE_FLUSHING);
-    return oboeService->flushStream(mServiceStreamHandle);
+    const sp<IAAudioService>& aaudioService = getAAudioService();
+    if (aaudioService == 0) return AAUDIO_ERROR_NO_SERVICE;
+setState(AAUDIO_STREAM_STATE_FLUSHING);
+    return aaudioService->flushStream(mServiceStreamHandle);
 }
 
 void AudioStreamInternal::onFlushFromServer() {
     ALOGD("AudioStreamInternal(): onFlushFromServer()");
-    oboe_position_frames_t readCounter = mAudioEndpoint.getDownDataReadCounter();
-    oboe_position_frames_t writeCounter = mAudioEndpoint.getDownDataWriteCounter();
+    aaudio_position_frames_t readCounter = mAudioEndpoint.getDownDataReadCounter();
+    aaudio_position_frames_t writeCounter = mAudioEndpoint.getDownDataWriteCounter();
     // Bump offset so caller does not see the retrograde motion in getFramesRead().
-    oboe_position_frames_t framesFlushed = writeCounter - readCounter;
+    aaudio_position_frames_t framesFlushed = writeCounter - readCounter;
     mFramesOffsetFromService += framesFlushed;
     // Flush written frames by forcing writeCounter to readCounter.
     // This is because we cannot move the read counter in the hardware.
     mAudioEndpoint.setDownDataWriteCounter(readCounter);
 }
 
-oboe_result_t AudioStreamInternal::requestStop()
+aaudio_result_t AudioStreamInternal::requestStop()
 {
     // TODO better implementation of requestStop()
-    oboe_result_t result = requestPause();
-    if (result == OBOE_OK) {
-        oboe_stream_state_t state;
-        result = waitForStateChange(OBOE_STREAM_STATE_PAUSING,
+    aaudio_result_t result = requestPause();
+    if (result == AAUDIO_OK) {
+        aaudio_stream_state_t state;
+        result = waitForStateChange(AAUDIO_STREAM_STATE_PAUSING,
                                     &state,
-                                    500 * OBOE_NANOS_PER_MILLISECOND);// TODO temporary code
-        if (result == OBOE_OK) {
+                                    500 * AAUDIO_NANOS_PER_MILLISECOND);// TODO temporary code
+        if (result == AAUDIO_OK) {
             result = requestFlush();
         }
     }
     return result;
 }
 
-oboe_result_t AudioStreamInternal::registerThread() {
+aaudio_result_t AudioStreamInternal::registerThread() {
     ALOGD("AudioStreamInternal(): registerThread()");
-    if (mServiceStreamHandle == OBOE_HANDLE_INVALID) {
-        return OBOE_ERROR_INVALID_STATE;
+    if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
+        return AAUDIO_ERROR_INVALID_STATE;
     }
-    const sp<IOboeAudioService>& oboeService = getOboeAudioService();
-    if (oboeService == 0) return OBOE_ERROR_NO_SERVICE;
-    return oboeService->registerAudioThread(mServiceStreamHandle,
+    const sp<IAAudioService>& aaudioService = getAAudioService();
+    if (aaudioService == 0) return AAUDIO_ERROR_NO_SERVICE;
+    return aaudioService->registerAudioThread(mServiceStreamHandle,
                                          gettid(),
                                          getPeriodNanoseconds());
 }
 
-oboe_result_t AudioStreamInternal::unregisterThread() {
+aaudio_result_t AudioStreamInternal::unregisterThread() {
     ALOGD("AudioStreamInternal(): unregisterThread()");
-    if (mServiceStreamHandle == OBOE_HANDLE_INVALID) {
-        return OBOE_ERROR_INVALID_STATE;
+    if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
+        return AAUDIO_ERROR_INVALID_STATE;
     }
-    const sp<IOboeAudioService>& oboeService = getOboeAudioService();
-    if (oboeService == 0) return OBOE_ERROR_NO_SERVICE;
-    return oboeService->unregisterAudioThread(mServiceStreamHandle, gettid());
+    const sp<IAAudioService>& aaudioService = getAAudioService();
+    if (aaudioService == 0) return AAUDIO_ERROR_NO_SERVICE;
+    return aaudioService->unregisterAudioThread(mServiceStreamHandle, gettid());
 }
 
-// TODO use oboe_clockid_t all the way down to AudioClock
-oboe_result_t AudioStreamInternal::getTimestamp(clockid_t clockId,
-                           oboe_position_frames_t *framePosition,
-                           oboe_nanoseconds_t *timeNanoseconds) {
+// TODO use aaudio_clockid_t all the way down to AudioClock
+aaudio_result_t AudioStreamInternal::getTimestamp(clockid_t clockId,
+                           aaudio_position_frames_t *framePosition,
+                           aaudio_nanoseconds_t *timeNanoseconds) {
 // TODO implement using real HAL
-    oboe_nanoseconds_t time = AudioClock::getNanoseconds();
+    aaudio_nanoseconds_t time = AudioClock::getNanoseconds();
     *framePosition = mClockModel.convertTimeToPosition(time);
-    *timeNanoseconds = time + (10 * OBOE_NANOS_PER_MILLISECOND); // Fake hardware delay
-    return OBOE_OK;
+    *timeNanoseconds = time + (10 * AAUDIO_NANOS_PER_MILLISECOND); // Fake hardware delay
+    return AAUDIO_OK;
 }
 
-oboe_result_t AudioStreamInternal::updateState() {
+aaudio_result_t AudioStreamInternal::updateState() {
     return processCommands();
 }
 
 #if LOG_TIMESTAMPS
-static void AudioStreamInternal_LogTimestamp(OboeServiceMessage &command) {
+static void AudioStreamInternal_LogTimestamp(AAudioServiceMessage &command) {
     static int64_t oldPosition = 0;
-    static oboe_nanoseconds_t oldTime = 0;
+    static aaudio_nanoseconds_t oldTime = 0;
     int64_t framePosition = command.timestamp.position;
-    oboe_nanoseconds_t nanoTime = command.timestamp.timestamp;
+    aaudio_nanoseconds_t nanoTime = command.timestamp.timestamp;
     ALOGD("AudioStreamInternal() timestamp says framePosition = %08lld at nanoTime %llu",
          (long long) framePosition,
          (long long) nanoTime);
     int64_t nanosDelta = nanoTime - oldTime;
     if (nanosDelta > 0 && oldTime > 0) {
         int64_t framesDelta = framePosition - oldPosition;
-        int64_t rate = (framesDelta * OBOE_NANOS_PER_SECOND) / nanosDelta;
+        int64_t rate = (framesDelta * AAUDIO_NANOS_PER_SECOND) / nanosDelta;
         ALOGD("AudioStreamInternal() - framesDelta = %08lld", (long long) framesDelta);
         ALOGD("AudioStreamInternal() - nanosDelta = %08lld", (long long) nanosDelta);
         ALOGD("AudioStreamInternal() - measured rate = %llu", (unsigned long long) rate);
@@ -296,40 +296,40 @@
 }
 #endif
 
-oboe_result_t AudioStreamInternal::onTimestampFromServer(OboeServiceMessage *message) {
-    oboe_position_frames_t framePosition = 0;
+aaudio_result_t AudioStreamInternal::onTimestampFromServer(AAudioServiceMessage *message) {
+    aaudio_position_frames_t framePosition = 0;
 #if LOG_TIMESTAMPS
     AudioStreamInternal_LogTimestamp(command);
 #endif
     framePosition = message->timestamp.position;
     processTimestamp(framePosition, message->timestamp.timestamp);
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
-oboe_result_t AudioStreamInternal::onEventFromServer(OboeServiceMessage *message) {
-    oboe_result_t result = OBOE_OK;
+aaudio_result_t AudioStreamInternal::onEventFromServer(AAudioServiceMessage *message) {
+    aaudio_result_t result = AAUDIO_OK;
     ALOGD("processCommands() got event %d", message->event.event);
     switch (message->event.event) {
-        case OBOE_SERVICE_EVENT_STARTED:
-            ALOGD("processCommands() got OBOE_SERVICE_EVENT_STARTED");
-            setState(OBOE_STREAM_STATE_STARTED);
+        case AAUDIO_SERVICE_EVENT_STARTED:
+            ALOGD("processCommands() got AAUDIO_SERVICE_EVENT_STARTED");
+            setState(AAUDIO_STREAM_STATE_STARTED);
             break;
-        case OBOE_SERVICE_EVENT_PAUSED:
-            ALOGD("processCommands() got OBOE_SERVICE_EVENT_PAUSED");
-            setState(OBOE_STREAM_STATE_PAUSED);
+        case AAUDIO_SERVICE_EVENT_PAUSED:
+            ALOGD("processCommands() got AAUDIO_SERVICE_EVENT_PAUSED");
+            setState(AAUDIO_STREAM_STATE_PAUSED);
             break;
-        case OBOE_SERVICE_EVENT_FLUSHED:
-            ALOGD("processCommands() got OBOE_SERVICE_EVENT_FLUSHED");
-            setState(OBOE_STREAM_STATE_FLUSHED);
+        case AAUDIO_SERVICE_EVENT_FLUSHED:
+            ALOGD("processCommands() got AAUDIO_SERVICE_EVENT_FLUSHED");
+            setState(AAUDIO_STREAM_STATE_FLUSHED);
             onFlushFromServer();
             break;
-        case OBOE_SERVICE_EVENT_CLOSED:
-            ALOGD("processCommands() got OBOE_SERVICE_EVENT_CLOSED");
-            setState(OBOE_STREAM_STATE_CLOSED);
+        case AAUDIO_SERVICE_EVENT_CLOSED:
+            ALOGD("processCommands() got AAUDIO_SERVICE_EVENT_CLOSED");
+            setState(AAUDIO_STREAM_STATE_CLOSED);
             break;
-        case OBOE_SERVICE_EVENT_DISCONNECTED:
-            result = OBOE_ERROR_DISCONNECTED;
-            ALOGW("WARNING - processCommands() OBOE_SERVICE_EVENT_DISCONNECTED");
+        case AAUDIO_SERVICE_EVENT_DISCONNECTED:
+            result = AAUDIO_ERROR_DISCONNECTED;
+            ALOGW("WARNING - processCommands() AAUDIO_SERVICE_EVENT_DISCONNECTED");
             break;
         default:
             ALOGW("WARNING - processCommands() Unrecognized event = %d",
@@ -340,27 +340,27 @@
 }
 
 // Process all the commands coming from the server.
-oboe_result_t AudioStreamInternal::processCommands() {
-    oboe_result_t result = OBOE_OK;
+aaudio_result_t AudioStreamInternal::processCommands() {
+    aaudio_result_t result = AAUDIO_OK;
 
-    while (result == OBOE_OK) {
-        OboeServiceMessage message;
+    while (result == AAUDIO_OK) {
+        AAudioServiceMessage message;
         if (mAudioEndpoint.readUpCommand(&message) != 1) {
             break; // no command this time, no problem
         }
         switch (message.what) {
-        case OboeServiceMessage::code::TIMESTAMP:
+        case AAudioServiceMessage::code::TIMESTAMP:
             result = onTimestampFromServer(&message);
             break;
 
-        case OboeServiceMessage::code::EVENT:
+        case AAudioServiceMessage::code::EVENT:
             result = onEventFromServer(&message);
             break;
 
         default:
             ALOGW("WARNING - AudioStreamInternal::processCommands() Unrecognized what = %d",
                  (int) message.what);
-            result = OBOE_ERROR_UNEXPECTED_VALUE;
+            result = AAUDIO_ERROR_UNEXPECTED_VALUE;
             break;
         }
     }
@@ -368,13 +368,13 @@
 }
 
 // Write the data, block if needed and timeoutMillis > 0
-oboe_result_t AudioStreamInternal::write(const void *buffer, int32_t numFrames,
-                                         oboe_nanoseconds_t timeoutNanoseconds)
+aaudio_result_t AudioStreamInternal::write(const void *buffer, int32_t numFrames,
+                                         aaudio_nanoseconds_t timeoutNanoseconds)
 {
-    oboe_result_t result = OBOE_OK;
+    aaudio_result_t result = AAUDIO_OK;
     uint8_t* source = (uint8_t*)buffer;
-    oboe_nanoseconds_t currentTimeNanos = AudioClock::getNanoseconds();
-    oboe_nanoseconds_t deadlineNanos = currentTimeNanos + timeoutNanoseconds;
+    aaudio_nanoseconds_t currentTimeNanos = AudioClock::getNanoseconds();
+    aaudio_nanoseconds_t deadlineNanos = currentTimeNanos + timeoutNanoseconds;
     int32_t framesLeft = numFrames;
 //    ALOGD("AudioStreamInternal::write(%p, %d) at time %08llu , mState = %d ------------------",
 //         buffer, numFrames, (unsigned long long) currentTimeNanos, mState);
@@ -382,8 +382,8 @@
     // Write until all the data has been written or until a timeout occurs.
     while (framesLeft > 0) {
         // The call to writeNow() will not block. It will just write as much as it can.
-        oboe_nanoseconds_t wakeTimeNanos = 0;
-        oboe_result_t framesWritten = writeNow(source, framesLeft,
+        aaudio_nanoseconds_t wakeTimeNanos = 0;
+        aaudio_result_t framesWritten = writeNow(source, framesLeft,
                                                currentTimeNanos, &wakeTimeNanos);
 //        ALOGD("AudioStreamInternal::write() writeNow() framesLeft = %d --> framesWritten = %d", framesLeft, framesWritten);
         if (framesWritten < 0) {
@@ -420,11 +420,11 @@
 }
 
 // Write as much data as we can without blocking.
-oboe_result_t AudioStreamInternal::writeNow(const void *buffer, int32_t numFrames,
-                                         oboe_nanoseconds_t currentNanoTime, oboe_nanoseconds_t *wakeTimePtr) {
+aaudio_result_t AudioStreamInternal::writeNow(const void *buffer, int32_t numFrames,
+                                         aaudio_nanoseconds_t currentNanoTime, aaudio_nanoseconds_t *wakeTimePtr) {
     {
-        oboe_result_t result = processCommands();
-        if (result != OBOE_OK) {
+        aaudio_result_t result = processCommands();
+        if (result != AAUDIO_OK) {
             return result;
         }
     }
@@ -451,16 +451,16 @@
     // Calculate an ideal time to wake up.
     if (wakeTimePtr != nullptr && framesWritten >= 0) {
         // By default wake up a few milliseconds from now.  // TODO review
-        oboe_nanoseconds_t wakeTime = currentNanoTime + (2 * OBOE_NANOS_PER_MILLISECOND);
+        aaudio_nanoseconds_t wakeTime = currentNanoTime + (2 * AAUDIO_NANOS_PER_MILLISECOND);
         switch (getState()) {
-            case OBOE_STREAM_STATE_OPEN:
-            case OBOE_STREAM_STATE_STARTING:
+            case AAUDIO_STREAM_STATE_OPEN:
+            case AAUDIO_STREAM_STATE_STARTING:
                 if (framesWritten != 0) {
                     // Don't wait to write more data. Just prime the buffer.
                     wakeTime = currentNanoTime;
                 }
                 break;
-            case OBOE_STREAM_STATE_STARTED:   // When do we expect the next read burst to occur?
+            case AAUDIO_STREAM_STATE_STARTED:   // When do we expect the next read burst to occur?
                 {
                     uint32_t burstSize = mFramesPerBurst;
                     if (burstSize < 32) {
@@ -484,19 +484,19 @@
     return framesWritten;
 }
 
-oboe_result_t AudioStreamInternal::waitForStateChange(oboe_stream_state_t currentState,
-                                                      oboe_stream_state_t *nextState,
-                                                      oboe_nanoseconds_t timeoutNanoseconds)
+aaudio_result_t AudioStreamInternal::waitForStateChange(aaudio_stream_state_t currentState,
+                                                      aaudio_stream_state_t *nextState,
+                                                      aaudio_nanoseconds_t timeoutNanoseconds)
 
 {
-    oboe_result_t result = processCommands();
+    aaudio_result_t result = processCommands();
 //    ALOGD("AudioStreamInternal::waitForStateChange() - processCommands() returned %d", result);
-    if (result != OBOE_OK) {
+    if (result != AAUDIO_OK) {
         return result;
     }
     // TODO replace this polling with a timed sleep on a futex on the message queue
-    int32_t durationNanos = 5 * OBOE_NANOS_PER_MILLISECOND;
-    oboe_stream_state_t state = getState();
+    int32_t durationNanos = 5 * AAUDIO_NANOS_PER_MILLISECOND;
+    aaudio_stream_state_t state = getState();
 //    ALOGD("AudioStreamInternal::waitForStateChange() - state = %d", state);
     while (state == currentState && timeoutNanoseconds > 0) {
         // TODO use futex from service message queue
@@ -507,7 +507,7 @@
         timeoutNanoseconds -= durationNanos;
 
         result = processCommands();
-        if (result != OBOE_OK) {
+        if (result != AAUDIO_OK) {
             return result;
         }
 
@@ -517,37 +517,37 @@
     if (nextState != nullptr) {
         *nextState = state;
     }
-    return (state == currentState) ? OBOE_ERROR_TIMEOUT : OBOE_OK;
+    return (state == currentState) ? AAUDIO_ERROR_TIMEOUT : AAUDIO_OK;
 }
 
 
-void AudioStreamInternal::processTimestamp(uint64_t position, oboe_nanoseconds_t time) {
+void AudioStreamInternal::processTimestamp(uint64_t position, aaudio_nanoseconds_t time) {
     mClockModel.processTimestamp( position, time);
 }
 
-oboe_result_t AudioStreamInternal::setBufferSize(oboe_size_frames_t requestedFrames,
-                                        oboe_size_frames_t *actualFrames) {
+aaudio_result_t AudioStreamInternal::setBufferSize(aaudio_size_frames_t requestedFrames,
+                                        aaudio_size_frames_t *actualFrames) {
     return mAudioEndpoint.setBufferSizeInFrames(requestedFrames, actualFrames);
 }
 
-oboe_size_frames_t AudioStreamInternal::getBufferSize() const
+aaudio_size_frames_t AudioStreamInternal::getBufferSize() const
 {
     return mAudioEndpoint.getBufferSizeInFrames();
 }
 
-oboe_size_frames_t AudioStreamInternal::getBufferCapacity() const
+aaudio_size_frames_t AudioStreamInternal::getBufferCapacity() const
 {
     return mAudioEndpoint.getBufferCapacityInFrames();
 }
 
-oboe_size_frames_t AudioStreamInternal::getFramesPerBurst() const
+aaudio_size_frames_t AudioStreamInternal::getFramesPerBurst() const
 {
     return mEndpointDescriptor.downDataQueueDescriptor.framesPerBurst;
 }
 
-oboe_position_frames_t AudioStreamInternal::getFramesRead()
+aaudio_position_frames_t AudioStreamInternal::getFramesRead()
 {
-    oboe_position_frames_t framesRead =
+    aaudio_position_frames_t framesRead =
             mClockModel.convertTimeToPosition(AudioClock::getNanoseconds())
             + mFramesOffsetFromService;
     // Prevent retrograde motion.
diff --git a/media/liboboe/src/client/AudioStreamInternal.h b/media/liboboe/src/client/AudioStreamInternal.h
index 9459f97..666df3a 100644
--- a/media/liboboe/src/client/AudioStreamInternal.h
+++ b/media/liboboe/src/client/AudioStreamInternal.h
@@ -14,24 +14,24 @@
  * limitations under the License.
  */
 
-#ifndef OBOE_AUDIOSTREAMINTERNAL_H
-#define OBOE_AUDIOSTREAMINTERNAL_H
+#ifndef AAUDIO_AUDIOSTREAMINTERNAL_H
+#define AAUDIO_AUDIOSTREAMINTERNAL_H
 
 #include <stdint.h>
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudio.h>
 
-#include "binding/IOboeAudioService.h"
+#include "binding/IAAudioService.h"
 #include "binding/AudioEndpointParcelable.h"
 #include "client/IsochronousClockModel.h"
 #include "client/AudioEndpoint.h"
 #include "core/AudioStream.h"
 
 using android::sp;
-using android::IOboeAudioService;
+using android::IAAudioService;
 
-namespace oboe {
+namespace aaudio {
 
-// A stream that talks to the OboeService or directly to a HAL.
+// A stream that talks to the AAudioService or directly to a HAL.
 class AudioStreamInternal : public AudioStream {
 
 public:
@@ -39,57 +39,57 @@
     virtual ~AudioStreamInternal();
 
     // =========== Begin ABSTRACT methods ===========================
-    virtual oboe_result_t requestStart() override;
+    virtual aaudio_result_t requestStart() override;
 
-    virtual oboe_result_t requestPause() override;
+    virtual aaudio_result_t requestPause() override;
 
-    virtual oboe_result_t requestFlush() override;
+    virtual aaudio_result_t requestFlush() override;
 
-    virtual oboe_result_t requestStop() override;
+    virtual aaudio_result_t requestStop() override;
 
-    // TODO use oboe_clockid_t all the way down to AudioClock
-    virtual oboe_result_t getTimestamp(clockid_t clockId,
-                                       oboe_position_frames_t *framePosition,
-                                       oboe_nanoseconds_t *timeNanoseconds) override;
+    // TODO use aaudio_clockid_t all the way down to AudioClock
+    virtual aaudio_result_t getTimestamp(clockid_t clockId,
+                                       aaudio_position_frames_t *framePosition,
+                                       aaudio_nanoseconds_t *timeNanoseconds) override;
 
 
-    virtual oboe_result_t updateState() override;
+    virtual aaudio_result_t updateState() override;
     // =========== End ABSTRACT methods ===========================
 
-    virtual oboe_result_t open(const AudioStreamBuilder &builder) override;
+    virtual aaudio_result_t open(const AudioStreamBuilder &builder) override;
 
-    virtual oboe_result_t close() override;
+    virtual aaudio_result_t close() override;
 
-    virtual oboe_result_t write(const void *buffer,
+    virtual aaudio_result_t write(const void *buffer,
                              int32_t numFrames,
-                             oboe_nanoseconds_t timeoutNanoseconds) override;
+                             aaudio_nanoseconds_t timeoutNanoseconds) override;
 
-    virtual oboe_result_t waitForStateChange(oboe_stream_state_t currentState,
-                                          oboe_stream_state_t *nextState,
-                                          oboe_nanoseconds_t timeoutNanoseconds) override;
+    virtual aaudio_result_t waitForStateChange(aaudio_stream_state_t currentState,
+                                          aaudio_stream_state_t *nextState,
+                                          aaudio_nanoseconds_t timeoutNanoseconds) override;
 
-    virtual oboe_result_t setBufferSize(oboe_size_frames_t requestedFrames,
-                                        oboe_size_frames_t *actualFrames) override;
+    virtual aaudio_result_t setBufferSize(aaudio_size_frames_t requestedFrames,
+                                        aaudio_size_frames_t *actualFrames) override;
 
-    virtual oboe_size_frames_t getBufferSize() const override;
+    virtual aaudio_size_frames_t getBufferSize() const override;
 
-    virtual oboe_size_frames_t getBufferCapacity() const override;
+    virtual aaudio_size_frames_t getBufferCapacity() const override;
 
-    virtual oboe_size_frames_t getFramesPerBurst() const override;
+    virtual aaudio_size_frames_t getFramesPerBurst() const override;
 
-    virtual oboe_position_frames_t getFramesRead() override;
+    virtual aaudio_position_frames_t getFramesRead() override;
 
     virtual int32_t getXRunCount() const override {
         return mXRunCount;
     }
 
-    virtual oboe_result_t registerThread() override;
+    virtual aaudio_result_t registerThread() override;
 
-    virtual oboe_result_t unregisterThread() override;
+    virtual aaudio_result_t unregisterThread() override;
 
 protected:
 
-    oboe_result_t processCommands();
+    aaudio_result_t processCommands();
 
 /**
  * Low level write that will not block. It will just write as much as it can.
@@ -98,31 +98,31 @@
  *
  * @return the number of frames written or a negative error code.
  */
-    virtual oboe_result_t writeNow(const void *buffer,
+    virtual aaudio_result_t writeNow(const void *buffer,
                                 int32_t numFrames,
-                                oboe_nanoseconds_t currentTimeNanos,
-                                oboe_nanoseconds_t *wakeTimePtr);
+                                aaudio_nanoseconds_t currentTimeNanos,
+                                aaudio_nanoseconds_t *wakeTimePtr);
 
     void onFlushFromServer();
 
-    oboe_result_t onEventFromServer(OboeServiceMessage *message);
+    aaudio_result_t onEventFromServer(AAudioServiceMessage *message);
 
-    oboe_result_t onTimestampFromServer(OboeServiceMessage *message);
+    aaudio_result_t onTimestampFromServer(AAudioServiceMessage *message);
 
 private:
     IsochronousClockModel    mClockModel;
     AudioEndpoint            mAudioEndpoint;
-    oboe_handle_t            mServiceStreamHandle;
+    aaudio_handle_t            mServiceStreamHandle;
     EndpointDescriptor       mEndpointDescriptor;
     // Offset from underlying frame position.
-    oboe_position_frames_t   mFramesOffsetFromService = 0;
-    oboe_position_frames_t   mLastFramesRead = 0;
-    oboe_size_frames_t       mFramesPerBurst;
+    aaudio_position_frames_t   mFramesOffsetFromService = 0;
+    aaudio_position_frames_t   mLastFramesRead = 0;
+    aaudio_size_frames_t       mFramesPerBurst;
     int32_t                  mXRunCount = 0;
 
-    void processTimestamp(uint64_t position, oboe_nanoseconds_t time);
+    void processTimestamp(uint64_t position, aaudio_nanoseconds_t time);
 };
 
-} /* namespace oboe */
+} /* namespace aaudio */
 
-#endif //OBOE_AUDIOSTREAMINTERNAL_H
+#endif //AAUDIO_AUDIOSTREAMINTERNAL_H
diff --git a/media/liboboe/src/client/IsochronousClockModel.cpp b/media/liboboe/src/client/IsochronousClockModel.cpp
index b8e5538..bdb491d 100644
--- a/media/liboboe/src/client/IsochronousClockModel.cpp
+++ b/media/liboboe/src/client/IsochronousClockModel.cpp
@@ -14,19 +14,19 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "OboeAudio"
+#define LOG_TAG "AAudio"
 //#define LOG_NDEBUG 0
 #include <utils/Log.h>
 
 #include <stdint.h>
-#include <oboe/OboeDefinitions.h>
+#include <aaudio/AAudioDefinitions.h>
 
 #include "IsochronousClockModel.h"
 
-#define MIN_LATENESS_NANOS (10 * OBOE_NANOS_PER_MICROSECOND)
+#define MIN_LATENESS_NANOS (10 * AAUDIO_NANOS_PER_MICROSECOND)
 
 using namespace android;
-using namespace oboe;
+using namespace aaudio;
 
 IsochronousClockModel::IsochronousClockModel()
         : mSampleRate(48000)
@@ -41,21 +41,21 @@
 IsochronousClockModel::~IsochronousClockModel() {
 }
 
-void IsochronousClockModel::start(oboe_nanoseconds_t nanoTime)
+void IsochronousClockModel::start(aaudio_nanoseconds_t nanoTime)
 {
     mMarkerNanoTime = nanoTime;
     mState = STATE_STARTING;
 }
 
-void IsochronousClockModel::stop(oboe_nanoseconds_t nanoTime)
+void IsochronousClockModel::stop(aaudio_nanoseconds_t nanoTime)
 {
     mMarkerNanoTime = nanoTime;
     mMarkerFramePosition = convertTimeToPosition(nanoTime); // TODO should we do this?
     mState = STATE_STOPPED;
 }
 
-void IsochronousClockModel::processTimestamp(oboe_position_frames_t framePosition,
-                                             oboe_nanoseconds_t nanoTime) {
+void IsochronousClockModel::processTimestamp(aaudio_position_frames_t framePosition,
+                                             aaudio_nanoseconds_t nanoTime) {
     int64_t framesDelta = framePosition - mMarkerFramePosition;
     int64_t nanosDelta = nanoTime - mMarkerNanoTime;
     if (nanosDelta < 1000) {
@@ -133,41 +133,41 @@
     mMaxLatenessInNanos = (nanosLate > MIN_LATENESS_NANOS) ? nanosLate : MIN_LATENESS_NANOS;
 }
 
-oboe_nanoseconds_t IsochronousClockModel::convertDeltaPositionToTime(
-        oboe_position_frames_t framesDelta) const {
-    return (OBOE_NANOS_PER_SECOND * framesDelta) / mSampleRate;
+aaudio_nanoseconds_t IsochronousClockModel::convertDeltaPositionToTime(
+        aaudio_position_frames_t framesDelta) const {
+    return (AAUDIO_NANOS_PER_SECOND * framesDelta) / mSampleRate;
 }
 
-int64_t IsochronousClockModel::convertDeltaTimeToPosition(oboe_nanoseconds_t nanosDelta) const {
-    return (mSampleRate * nanosDelta) / OBOE_NANOS_PER_SECOND;
+int64_t IsochronousClockModel::convertDeltaTimeToPosition(aaudio_nanoseconds_t nanosDelta) const {
+    return (mSampleRate * nanosDelta) / AAUDIO_NANOS_PER_SECOND;
 }
 
-oboe_nanoseconds_t IsochronousClockModel::convertPositionToTime(
-        oboe_position_frames_t framePosition) const {
+aaudio_nanoseconds_t IsochronousClockModel::convertPositionToTime(
+        aaudio_position_frames_t framePosition) const {
     if (mState == STATE_STOPPED) {
         return mMarkerNanoTime;
     }
-    oboe_position_frames_t nextBurstIndex = (framePosition + mFramesPerBurst - 1) / mFramesPerBurst;
-    oboe_position_frames_t nextBurstPosition = mFramesPerBurst * nextBurstIndex;
-    oboe_position_frames_t framesDelta = nextBurstPosition - mMarkerFramePosition;
-    oboe_nanoseconds_t nanosDelta = convertDeltaPositionToTime(framesDelta);
-    oboe_nanoseconds_t time = (oboe_nanoseconds_t) (mMarkerNanoTime + nanosDelta);
+    aaudio_position_frames_t nextBurstIndex = (framePosition + mFramesPerBurst - 1) / mFramesPerBurst;
+    aaudio_position_frames_t nextBurstPosition = mFramesPerBurst * nextBurstIndex;
+    aaudio_position_frames_t framesDelta = nextBurstPosition - mMarkerFramePosition;
+    aaudio_nanoseconds_t nanosDelta = convertDeltaPositionToTime(framesDelta);
+    aaudio_nanoseconds_t time = (aaudio_nanoseconds_t) (mMarkerNanoTime + nanosDelta);
 //    ALOGI("IsochronousClockModel::convertPositionToTime: pos = %llu --> time = %llu",
 //         (unsigned long long)framePosition,
 //         (unsigned long long)time);
     return time;
 }
 
-oboe_position_frames_t IsochronousClockModel::convertTimeToPosition(
-        oboe_nanoseconds_t nanoTime) const {
+aaudio_position_frames_t IsochronousClockModel::convertTimeToPosition(
+        aaudio_nanoseconds_t nanoTime) const {
     if (mState == STATE_STOPPED) {
         return mMarkerFramePosition;
     }
-    oboe_nanoseconds_t nanosDelta = nanoTime - mMarkerNanoTime;
-    oboe_position_frames_t framesDelta = convertDeltaTimeToPosition(nanosDelta);
-    oboe_position_frames_t nextBurstPosition = mMarkerFramePosition + framesDelta;
-    oboe_position_frames_t nextBurstIndex = nextBurstPosition / mFramesPerBurst;
-    oboe_position_frames_t position = nextBurstIndex * mFramesPerBurst;
+    aaudio_nanoseconds_t nanosDelta = nanoTime - mMarkerNanoTime;
+    aaudio_position_frames_t framesDelta = convertDeltaTimeToPosition(nanosDelta);
+    aaudio_position_frames_t nextBurstPosition = mMarkerFramePosition + framesDelta;
+    aaudio_position_frames_t nextBurstIndex = nextBurstPosition / mFramesPerBurst;
+    aaudio_position_frames_t position = nextBurstIndex * mFramesPerBurst;
 //    ALOGI("IsochronousClockModel::convertTimeToPosition: time = %llu --> pos = %llu",
 //         (unsigned long long)nanoTime,
 //         (unsigned long long)position);
diff --git a/media/liboboe/src/client/IsochronousClockModel.h b/media/liboboe/src/client/IsochronousClockModel.h
index 97be325..b188a3d 100644
--- a/media/liboboe/src/client/IsochronousClockModel.h
+++ b/media/liboboe/src/client/IsochronousClockModel.h
@@ -14,13 +14,13 @@
  * limitations under the License.
  */
 
-#ifndef OBOE_ISOCHRONOUSCLOCKMODEL_H
-#define OBOE_ISOCHRONOUSCLOCKMODEL_H
+#ifndef AAUDIO_ISOCHRONOUSCLOCKMODEL_H
+#define AAUDIO_ISOCHRONOUSCLOCKMODEL_H
 
 #include <stdint.h>
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudio.h>
 
-namespace oboe {
+namespace aaudio {
 
 /**
  * Model an isochronous data stream using occasional timestamps as input.
@@ -34,17 +34,17 @@
     IsochronousClockModel();
     virtual ~IsochronousClockModel();
 
-    void start(oboe_nanoseconds_t nanoTime);
-    void stop(oboe_nanoseconds_t nanoTime);
+    void start(aaudio_nanoseconds_t nanoTime);
+    void stop(aaudio_nanoseconds_t nanoTime);
 
-    void processTimestamp(oboe_position_frames_t framePosition, oboe_nanoseconds_t nanoTime);
+    void processTimestamp(aaudio_position_frames_t framePosition, aaudio_nanoseconds_t nanoTime);
 
     /**
      * @param sampleRate rate of the stream in frames per second
      */
-    void setSampleRate(oboe_sample_rate_t sampleRate);
+    void setSampleRate(aaudio_sample_rate_t sampleRate);
 
-    oboe_sample_rate_t getSampleRate() const {
+    aaudio_sample_rate_t getSampleRate() const {
         return mSampleRate;
     }
 
@@ -53,9 +53,9 @@
      *
      * @param framesPerBurst number of frames that stream advance at one time.
      */
-    void setFramesPerBurst(oboe_size_frames_t framesPerBurst);
+    void setFramesPerBurst(aaudio_size_frames_t framesPerBurst);
 
-    oboe_size_frames_t getFramesPerBurst() const {
+    aaudio_size_frames_t getFramesPerBurst() const {
         return mFramesPerBurst;
     }
 
@@ -65,7 +65,7 @@
      * @param framePosition position of the stream in frames
      * @return time in nanoseconds
      */
-    oboe_nanoseconds_t convertPositionToTime(oboe_position_frames_t framePosition) const;
+    aaudio_nanoseconds_t convertPositionToTime(aaudio_position_frames_t framePosition) const;
 
     /**
      * Calculate an estimated position where the stream will be at the specified time.
@@ -73,19 +73,19 @@
      * @param nanoTime time of interest
      * @return position in frames
      */
-    oboe_position_frames_t convertTimeToPosition(oboe_nanoseconds_t nanoTime) const;
+    aaudio_position_frames_t convertTimeToPosition(aaudio_nanoseconds_t nanoTime) const;
 
     /**
      * @param framesDelta difference in frames
      * @return duration in nanoseconds
      */
-    oboe_nanoseconds_t convertDeltaPositionToTime(oboe_position_frames_t framesDelta) const;
+    aaudio_nanoseconds_t convertDeltaPositionToTime(aaudio_position_frames_t framesDelta) const;
 
     /**
      * @param nanosDelta duration in nanoseconds
      * @return frames that stream will advance in that time
      */
-    oboe_position_frames_t convertDeltaTimeToPosition(oboe_nanoseconds_t nanosDelta) const;
+    aaudio_position_frames_t convertDeltaTimeToPosition(aaudio_nanoseconds_t nanosDelta) const;
 
 private:
     enum clock_model_state_t {
@@ -95,17 +95,17 @@
         STATE_RUNNING
     };
 
-    oboe_sample_rate_t     mSampleRate;
-    oboe_size_frames_t     mFramesPerBurst;
+    aaudio_sample_rate_t     mSampleRate;
+    aaudio_size_frames_t     mFramesPerBurst;
     int32_t                mMaxLatenessInNanos;
-    oboe_position_frames_t mMarkerFramePosition;
-    oboe_nanoseconds_t     mMarkerNanoTime;
+    aaudio_position_frames_t mMarkerFramePosition;
+    aaudio_nanoseconds_t     mMarkerNanoTime;
     int32_t                mTimestampCount;
     clock_model_state_t     mState;
 
     void update();
 };
 
-} /* namespace oboe */
+} /* namespace aaudio */
 
-#endif //OBOE_ISOCHRONOUSCLOCKMODEL_H
+#endif //AAUDIO_ISOCHRONOUSCLOCKMODEL_H
diff --git a/media/liboboe/src/core/AAudioAudio.cpp b/media/liboboe/src/core/AAudioAudio.cpp
new file mode 100644
index 0000000..c1fa7cf
--- /dev/null
+++ b/media/liboboe/src/core/AAudioAudio.cpp
@@ -0,0 +1,562 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "AAudio"
+//#define LOG_NDEBUG 0
+#include <utils/Log.h>
+
+#include <time.h>
+#include <pthread.h>
+
+#include <aaudio/AAudioDefinitions.h>
+#include <aaudio/AAudio.h>
+
+#include "AudioStreamBuilder.h"
+#include "AudioStream.h"
+#include "AudioClock.h"
+#include "client/AudioStreamInternal.h"
+#include "HandleTracker.h"
+
+using namespace aaudio;
+
+// This is not the maximum theoretic possible number of handles that the HandlerTracker
+// class could support; instead it is the maximum number of handles that we are configuring
+// for our HandleTracker instance (sHandleTracker).
+#define AAUDIO_MAX_HANDLES  64
+
+// Macros for common code that includes a return.
+// TODO Consider using do{}while(0) construct. I tried but it hung AndroidStudio
+#define CONVERT_BUILDER_HANDLE_OR_RETURN() \
+    convertAAudioBuilderToStreamBuilder(builder); \
+    if (streamBuilder == nullptr) { \
+        return AAUDIO_ERROR_INVALID_HANDLE; \
+    }
+
+#define COMMON_GET_FROM_BUILDER_OR_RETURN(resultPtr) \
+    CONVERT_BUILDER_HANDLE_OR_RETURN() \
+    if ((resultPtr) == nullptr) { \
+        return AAUDIO_ERROR_NULL; \
+    }
+
+#define CONVERT_STREAM_HANDLE_OR_RETURN() \
+    convertAAudioStreamToAudioStream(stream); \
+    if (audioStream == nullptr) { \
+        return AAUDIO_ERROR_INVALID_HANDLE; \
+    }
+
+#define COMMON_GET_FROM_STREAM_OR_RETURN(resultPtr) \
+    CONVERT_STREAM_HANDLE_OR_RETURN(); \
+    if ((resultPtr) == nullptr) { \
+        return AAUDIO_ERROR_NULL; \
+    }
+
+// Static data.
+// TODO static constructors are discouraged, alternatives?
+static HandleTracker sHandleTracker(AAUDIO_MAX_HANDLES);
+
+typedef enum
+{
+    AAUDIO_HANDLE_TYPE_STREAM,
+    AAUDIO_HANDLE_TYPE_STREAM_BUILDER,
+    AAUDIO_HANDLE_TYPE_COUNT
+} aaudio_handle_type_t;
+static_assert(AAUDIO_HANDLE_TYPE_COUNT <= HANDLE_TRACKER_MAX_TYPES, "Too many handle types.");
+
+
+#define AAUDIO_CASE_ENUM(name) case name: return #name
+
+AAUDIO_API const char * AAudio_convertResultToText(aaudio_result_t returnCode) {
+    switch (returnCode) {
+        AAUDIO_CASE_ENUM(AAUDIO_OK);
+        AAUDIO_CASE_ENUM(AAUDIO_ERROR_ILLEGAL_ARGUMENT);
+        AAUDIO_CASE_ENUM(AAUDIO_ERROR_INCOMPATIBLE);
+        AAUDIO_CASE_ENUM(AAUDIO_ERROR_INTERNAL);
+        AAUDIO_CASE_ENUM(AAUDIO_ERROR_INVALID_STATE);
+        AAUDIO_CASE_ENUM(AAUDIO_ERROR_INVALID_HANDLE);
+        AAUDIO_CASE_ENUM(AAUDIO_ERROR_INVALID_QUERY);
+        AAUDIO_CASE_ENUM(AAUDIO_ERROR_UNIMPLEMENTED);
+        AAUDIO_CASE_ENUM(AAUDIO_ERROR_UNAVAILABLE);
+        AAUDIO_CASE_ENUM(AAUDIO_ERROR_NO_FREE_HANDLES);
+        AAUDIO_CASE_ENUM(AAUDIO_ERROR_NO_MEMORY);
+        AAUDIO_CASE_ENUM(AAUDIO_ERROR_NULL);
+        AAUDIO_CASE_ENUM(AAUDIO_ERROR_TIMEOUT);
+        AAUDIO_CASE_ENUM(AAUDIO_ERROR_WOULD_BLOCK);
+        AAUDIO_CASE_ENUM(AAUDIO_ERROR_INVALID_ORDER);
+        AAUDIO_CASE_ENUM(AAUDIO_ERROR_OUT_OF_RANGE);
+        AAUDIO_CASE_ENUM(AAUDIO_ERROR_NO_SERVICE);
+    }
+    return "Unrecognized AAudio error.";
+}
+
+AAUDIO_API const char * AAudio_convertStreamStateToText(aaudio_stream_state_t state) {
+    switch (state) {
+        AAUDIO_CASE_ENUM(AAUDIO_STREAM_STATE_UNINITIALIZED);
+        AAUDIO_CASE_ENUM(AAUDIO_STREAM_STATE_OPEN);
+        AAUDIO_CASE_ENUM(AAUDIO_STREAM_STATE_STARTING);
+        AAUDIO_CASE_ENUM(AAUDIO_STREAM_STATE_STARTED);
+        AAUDIO_CASE_ENUM(AAUDIO_STREAM_STATE_PAUSING);
+        AAUDIO_CASE_ENUM(AAUDIO_STREAM_STATE_PAUSED);
+        AAUDIO_CASE_ENUM(AAUDIO_STREAM_STATE_FLUSHING);
+        AAUDIO_CASE_ENUM(AAUDIO_STREAM_STATE_FLUSHED);
+        AAUDIO_CASE_ENUM(AAUDIO_STREAM_STATE_STOPPING);
+        AAUDIO_CASE_ENUM(AAUDIO_STREAM_STATE_STOPPED);
+        AAUDIO_CASE_ENUM(AAUDIO_STREAM_STATE_CLOSING);
+        AAUDIO_CASE_ENUM(AAUDIO_STREAM_STATE_CLOSED);
+    }
+    return "Unrecognized AAudio state.";
+}
+
+#undef AAUDIO_CASE_ENUM
+
+static AudioStream *convertAAudioStreamToAudioStream(AAudioStream stream)
+{
+    return (AudioStream *) sHandleTracker.get(AAUDIO_HANDLE_TYPE_STREAM,
+                                              (aaudio_handle_t) stream);
+}
+
+static AudioStreamBuilder *convertAAudioBuilderToStreamBuilder(AAudioStreamBuilder builder)
+{
+    return (AudioStreamBuilder *) sHandleTracker.get(AAUDIO_HANDLE_TYPE_STREAM_BUILDER,
+                                                     (aaudio_handle_t) builder);
+}
+
+AAUDIO_API aaudio_result_t AAudio_createStreamBuilder(AAudioStreamBuilder *builder)
+{
+    ALOGD("AAudio_createStreamBuilder(): check sHandleTracker.isInitialized ()");
+    if (!sHandleTracker.isInitialized()) {
+        return AAUDIO_ERROR_NO_MEMORY;
+    }
+    AudioStreamBuilder *audioStreamBuilder =  new AudioStreamBuilder();
+    if (audioStreamBuilder == nullptr) {
+        return AAUDIO_ERROR_NO_MEMORY;
+    }
+    ALOGD("AAudio_createStreamBuilder(): created AudioStreamBuilder = %p", audioStreamBuilder);
+    // TODO protect the put() with a Mutex
+    AAudioStreamBuilder handle = sHandleTracker.put(AAUDIO_HANDLE_TYPE_STREAM_BUILDER,
+            audioStreamBuilder);
+    if (handle < 0) {
+        delete audioStreamBuilder;
+        return static_cast<aaudio_result_t>(handle);
+    } else {
+        *builder = handle;
+    }
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStreamBuilder_setDeviceId(AAudioStreamBuilder builder,
+                                                     aaudio_device_id_t deviceId)
+{
+    AudioStreamBuilder *streamBuilder = CONVERT_BUILDER_HANDLE_OR_RETURN();
+    streamBuilder->setDeviceId(deviceId);
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStreamBuilder_getDeviceId(AAudioStreamBuilder builder,
+                                              aaudio_device_id_t *deviceId)
+{
+    AudioStreamBuilder *streamBuilder = COMMON_GET_FROM_BUILDER_OR_RETURN(deviceId);
+    *deviceId = streamBuilder->getDeviceId();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStreamBuilder_setSampleRate(AAudioStreamBuilder builder,
+                                              aaudio_sample_rate_t sampleRate)
+{
+    AudioStreamBuilder *streamBuilder = CONVERT_BUILDER_HANDLE_OR_RETURN();
+    streamBuilder->setSampleRate(sampleRate);
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStreamBuilder_getSampleRate(AAudioStreamBuilder builder,
+                                              aaudio_sample_rate_t *sampleRate)
+{
+    AudioStreamBuilder *streamBuilder = COMMON_GET_FROM_BUILDER_OR_RETURN(sampleRate);
+    *sampleRate = streamBuilder->getSampleRate();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder builder,
+                                                   int32_t samplesPerFrame)
+{
+    AudioStreamBuilder *streamBuilder = CONVERT_BUILDER_HANDLE_OR_RETURN();
+    streamBuilder->setSamplesPerFrame(samplesPerFrame);
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStreamBuilder_getSamplesPerFrame(AAudioStreamBuilder builder,
+                                                   int32_t *samplesPerFrame)
+{
+    AudioStreamBuilder *streamBuilder = COMMON_GET_FROM_BUILDER_OR_RETURN(samplesPerFrame);
+    *samplesPerFrame = streamBuilder->getSamplesPerFrame();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStreamBuilder_setDirection(AAudioStreamBuilder builder,
+                                             aaudio_direction_t direction)
+{
+    AudioStreamBuilder *streamBuilder = CONVERT_BUILDER_HANDLE_OR_RETURN();
+    streamBuilder->setDirection(direction);
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStreamBuilder_getDirection(AAudioStreamBuilder builder,
+                                             aaudio_direction_t *direction)
+{
+    AudioStreamBuilder *streamBuilder = COMMON_GET_FROM_BUILDER_OR_RETURN(direction);
+    *direction = streamBuilder->getDirection();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStreamBuilder_setFormat(AAudioStreamBuilder builder,
+                                                   aaudio_audio_format_t format)
+{
+    AudioStreamBuilder *streamBuilder = CONVERT_BUILDER_HANDLE_OR_RETURN();
+    streamBuilder->setFormat(format);
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStreamBuilder_getFormat(AAudioStreamBuilder builder,
+                                                   aaudio_audio_format_t *format)
+{
+    AudioStreamBuilder *streamBuilder = COMMON_GET_FROM_BUILDER_OR_RETURN(format);
+    *format = streamBuilder->getFormat();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStreamBuilder_setSharingMode(AAudioStreamBuilder builder,
+                                                        aaudio_sharing_mode_t sharingMode)
+{
+    AudioStreamBuilder *streamBuilder = CONVERT_BUILDER_HANDLE_OR_RETURN();
+    if ((sharingMode < 0) || (sharingMode >= AAUDIO_SHARING_MODE_COUNT)) {
+        return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
+    } else {
+        streamBuilder->setSharingMode(sharingMode);
+        return AAUDIO_OK;
+    }
+}
+
+AAUDIO_API aaudio_result_t AAudioStreamBuilder_getSharingMode(AAudioStreamBuilder builder,
+                                                        aaudio_sharing_mode_t *sharingMode)
+{
+    AudioStreamBuilder *streamBuilder = COMMON_GET_FROM_BUILDER_OR_RETURN(sharingMode);
+    *sharingMode = streamBuilder->getSharingMode();
+    return AAUDIO_OK;
+}
+
+static aaudio_result_t  AAudioInternal_openStream(AudioStreamBuilder *streamBuilder,
+                                              AAudioStream *streamPtr)
+{
+    AudioStream *audioStream = nullptr;
+    aaudio_result_t result = streamBuilder->build(&audioStream);
+    if (result != AAUDIO_OK) {
+        return result;
+    } else {
+        // Create a handle for referencing the object.
+        // TODO protect the put() with a Mutex
+        AAudioStream handle = sHandleTracker.put(AAUDIO_HANDLE_TYPE_STREAM, audioStream);
+        if (handle < 0) {
+            delete audioStream;
+            return static_cast<aaudio_result_t>(handle);
+        }
+        *streamPtr = handle;
+        return AAUDIO_OK;
+    }
+}
+
+AAUDIO_API aaudio_result_t  AAudioStreamBuilder_openStream(AAudioStreamBuilder builder,
+                                                     AAudioStream *streamPtr)
+{
+    ALOGD("AAudioStreamBuilder_openStream(): builder = 0x%08X", builder);
+    AudioStreamBuilder *streamBuilder = COMMON_GET_FROM_BUILDER_OR_RETURN(streamPtr);
+    return AAudioInternal_openStream(streamBuilder, streamPtr);
+}
+
+AAUDIO_API aaudio_result_t  AAudioStreamBuilder_delete(AAudioStreamBuilder builder)
+{
+    AudioStreamBuilder *streamBuilder = (AudioStreamBuilder *)
+            sHandleTracker.remove(AAUDIO_HANDLE_TYPE_STREAM_BUILDER, builder);
+    if (streamBuilder != nullptr) {
+        delete streamBuilder;
+        return AAUDIO_OK;
+    }
+    return AAUDIO_ERROR_INVALID_HANDLE;
+}
+
+AAUDIO_API aaudio_result_t  AAudioStream_close(AAudioStream stream)
+{
+    AudioStream *audioStream = (AudioStream *)
+            sHandleTracker.remove(AAUDIO_HANDLE_TYPE_STREAM, (aaudio_handle_t)stream);
+    ALOGD("AAudioStream_close(0x%08X), audioStream = %p", stream, audioStream);
+    if (audioStream != nullptr) {
+        audioStream->close();
+        delete audioStream;
+        return AAUDIO_OK;
+    }
+    return AAUDIO_ERROR_INVALID_HANDLE;
+}
+
+AAUDIO_API aaudio_result_t  AAudioStream_requestStart(AAudioStream stream)
+{
+    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
+    ALOGD("AAudioStream_requestStart(0x%08X), audioStream = %p", stream, audioStream);
+    return audioStream->requestStart();
+}
+
+AAUDIO_API aaudio_result_t  AAudioStream_requestPause(AAudioStream stream)
+{
+    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
+    ALOGD("AAudioStream_requestPause(0x%08X), audioStream = %p", stream, audioStream);
+    return audioStream->requestPause();
+}
+
+AAUDIO_API aaudio_result_t  AAudioStream_requestFlush(AAudioStream stream)
+{
+    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
+    ALOGD("AAudioStream_requestFlush(0x%08X), audioStream = %p", stream, audioStream);
+    return audioStream->requestFlush();
+}
+
+AAUDIO_API aaudio_result_t  AAudioStream_requestStop(AAudioStream stream)
+{
+    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
+    ALOGD("AAudioStream_requestStop(0x%08X), audioStream = %p", stream, audioStream);
+    return audioStream->requestStop();
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_waitForStateChange(AAudioStream stream,
+                                            aaudio_stream_state_t inputState,
+                                            aaudio_stream_state_t *nextState,
+                                            aaudio_nanoseconds_t timeoutNanoseconds)
+{
+
+    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
+    return audioStream->waitForStateChange(inputState, nextState, timeoutNanoseconds);
+}
+
+// ============================================================
+// Stream - non-blocking I/O
+// ============================================================
+
+AAUDIO_API aaudio_result_t AAudioStream_read(AAudioStream stream,
+                               void *buffer,
+                               aaudio_size_frames_t numFrames,
+                               aaudio_nanoseconds_t timeoutNanoseconds)
+{
+    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
+    if (buffer == nullptr) {
+        return AAUDIO_ERROR_NULL;
+    }
+    if (numFrames < 0) {
+        return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
+    } else if (numFrames == 0) {
+        return 0;
+    }
+
+    aaudio_result_t result = audioStream->read(buffer, numFrames, timeoutNanoseconds);
+    // ALOGD("AAudioStream_read(): read returns %d", result);
+
+    return result;
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_write(AAudioStream stream,
+                               const void *buffer,
+                               aaudio_size_frames_t numFrames,
+                               aaudio_nanoseconds_t timeoutNanoseconds)
+{
+    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
+    if (buffer == nullptr) {
+        return AAUDIO_ERROR_NULL;
+    }
+    if (numFrames < 0) {
+        return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
+    } else if (numFrames == 0) {
+        return 0;
+    }
+
+    aaudio_result_t result = audioStream->write(buffer, numFrames, timeoutNanoseconds);
+    // ALOGD("AAudioStream_write(): write returns %d", result);
+
+    return result;
+}
+
+// ============================================================
+// Miscellaneous
+// ============================================================
+
+AAUDIO_API aaudio_result_t AAudioStream_createThread(AAudioStream stream,
+                                     aaudio_nanoseconds_t periodNanoseconds,
+                                     aaudio_audio_thread_proc_t *threadProc, void *arg)
+{
+    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
+    return audioStream->createThread(periodNanoseconds, threadProc, arg);
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_joinThread(AAudioStream stream,
+                                   void **returnArg,
+                                   aaudio_nanoseconds_t timeoutNanoseconds)
+{
+    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
+    return audioStream->joinThread(returnArg, timeoutNanoseconds);
+}
+
+// ============================================================
+// Stream - queries
+// ============================================================
+
+// TODO Use aaudio_clockid_t all the way down through the C++ streams.
+static clockid_t AAudioConvert_fromAAudioClockId(aaudio_clockid_t clockid)
+{
+    clockid_t hostClockId;
+    switch (clockid) {
+        case AAUDIO_CLOCK_MONOTONIC:
+            hostClockId = CLOCK_MONOTONIC;
+            break;
+        case AAUDIO_CLOCK_BOOTTIME:
+            hostClockId = CLOCK_BOOTTIME;
+            break;
+        default:
+            hostClockId = 0; // TODO review
+    }
+    return hostClockId;
+}
+
+aaudio_nanoseconds_t AAudio_getNanoseconds(aaudio_clockid_t clockid)
+{
+    clockid_t hostClockId = AAudioConvert_fromAAudioClockId(clockid);
+   return AudioClock::getNanoseconds(hostClockId);
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_getSampleRate(AAudioStream stream, aaudio_sample_rate_t *sampleRate)
+{
+    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(sampleRate);
+    *sampleRate = audioStream->getSampleRate();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_getSamplesPerFrame(AAudioStream stream, int32_t *samplesPerFrame)
+{
+    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(samplesPerFrame);
+    *samplesPerFrame = audioStream->getSamplesPerFrame();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_getState(AAudioStream stream, aaudio_stream_state_t *state)
+{
+    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(state);
+    *state = audioStream->getState();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_getFormat(AAudioStream stream, aaudio_audio_format_t *format)
+{
+    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(format);
+    *format = audioStream->getFormat();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_setBufferSize(AAudioStream stream,
+                                                aaudio_size_frames_t requestedFrames,
+                                                aaudio_size_frames_t *actualFrames)
+{
+    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
+    return audioStream->setBufferSize(requestedFrames, actualFrames);
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_getBufferSize(AAudioStream stream, aaudio_size_frames_t *frames)
+{
+    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(frames);
+    *frames = audioStream->getBufferSize();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_getDirection(AAudioStream stream, int32_t *direction)
+{
+    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(direction);
+    *direction = audioStream->getDirection();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_getFramesPerBurst(AAudioStream stream,
+                                                    aaudio_size_frames_t *framesPerBurst)
+{
+    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(framesPerBurst);
+    *framesPerBurst = audioStream->getFramesPerBurst();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_getBufferCapacity(AAudioStream stream,
+                                           aaudio_size_frames_t *capacity)
+{
+    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(capacity);
+    *capacity = audioStream->getBufferCapacity();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_getXRunCount(AAudioStream stream, int32_t *xRunCount)
+{
+    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(xRunCount);
+    *xRunCount = audioStream->getXRunCount();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_getDeviceId(AAudioStream stream,
+                                                 aaudio_device_id_t *deviceId)
+{
+    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(deviceId);
+    *deviceId = audioStream->getDeviceId();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_getSharingMode(AAudioStream stream,
+                                                 aaudio_sharing_mode_t *sharingMode)
+{
+    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(sharingMode);
+    *sharingMode = audioStream->getSharingMode();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_getFramesWritten(AAudioStream stream,
+                                                   aaudio_position_frames_t *frames)
+{
+    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(frames);
+    *frames = audioStream->getFramesWritten();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_getFramesRead(AAudioStream stream, aaudio_position_frames_t *frames)
+{
+    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(frames);
+    *frames = audioStream->getFramesRead();
+    return AAUDIO_OK;
+}
+
+AAUDIO_API aaudio_result_t AAudioStream_getTimestamp(AAudioStream stream,
+                                      aaudio_clockid_t clockid,
+                                      aaudio_position_frames_t *framePosition,
+                                      aaudio_nanoseconds_t *timeNanoseconds)
+{
+    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
+    if (framePosition == nullptr) {
+        return AAUDIO_ERROR_NULL;
+    } else if (timeNanoseconds == nullptr) {
+        return AAUDIO_ERROR_NULL;
+    } else if (clockid != AAUDIO_CLOCK_MONOTONIC && clockid != AAUDIO_CLOCK_BOOTTIME) {
+        return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
+    }
+
+    clockid_t hostClockId = AAudioConvert_fromAAudioClockId(clockid);
+    return audioStream->getTimestamp(hostClockId, framePosition, timeNanoseconds);
+}
diff --git a/media/liboboe/src/core/AudioStream.cpp b/media/liboboe/src/core/AudioStream.cpp
index cc654c3..77d3cc0 100644
--- a/media/liboboe/src/core/AudioStream.cpp
+++ b/media/liboboe/src/core/AudioStream.cpp
@@ -14,19 +14,19 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "OboeAudio"
+#define LOG_TAG "AAudio"
 //#define LOG_NDEBUG 0
 #include <utils/Log.h>
 
 #include <atomic>
 #include <stdint.h>
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudio.h>
 
 #include "AudioStreamBuilder.h"
 #include "AudioStream.h"
 #include "AudioClock.h"
 
-using namespace oboe;
+using namespace aaudio;
 
 AudioStream::AudioStream() {
     // mThread is a pthread_t of unknown size so we need memset.
@@ -34,7 +34,7 @@
     setPeriodNanoseconds(0);
 }
 
-oboe_result_t AudioStream::open(const AudioStreamBuilder& builder)
+aaudio_result_t AudioStream::open(const AudioStreamBuilder& builder)
 {
     // TODO validate parameters.
     // Copy parameters from the Builder because the Builder may be deleted after this call.
@@ -43,41 +43,41 @@
     mDeviceId = builder.getDeviceId();
     mFormat = builder.getFormat();
     mSharingMode = builder.getSharingMode();
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
 AudioStream::~AudioStream() {
     close();
 }
 
-oboe_result_t AudioStream::waitForStateTransition(oboe_stream_state_t startingState,
-                                               oboe_stream_state_t endingState,
-                                               oboe_nanoseconds_t timeoutNanoseconds)
+aaudio_result_t AudioStream::waitForStateTransition(aaudio_stream_state_t startingState,
+                                               aaudio_stream_state_t endingState,
+                                               aaudio_nanoseconds_t timeoutNanoseconds)
 {
-    oboe_stream_state_t state = getState();
-    oboe_stream_state_t nextState = state;
+    aaudio_stream_state_t state = getState();
+    aaudio_stream_state_t nextState = state;
     if (state == startingState && state != endingState) {
-        oboe_result_t result = waitForStateChange(state, &nextState, timeoutNanoseconds);
-        if (result != OBOE_OK) {
+        aaudio_result_t result = waitForStateChange(state, &nextState, timeoutNanoseconds);
+        if (result != AAUDIO_OK) {
             return result;
         }
     }
 // It's OK if the expected transition has already occurred.
 // But if we reach an unexpected state then that is an error.
     if (nextState != endingState) {
-        return OBOE_ERROR_UNEXPECTED_STATE;
+        return AAUDIO_ERROR_UNEXPECTED_STATE;
     } else {
-        return OBOE_OK;
+        return AAUDIO_OK;
     }
 }
 
-oboe_result_t AudioStream::waitForStateChange(oboe_stream_state_t currentState,
-                                                oboe_stream_state_t *nextState,
-                                                oboe_nanoseconds_t timeoutNanoseconds)
+aaudio_result_t AudioStream::waitForStateChange(aaudio_stream_state_t currentState,
+                                                aaudio_stream_state_t *nextState,
+                                                aaudio_nanoseconds_t timeoutNanoseconds)
 {
     // TODO replace this when similar functionality added to AudioTrack.cpp
-    oboe_nanoseconds_t durationNanos = 20 * OBOE_NANOS_PER_MILLISECOND;
-    oboe_stream_state_t state = getState();
+    aaudio_nanoseconds_t durationNanos = 20 * AAUDIO_NANOS_PER_MILLISECOND;
+    aaudio_stream_state_t state = getState();
     while (state == currentState && timeoutNanoseconds > 0) {
         if (durationNanos > timeoutNanoseconds) {
             durationNanos = timeoutNanoseconds;
@@ -85,8 +85,8 @@
         AudioClock::sleepForNanos(durationNanos);
         timeoutNanoseconds -= durationNanos;
 
-        oboe_result_t result = updateState();
-        if (result != OBOE_OK) {
+        aaudio_result_t result = updateState();
+        if (result != AAUDIO_OK) {
             return result;
         }
 
@@ -95,7 +95,7 @@
     if (nextState != nullptr) {
         *nextState = state;
     }
-    return (state == currentState) ? OBOE_ERROR_TIMEOUT : OBOE_OK;
+    return (state == currentState) ? AAUDIO_ERROR_TIMEOUT : AAUDIO_OK;
 }
 
 // This registers the app's background audio thread with the server before
@@ -104,7 +104,7 @@
 void* AudioStream::wrapUserThread() {
     void* procResult = nullptr;
     mThreadRegistrationResult = registerThread();
-    if (mThreadRegistrationResult == OBOE_OK) {
+    if (mThreadRegistrationResult == AAUDIO_OK) {
         // Call application procedure. This may take a very long time.
         procResult = mThreadProc(mThreadArg);
         ALOGD("AudioStream::mThreadProc() returned");
@@ -120,15 +120,15 @@
     return audioStream->wrapUserThread();
 }
 
-oboe_result_t AudioStream::createThread(oboe_nanoseconds_t periodNanoseconds,
-                                     oboe_audio_thread_proc_t *threadProc,
+aaudio_result_t AudioStream::createThread(aaudio_nanoseconds_t periodNanoseconds,
+                                     aaudio_audio_thread_proc_t *threadProc,
                                      void* threadArg)
 {
     if (mHasThread) {
-        return OBOE_ERROR_INVALID_STATE;
+        return AAUDIO_ERROR_INVALID_STATE;
     }
     if (threadProc == nullptr) {
-        return OBOE_ERROR_NULL;
+        return AAUDIO_ERROR_NULL;
     }
     // Pass input parameters to the background thread.
     mThreadProc = threadProc;
@@ -136,18 +136,18 @@
     setPeriodNanoseconds(periodNanoseconds);
     int err = pthread_create(&mThread, nullptr, AudioStream_internalThreadProc, this);
     if (err != 0) {
-        // TODO convert errno to oboe_result_t
-        return OBOE_ERROR_INTERNAL;
+        // TODO convert errno to aaudio_result_t
+        return AAUDIO_ERROR_INTERNAL;
     } else {
         mHasThread = true;
-        return OBOE_OK;
+        return AAUDIO_OK;
     }
 }
 
-oboe_result_t AudioStream::joinThread(void** returnArg, oboe_nanoseconds_t timeoutNanoseconds)
+aaudio_result_t AudioStream::joinThread(void** returnArg, aaudio_nanoseconds_t timeoutNanoseconds)
 {
     if (!mHasThread) {
-        return OBOE_ERROR_INVALID_STATE;
+        return AAUDIO_ERROR_INVALID_STATE;
     }
 #if 0
     // TODO implement equivalent of pthread_timedjoin_np()
@@ -157,7 +157,7 @@
     int err = pthread_join(mThread, returnArg);
 #endif
     mHasThread = false;
-    // TODO convert errno to oboe_result_t
-    return err ? OBOE_ERROR_INTERNAL : mThreadRegistrationResult;
+    // TODO convert errno to aaudio_result_t
+    return err ? AAUDIO_ERROR_INTERNAL : mThreadRegistrationResult;
 }
 
diff --git a/media/liboboe/src/core/AudioStream.h b/media/liboboe/src/core/AudioStream.h
index c13ae9f..8e4aa05 100644
--- a/media/liboboe/src/core/AudioStream.h
+++ b/media/liboboe/src/core/AudioStream.h
@@ -14,23 +14,23 @@
  * limitations under the License.
  */
 
-#ifndef OBOE_AUDIOSTREAM_H
-#define OBOE_AUDIOSTREAM_H
+#ifndef AAUDIO_AUDIOSTREAM_H
+#define AAUDIO_AUDIOSTREAM_H
 
 #include <atomic>
 #include <stdint.h>
-#include <oboe/OboeDefinitions.h>
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudioDefinitions.h>
+#include <aaudio/AAudio.h>
 
-#include "OboeUtilities.h"
+#include "AAudioUtilities.h"
 #include "MonotonicCounter.h"
 
-namespace oboe {
+namespace aaudio {
 
 class AudioStreamBuilder;
 
 /**
- * Oboe audio stream.
+ * AAudio audio stream.
  */
 class AudioStream {
 public:
@@ -45,57 +45,57 @@
     /* Asynchronous requests.
      * Use waitForStateChange() to wait for completion.
      */
-    virtual oboe_result_t requestStart() = 0;
-    virtual oboe_result_t requestPause() = 0;
-    virtual oboe_result_t requestFlush() = 0;
-    virtual oboe_result_t requestStop() = 0;
+    virtual aaudio_result_t requestStart() = 0;
+    virtual aaudio_result_t requestPause() = 0;
+    virtual aaudio_result_t requestFlush() = 0;
+    virtual aaudio_result_t requestStop() = 0;
 
-    // TODO use oboe_clockid_t all the way down to AudioClock
-    virtual oboe_result_t getTimestamp(clockid_t clockId,
-                                       oboe_position_frames_t *framePosition,
-                                       oboe_nanoseconds_t *timeNanoseconds) = 0;
+    // TODO use aaudio_clockid_t all the way down to AudioClock
+    virtual aaudio_result_t getTimestamp(clockid_t clockId,
+                                       aaudio_position_frames_t *framePosition,
+                                       aaudio_nanoseconds_t *timeNanoseconds) = 0;
 
 
-    virtual oboe_result_t updateState() = 0;
+    virtual aaudio_result_t updateState() = 0;
 
 
     // =========== End ABSTRACT methods ===========================
 
-    virtual oboe_result_t waitForStateChange(oboe_stream_state_t currentState,
-                                          oboe_stream_state_t *nextState,
-                                          oboe_nanoseconds_t timeoutNanoseconds);
+    virtual aaudio_result_t waitForStateChange(aaudio_stream_state_t currentState,
+                                          aaudio_stream_state_t *nextState,
+                                          aaudio_nanoseconds_t timeoutNanoseconds);
 
     /**
      * Open the stream using the parameters in the builder.
      * Allocate the necessary resources.
      */
-    virtual oboe_result_t open(const AudioStreamBuilder& builder);
+    virtual aaudio_result_t open(const AudioStreamBuilder& builder);
 
     /**
      * Close the stream and deallocate any resources from the open() call.
      * It is safe to call close() multiple times.
      */
-    virtual oboe_result_t close() {
-        return OBOE_OK;
+    virtual aaudio_result_t close() {
+        return AAUDIO_OK;
     }
 
-    virtual oboe_result_t setBufferSize(oboe_size_frames_t requestedFrames,
-                                        oboe_size_frames_t *actualFrames) {
-        return OBOE_ERROR_UNIMPLEMENTED;
+    virtual aaudio_result_t setBufferSize(aaudio_size_frames_t requestedFrames,
+                                        aaudio_size_frames_t *actualFrames) {
+        return AAUDIO_ERROR_UNIMPLEMENTED;
     }
 
-    virtual oboe_result_t createThread(oboe_nanoseconds_t periodNanoseconds,
-                                       oboe_audio_thread_proc_t *threadProc,
+    virtual aaudio_result_t createThread(aaudio_nanoseconds_t periodNanoseconds,
+                                       aaudio_audio_thread_proc_t *threadProc,
                                        void *threadArg);
 
-    virtual oboe_result_t joinThread(void **returnArg, oboe_nanoseconds_t timeoutNanoseconds);
+    virtual aaudio_result_t joinThread(void **returnArg, aaudio_nanoseconds_t timeoutNanoseconds);
 
-    virtual oboe_result_t registerThread() {
-        return OBOE_OK;
+    virtual aaudio_result_t registerThread() {
+        return AAUDIO_OK;
     }
 
-    virtual oboe_result_t unregisterThread() {
-        return OBOE_OK;
+    virtual aaudio_result_t unregisterThread() {
+        return AAUDIO_OK;
     }
 
     /**
@@ -106,109 +106,109 @@
 
     // ============== Queries ===========================
 
-    virtual oboe_stream_state_t getState() const {
+    virtual aaudio_stream_state_t getState() const {
         return mState;
     }
 
-    virtual oboe_size_frames_t getBufferSize() const {
-        return OBOE_ERROR_UNIMPLEMENTED;
+    virtual aaudio_size_frames_t getBufferSize() const {
+        return AAUDIO_ERROR_UNIMPLEMENTED;
     }
 
-    virtual oboe_size_frames_t getBufferCapacity() const {
-        return OBOE_ERROR_UNIMPLEMENTED;
+    virtual aaudio_size_frames_t getBufferCapacity() const {
+        return AAUDIO_ERROR_UNIMPLEMENTED;
     }
 
-    virtual oboe_size_frames_t getFramesPerBurst() const {
-        return OBOE_ERROR_UNIMPLEMENTED;
+    virtual aaudio_size_frames_t getFramesPerBurst() const {
+        return AAUDIO_ERROR_UNIMPLEMENTED;
     }
 
     virtual int32_t getXRunCount() const {
-        return OBOE_ERROR_UNIMPLEMENTED;
+        return AAUDIO_ERROR_UNIMPLEMENTED;
     }
 
     bool isPlaying() const {
-        return mState == OBOE_STREAM_STATE_STARTING || mState == OBOE_STREAM_STATE_STARTED;
+        return mState == AAUDIO_STREAM_STATE_STARTING || mState == AAUDIO_STREAM_STATE_STARTED;
     }
 
-    oboe_result_t getSampleRate() const {
+    aaudio_result_t getSampleRate() const {
         return mSampleRate;
     }
 
-    oboe_audio_format_t getFormat()  const {
+    aaudio_audio_format_t getFormat()  const {
         return mFormat;
     }
 
-    oboe_result_t getSamplesPerFrame() const {
+    aaudio_result_t getSamplesPerFrame() const {
         return mSamplesPerFrame;
     }
 
-    oboe_device_id_t getDeviceId() const {
+    aaudio_device_id_t getDeviceId() const {
         return mDeviceId;
     }
 
-    oboe_sharing_mode_t getSharingMode() const {
+    aaudio_sharing_mode_t getSharingMode() const {
         return mSharingMode;
     }
 
-    oboe_direction_t getDirection() const {
+    aaudio_direction_t getDirection() const {
         return mDirection;
     }
 
-    oboe_size_bytes_t getBytesPerFrame() const {
+    aaudio_size_bytes_t getBytesPerFrame() const {
         return mSamplesPerFrame * getBytesPerSample();
     }
 
-    oboe_size_bytes_t getBytesPerSample() const {
-        return OboeConvert_formatToSizeInBytes(mFormat);
+    aaudio_size_bytes_t getBytesPerSample() const {
+        return AAudioConvert_formatToSizeInBytes(mFormat);
     }
 
-    virtual oboe_position_frames_t getFramesWritten() {
+    virtual aaudio_position_frames_t getFramesWritten() {
         return mFramesWritten.get();
     }
 
-    virtual oboe_position_frames_t getFramesRead() {
+    virtual aaudio_position_frames_t getFramesRead() {
         return mFramesRead.get();
     }
 
 
     // ============== I/O ===========================
     // A Stream will only implement read() or write() depending on its direction.
-    virtual oboe_result_t write(const void *buffer,
-                             oboe_size_frames_t numFrames,
-                             oboe_nanoseconds_t timeoutNanoseconds) {
-        return OBOE_ERROR_UNIMPLEMENTED;
+    virtual aaudio_result_t write(const void *buffer,
+                             aaudio_size_frames_t numFrames,
+                             aaudio_nanoseconds_t timeoutNanoseconds) {
+        return AAUDIO_ERROR_UNIMPLEMENTED;
     }
 
-    virtual oboe_result_t read(void *buffer,
-                            oboe_size_frames_t numFrames,
-                            oboe_nanoseconds_t timeoutNanoseconds) {
-        return OBOE_ERROR_UNIMPLEMENTED;
+    virtual aaudio_result_t read(void *buffer,
+                            aaudio_size_frames_t numFrames,
+                            aaudio_nanoseconds_t timeoutNanoseconds) {
+        return AAUDIO_ERROR_UNIMPLEMENTED;
     }
 
 protected:
 
-    virtual oboe_position_frames_t incrementFramesWritten(oboe_size_frames_t frames) {
-        return static_cast<oboe_position_frames_t>(mFramesWritten.increment(frames));
+    virtual aaudio_position_frames_t incrementFramesWritten(aaudio_size_frames_t frames) {
+        return static_cast<aaudio_position_frames_t>(mFramesWritten.increment(frames));
     }
 
-    virtual oboe_position_frames_t incrementFramesRead(oboe_size_frames_t frames) {
-        return static_cast<oboe_position_frames_t>(mFramesRead.increment(frames));
+    virtual aaudio_position_frames_t incrementFramesRead(aaudio_size_frames_t frames) {
+        return static_cast<aaudio_position_frames_t>(mFramesRead.increment(frames));
     }
 
     /**
      * Wait for a transition from one state to another.
-     * @return OBOE_OK if the endingState was observed, or OBOE_ERROR_UNEXPECTED_STATE
+     * @return AAUDIO_OK if the endingState was observed, or AAUDIO_ERROR_UNEXPECTED_STATE
      *   if any state that was not the startingState or endingState was observed
-     *   or OBOE_ERROR_TIMEOUT
+     *   or AAUDIO_ERROR_TIMEOUT
      */
-    virtual oboe_result_t waitForStateTransition(oboe_stream_state_t startingState,
-                                              oboe_stream_state_t endingState,
-                                              oboe_nanoseconds_t timeoutNanoseconds);
+    virtual aaudio_result_t waitForStateTransition(aaudio_stream_state_t startingState,
+                                              aaudio_stream_state_t endingState,
+                                              aaudio_nanoseconds_t timeoutNanoseconds);
 
     /**
      * This should not be called after the open() call.
      */
-    void setSampleRate(oboe_sample_rate_t sampleRate) {
+    void setSampleRate(aaudio_sample_rate_t sampleRate) {
         mSampleRate = sampleRate;
     }
 
@@ -222,18 +222,18 @@
     /**
      * This should not be called after the open() call.
      */
-    void setSharingMode(oboe_sharing_mode_t sharingMode) {
+    void setSharingMode(aaudio_sharing_mode_t sharingMode) {
         mSharingMode = sharingMode;
     }
 
     /**
      * This should not be called after the open() call.
      */
-    void setFormat(oboe_audio_format_t format) {
+    void setFormat(aaudio_audio_format_t format) {
         mFormat = format;
     }
 
-    void setState(oboe_stream_state_t state) {
+    void setState(aaudio_stream_state_t state) {
         mState = state;
     }
 
@@ -243,38 +243,38 @@
     MonotonicCounter     mFramesWritten;
     MonotonicCounter     mFramesRead;
 
-    void setPeriodNanoseconds(oboe_nanoseconds_t periodNanoseconds) {
+    void setPeriodNanoseconds(aaudio_nanoseconds_t periodNanoseconds) {
         mPeriodNanoseconds.store(periodNanoseconds, std::memory_order_release);
     }
 
-    oboe_nanoseconds_t getPeriodNanoseconds() {
+    aaudio_nanoseconds_t getPeriodNanoseconds() {
         return mPeriodNanoseconds.load(std::memory_order_acquire);
     }
 
 private:
     // These do not change after open().
-    int32_t              mSamplesPerFrame = OBOE_UNSPECIFIED;
-    oboe_sample_rate_t   mSampleRate = OBOE_UNSPECIFIED;
-    oboe_stream_state_t  mState = OBOE_STREAM_STATE_UNINITIALIZED;
-    oboe_device_id_t     mDeviceId = OBOE_UNSPECIFIED;
-    oboe_sharing_mode_t  mSharingMode = OBOE_SHARING_MODE_LEGACY;
-    oboe_audio_format_t  mFormat = OBOE_AUDIO_FORMAT_UNSPECIFIED;
-    oboe_direction_t     mDirection = OBOE_DIRECTION_OUTPUT;
+    int32_t              mSamplesPerFrame = AAUDIO_UNSPECIFIED;
+    aaudio_sample_rate_t   mSampleRate = AAUDIO_UNSPECIFIED;
+    aaudio_stream_state_t  mState = AAUDIO_STREAM_STATE_UNINITIALIZED;
+    aaudio_device_id_t     mDeviceId = AAUDIO_UNSPECIFIED;
+    aaudio_sharing_mode_t  mSharingMode = AAUDIO_SHARING_MODE_LEGACY;
+    aaudio_audio_format_t  mFormat = AAUDIO_FORMAT_UNSPECIFIED;
+    aaudio_direction_t     mDirection = AAUDIO_DIRECTION_OUTPUT;
 
     // background thread ----------------------------------
     bool                 mHasThread = false;
     pthread_t            mThread; // initialized in constructor
 
     // These are set by the application thread and then read by the audio pthread.
-    std::atomic<oboe_nanoseconds_t>  mPeriodNanoseconds; // for tuning SCHED_FIFO threads
+    std::atomic<aaudio_nanoseconds_t>  mPeriodNanoseconds; // for tuning SCHED_FIFO threads
     // TODO make atomic?
-    oboe_audio_thread_proc_t* mThreadProc = nullptr;
+    aaudio_audio_thread_proc_t* mThreadProc = nullptr;
     void*                mThreadArg = nullptr;
-    oboe_result_t        mThreadRegistrationResult = OBOE_OK;
+    aaudio_result_t        mThreadRegistrationResult = AAUDIO_OK;
 
 
 };
 
-} /* namespace oboe */
+} /* namespace aaudio */
 
-#endif /* OBOE_AUDIOSTREAM_H */
+#endif /* AAUDIO_AUDIOSTREAM_H */
diff --git a/media/liboboe/src/core/AudioStreamBuilder.cpp b/media/liboboe/src/core/AudioStreamBuilder.cpp
index 37e1378..decd53c 100644
--- a/media/liboboe/src/core/AudioStreamBuilder.cpp
+++ b/media/liboboe/src/core/AudioStreamBuilder.cpp
@@ -14,15 +14,15 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "OboeAudio"
+#define LOG_TAG "AAudio"
 //#define LOG_NDEBUG 0
 #include <utils/Log.h>
 
 #include <new>
 #include <stdint.h>
 
-#include <oboe/OboeDefinitions.h>
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudioDefinitions.h>
+#include <aaudio/AAudio.h>
 
 #include "client/AudioStreamInternal.h"
 #include "core/AudioStream.h"
@@ -30,7 +30,7 @@
 #include "legacy/AudioStreamRecord.h"
 #include "legacy/AudioStreamTrack.h"
 
-using namespace oboe;
+using namespace aaudio;
 
 /*
  * AudioStreamBuilder
@@ -41,50 +41,50 @@
 AudioStreamBuilder::~AudioStreamBuilder() {
 }
 
-oboe_result_t AudioStreamBuilder::build(AudioStream** streamPtr) {
+aaudio_result_t AudioStreamBuilder::build(AudioStream** streamPtr) {
     // TODO Is there a better place to put the code that decides which class to use?
     AudioStream* audioStream = nullptr;
-    const oboe_sharing_mode_t sharingMode = getSharingMode();
+    const aaudio_sharing_mode_t sharingMode = getSharingMode();
     switch (getDirection()) {
-    case OBOE_DIRECTION_INPUT:
+    case AAUDIO_DIRECTION_INPUT:
         switch (sharingMode) {
-            case OBOE_SHARING_MODE_LEGACY:
+            case AAUDIO_SHARING_MODE_LEGACY:
                 audioStream = new(std::nothrow) AudioStreamRecord();
                 break;
             default:
                 ALOGE("AudioStreamBuilder(): bad sharing mode = %d", sharingMode);
-                return OBOE_ERROR_ILLEGAL_ARGUMENT;
+                return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
                 break;
         }
         break;
-    case OBOE_DIRECTION_OUTPUT:
+    case AAUDIO_DIRECTION_OUTPUT:
         switch (sharingMode) {
-            case OBOE_SHARING_MODE_LEGACY:
+            case AAUDIO_SHARING_MODE_LEGACY:
                 audioStream = new(std::nothrow) AudioStreamTrack();
                 break;
-            case OBOE_SHARING_MODE_EXCLUSIVE:
+            case AAUDIO_SHARING_MODE_EXCLUSIVE:
                 audioStream = new(std::nothrow) AudioStreamInternal();
                 break;
             default:
                 ALOGE("AudioStreamBuilder(): bad sharing mode = %d", sharingMode);
-                return OBOE_ERROR_ILLEGAL_ARGUMENT;
+                return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
                 break;
         }
         break;
     default:
         ALOGE("AudioStreamBuilder(): bad direction = %d", getDirection());
-        return OBOE_ERROR_ILLEGAL_ARGUMENT;
+        return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
         break;
     }
     if (audioStream == nullptr) {
-        return OBOE_ERROR_NO_MEMORY;
+        return AAUDIO_ERROR_NO_MEMORY;
     }
     ALOGD("AudioStreamBuilder(): created audioStream = %p", audioStream);
 
     // TODO maybe move this out of build and pass the builder to the constructors
     // Open the stream using the parameters from the builder.
-    const oboe_result_t result = audioStream->open(*this);
-    if (result != OBOE_OK) {
+    const aaudio_result_t result = audioStream->open(*this);
+    if (result != AAUDIO_OK) {
         delete audioStream;
     } else {
         *streamPtr = audioStream;
diff --git a/media/liboboe/src/core/AudioStreamBuilder.h b/media/liboboe/src/core/AudioStreamBuilder.h
index ec17eb6..9e1a1a7 100644
--- a/media/liboboe/src/core/AudioStreamBuilder.h
+++ b/media/liboboe/src/core/AudioStreamBuilder.h
@@ -14,17 +14,17 @@
  * limitations under the License.
  */
 
-#ifndef OBOE_AUDIOSTREAMBUILDER_H
-#define OBOE_AUDIOSTREAMBUILDER_H
+#ifndef AAUDIO_AUDIOSTREAMBUILDER_H
+#define AAUDIO_AUDIOSTREAMBUILDER_H
 
 #include <stdint.h>
 
-#include <oboe/OboeDefinitions.h>
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudioDefinitions.h>
+#include <aaudio/AAudio.h>
 
 #include "AudioStream.h"
 
-namespace oboe {
+namespace aaudio {
 
 /**
  * Factory class for an AudioStream.
@@ -47,62 +47,62 @@
         return this;
     }
 
-    oboe_direction_t getDirection() const {
+    aaudio_direction_t getDirection() const {
         return mDirection;
     }
 
-    AudioStreamBuilder* setDirection(oboe_direction_t direction) {
+    AudioStreamBuilder* setDirection(aaudio_direction_t direction) {
         mDirection = direction;
         return this;
     }
 
-    oboe_sample_rate_t getSampleRate() const {
+    aaudio_sample_rate_t getSampleRate() const {
         return mSampleRate;
     }
 
-    AudioStreamBuilder* setSampleRate(oboe_sample_rate_t sampleRate) {
+    AudioStreamBuilder* setSampleRate(aaudio_sample_rate_t sampleRate) {
         mSampleRate = sampleRate;
         return this;
     }
 
-    oboe_audio_format_t getFormat() const {
+    aaudio_audio_format_t getFormat() const {
         return mFormat;
     }
 
-    AudioStreamBuilder *setFormat(oboe_audio_format_t format) {
+    AudioStreamBuilder *setFormat(aaudio_audio_format_t format) {
         mFormat = format;
         return this;
     }
 
-    oboe_sharing_mode_t getSharingMode() const {
+    aaudio_sharing_mode_t getSharingMode() const {
         return mSharingMode;
     }
 
-    AudioStreamBuilder* setSharingMode(oboe_sharing_mode_t sharingMode) {
+    AudioStreamBuilder* setSharingMode(aaudio_sharing_mode_t sharingMode) {
         mSharingMode = sharingMode;
         return this;
     }
 
-    oboe_device_id_t getDeviceId() const {
+    aaudio_device_id_t getDeviceId() const {
         return mDeviceId;
     }
 
-    AudioStreamBuilder* setDeviceId(oboe_device_id_t deviceId) {
+    AudioStreamBuilder* setDeviceId(aaudio_device_id_t deviceId) {
         mDeviceId = deviceId;
         return this;
     }
 
-    oboe_result_t build(AudioStream **streamPtr);
+    aaudio_result_t build(AudioStream **streamPtr);
 
 private:
-    int32_t              mSamplesPerFrame = OBOE_UNSPECIFIED;
-    oboe_sample_rate_t   mSampleRate = OBOE_UNSPECIFIED;
-    oboe_device_id_t     mDeviceId = OBOE_DEVICE_UNSPECIFIED;
-    oboe_sharing_mode_t  mSharingMode = OBOE_SHARING_MODE_LEGACY;
-    oboe_audio_format_t  mFormat = OBOE_AUDIO_FORMAT_UNSPECIFIED;
-    oboe_direction_t     mDirection = OBOE_DIRECTION_OUTPUT;
+    int32_t              mSamplesPerFrame = AAUDIO_UNSPECIFIED;
+    aaudio_sample_rate_t   mSampleRate = AAUDIO_UNSPECIFIED;
+    aaudio_device_id_t     mDeviceId = AAUDIO_DEVICE_UNSPECIFIED;
+    aaudio_sharing_mode_t  mSharingMode = AAUDIO_SHARING_MODE_LEGACY;
+    aaudio_audio_format_t  mFormat = AAUDIO_FORMAT_UNSPECIFIED;
+    aaudio_direction_t     mDirection = AAUDIO_DIRECTION_OUTPUT;
 };
 
-} /* namespace oboe */
+} /* namespace aaudio */
 
-#endif /* OBOE_AUDIOSTREAMBUILDER_H */
+#endif /* AAUDIO_AUDIOSTREAMBUILDER_H */
diff --git a/media/liboboe/src/core/OboeAudio.cpp b/media/liboboe/src/core/OboeAudio.cpp
deleted file mode 100644
index be563b5..0000000
--- a/media/liboboe/src/core/OboeAudio.cpp
+++ /dev/null
@@ -1,562 +0,0 @@
-/*
- * Copyright (C) 2016 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.
- */
-
-#define LOG_TAG "OboeAudio"
-//#define LOG_NDEBUG 0
-#include <utils/Log.h>
-
-#include <time.h>
-#include <pthread.h>
-
-#include <oboe/OboeDefinitions.h>
-#include <oboe/OboeAudio.h>
-
-#include "AudioStreamBuilder.h"
-#include "AudioStream.h"
-#include "AudioClock.h"
-#include "client/AudioStreamInternal.h"
-#include "HandleTracker.h"
-
-using namespace oboe;
-
-// This is not the maximum theoretic possible number of handles that the HandlerTracker
-// class could support; instead it is the maximum number of handles that we are configuring
-// for our HandleTracker instance (sHandleTracker).
-#define OBOE_MAX_HANDLES  64
-
-// Macros for common code that includes a return.
-// TODO Consider using do{}while(0) construct. I tried but it hung AndroidStudio
-#define CONVERT_BUILDER_HANDLE_OR_RETURN() \
-    convertOboeBuilderToStreamBuilder(builder); \
-    if (streamBuilder == nullptr) { \
-        return OBOE_ERROR_INVALID_HANDLE; \
-    }
-
-#define COMMON_GET_FROM_BUILDER_OR_RETURN(resultPtr) \
-    CONVERT_BUILDER_HANDLE_OR_RETURN() \
-    if ((resultPtr) == nullptr) { \
-        return OBOE_ERROR_NULL; \
-    }
-
-#define CONVERT_STREAM_HANDLE_OR_RETURN() \
-    convertOboeStreamToAudioStream(stream); \
-    if (audioStream == nullptr) { \
-        return OBOE_ERROR_INVALID_HANDLE; \
-    }
-
-#define COMMON_GET_FROM_STREAM_OR_RETURN(resultPtr) \
-    CONVERT_STREAM_HANDLE_OR_RETURN(); \
-    if ((resultPtr) == nullptr) { \
-        return OBOE_ERROR_NULL; \
-    }
-
-// Static data.
-// TODO static constructors are discouraged, alternatives?
-static HandleTracker sHandleTracker(OBOE_MAX_HANDLES);
-
-typedef enum
-{
-    OBOE_HANDLE_TYPE_STREAM,
-    OBOE_HANDLE_TYPE_STREAM_BUILDER,
-    OBOE_HANDLE_TYPE_COUNT
-} oboe_handle_type_t;
-static_assert(OBOE_HANDLE_TYPE_COUNT <= HANDLE_TRACKER_MAX_TYPES, "Too many handle types.");
-
-
-#define OBOE_CASE_ENUM(name) case name: return #name
-
-OBOE_API const char * Oboe_convertResultToText(oboe_result_t returnCode) {
-    switch (returnCode) {
-        OBOE_CASE_ENUM(OBOE_OK);
-        OBOE_CASE_ENUM(OBOE_ERROR_ILLEGAL_ARGUMENT);
-        OBOE_CASE_ENUM(OBOE_ERROR_INCOMPATIBLE);
-        OBOE_CASE_ENUM(OBOE_ERROR_INTERNAL);
-        OBOE_CASE_ENUM(OBOE_ERROR_INVALID_STATE);
-        OBOE_CASE_ENUM(OBOE_ERROR_INVALID_HANDLE);
-        OBOE_CASE_ENUM(OBOE_ERROR_INVALID_QUERY);
-        OBOE_CASE_ENUM(OBOE_ERROR_UNIMPLEMENTED);
-        OBOE_CASE_ENUM(OBOE_ERROR_UNAVAILABLE);
-        OBOE_CASE_ENUM(OBOE_ERROR_NO_FREE_HANDLES);
-        OBOE_CASE_ENUM(OBOE_ERROR_NO_MEMORY);
-        OBOE_CASE_ENUM(OBOE_ERROR_NULL);
-        OBOE_CASE_ENUM(OBOE_ERROR_TIMEOUT);
-        OBOE_CASE_ENUM(OBOE_ERROR_WOULD_BLOCK);
-        OBOE_CASE_ENUM(OBOE_ERROR_INVALID_ORDER);
-        OBOE_CASE_ENUM(OBOE_ERROR_OUT_OF_RANGE);
-        OBOE_CASE_ENUM(OBOE_ERROR_NO_SERVICE);
-    }
-    return "Unrecognized Oboe error.";
-}
-
-OBOE_API const char * Oboe_convertStreamStateToText(oboe_stream_state_t state) {
-    switch (state) {
-        OBOE_CASE_ENUM(OBOE_STREAM_STATE_UNINITIALIZED);
-        OBOE_CASE_ENUM(OBOE_STREAM_STATE_OPEN);
-        OBOE_CASE_ENUM(OBOE_STREAM_STATE_STARTING);
-        OBOE_CASE_ENUM(OBOE_STREAM_STATE_STARTED);
-        OBOE_CASE_ENUM(OBOE_STREAM_STATE_PAUSING);
-        OBOE_CASE_ENUM(OBOE_STREAM_STATE_PAUSED);
-        OBOE_CASE_ENUM(OBOE_STREAM_STATE_FLUSHING);
-        OBOE_CASE_ENUM(OBOE_STREAM_STATE_FLUSHED);
-        OBOE_CASE_ENUM(OBOE_STREAM_STATE_STOPPING);
-        OBOE_CASE_ENUM(OBOE_STREAM_STATE_STOPPED);
-        OBOE_CASE_ENUM(OBOE_STREAM_STATE_CLOSING);
-        OBOE_CASE_ENUM(OBOE_STREAM_STATE_CLOSED);
-    }
-    return "Unrecognized Oboe state.";
-}
-
-#undef OBOE_CASE_ENUM
-
-static AudioStream *convertOboeStreamToAudioStream(OboeStream stream)
-{
-    return (AudioStream *) sHandleTracker.get(OBOE_HANDLE_TYPE_STREAM,
-                                              (oboe_handle_t) stream);
-}
-
-static AudioStreamBuilder *convertOboeBuilderToStreamBuilder(OboeStreamBuilder builder)
-{
-    return (AudioStreamBuilder *) sHandleTracker.get(OBOE_HANDLE_TYPE_STREAM_BUILDER,
-                                                     (oboe_handle_t) builder);
-}
-
-OBOE_API oboe_result_t Oboe_createStreamBuilder(OboeStreamBuilder *builder)
-{
-    ALOGD("Oboe_createStreamBuilder(): check sHandleTracker.isInitialized ()");
-    if (!sHandleTracker.isInitialized()) {
-        return OBOE_ERROR_NO_MEMORY;
-    }
-    AudioStreamBuilder *audioStreamBuilder =  new AudioStreamBuilder();
-    if (audioStreamBuilder == nullptr) {
-        return OBOE_ERROR_NO_MEMORY;
-    }
-    ALOGD("Oboe_createStreamBuilder(): created AudioStreamBuilder = %p", audioStreamBuilder);
-    // TODO protect the put() with a Mutex
-    OboeStreamBuilder handle = sHandleTracker.put(OBOE_HANDLE_TYPE_STREAM_BUILDER,
-            audioStreamBuilder);
-    if (handle < 0) {
-        delete audioStreamBuilder;
-        return static_cast<oboe_result_t>(handle);
-    } else {
-        *builder = handle;
-    }
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStreamBuilder_setDeviceId(OboeStreamBuilder builder,
-                                                     oboe_device_id_t deviceId)
-{
-    AudioStreamBuilder *streamBuilder = CONVERT_BUILDER_HANDLE_OR_RETURN();
-    streamBuilder->setDeviceId(deviceId);
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStreamBuilder_getDeviceId(OboeStreamBuilder builder,
-                                              oboe_device_id_t *deviceId)
-{
-    AudioStreamBuilder *streamBuilder = COMMON_GET_FROM_BUILDER_OR_RETURN(deviceId);
-    *deviceId = streamBuilder->getDeviceId();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStreamBuilder_setSampleRate(OboeStreamBuilder builder,
-                                              oboe_sample_rate_t sampleRate)
-{
-    AudioStreamBuilder *streamBuilder = CONVERT_BUILDER_HANDLE_OR_RETURN();
-    streamBuilder->setSampleRate(sampleRate);
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStreamBuilder_getSampleRate(OboeStreamBuilder builder,
-                                              oboe_sample_rate_t *sampleRate)
-{
-    AudioStreamBuilder *streamBuilder = COMMON_GET_FROM_BUILDER_OR_RETURN(sampleRate);
-    *sampleRate = streamBuilder->getSampleRate();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStreamBuilder_setSamplesPerFrame(OboeStreamBuilder builder,
-                                                   int32_t samplesPerFrame)
-{
-    AudioStreamBuilder *streamBuilder = CONVERT_BUILDER_HANDLE_OR_RETURN();
-    streamBuilder->setSamplesPerFrame(samplesPerFrame);
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStreamBuilder_getSamplesPerFrame(OboeStreamBuilder builder,
-                                                   int32_t *samplesPerFrame)
-{
-    AudioStreamBuilder *streamBuilder = COMMON_GET_FROM_BUILDER_OR_RETURN(samplesPerFrame);
-    *samplesPerFrame = streamBuilder->getSamplesPerFrame();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStreamBuilder_setDirection(OboeStreamBuilder builder,
-                                             oboe_direction_t direction)
-{
-    AudioStreamBuilder *streamBuilder = CONVERT_BUILDER_HANDLE_OR_RETURN();
-    streamBuilder->setDirection(direction);
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStreamBuilder_getDirection(OboeStreamBuilder builder,
-                                             oboe_direction_t *direction)
-{
-    AudioStreamBuilder *streamBuilder = COMMON_GET_FROM_BUILDER_OR_RETURN(direction);
-    *direction = streamBuilder->getDirection();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStreamBuilder_setFormat(OboeStreamBuilder builder,
-                                                   oboe_audio_format_t format)
-{
-    AudioStreamBuilder *streamBuilder = CONVERT_BUILDER_HANDLE_OR_RETURN();
-    streamBuilder->setFormat(format);
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStreamBuilder_getFormat(OboeStreamBuilder builder,
-                                                   oboe_audio_format_t *format)
-{
-    AudioStreamBuilder *streamBuilder = COMMON_GET_FROM_BUILDER_OR_RETURN(format);
-    *format = streamBuilder->getFormat();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStreamBuilder_setSharingMode(OboeStreamBuilder builder,
-                                                        oboe_sharing_mode_t sharingMode)
-{
-    AudioStreamBuilder *streamBuilder = CONVERT_BUILDER_HANDLE_OR_RETURN();
-    if ((sharingMode < 0) || (sharingMode >= OBOE_SHARING_MODE_COUNT)) {
-        return OBOE_ERROR_ILLEGAL_ARGUMENT;
-    } else {
-        streamBuilder->setSharingMode(sharingMode);
-        return OBOE_OK;
-    }
-}
-
-OBOE_API oboe_result_t OboeStreamBuilder_getSharingMode(OboeStreamBuilder builder,
-                                                        oboe_sharing_mode_t *sharingMode)
-{
-    AudioStreamBuilder *streamBuilder = COMMON_GET_FROM_BUILDER_OR_RETURN(sharingMode);
-    *sharingMode = streamBuilder->getSharingMode();
-    return OBOE_OK;
-}
-
-static oboe_result_t  OboeInternal_openStream(AudioStreamBuilder *streamBuilder,
-                                              OboeStream *streamPtr)
-{
-    AudioStream *audioStream = nullptr;
-    oboe_result_t result = streamBuilder->build(&audioStream);
-    if (result != OBOE_OK) {
-        return result;
-    } else {
-        // Create a handle for referencing the object.
-        // TODO protect the put() with a Mutex
-        OboeStream handle = sHandleTracker.put(OBOE_HANDLE_TYPE_STREAM, audioStream);
-        if (handle < 0) {
-            delete audioStream;
-            return static_cast<oboe_result_t>(handle);
-        }
-        *streamPtr = handle;
-        return OBOE_OK;
-    }
-}
-
-OBOE_API oboe_result_t  OboeStreamBuilder_openStream(OboeStreamBuilder builder,
-                                                     OboeStream *streamPtr)
-{
-    ALOGD("OboeStreamBuilder_openStream(): builder = 0x%08X", builder);
-    AudioStreamBuilder *streamBuilder = COMMON_GET_FROM_BUILDER_OR_RETURN(streamPtr);
-    return OboeInternal_openStream(streamBuilder, streamPtr);
-}
-
-OBOE_API oboe_result_t  OboeStreamBuilder_delete(OboeStreamBuilder builder)
-{
-    AudioStreamBuilder *streamBuilder = (AudioStreamBuilder *)
-            sHandleTracker.remove(OBOE_HANDLE_TYPE_STREAM_BUILDER, builder);
-    if (streamBuilder != nullptr) {
-        delete streamBuilder;
-        return OBOE_OK;
-    }
-    return OBOE_ERROR_INVALID_HANDLE;
-}
-
-OBOE_API oboe_result_t  OboeStream_close(OboeStream stream)
-{
-    AudioStream *audioStream = (AudioStream *)
-            sHandleTracker.remove(OBOE_HANDLE_TYPE_STREAM, (oboe_handle_t)stream);
-    ALOGD("OboeStream_close(0x%08X), audioStream = %p", stream, audioStream);
-    if (audioStream != nullptr) {
-        audioStream->close();
-        delete audioStream;
-        return OBOE_OK;
-    }
-    return OBOE_ERROR_INVALID_HANDLE;
-}
-
-OBOE_API oboe_result_t  OboeStream_requestStart(OboeStream stream)
-{
-    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
-    ALOGD("OboeStream_requestStart(0x%08X), audioStream = %p", stream, audioStream);
-    return audioStream->requestStart();
-}
-
-OBOE_API oboe_result_t  OboeStream_requestPause(OboeStream stream)
-{
-    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
-    ALOGD("OboeStream_requestPause(0x%08X), audioStream = %p", stream, audioStream);
-    return audioStream->requestPause();
-}
-
-OBOE_API oboe_result_t  OboeStream_requestFlush(OboeStream stream)
-{
-    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
-    ALOGD("OboeStream_requestFlush(0x%08X), audioStream = %p", stream, audioStream);
-    return audioStream->requestFlush();
-}
-
-OBOE_API oboe_result_t  OboeStream_requestStop(OboeStream stream)
-{
-    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
-    ALOGD("OboeStream_requestStop(0x%08X), audioStream = %p", stream, audioStream);
-    return audioStream->requestStop();
-}
-
-OBOE_API oboe_result_t OboeStream_waitForStateChange(OboeStream stream,
-                                            oboe_stream_state_t inputState,
-                                            oboe_stream_state_t *nextState,
-                                            oboe_nanoseconds_t timeoutNanoseconds)
-{
-
-    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
-    return audioStream->waitForStateChange(inputState, nextState, timeoutNanoseconds);
-}
-
-// ============================================================
-// Stream - non-blocking I/O
-// ============================================================
-
-OBOE_API oboe_result_t OboeStream_read(OboeStream stream,
-                               void *buffer,
-                               oboe_size_frames_t numFrames,
-                               oboe_nanoseconds_t timeoutNanoseconds)
-{
-    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
-    if (buffer == nullptr) {
-        return OBOE_ERROR_NULL;
-    }
-    if (numFrames < 0) {
-        return OBOE_ERROR_ILLEGAL_ARGUMENT;
-    } else if (numFrames == 0) {
-        return 0;
-    }
-
-    oboe_result_t result = audioStream->read(buffer, numFrames, timeoutNanoseconds);
-    // ALOGD("OboeStream_read(): read returns %d", result);
-
-    return result;
-}
-
-OBOE_API oboe_result_t OboeStream_write(OboeStream stream,
-                               const void *buffer,
-                               oboe_size_frames_t numFrames,
-                               oboe_nanoseconds_t timeoutNanoseconds)
-{
-    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
-    if (buffer == nullptr) {
-        return OBOE_ERROR_NULL;
-    }
-    if (numFrames < 0) {
-        return OBOE_ERROR_ILLEGAL_ARGUMENT;
-    } else if (numFrames == 0) {
-        return 0;
-    }
-
-    oboe_result_t result = audioStream->write(buffer, numFrames, timeoutNanoseconds);
-    // ALOGD("OboeStream_write(): write returns %d", result);
-
-    return result;
-}
-
-// ============================================================
-// Miscellaneous
-// ============================================================
-
-OBOE_API oboe_result_t OboeStream_createThread(OboeStream stream,
-                                     oboe_nanoseconds_t periodNanoseconds,
-                                     oboe_audio_thread_proc_t *threadProc, void *arg)
-{
-    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
-    return audioStream->createThread(periodNanoseconds, threadProc, arg);
-}
-
-OBOE_API oboe_result_t OboeStream_joinThread(OboeStream stream,
-                                   void **returnArg,
-                                   oboe_nanoseconds_t timeoutNanoseconds)
-{
-    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
-    return audioStream->joinThread(returnArg, timeoutNanoseconds);
-}
-
-// ============================================================
-// Stream - queries
-// ============================================================
-
-// TODO Use oboe_clockid_t all the way down through the C++ streams.
-static clockid_t OboeConvert_fromOboeClockId(oboe_clockid_t clockid)
-{
-    clockid_t hostClockId;
-    switch (clockid) {
-        case OBOE_CLOCK_MONOTONIC:
-            hostClockId = CLOCK_MONOTONIC;
-            break;
-        case OBOE_CLOCK_BOOTTIME:
-            hostClockId = CLOCK_BOOTTIME;
-            break;
-        default:
-            hostClockId = 0; // TODO review
-    }
-    return hostClockId;
-}
-
-oboe_nanoseconds_t Oboe_getNanoseconds(oboe_clockid_t clockid)
-{
-    clockid_t hostClockId = OboeConvert_fromOboeClockId(clockid);
-   return AudioClock::getNanoseconds(hostClockId);
-}
-
-OBOE_API oboe_result_t OboeStream_getSampleRate(OboeStream stream, oboe_sample_rate_t *sampleRate)
-{
-    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(sampleRate);
-    *sampleRate = audioStream->getSampleRate();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStream_getSamplesPerFrame(OboeStream stream, int32_t *samplesPerFrame)
-{
-    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(samplesPerFrame);
-    *samplesPerFrame = audioStream->getSamplesPerFrame();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStream_getState(OboeStream stream, oboe_stream_state_t *state)
-{
-    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(state);
-    *state = audioStream->getState();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStream_getFormat(OboeStream stream, oboe_audio_format_t *format)
-{
-    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(format);
-    *format = audioStream->getFormat();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStream_setBufferSize(OboeStream stream,
-                                                oboe_size_frames_t requestedFrames,
-                                                oboe_size_frames_t *actualFrames)
-{
-    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
-    return audioStream->setBufferSize(requestedFrames, actualFrames);
-}
-
-OBOE_API oboe_result_t OboeStream_getBufferSize(OboeStream stream, oboe_size_frames_t *frames)
-{
-    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(frames);
-    *frames = audioStream->getBufferSize();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStream_getDirection(OboeStream stream, int32_t *direction)
-{
-    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(direction);
-    *direction = audioStream->getDirection();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStream_getFramesPerBurst(OboeStream stream,
-                                                    oboe_size_frames_t *framesPerBurst)
-{
-    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(framesPerBurst);
-    *framesPerBurst = audioStream->getFramesPerBurst();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStream_getBufferCapacity(OboeStream stream,
-                                           oboe_size_frames_t *capacity)
-{
-    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(capacity);
-    *capacity = audioStream->getBufferCapacity();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStream_getXRunCount(OboeStream stream, int32_t *xRunCount)
-{
-    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(xRunCount);
-    *xRunCount = audioStream->getXRunCount();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStream_getDeviceId(OboeStream stream,
-                                                 oboe_device_id_t *deviceId)
-{
-    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(deviceId);
-    *deviceId = audioStream->getDeviceId();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStream_getSharingMode(OboeStream stream,
-                                                 oboe_sharing_mode_t *sharingMode)
-{
-    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(sharingMode);
-    *sharingMode = audioStream->getSharingMode();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStream_getFramesWritten(OboeStream stream,
-                                                   oboe_position_frames_t *frames)
-{
-    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(frames);
-    *frames = audioStream->getFramesWritten();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStream_getFramesRead(OboeStream stream, oboe_position_frames_t *frames)
-{
-    AudioStream *audioStream = COMMON_GET_FROM_STREAM_OR_RETURN(frames);
-    *frames = audioStream->getFramesRead();
-    return OBOE_OK;
-}
-
-OBOE_API oboe_result_t OboeStream_getTimestamp(OboeStream stream,
-                                      oboe_clockid_t clockid,
-                                      oboe_position_frames_t *framePosition,
-                                      oboe_nanoseconds_t *timeNanoseconds)
-{
-    AudioStream *audioStream = CONVERT_STREAM_HANDLE_OR_RETURN();
-    if (framePosition == nullptr) {
-        return OBOE_ERROR_NULL;
-    } else if (timeNanoseconds == nullptr) {
-        return OBOE_ERROR_NULL;
-    } else if (clockid != OBOE_CLOCK_MONOTONIC && clockid != OBOE_CLOCK_BOOTTIME) {
-        return OBOE_ERROR_ILLEGAL_ARGUMENT;
-    }
-
-    clockid_t hostClockId = OboeConvert_fromOboeClockId(clockid);
-    return audioStream->getTimestamp(hostClockId, framePosition, timeNanoseconds);
-}
diff --git a/media/liboboe/src/core/README.md b/media/liboboe/src/core/README.md
index dd99286..5ce41f3 100644
--- a/media/liboboe/src/core/README.md
+++ b/media/liboboe/src/core/README.md
@@ -1,2 +1,2 @@
-The core folder contains the essential Oboe files common to all implementations.
-The OboeAudio.cpp contains the 'C' API.
+The core folder contains the essential AAudio files common to all implementations.
+The AAudioAudio.cpp contains the 'C' API.
diff --git a/media/liboboe/src/fifo/README.md b/media/liboboe/src/fifo/README.md
index 61ffbae..5d0c471 100644
--- a/media/liboboe/src/fifo/README.md
+++ b/media/liboboe/src/fifo/README.md
@@ -5,5 +5,5 @@
 
 TODO The internal low-level implementation might be merged in some form with audio_utils fifo
 and/or FMQ [after confirming that requirements are met].
-The higher-levels parts related to Oboe use of the FIFO such as API, fds, relative
+The higher-levels parts related to AAudio use of the FIFO such as API, fds, relative
 location of indices and data buffer, mapping, allocation of memmory will probably be kept as-is.
diff --git a/media/liboboe/src/legacy/OboeLegacy.h b/media/liboboe/src/legacy/AAudioLegacy.h
similarity index 83%
rename from media/liboboe/src/legacy/OboeLegacy.h
rename to media/liboboe/src/legacy/AAudioLegacy.h
index 6803837..2ceb7d4 100644
--- a/media/liboboe/src/legacy/OboeLegacy.h
+++ b/media/liboboe/src/legacy/AAudioLegacy.h
@@ -14,17 +14,17 @@
  * limitations under the License.
  */
 
-#ifndef OBOE_LEGACY_H
-#define OBOE_LEGACY_H
+#ifndef AAUDIO_LEGACY_H
+#define AAUDIO_LEGACY_H
 
 #include <stdint.h>
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudio.h>
 
 /**
  * Common code for legacy classes.
  */
 
 /* AudioTrack uses a 32-bit frame counter that can wrap around in about a day. */
-typedef uint32_t oboe_wrapping_frames_t;
+typedef uint32_t aaudio_wrapping_frames_t;
 
-#endif /* OBOE_LEGACY_H */
+#endif /* AAUDIO_LEGACY_H */
diff --git a/media/liboboe/src/legacy/AudioStreamRecord.cpp b/media/liboboe/src/legacy/AudioStreamRecord.cpp
index bf4bd36..2d1785f 100644
--- a/media/liboboe/src/legacy/AudioStreamRecord.cpp
+++ b/media/liboboe/src/legacy/AudioStreamRecord.cpp
@@ -21,13 +21,13 @@
 #include <stdint.h>
 #include <utils/String16.h>
 #include <media/AudioRecord.h>
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudio.h>
 
 #include "AudioClock.h"
 #include "AudioStreamRecord.h"
 
 using namespace android;
-using namespace oboe;
+using namespace aaudio;
 
 AudioStreamRecord::AudioStreamRecord()
     : AudioStream()
@@ -36,24 +36,24 @@
 
 AudioStreamRecord::~AudioStreamRecord()
 {
-    const oboe_stream_state_t state = getState();
-    bool bad = !(state == OBOE_STREAM_STATE_UNINITIALIZED || state == OBOE_STREAM_STATE_CLOSED);
+    const aaudio_stream_state_t state = getState();
+    bool bad = !(state == AAUDIO_STREAM_STATE_UNINITIALIZED || state == AAUDIO_STREAM_STATE_CLOSED);
     ALOGE_IF(bad, "stream not closed, in state %d", state);
 }
 
-oboe_result_t AudioStreamRecord::open(const AudioStreamBuilder& builder)
+aaudio_result_t AudioStreamRecord::open(const AudioStreamBuilder& builder)
 {
-    oboe_result_t result = OBOE_OK;
+    aaudio_result_t result = AAUDIO_OK;
 
     result = AudioStream::open(builder);
-    if (result != OBOE_OK) {
+    if (result != AAUDIO_OK) {
         return result;
     }
 
     // Try to create an AudioRecord
 
     // TODO Support UNSPECIFIED in AudioTrack. For now, use stereo if unspecified.
-    int32_t samplesPerFrame = (getSamplesPerFrame() == OBOE_UNSPECIFIED)
+    int32_t samplesPerFrame = (getSamplesPerFrame() == AAUDIO_UNSPECIFIED)
                               ? 2 : getSamplesPerFrame();
     audio_channel_mask_t channelMask = audio_channel_in_mask_from_count(samplesPerFrame);
 
@@ -61,9 +61,9 @@
     audio_input_flags_t flags = (audio_input_flags_t) AUDIO_INPUT_FLAG_NONE;
 
     // TODO implement an unspecified Android format then use that.
-    audio_format_t format = (getFormat() == OBOE_UNSPECIFIED)
+    audio_format_t format = (getFormat() == AAUDIO_UNSPECIFIED)
             ? AUDIO_FORMAT_PCM_FLOAT
-            : OboeConvert_oboeToAndroidDataFormat(getFormat());
+            : AAudioConvert_aaudioToAndroidDataFormat(getFormat());
 
     mAudioRecord = new AudioRecord(
             AUDIO_SOURCE_DEFAULT,
@@ -90,84 +90,84 @@
     if (status != OK) {
         close();
         ALOGE("AudioStreamRecord::open(), initCheck() returned %d", status);
-        return OboeConvert_androidToOboeResult(status);
+        return AAudioConvert_androidToAAudioResult(status);
     }
 
     // Get the actual rate.
     setSampleRate(mAudioRecord->getSampleRate());
     setSamplesPerFrame(mAudioRecord->channelCount());
-    setFormat(OboeConvert_androidToOboeDataFormat(mAudioRecord->format()));
+    setFormat(AAudioConvert_androidToAAudioDataFormat(mAudioRecord->format()));
 
-    setState(OBOE_STREAM_STATE_OPEN);
+    setState(AAUDIO_STREAM_STATE_OPEN);
 
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
-oboe_result_t AudioStreamRecord::close()
+aaudio_result_t AudioStreamRecord::close()
 {
     // TODO add close() or release() to AudioRecord API then call it from here
-    if (getState() != OBOE_STREAM_STATE_CLOSED) {
+    if (getState() != AAUDIO_STREAM_STATE_CLOSED) {
         mAudioRecord.clear();
-        setState(OBOE_STREAM_STATE_CLOSED);
+        setState(AAUDIO_STREAM_STATE_CLOSED);
     }
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
-oboe_result_t AudioStreamRecord::requestStart()
+aaudio_result_t AudioStreamRecord::requestStart()
 {
     if (mAudioRecord.get() == nullptr) {
-        return OBOE_ERROR_INVALID_STATE;
+        return AAUDIO_ERROR_INVALID_STATE;
     }
     // Get current position so we can detect when the track is playing.
     status_t err = mAudioRecord->getPosition(&mPositionWhenStarting);
     if (err != OK) {
-        return OboeConvert_androidToOboeResult(err);
+        return AAudioConvert_androidToAAudioResult(err);
     }
     err = mAudioRecord->start();
     if (err != OK) {
-        return OboeConvert_androidToOboeResult(err);
+        return AAudioConvert_androidToAAudioResult(err);
     } else {
-        setState(OBOE_STREAM_STATE_STARTING);
+        setState(AAUDIO_STREAM_STATE_STARTING);
     }
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
-oboe_result_t AudioStreamRecord::requestPause()
+aaudio_result_t AudioStreamRecord::requestPause()
 {
-    return OBOE_ERROR_UNIMPLEMENTED;
+    return AAUDIO_ERROR_UNIMPLEMENTED;
 }
 
-oboe_result_t AudioStreamRecord::requestFlush() {
-    return OBOE_ERROR_UNIMPLEMENTED;
+aaudio_result_t AudioStreamRecord::requestFlush() {
+    return AAUDIO_ERROR_UNIMPLEMENTED;
 }
 
-oboe_result_t AudioStreamRecord::requestStop() {
+aaudio_result_t AudioStreamRecord::requestStop() {
     if (mAudioRecord.get() == nullptr) {
-        return OBOE_ERROR_INVALID_STATE;
+        return AAUDIO_ERROR_INVALID_STATE;
     }
-    setState(OBOE_STREAM_STATE_STOPPING);
+    setState(AAUDIO_STREAM_STATE_STOPPING);
     mAudioRecord->stop();
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
-oboe_result_t AudioStreamRecord::updateState()
+aaudio_result_t AudioStreamRecord::updateState()
 {
-    oboe_result_t result = OBOE_OK;
-    oboe_wrapping_frames_t position;
+    aaudio_result_t result = AAUDIO_OK;
+    aaudio_wrapping_frames_t position;
     status_t err;
     switch (getState()) {
     // TODO add better state visibility to AudioRecord
-    case OBOE_STREAM_STATE_STARTING:
+    case AAUDIO_STREAM_STATE_STARTING:
         err = mAudioRecord->getPosition(&position);
         if (err != OK) {
-            result = OboeConvert_androidToOboeResult(err);
+            result = AAudioConvert_androidToAAudioResult(err);
         } else if (position != mPositionWhenStarting) {
-            setState(OBOE_STREAM_STATE_STARTED);
+            setState(AAUDIO_STREAM_STATE_STARTED);
         }
         break;
-    case OBOE_STREAM_STATE_STOPPING:
+    case AAUDIO_STREAM_STATE_STOPPING:
         if (mAudioRecord->stopped()) {
-            setState(OBOE_STREAM_STATE_STOPPED);
+            setState(AAUDIO_STREAM_STATE_STOPPED);
         }
         break;
     default:
@@ -176,14 +176,14 @@
     return result;
 }
 
-oboe_result_t AudioStreamRecord::read(void *buffer,
-                                      oboe_size_frames_t numFrames,
-                                      oboe_nanoseconds_t timeoutNanoseconds)
+aaudio_result_t AudioStreamRecord::read(void *buffer,
+                                      aaudio_size_frames_t numFrames,
+                                      aaudio_nanoseconds_t timeoutNanoseconds)
 {
-    oboe_size_frames_t bytesPerFrame = getBytesPerFrame();
-    oboe_size_bytes_t numBytes;
-    oboe_result_t result = OboeConvert_framesToBytes(numFrames, bytesPerFrame, &numBytes);
-    if (result != OBOE_OK) {
+    aaudio_size_frames_t bytesPerFrame = getBytesPerFrame();
+    aaudio_size_bytes_t numBytes;
+    aaudio_result_t result = AAudioConvert_framesToBytes(numFrames, bytesPerFrame, &numBytes);
+    if (result != AAUDIO_OK) {
         return result;
     }
 
@@ -193,35 +193,35 @@
     if (bytesRead == WOULD_BLOCK) {
         return 0;
     } else if (bytesRead < 0) {
-        return OboeConvert_androidToOboeResult(bytesRead);
+        return AAudioConvert_androidToAAudioResult(bytesRead);
     }
-    oboe_size_frames_t framesRead = (oboe_size_frames_t)(bytesRead / bytesPerFrame);
-    return (oboe_result_t) framesRead;
+    aaudio_size_frames_t framesRead = (aaudio_size_frames_t)(bytesRead / bytesPerFrame);
+    return (aaudio_result_t) framesRead;
 }
 
-oboe_result_t AudioStreamRecord::setBufferSize(oboe_size_frames_t requestedFrames,
-                                             oboe_size_frames_t *actualFrames)
+aaudio_result_t AudioStreamRecord::setBufferSize(aaudio_size_frames_t requestedFrames,
+                                             aaudio_size_frames_t *actualFrames)
 {
     *actualFrames = getBufferCapacity();
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
-oboe_size_frames_t AudioStreamRecord::getBufferSize() const
+aaudio_size_frames_t AudioStreamRecord::getBufferSize() const
 {
     return getBufferCapacity(); // TODO implement in AudioRecord?
 }
 
-oboe_size_frames_t AudioStreamRecord::getBufferCapacity() const
+aaudio_size_frames_t AudioStreamRecord::getBufferCapacity() const
 {
-    return static_cast<oboe_size_frames_t>(mAudioRecord->frameCount());
+    return static_cast<aaudio_size_frames_t>(mAudioRecord->frameCount());
 }
 
 int32_t AudioStreamRecord::getXRunCount() const
 {
-    return OBOE_ERROR_UNIMPLEMENTED; // TODO implement when AudioRecord supports it
+    return AAUDIO_ERROR_UNIMPLEMENTED; // TODO implement when AudioRecord supports it
 }
 
-oboe_size_frames_t AudioStreamRecord::getFramesPerBurst() const
+aaudio_size_frames_t AudioStreamRecord::getFramesPerBurst() const
 {
     return 192; // TODO add query to AudioRecord.cpp
 }
diff --git a/media/liboboe/src/legacy/AudioStreamRecord.h b/media/liboboe/src/legacy/AudioStreamRecord.h
index a884ed2..a2ac9f3 100644
--- a/media/liboboe/src/legacy/AudioStreamRecord.h
+++ b/media/liboboe/src/legacy/AudioStreamRecord.h
@@ -18,13 +18,13 @@
 #define LEGACY_AUDIO_STREAM_RECORD_H
 
 #include <media/AudioRecord.h>
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudio.h>
 
 #include "AudioStreamBuilder.h"
 #include "AudioStream.h"
-#include "OboeLegacy.h"
+#include "AAudioLegacy.h"
 
-namespace oboe {
+namespace aaudio {
 
 /**
  * Internal stream that uses the legacy AudioTrack path.
@@ -35,44 +35,44 @@
 
     virtual ~AudioStreamRecord();
 
-    virtual oboe_result_t open(const AudioStreamBuilder & builder) override;
-    virtual oboe_result_t close() override;
+    virtual aaudio_result_t open(const AudioStreamBuilder & builder) override;
+    virtual aaudio_result_t close() override;
 
-    virtual oboe_result_t requestStart() override;
-    virtual oboe_result_t requestPause() override;
-    virtual oboe_result_t requestFlush() override;
-    virtual oboe_result_t requestStop() override;
+    virtual aaudio_result_t requestStart() override;
+    virtual aaudio_result_t requestPause() override;
+    virtual aaudio_result_t requestFlush() override;
+    virtual aaudio_result_t requestStop() override;
 
-    virtual oboe_result_t getTimestamp(clockid_t clockId,
-                                       oboe_position_frames_t *framePosition,
-                                       oboe_nanoseconds_t *timeNanoseconds) override {
-        return OBOE_ERROR_UNIMPLEMENTED; // TODO
+    virtual aaudio_result_t getTimestamp(clockid_t clockId,
+                                       aaudio_position_frames_t *framePosition,
+                                       aaudio_nanoseconds_t *timeNanoseconds) override {
+        return AAUDIO_ERROR_UNIMPLEMENTED; // TODO
     }
 
-    virtual oboe_result_t read(void *buffer,
-                             oboe_size_frames_t numFrames,
-                             oboe_nanoseconds_t timeoutNanoseconds) override;
+    virtual aaudio_result_t read(void *buffer,
+                             aaudio_size_frames_t numFrames,
+                             aaudio_nanoseconds_t timeoutNanoseconds) override;
 
-    virtual oboe_result_t setBufferSize(oboe_size_frames_t requestedFrames,
-                                             oboe_size_frames_t *actualFrames) override;
+    virtual aaudio_result_t setBufferSize(aaudio_size_frames_t requestedFrames,
+                                             aaudio_size_frames_t *actualFrames) override;
 
-    virtual oboe_size_frames_t getBufferSize() const override;
+    virtual aaudio_size_frames_t getBufferSize() const override;
 
-    virtual oboe_size_frames_t getBufferCapacity() const override;
+    virtual aaudio_size_frames_t getBufferCapacity() const override;
 
     virtual int32_t getXRunCount() const override;
 
-    virtual oboe_size_frames_t getFramesPerBurst() const override;
+    virtual aaudio_size_frames_t getFramesPerBurst() const override;
 
-    virtual oboe_result_t updateState() override;
+    virtual aaudio_result_t updateState() override;
 
 private:
     android::sp<android::AudioRecord> mAudioRecord;
     // TODO add 64-bit position reporting to AudioRecord and use it.
-    oboe_wrapping_frames_t   mPositionWhenStarting = 0;
+    aaudio_wrapping_frames_t   mPositionWhenStarting = 0;
     android::String16        mOpPackageName;
 };
 
-} /* namespace oboe */
+} /* namespace aaudio */
 
 #endif /* LEGACY_AUDIO_STREAM_RECORD_H */
diff --git a/media/liboboe/src/legacy/AudioStreamTrack.cpp b/media/liboboe/src/legacy/AudioStreamTrack.cpp
index 291e56c..a60b5b4 100644
--- a/media/liboboe/src/legacy/AudioStreamTrack.cpp
+++ b/media/liboboe/src/legacy/AudioStreamTrack.cpp
@@ -21,13 +21,13 @@
 #include <stdint.h>
 #include <media/AudioTrack.h>
 
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudio.h>
 #include "AudioClock.h"
 #include "AudioStreamTrack.h"
 
 
 using namespace android;
-using namespace oboe;
+using namespace aaudio;
 
 /*
  * Create a stream that uses the AudioTrack.
@@ -39,14 +39,14 @@
 
 AudioStreamTrack::~AudioStreamTrack()
 {
-    const oboe_stream_state_t state = getState();
-    bool bad = !(state == OBOE_STREAM_STATE_UNINITIALIZED || state == OBOE_STREAM_STATE_CLOSED);
+    const aaudio_stream_state_t state = getState();
+    bool bad = !(state == AAUDIO_STREAM_STATE_UNINITIALIZED || state == AAUDIO_STREAM_STATE_CLOSED);
     ALOGE_IF(bad, "stream not closed, in state %d", state);
 }
 
-oboe_result_t AudioStreamTrack::open(const AudioStreamBuilder& builder)
+aaudio_result_t AudioStreamTrack::open(const AudioStreamBuilder& builder)
 {
-    oboe_result_t result = OBOE_OK;
+    aaudio_result_t result = AAUDIO_OK;
 
     result = AudioStream::open(builder);
     if (result != OK) {
@@ -55,7 +55,7 @@
 
     // Try to create an AudioTrack
     // TODO Support UNSPECIFIED in AudioTrack. For now, use stereo if unspecified.
-    int32_t samplesPerFrame = (getSamplesPerFrame() == OBOE_UNSPECIFIED)
+    int32_t samplesPerFrame = (getSamplesPerFrame() == AAUDIO_UNSPECIFIED)
                               ? 2 : getSamplesPerFrame();
     audio_channel_mask_t channelMask = audio_channel_out_mask_from_count(samplesPerFrame);
     ALOGD("AudioStreamTrack::open(), samplesPerFrame = %d, channelMask = 0x%08x",
@@ -66,9 +66,9 @@
     audio_output_flags_t flags = (audio_output_flags_t) AUDIO_OUTPUT_FLAG_FAST;
     size_t frameCount = 0;
     // TODO implement an unspecified AudioTrack format then use that.
-    audio_format_t format = (getFormat() == OBOE_UNSPECIFIED)
+    audio_format_t format = (getFormat() == AAUDIO_UNSPECIFIED)
             ? AUDIO_FORMAT_PCM_FLOAT
-            : OboeConvert_oboeToAndroidDataFormat(getFormat());
+            : AAudioConvert_aaudioToAndroidDataFormat(getFormat());
 
     mAudioTrack = new AudioTrack(
             (audio_stream_type_t) AUDIO_STREAM_MUSIC,
@@ -90,143 +90,143 @@
     if (status != NO_ERROR) {
         close();
         ALOGE("AudioStreamTrack::open(), initCheck() returned %d", status);
-        return OboeConvert_androidToOboeResult(status);
+        return AAudioConvert_androidToAAudioResult(status);
     }
 
     // Get the actual values from the AudioTrack.
     setSamplesPerFrame(mAudioTrack->channelCount());
     setSampleRate(mAudioTrack->getSampleRate());
-    setFormat(OboeConvert_androidToOboeDataFormat(mAudioTrack->format()));
+    setFormat(AAudioConvert_androidToAAudioDataFormat(mAudioTrack->format()));
 
-    setState(OBOE_STREAM_STATE_OPEN);
+    setState(AAUDIO_STREAM_STATE_OPEN);
 
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
-oboe_result_t AudioStreamTrack::close()
+aaudio_result_t AudioStreamTrack::close()
 {
     // TODO maybe add close() or release() to AudioTrack API then call it from here
-    if (getState() != OBOE_STREAM_STATE_CLOSED) {
+    if (getState() != AAUDIO_STREAM_STATE_CLOSED) {
         mAudioTrack.clear(); // TODO is this right?
-        setState(OBOE_STREAM_STATE_CLOSED);
+        setState(AAUDIO_STREAM_STATE_CLOSED);
     }
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
-oboe_result_t AudioStreamTrack::requestStart()
+aaudio_result_t AudioStreamTrack::requestStart()
 {
     if (mAudioTrack.get() == nullptr) {
-        return OBOE_ERROR_INVALID_STATE;
+        return AAUDIO_ERROR_INVALID_STATE;
     }
     // Get current position so we can detect when the track is playing.
     status_t err = mAudioTrack->getPosition(&mPositionWhenStarting);
     if (err != OK) {
-        return OboeConvert_androidToOboeResult(err);
+        return AAudioConvert_androidToAAudioResult(err);
     }
     err = mAudioTrack->start();
     if (err != OK) {
-        return OboeConvert_androidToOboeResult(err);
+        return AAudioConvert_androidToAAudioResult(err);
     } else {
-        setState(OBOE_STREAM_STATE_STARTING);
+        setState(AAUDIO_STREAM_STATE_STARTING);
     }
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
-oboe_result_t AudioStreamTrack::requestPause()
+aaudio_result_t AudioStreamTrack::requestPause()
 {
     if (mAudioTrack.get() == nullptr) {
-        return OBOE_ERROR_INVALID_STATE;
-    } else if (getState() != OBOE_STREAM_STATE_STARTING
-            && getState() != OBOE_STREAM_STATE_STARTED) {
-        ALOGE("requestPause(), called when state is %s", Oboe_convertStreamStateToText(getState()));
-        return OBOE_ERROR_INVALID_STATE;
+        return AAUDIO_ERROR_INVALID_STATE;
+    } else if (getState() != AAUDIO_STREAM_STATE_STARTING
+            && getState() != AAUDIO_STREAM_STATE_STARTED) {
+        ALOGE("requestPause(), called when state is %s", AAudio_convertStreamStateToText(getState()));
+        return AAUDIO_ERROR_INVALID_STATE;
     }
-    setState(OBOE_STREAM_STATE_PAUSING);
+    setState(AAUDIO_STREAM_STATE_PAUSING);
     mAudioTrack->pause();
     status_t err = mAudioTrack->getPosition(&mPositionWhenPausing);
     if (err != OK) {
-        return OboeConvert_androidToOboeResult(err);
+        return AAudioConvert_androidToAAudioResult(err);
     }
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
-oboe_result_t AudioStreamTrack::requestFlush() {
+aaudio_result_t AudioStreamTrack::requestFlush() {
     if (mAudioTrack.get() == nullptr) {
-        return OBOE_ERROR_INVALID_STATE;
-    } else if (getState() != OBOE_STREAM_STATE_PAUSED) {
-        return OBOE_ERROR_INVALID_STATE;
+        return AAUDIO_ERROR_INVALID_STATE;
+    } else if (getState() != AAUDIO_STREAM_STATE_PAUSED) {
+        return AAUDIO_ERROR_INVALID_STATE;
     }
-    setState(OBOE_STREAM_STATE_FLUSHING);
+    setState(AAUDIO_STREAM_STATE_FLUSHING);
     incrementFramesRead(getFramesWritten() - getFramesRead());
     mAudioTrack->flush();
     mFramesWritten.reset32();
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
-oboe_result_t AudioStreamTrack::requestStop() {
+aaudio_result_t AudioStreamTrack::requestStop() {
     if (mAudioTrack.get() == nullptr) {
-        return OBOE_ERROR_INVALID_STATE;
+        return AAUDIO_ERROR_INVALID_STATE;
     }
-    setState(OBOE_STREAM_STATE_STOPPING);
+    setState(AAUDIO_STREAM_STATE_STOPPING);
     incrementFramesRead(getFramesWritten() - getFramesRead()); // TODO review
     mAudioTrack->stop();
     mFramesWritten.reset32();
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
-oboe_result_t AudioStreamTrack::updateState()
+aaudio_result_t AudioStreamTrack::updateState()
 {
     status_t err;
-    oboe_wrapping_frames_t position;
+    aaudio_wrapping_frames_t position;
     switch (getState()) {
     // TODO add better state visibility to AudioTrack
-    case OBOE_STREAM_STATE_STARTING:
+    case AAUDIO_STREAM_STATE_STARTING:
         if (mAudioTrack->hasStarted()) {
-            setState(OBOE_STREAM_STATE_STARTED);
+            setState(AAUDIO_STREAM_STATE_STARTED);
         }
         break;
-    case OBOE_STREAM_STATE_PAUSING:
+    case AAUDIO_STREAM_STATE_PAUSING:
         if (mAudioTrack->stopped()) {
             err = mAudioTrack->getPosition(&position);
             if (err != OK) {
-                return OboeConvert_androidToOboeResult(err);
+                return AAudioConvert_androidToAAudioResult(err);
             } else if (position == mPositionWhenPausing) {
                 // Has stream really stopped advancing?
-                setState(OBOE_STREAM_STATE_PAUSED);
+                setState(AAUDIO_STREAM_STATE_PAUSED);
             }
             mPositionWhenPausing = position;
         }
         break;
-    case OBOE_STREAM_STATE_FLUSHING:
+    case AAUDIO_STREAM_STATE_FLUSHING:
         {
             err = mAudioTrack->getPosition(&position);
             if (err != OK) {
-                return OboeConvert_androidToOboeResult(err);
+                return AAudioConvert_androidToAAudioResult(err);
             } else if (position == 0) {
                 // Advance frames read to match written.
-                setState(OBOE_STREAM_STATE_FLUSHED);
+                setState(AAUDIO_STREAM_STATE_FLUSHED);
             }
         }
         break;
-    case OBOE_STREAM_STATE_STOPPING:
+    case AAUDIO_STREAM_STATE_STOPPING:
         if (mAudioTrack->stopped()) {
-            setState(OBOE_STREAM_STATE_STOPPED);
+            setState(AAUDIO_STREAM_STATE_STOPPED);
         }
         break;
     default:
         break;
     }
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
-oboe_result_t AudioStreamTrack::write(const void *buffer,
-                                      oboe_size_frames_t numFrames,
-                                      oboe_nanoseconds_t timeoutNanoseconds)
+aaudio_result_t AudioStreamTrack::write(const void *buffer,
+                                      aaudio_size_frames_t numFrames,
+                                      aaudio_nanoseconds_t timeoutNanoseconds)
 {
-    oboe_size_frames_t bytesPerFrame = getBytesPerFrame();
-    oboe_size_bytes_t numBytes;
-    oboe_result_t result = OboeConvert_framesToBytes(numFrames, bytesPerFrame, &numBytes);
-    if (result != OBOE_OK) {
+    aaudio_size_frames_t bytesPerFrame = getBytesPerFrame();
+    aaudio_size_bytes_t numBytes;
+    aaudio_result_t result = AAudioConvert_framesToBytes(numFrames, bytesPerFrame, &numBytes);
+    if (result != AAUDIO_OK) {
         return result;
     }
 
@@ -237,33 +237,33 @@
         return 0;
     } else if (bytesWritten < 0) {
         ALOGE("invalid write, returned %d", (int)bytesWritten);
-        return OboeConvert_androidToOboeResult(bytesWritten);
+        return AAudioConvert_androidToAAudioResult(bytesWritten);
     }
-    oboe_size_frames_t framesWritten = (oboe_size_frames_t)(bytesWritten / bytesPerFrame);
+    aaudio_size_frames_t framesWritten = (aaudio_size_frames_t)(bytesWritten / bytesPerFrame);
     incrementFramesWritten(framesWritten);
     return framesWritten;
 }
 
-oboe_result_t AudioStreamTrack::setBufferSize(oboe_size_frames_t requestedFrames,
-                                             oboe_size_frames_t *actualFrames)
+aaudio_result_t AudioStreamTrack::setBufferSize(aaudio_size_frames_t requestedFrames,
+                                             aaudio_size_frames_t *actualFrames)
 {
     ssize_t result = mAudioTrack->setBufferSizeInFrames(requestedFrames);
     if (result != OK) {
-        return OboeConvert_androidToOboeResult(result);
+        return AAudioConvert_androidToAAudioResult(result);
     } else {
         *actualFrames = result;
-        return OBOE_OK;
+        return AAUDIO_OK;
     }
 }
 
-oboe_size_frames_t AudioStreamTrack::getBufferSize() const
+aaudio_size_frames_t AudioStreamTrack::getBufferSize() const
 {
-    return static_cast<oboe_size_frames_t>(mAudioTrack->getBufferSizeInFrames());
+    return static_cast<aaudio_size_frames_t>(mAudioTrack->getBufferSizeInFrames());
 }
 
-oboe_size_frames_t AudioStreamTrack::getBufferCapacity() const
+aaudio_size_frames_t AudioStreamTrack::getBufferCapacity() const
 {
-    return static_cast<oboe_size_frames_t>(mAudioTrack->frameCount());
+    return static_cast<aaudio_size_frames_t>(mAudioTrack->frameCount());
 }
 
 int32_t AudioStreamTrack::getXRunCount() const
@@ -276,13 +276,13 @@
     return 192; // TODO add query to AudioTrack.cpp
 }
 
-oboe_position_frames_t AudioStreamTrack::getFramesRead() {
-    oboe_wrapping_frames_t position;
+aaudio_position_frames_t AudioStreamTrack::getFramesRead() {
+    aaudio_wrapping_frames_t position;
     status_t result;
     switch (getState()) {
-    case OBOE_STREAM_STATE_STARTING:
-    case OBOE_STREAM_STATE_STARTED:
-    case OBOE_STREAM_STATE_STOPPING:
+    case AAUDIO_STREAM_STATE_STARTING:
+    case AAUDIO_STREAM_STATE_STARTED:
+    case AAUDIO_STREAM_STATE_STOPPING:
         result = mAudioTrack->getPosition(&position);
         if (result == OK) {
             mFramesRead.update32(position);
diff --git a/media/liboboe/src/legacy/AudioStreamTrack.h b/media/liboboe/src/legacy/AudioStreamTrack.h
index 0c41331..73d0cac 100644
--- a/media/liboboe/src/legacy/AudioStreamTrack.h
+++ b/media/liboboe/src/legacy/AudioStreamTrack.h
@@ -18,13 +18,13 @@
 #define LEGACY_AUDIO_STREAM_TRACK_H
 
 #include <media/AudioTrack.h>
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudio.h>
 
 #include "AudioStreamBuilder.h"
 #include "AudioStream.h"
-#include "OboeLegacy.h"
+#include "AAudioLegacy.h"
 
-namespace oboe {
+namespace aaudio {
 
 
 /**
@@ -37,42 +37,42 @@
     virtual ~AudioStreamTrack();
 
 
-    virtual oboe_result_t open(const AudioStreamBuilder & builder) override;
-    virtual oboe_result_t close() override;
+    virtual aaudio_result_t open(const AudioStreamBuilder & builder) override;
+    virtual aaudio_result_t close() override;
 
-    virtual oboe_result_t requestStart() override;
-    virtual oboe_result_t requestPause() override;
-    virtual oboe_result_t requestFlush() override;
-    virtual oboe_result_t requestStop() override;
+    virtual aaudio_result_t requestStart() override;
+    virtual aaudio_result_t requestPause() override;
+    virtual aaudio_result_t requestFlush() override;
+    virtual aaudio_result_t requestStop() override;
 
-    virtual oboe_result_t getTimestamp(clockid_t clockId,
-                                       oboe_position_frames_t *framePosition,
-                                       oboe_nanoseconds_t *timeNanoseconds) override {
-        return OBOE_ERROR_UNIMPLEMENTED; // TODO call getTimestamp(ExtendedTimestamp *timestamp);
+    virtual aaudio_result_t getTimestamp(clockid_t clockId,
+                                       aaudio_position_frames_t *framePosition,
+                                       aaudio_nanoseconds_t *timeNanoseconds) override {
+        return AAUDIO_ERROR_UNIMPLEMENTED; // TODO call getTimestamp(ExtendedTimestamp *timestamp);
     }
 
-    virtual oboe_result_t write(const void *buffer,
-                             oboe_size_frames_t numFrames,
-                             oboe_nanoseconds_t timeoutNanoseconds) override;
+    virtual aaudio_result_t write(const void *buffer,
+                             aaudio_size_frames_t numFrames,
+                             aaudio_nanoseconds_t timeoutNanoseconds) override;
 
-    virtual oboe_result_t setBufferSize(oboe_size_frames_t requestedFrames,
-                                             oboe_size_frames_t *actualFrames) override;
-    virtual oboe_size_frames_t getBufferSize() const override;
-    virtual oboe_size_frames_t getBufferCapacity() const override;
-    virtual oboe_size_frames_t getFramesPerBurst()const  override;
+    virtual aaudio_result_t setBufferSize(aaudio_size_frames_t requestedFrames,
+                                             aaudio_size_frames_t *actualFrames) override;
+    virtual aaudio_size_frames_t getBufferSize() const override;
+    virtual aaudio_size_frames_t getBufferCapacity() const override;
+    virtual aaudio_size_frames_t getFramesPerBurst()const  override;
     virtual int32_t getXRunCount() const override;
 
-    virtual oboe_position_frames_t getFramesRead() override;
+    virtual aaudio_position_frames_t getFramesRead() override;
 
-    virtual oboe_result_t updateState() override;
+    virtual aaudio_result_t updateState() override;
 
 private:
     android::sp<android::AudioTrack> mAudioTrack;
     // TODO add 64-bit position reporting to AudioRecord and use it.
-    oboe_wrapping_frames_t           mPositionWhenStarting = 0;
-    oboe_wrapping_frames_t           mPositionWhenPausing = 0;
+    aaudio_wrapping_frames_t           mPositionWhenStarting = 0;
+    aaudio_wrapping_frames_t           mPositionWhenPausing = 0;
 };
 
-} /* namespace oboe */
+} /* namespace aaudio */
 
 #endif /* LEGACY_AUDIO_STREAM_TRACK_H */
diff --git a/media/liboboe/src/legacy/README.md b/media/liboboe/src/legacy/README.md
index b51c44b..8805915 100644
--- a/media/liboboe/src/legacy/README.md
+++ b/media/liboboe/src/legacy/README.md
@@ -1,2 +1,2 @@
-The legacy folder contains the classes that implement Oboe AudioStream on top of
+The legacy folder contains the classes that implement AAudio AudioStream on top of
 Android AudioTrack and AudioRecord.
diff --git a/media/liboboe/src/utility/AAudioUtilities.cpp b/media/liboboe/src/utility/AAudioUtilities.cpp
new file mode 100644
index 0000000..34c1ae4
--- /dev/null
+++ b/media/liboboe/src/utility/AAudioUtilities.cpp
@@ -0,0 +1,188 @@
+/*
+ * Copyright 2016 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.
+ */
+
+#define LOG_TAG "AAudio"
+//#define LOG_NDEBUG 0
+#include <utils/Log.h>
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <utils/Errors.h>
+
+#include "aaudio/AAudioDefinitions.h"
+#include "AAudioUtilities.h"
+
+using namespace android;
+
+aaudio_size_bytes_t AAudioConvert_formatToSizeInBytes(aaudio_audio_format_t format) {
+    aaudio_size_bytes_t size = AAUDIO_ERROR_ILLEGAL_ARGUMENT;
+    switch (format) {
+        case AAUDIO_FORMAT_PCM_I16:
+            size = sizeof(int16_t);
+            break;
+        case AAUDIO_FORMAT_PCM_I32:
+        case AAUDIO_FORMAT_PCM_I8_24:
+            size = sizeof(int32_t);
+            break;
+        case AAUDIO_FORMAT_PCM_FLOAT:
+            size = sizeof(float);
+            break;
+        default:
+            break;
+    }
+    return size;
+}
+
+// TODO This similar to a function in audio_utils. Consider using that instead.
+void AAudioConvert_floatToPcm16(const float *source, int32_t numSamples, int16_t *destination) {
+    for (int i = 0; i < numSamples; i++) {
+        float fval = source[i];
+        fval += 1.0; // to avoid discontinuity at 0.0 caused by truncation
+        fval *= 32768.0f;
+        int32_t sample = (int32_t) fval;
+        // clip to 16-bit range
+        if (sample < 0) sample = 0;
+        else if (sample > 0x0FFFF) sample = 0x0FFFF;
+        sample -= 32768; // center at zero
+        destination[i] = (int16_t) sample;
+    }
+}
+
+void AAudioConvert_pcm16ToFloat(const float *source, int32_t numSamples, int16_t *destination) {
+    for (int i = 0; i < numSamples; i++) {
+        destination[i] = source[i] * (1.0f / 32768.0f);
+    }
+}
+
+status_t AAudioConvert_aaudioToAndroidStatus(aaudio_result_t result) {
+    // This covers the case for AAUDIO_OK and for positive results.
+    if (result >= 0) {
+        return result;
+    }
+    status_t status;
+    switch (result) {
+    case AAUDIO_ERROR_DISCONNECTED:
+    case AAUDIO_ERROR_INVALID_HANDLE:
+        status = DEAD_OBJECT;
+        break;
+    case AAUDIO_ERROR_INVALID_STATE:
+        status = INVALID_OPERATION;
+        break;
+    case AAUDIO_ERROR_UNEXPECTED_VALUE: // TODO redundant?
+    case AAUDIO_ERROR_ILLEGAL_ARGUMENT:
+        status = BAD_VALUE;
+        break;
+    case AAUDIO_ERROR_WOULD_BLOCK:
+        status = WOULD_BLOCK;
+        break;
+    // TODO add more result codes
+    default:
+        status = UNKNOWN_ERROR;
+        break;
+    }
+    return status;
+}
+
+aaudio_result_t AAudioConvert_androidToAAudioResult(status_t status) {
+    // This covers the case for OK and for positive result.
+    if (status >= 0) {
+        return status;
+    }
+    aaudio_result_t result;
+    switch (status) {
+    case BAD_TYPE:
+        result = AAUDIO_ERROR_INVALID_HANDLE;
+        break;
+    case DEAD_OBJECT:
+        result = AAUDIO_ERROR_DISCONNECTED;
+        break;
+    case INVALID_OPERATION:
+        result = AAUDIO_ERROR_INVALID_STATE;
+        break;
+    case BAD_VALUE:
+        result = AAUDIO_ERROR_UNEXPECTED_VALUE;
+        break;
+    case WOULD_BLOCK:
+        result = AAUDIO_ERROR_WOULD_BLOCK;
+        break;
+    // TODO add more status codes
+    default:
+        result = AAUDIO_ERROR_INTERNAL;
+        break;
+    }
+    return result;
+}
+
+audio_format_t AAudioConvert_aaudioToAndroidDataFormat(aaudio_audio_format_t aaudioFormat) {
+    audio_format_t androidFormat;
+    switch (aaudioFormat) {
+    case AAUDIO_FORMAT_PCM_I16:
+        androidFormat = AUDIO_FORMAT_PCM_16_BIT;
+        break;
+    case AAUDIO_FORMAT_PCM_FLOAT:
+        androidFormat = AUDIO_FORMAT_PCM_FLOAT;
+        break;
+    case AAUDIO_FORMAT_PCM_I8_24:
+        androidFormat = AUDIO_FORMAT_PCM_8_24_BIT;
+        break;
+    case AAUDIO_FORMAT_PCM_I32:
+        androidFormat = AUDIO_FORMAT_PCM_32_BIT;
+        break;
+    default:
+        androidFormat = AUDIO_FORMAT_DEFAULT;
+        ALOGE("AAudioConvert_aaudioToAndroidDataFormat 0x%08X unrecognized", aaudioFormat);
+        break;
+    }
+    return androidFormat;
+}
+
+aaudio_audio_format_t AAudioConvert_androidToAAudioDataFormat(audio_format_t androidFormat) {
+    aaudio_audio_format_t aaudioFormat = AAUDIO_FORMAT_INVALID;
+    switch (androidFormat) {
+    case AUDIO_FORMAT_PCM_16_BIT:
+        aaudioFormat = AAUDIO_FORMAT_PCM_I16;
+        break;
+    case AUDIO_FORMAT_PCM_FLOAT:
+        aaudioFormat = AAUDIO_FORMAT_PCM_FLOAT;
+        break;
+    case AUDIO_FORMAT_PCM_32_BIT:
+        aaudioFormat = AAUDIO_FORMAT_PCM_I32;
+        break;
+    case AUDIO_FORMAT_PCM_8_24_BIT:
+        aaudioFormat = AAUDIO_FORMAT_PCM_I8_24;
+        break;
+    default:
+        aaudioFormat = AAUDIO_FORMAT_INVALID;
+        ALOGE("AAudioConvert_androidToAAudioDataFormat 0x%08X unrecognized", androidFormat);
+        break;
+    }
+    return aaudioFormat;
+}
+
+aaudio_size_bytes_t AAudioConvert_framesToBytes(aaudio_size_frames_t numFrames,
+                                            aaudio_size_bytes_t bytesPerFrame,
+                                            aaudio_size_bytes_t *sizeInBytes) {
+    // TODO implement more elegantly
+    const int32_t maxChannels = 256; // ridiculously large
+    const aaudio_size_frames_t maxBytesPerFrame = maxChannels * sizeof(float);
+    // Prevent overflow by limiting multiplicands.
+    if (bytesPerFrame > maxBytesPerFrame || numFrames > (0x3FFFFFFF / maxBytesPerFrame)) {
+        ALOGE("size overflow, numFrames = %d, frameSize = %zd", numFrames, bytesPerFrame);
+        return AAUDIO_ERROR_OUT_OF_RANGE;
+    }
+    *sizeInBytes = numFrames * bytesPerFrame;
+    return AAUDIO_OK;
+}
diff --git a/media/liboboe/src/utility/AAudioUtilities.h b/media/liboboe/src/utility/AAudioUtilities.h
new file mode 100644
index 0000000..38696df
--- /dev/null
+++ b/media/liboboe/src/utility/AAudioUtilities.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2016 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 UTILITY_AAUDIO_UTILITIES_H
+#define UTILITY_AAUDIO_UTILITIES_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <utils/Errors.h>
+#include <hardware/audio.h>
+
+#include "aaudio/AAudioDefinitions.h"
+
+/**
+ * Convert an AAudio result into the closest matching Android status.
+ */
+android::status_t AAudioConvert_aaudioToAndroidStatus(aaudio_result_t result);
+
+/**
+ * Convert an Android status into the closest matching AAudio result.
+ */
+aaudio_result_t AAudioConvert_androidToAAudioResult(android::status_t status);
+
+void AAudioConvert_floatToPcm16(const float *source, int32_t numSamples, int16_t *destination);
+
+void AAudioConvert_pcm16ToFloat(const int16_t *source, int32_t numSamples, float *destination);
+
+/**
+ * Calculate the number of bytes and prevent numeric overflow.
+ * @param numFrames frame count
+ * @param bytesPerFrame size of a frame in bytes
+ * @param sizeInBytes total size in bytes
+ * @return AAUDIO_OK or negative error, eg. AAUDIO_ERROR_OUT_OF_RANGE
+ */
+aaudio_size_bytes_t AAudioConvert_framesToBytes(aaudio_size_frames_t numFrames,
+                                            aaudio_size_bytes_t bytesPerFrame,
+                                            aaudio_size_bytes_t *sizeInBytes);
+
+audio_format_t AAudioConvert_aaudioToAndroidDataFormat(aaudio_audio_format_t aaudio_format);
+
+aaudio_audio_format_t AAudioConvert_androidToAAudioDataFormat(audio_format_t format);
+
+/**
+ * @return the size of a sample of the given format in bytes or AAUDIO_ERROR_ILLEGAL_ARGUMENT
+ */
+aaudio_size_bytes_t AAudioConvert_formatToSizeInBytes(aaudio_audio_format_t format);
+
+#endif //UTILITY_AAUDIO_UTILITIES_H
diff --git a/media/liboboe/src/utility/AudioClock.h b/media/liboboe/src/utility/AudioClock.h
index 1779d8b..9ac21d3 100644
--- a/media/liboboe/src/utility/AudioClock.h
+++ b/media/liboboe/src/utility/AudioClock.h
@@ -20,35 +20,35 @@
 #include <stdint.h>
 #include <time.h>
 
-#include <oboe/OboeDefinitions.h>
+#include <aaudio/AAudioDefinitions.h>
 
 class AudioClock {
 public:
-    static oboe_nanoseconds_t getNanoseconds(clockid_t clockId = CLOCK_MONOTONIC) {
+    static aaudio_nanoseconds_t getNanoseconds(clockid_t clockId = CLOCK_MONOTONIC) {
         struct timespec time;
         int result = clock_gettime(clockId, &time);
         if (result < 0) {
             return -errno;
         }
-        return (time.tv_sec * OBOE_NANOS_PER_SECOND) + time.tv_nsec;
+        return (time.tv_sec * AAUDIO_NANOS_PER_SECOND) + time.tv_nsec;
     }
 
     /**
      * Sleep until the specified absolute time.
-     * Return immediately with OBOE_ERROR_ILLEGAL_ARGUMENT if a negative
+     * Return immediately with AAUDIO_ERROR_ILLEGAL_ARGUMENT if a negative
      * nanoTime is specified.
      *
      * @param nanoTime time to wake up
      * @param clockId CLOCK_MONOTONIC is default
      * @return 0, a negative error, or 1 if the call is interrupted by a signal handler (EINTR)
      */
-    static int sleepUntilNanoTime(oboe_nanoseconds_t nanoTime,
+    static int sleepUntilNanoTime(aaudio_nanoseconds_t nanoTime,
                                   clockid_t clockId = CLOCK_MONOTONIC) {
         if (nanoTime > 0) {
             struct timespec time;
-            time.tv_sec = nanoTime / OBOE_NANOS_PER_SECOND;
+            time.tv_sec = nanoTime / AAUDIO_NANOS_PER_SECOND;
             // Calculate the fractional nanoseconds. Avoids expensive % operation.
-            time.tv_nsec = nanoTime - (time.tv_sec * OBOE_NANOS_PER_SECOND);
+            time.tv_nsec = nanoTime - (time.tv_sec * AAUDIO_NANOS_PER_SECOND);
             int err = clock_nanosleep(clockId, TIMER_ABSTIME, &time, nullptr);
             switch (err) {
             case EINTR:
@@ -60,7 +60,7 @@
                 return 0 - err;
             }
         } else {
-            return OBOE_ERROR_ILLEGAL_ARGUMENT;
+            return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
         }
     }
 
@@ -72,12 +72,12 @@
      * @param clockId CLOCK_MONOTONIC is default
      * @return 0, a negative error, or 1 if the call is interrupted by a signal handler (EINTR)
      */
-    static int sleepForNanos(oboe_nanoseconds_t nanoseconds, clockid_t clockId = CLOCK_MONOTONIC) {
+    static int sleepForNanos(aaudio_nanoseconds_t nanoseconds, clockid_t clockId = CLOCK_MONOTONIC) {
         if (nanoseconds > 0) {
             struct timespec time;
-            time.tv_sec = nanoseconds / OBOE_NANOS_PER_SECOND;
+            time.tv_sec = nanoseconds / AAUDIO_NANOS_PER_SECOND;
             // Calculate the fractional nanoseconds. Avoids expensive % operation.
-            time.tv_nsec = nanoseconds - (time.tv_sec * OBOE_NANOS_PER_SECOND);
+            time.tv_nsec = nanoseconds - (time.tv_sec * AAUDIO_NANOS_PER_SECOND);
             const int flags = 0; // documented as relative sleep
             int err = clock_nanosleep(clockId, flags, &time, nullptr);
             switch (err) {
diff --git a/media/liboboe/src/utility/HandleTracker.cpp b/media/liboboe/src/utility/HandleTracker.cpp
index 27cc1f8..c4880b8 100644
--- a/media/liboboe/src/utility/HandleTracker.cpp
+++ b/media/liboboe/src/utility/HandleTracker.cpp
@@ -15,7 +15,7 @@
  *
  */
 
-#define LOG_TAG "OboeAudio"
+#define LOG_TAG "AAudio"
 //#define LOG_NDEBUG 0
 #include <utils/Log.h>
 
@@ -24,7 +24,7 @@
 #include <stdint.h>
 #include <utils/Mutex.h>
 
-#include <oboe/OboeDefinitions.h>
+#include <aaudio/AAudioDefinitions.h>
 #include "HandleTracker.h"
 
 using android::Mutex;
@@ -112,13 +112,13 @@
     return generation;
 }
 
-oboe_handle_t HandleTracker::put(handle_tracker_type_t type, void *address)
+aaudio_handle_t HandleTracker::put(handle_tracker_type_t type, void *address)
 {
     if (type < 0 || type >= HANDLE_TRACKER_MAX_TYPES) {
-        return static_cast<oboe_handle_t>(OBOE_ERROR_OUT_OF_RANGE);
+        return static_cast<aaudio_handle_t>(AAUDIO_ERROR_OUT_OF_RANGE);
     }
     if (!isInitialized()) {
-        return static_cast<oboe_handle_t>(OBOE_ERROR_NO_MEMORY);
+        return static_cast<aaudio_handle_t>(AAUDIO_ERROR_NO_MEMORY);
     }
 
     Mutex::Autolock _l(mLock);
@@ -127,7 +127,7 @@
     handle_tracker_slot_t index = allocateSlot_l();
     if (index == SLOT_UNAVAILABLE) {
         ALOGE("HandleTracker::put() no room for more handles");
-        return static_cast<oboe_handle_t>(OBOE_ERROR_NO_FREE_HANDLES);
+        return static_cast<aaudio_handle_t>(AAUDIO_ERROR_NO_FREE_HANDLES);
     }
 
     // Cycle the generation counter so stale handles can be detected.
@@ -140,20 +140,20 @@
     // TODO use store release to enforce memory order with get()
 
     // Generate a handle.
-    oboe_handle_t handle = buildHandle(inputHeader, index);
+    aaudio_handle_t handle = buildHandle(inputHeader, index);
 
     ALOGV("HandleTracker::put(%p) returns 0x%08x", address, handle);
     return handle;
 }
 
 handle_tracker_slot_t HandleTracker::handleToIndex(handle_tracker_type_t type,
-                                                   oboe_handle_t handle) const
+                                                   aaudio_handle_t handle) const
 {
     // Validate the handle.
     handle_tracker_slot_t index = extractIndex(handle);
     if (index >= mMaxHandleCount) {
         ALOGE("HandleTracker::handleToIndex() invalid handle = 0x%08X", handle);
-        return static_cast<oboe_handle_t>(OBOE_ERROR_INVALID_HANDLE);
+        return static_cast<aaudio_handle_t>(AAUDIO_ERROR_INVALID_HANDLE);
     }
     handle_tracker_generation_t handleGeneration = extractGeneration(handle);
     handle_tracker_header_t inputHeader = buildHeader(type, handleGeneration);
@@ -162,12 +162,12 @@
     if (inputHeader != mHandleHeaders[index]) {
         ALOGE("HandleTracker::handleToIndex() inputHeader = 0x%08x != mHandleHeaders[%d] = 0x%08x",
              inputHeader, index, mHandleHeaders[index]);
-        return static_cast<oboe_handle_t>(OBOE_ERROR_INVALID_HANDLE);
+        return static_cast<aaudio_handle_t>(AAUDIO_ERROR_INVALID_HANDLE);
     }
     return index;
 }
 
-handle_tracker_address_t HandleTracker::get(handle_tracker_type_t type, oboe_handle_t handle) const
+handle_tracker_address_t HandleTracker::get(handle_tracker_type_t type, aaudio_handle_t handle) const
 {
     if (!isInitialized()) {
         return nullptr;
@@ -182,7 +182,7 @@
     }
 }
 
-handle_tracker_address_t HandleTracker::remove(handle_tracker_type_t type, oboe_handle_t handle) {
+handle_tracker_address_t HandleTracker::remove(handle_tracker_type_t type, aaudio_handle_t handle) {
     if (!isInitialized()) {
         return nullptr;
     }
@@ -208,9 +208,9 @@
     }
 }
 
-oboe_handle_t HandleTracker::buildHandle(handle_tracker_header_t typeGeneration,
+aaudio_handle_t HandleTracker::buildHandle(handle_tracker_header_t typeGeneration,
                                          handle_tracker_slot_t index) {
-    return (oboe_handle_t)((typeGeneration << GENERATION_SHIFT) | (index & INDEX_MASK));
+    return (aaudio_handle_t)((typeGeneration << GENERATION_SHIFT) | (index & INDEX_MASK));
 }
 
 handle_tracker_header_t HandleTracker::buildHeader(handle_tracker_type_t type,
@@ -220,12 +220,12 @@
         | (generation & GENERATION_MASK));
 }
 
-handle_tracker_slot_t HandleTracker::extractIndex(oboe_handle_t handle)
+handle_tracker_slot_t HandleTracker::extractIndex(aaudio_handle_t handle)
 {
     return handle & INDEX_MASK;
 }
 
-handle_tracker_generation_t HandleTracker::extractGeneration(oboe_handle_t handle)
+handle_tracker_generation_t HandleTracker::extractGeneration(aaudio_handle_t handle)
 {
     return (handle >> GENERATION_SHIFT) & GENERATION_MASK;
 }
diff --git a/media/liboboe/src/utility/HandleTracker.h b/media/liboboe/src/utility/HandleTracker.h
index f1bead8..c80860c 100644
--- a/media/liboboe/src/utility/HandleTracker.h
+++ b/media/liboboe/src/utility/HandleTracker.h
@@ -60,7 +60,7 @@
      * @param address pointer to be converted to a handle
      * @return a valid handle or a negative error
      */
-    oboe_handle_t put(handle_tracker_type_t expectedType, handle_tracker_address_t address);
+    aaudio_handle_t put(handle_tracker_type_t expectedType, handle_tracker_address_t address);
 
     /**
      * Get the original pointer associated with the handle.
@@ -72,7 +72,7 @@
      * @param handle to be converted to a pointer
      * @return address associated with handle or nullptr
      */
-    handle_tracker_address_t get(handle_tracker_type_t expectedType, oboe_handle_t handle) const;
+    handle_tracker_address_t get(handle_tracker_type_t expectedType, aaudio_handle_t handle) const;
 
     /**
      * Free up the storage associated with the handle.
@@ -84,7 +84,7 @@
      * @param handle to be removed from tracking
      * @return address associated with handle or nullptr if not found
      */
-    handle_tracker_address_t remove(handle_tracker_type_t expectedType, oboe_handle_t handle);
+    handle_tracker_address_t remove(handle_tracker_type_t expectedType, aaudio_handle_t handle);
 
 private:
     const int32_t               mMaxHandleCount;   // size of array
@@ -115,7 +115,7 @@
      * Validate the handle and return the corresponding index.
      * @return slot index or a negative error
      */
-    handle_tracker_slot_t handleToIndex(oboe_handle_t handle, handle_tracker_type_t type) const;
+    handle_tracker_slot_t handleToIndex(aaudio_handle_t handle, handle_tracker_type_t type) const;
 
     /**
      * Construct a handle from a header and an index.
@@ -123,7 +123,7 @@
      * @param index slot index returned from allocateSlot
      * @return handle or a negative error
      */
-    static oboe_handle_t buildHandle(handle_tracker_header_t header, handle_tracker_slot_t index);
+    static aaudio_handle_t buildHandle(handle_tracker_header_t header, handle_tracker_slot_t index);
 
     /**
      * Combine a type and a generation field into a header.
@@ -136,14 +136,14 @@
      * Does not validate the handle.
      * @return index associated with a handle
      */
-    static handle_tracker_slot_t extractIndex(oboe_handle_t handle);
+    static handle_tracker_slot_t extractIndex(aaudio_handle_t handle);
 
     /**
      * Extract the generation from a handle.
      * Does not validate the handle.
      * @return generation associated with a handle
      */
-    static handle_tracker_generation_t extractGeneration(oboe_handle_t handle);
+    static handle_tracker_generation_t extractGeneration(aaudio_handle_t handle);
 
 };
 
diff --git a/media/liboboe/src/utility/OboeUtilities.cpp b/media/liboboe/src/utility/OboeUtilities.cpp
deleted file mode 100644
index fcf4252..0000000
--- a/media/liboboe/src/utility/OboeUtilities.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright 2016 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.
- */
-
-#define LOG_TAG "OboeAudio"
-//#define LOG_NDEBUG 0
-#include <utils/Log.h>
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <utils/Errors.h>
-
-#include "oboe/OboeDefinitions.h"
-#include "OboeUtilities.h"
-
-using namespace android;
-
-oboe_size_bytes_t OboeConvert_formatToSizeInBytes(oboe_audio_format_t format) {
-    oboe_size_bytes_t size = OBOE_ERROR_ILLEGAL_ARGUMENT;
-    switch (format) {
-        case OBOE_AUDIO_FORMAT_PCM_I16:
-            size = sizeof(int16_t);
-            break;
-        case OBOE_AUDIO_FORMAT_PCM_I32:
-        case OBOE_AUDIO_FORMAT_PCM_I8_24:
-            size = sizeof(int32_t);
-            break;
-        case OBOE_AUDIO_FORMAT_PCM_FLOAT:
-            size = sizeof(float);
-            break;
-        default:
-            break;
-    }
-    return size;
-}
-
-// TODO This similar to a function in audio_utils. Consider using that instead.
-void OboeConvert_floatToPcm16(const float *source, int32_t numSamples, int16_t *destination) {
-    for (int i = 0; i < numSamples; i++) {
-        float fval = source[i];
-        fval += 1.0; // to avoid discontinuity at 0.0 caused by truncation
-        fval *= 32768.0f;
-        int32_t sample = (int32_t) fval;
-        // clip to 16-bit range
-        if (sample < 0) sample = 0;
-        else if (sample > 0x0FFFF) sample = 0x0FFFF;
-        sample -= 32768; // center at zero
-        destination[i] = (int16_t) sample;
-    }
-}
-
-void OboeConvert_pcm16ToFloat(const float *source, int32_t numSamples, int16_t *destination) {
-    for (int i = 0; i < numSamples; i++) {
-        destination[i] = source[i] * (1.0f / 32768.0f);
-    }
-}
-
-status_t OboeConvert_oboeToAndroidStatus(oboe_result_t result) {
-    // This covers the case for OBOE_OK and for positive results.
-    if (result >= 0) {
-        return result;
-    }
-    status_t status;
-    switch (result) {
-    case OBOE_ERROR_DISCONNECTED:
-    case OBOE_ERROR_INVALID_HANDLE:
-        status = DEAD_OBJECT;
-        break;
-    case OBOE_ERROR_INVALID_STATE:
-        status = INVALID_OPERATION;
-        break;
-    case OBOE_ERROR_UNEXPECTED_VALUE: // TODO redundant?
-    case OBOE_ERROR_ILLEGAL_ARGUMENT:
-        status = BAD_VALUE;
-        break;
-    case OBOE_ERROR_WOULD_BLOCK:
-        status = WOULD_BLOCK;
-        break;
-    // TODO add more result codes
-    default:
-        status = UNKNOWN_ERROR;
-        break;
-    }
-    return status;
-}
-
-oboe_result_t OboeConvert_androidToOboeResult(status_t status) {
-    // This covers the case for OK and for positive result.
-    if (status >= 0) {
-        return status;
-    }
-    oboe_result_t result;
-    switch (status) {
-    case BAD_TYPE:
-        result = OBOE_ERROR_INVALID_HANDLE;
-        break;
-    case DEAD_OBJECT:
-        result = OBOE_ERROR_DISCONNECTED;
-        break;
-    case INVALID_OPERATION:
-        result = OBOE_ERROR_INVALID_STATE;
-        break;
-    case BAD_VALUE:
-        result = OBOE_ERROR_UNEXPECTED_VALUE;
-        break;
-    case WOULD_BLOCK:
-        result = OBOE_ERROR_WOULD_BLOCK;
-        break;
-    // TODO add more status codes
-    default:
-        result = OBOE_ERROR_INTERNAL;
-        break;
-    }
-    return result;
-}
-
-audio_format_t OboeConvert_oboeToAndroidDataFormat(oboe_audio_format_t oboeFormat) {
-    audio_format_t androidFormat;
-    switch (oboeFormat) {
-    case OBOE_AUDIO_FORMAT_PCM_I16:
-        androidFormat = AUDIO_FORMAT_PCM_16_BIT;
-        break;
-    case OBOE_AUDIO_FORMAT_PCM_FLOAT:
-        androidFormat = AUDIO_FORMAT_PCM_FLOAT;
-        break;
-    case OBOE_AUDIO_FORMAT_PCM_I8_24:
-        androidFormat = AUDIO_FORMAT_PCM_8_24_BIT;
-        break;
-    case OBOE_AUDIO_FORMAT_PCM_I32:
-        androidFormat = AUDIO_FORMAT_PCM_32_BIT;
-        break;
-    default:
-        androidFormat = AUDIO_FORMAT_DEFAULT;
-        ALOGE("OboeConvert_oboeToAndroidDataFormat 0x%08X unrecognized", oboeFormat);
-        break;
-    }
-    return androidFormat;
-}
-
-oboe_audio_format_t OboeConvert_androidToOboeDataFormat(audio_format_t androidFormat) {
-    oboe_audio_format_t oboeFormat = OBOE_AUDIO_FORMAT_INVALID;
-    switch (androidFormat) {
-    case AUDIO_FORMAT_PCM_16_BIT:
-        oboeFormat = OBOE_AUDIO_FORMAT_PCM_I16;
-        break;
-    case AUDIO_FORMAT_PCM_FLOAT:
-        oboeFormat = OBOE_AUDIO_FORMAT_PCM_FLOAT;
-        break;
-    case AUDIO_FORMAT_PCM_32_BIT:
-        oboeFormat = OBOE_AUDIO_FORMAT_PCM_I32;
-        break;
-    case AUDIO_FORMAT_PCM_8_24_BIT:
-        oboeFormat = OBOE_AUDIO_FORMAT_PCM_I8_24;
-        break;
-    default:
-        oboeFormat = OBOE_AUDIO_FORMAT_INVALID;
-        ALOGE("OboeConvert_androidToOboeDataFormat 0x%08X unrecognized", androidFormat);
-        break;
-    }
-    return oboeFormat;
-}
-
-oboe_size_bytes_t OboeConvert_framesToBytes(oboe_size_frames_t numFrames,
-                                            oboe_size_bytes_t bytesPerFrame,
-                                            oboe_size_bytes_t *sizeInBytes) {
-    // TODO implement more elegantly
-    const int32_t maxChannels = 256; // ridiculously large
-    const oboe_size_frames_t maxBytesPerFrame = maxChannels * sizeof(float);
-    // Prevent overflow by limiting multiplicands.
-    if (bytesPerFrame > maxBytesPerFrame || numFrames > (0x3FFFFFFF / maxBytesPerFrame)) {
-        ALOGE("size overflow, numFrames = %d, frameSize = %zd", numFrames, bytesPerFrame);
-        return OBOE_ERROR_OUT_OF_RANGE;
-    }
-    *sizeInBytes = numFrames * bytesPerFrame;
-    return OBOE_OK;
-}
diff --git a/media/liboboe/src/utility/OboeUtilities.h b/media/liboboe/src/utility/OboeUtilities.h
deleted file mode 100644
index 4096e2a..0000000
--- a/media/liboboe/src/utility/OboeUtilities.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2016 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 UTILITY_OBOE_UTILITIES_H
-#define UTILITY_OBOE_UTILITIES_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <utils/Errors.h>
-#include <hardware/audio.h>
-
-#include "oboe/OboeDefinitions.h"
-
-/**
- * Convert an Oboe result into the closest matching Android status.
- */
-android::status_t OboeConvert_oboeToAndroidStatus(oboe_result_t result);
-
-/**
- * Convert an Android status into the closest matching Oboe result.
- */
-oboe_result_t OboeConvert_androidToOboeResult(android::status_t status);
-
-void OboeConvert_floatToPcm16(const float *source, int32_t numSamples, int16_t *destination);
-
-void OboeConvert_pcm16ToFloat(const int16_t *source, int32_t numSamples, float *destination);
-
-/**
- * Calculate the number of bytes and prevent numeric overflow.
- * @param numFrames frame count
- * @param bytesPerFrame size of a frame in bytes
- * @param sizeInBytes total size in bytes
- * @return OBOE_OK or negative error, eg. OBOE_ERROR_OUT_OF_RANGE
- */
-oboe_size_bytes_t OboeConvert_framesToBytes(oboe_size_frames_t numFrames,
-                                            oboe_size_bytes_t bytesPerFrame,
-                                            oboe_size_bytes_t *sizeInBytes);
-
-audio_format_t OboeConvert_oboeToAndroidDataFormat(oboe_audio_format_t oboe_format);
-
-oboe_audio_format_t OboeConvert_androidToOboeDataFormat(audio_format_t format);
-
-/**
- * @return the size of a sample of the given format in bytes or OBOE_ERROR_ILLEGAL_ARGUMENT
- */
-oboe_size_bytes_t OboeConvert_formatToSizeInBytes(oboe_audio_format_t format);
-
-#endif //UTILITY_OBOE_UTILITIES_H
diff --git a/media/liboboe/src/utility/README.md b/media/liboboe/src/utility/README.md
index 9db926a..0ac74ea 100644
--- a/media/liboboe/src/utility/README.md
+++ b/media/liboboe/src/utility/README.md
@@ -1,3 +1,3 @@
-The utility folder contains things that may be shared between the Oboe client and server.
-They might also be handy outside Oboe.
-They generally do not depend on Oboe functionality.
+The utility folder contains things that may be shared between the AAudio client and server.
+They might also be handy outside AAudio.
+They generally do not depend on AAudio functionality.