Merge "Camera2 NDK: Add MOTION_TRACKING capability, and lens poseReference"
diff --git a/drm/mediadrm/plugins/clearkey/DrmPlugin.cpp b/drm/mediadrm/plugins/clearkey/DrmPlugin.cpp
index 7c43994..944002d 100644
--- a/drm/mediadrm/plugins/clearkey/DrmPlugin.cpp
+++ b/drm/mediadrm/plugins/clearkey/DrmPlugin.cpp
@@ -142,25 +142,24 @@
ssize_t index = mByteArrayProperties.indexOfKey(name);
if (index < 0) {
ALOGE("App requested unknown property: %s", name.string());
- return android::BAD_VALUE;
+ return android::ERROR_DRM_CANNOT_HANDLE;
}
value = mByteArrayProperties.valueAt(index);
return android::OK;
}
status_t DrmPlugin::setPropertyByteArray(
- const String8& name, const Vector<uint8_t>& value) {
+ const String8& name, const Vector<uint8_t>& value)
+{
+ UNUSED(value);
if (0 == name.compare(kDeviceIdKey)) {
ALOGD("Cannot set immutable property: %s", name.string());
- return android::BAD_VALUE;
+ return android::ERROR_DRM_CANNOT_HANDLE;
}
- ssize_t status = mByteArrayProperties.replaceValueFor(name, value);
- if (status >= 0) {
- return android::OK;
- }
+ // Setting of undefined properties is not supported
ALOGE("Failed to set property byte array, key=%s", name.string());
- return android::BAD_VALUE;
+ return android::ERROR_DRM_CANNOT_HANDLE;
}
status_t DrmPlugin::getPropertyString(
@@ -168,7 +167,7 @@
ssize_t index = mStringProperties.indexOfKey(name);
if (index < 0) {
ALOGE("App requested unknown property: %s", name.string());
- return android::BAD_VALUE;
+ return android::ERROR_DRM_CANNOT_HANDLE;
}
value = mStringProperties.valueAt(index);
return android::OK;
@@ -182,12 +181,18 @@
kVendorKey.string(), kVersionKey.string());
if (immutableKeys.contains(name.string())) {
ALOGD("Cannot set immutable property: %s", name.string());
- return android::BAD_VALUE;
+ return android::ERROR_DRM_CANNOT_HANDLE;
+ }
+
+ ssize_t index = mStringProperties.indexOfKey(name);
+ if (index < 0) {
+ ALOGE("Cannot set undefined property string, key=%s", name.string());
+ return android::ERROR_DRM_CANNOT_HANDLE;
}
if (mStringProperties.add(name, value) < 0) {
ALOGE("Failed to set property string, key=%s", name.string());
- return android::BAD_VALUE;
+ return android::ERROR_DRM_UNKNOWN;
}
return android::OK;
}
diff --git a/media/libmedia/nuplayer2/HTTPLiveSource.cpp b/media/libmedia/nuplayer2/HTTPLiveSource.cpp
index 14b67cad..e0e3df9 100644
--- a/media/libmedia/nuplayer2/HTTPLiveSource.cpp
+++ b/media/libmedia/nuplayer2/HTTPLiveSource.cpp
@@ -103,7 +103,8 @@
if (mLiveLooper == NULL) {
mLiveLooper = new ALooper;
mLiveLooper->setName("http live");
- mLiveLooper->start();
+ mLiveLooper->start(false, /* runOnCallingThread */
+ true /* canCallJava */);
mLiveLooper->registerHandler(this);
}
diff --git a/media/libmedia/omx/1.0/WOmxNode.cpp b/media/libmedia/omx/1.0/WOmxNode.cpp
index 0b40e8d..2cd8b76 100644
--- a/media/libmedia/omx/1.0/WOmxNode.cpp
+++ b/media/libmedia/omx/1.0/WOmxNode.cpp
@@ -151,7 +151,8 @@
hidl_handle const& outNativeHandle) {
fnStatus = toStatusT(status);
*buffer = outBuffer;
- *native_handle = NativeHandle::create(
+ *native_handle = outNativeHandle.getNativeHandle() == nullptr ?
+ nullptr : NativeHandle::create(
native_handle_clone(outNativeHandle), true);
}));
return transStatus == NO_ERROR ? fnStatus : transStatus;
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index 1e2e684..7eff8eb 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -1014,7 +1014,8 @@
mFetcherLooper = new ALooper();
mFetcherLooper->setName("Fetcher");
- mFetcherLooper->start(false, false);
+ mFetcherLooper->start(false, /* runOnCallingThread */
+ true /* canCallJava */);
}
// create fetcher to fetch the master playlist
diff --git a/media/libstagefright/omx/1.0/WOmxNode.cpp b/media/libstagefright/omx/1.0/WOmxNode.cpp
index 9f82283..1dc7c7b 100644
--- a/media/libstagefright/omx/1.0/WOmxNode.cpp
+++ b/media/libstagefright/omx/1.0/WOmxNode.cpp
@@ -154,7 +154,8 @@
hidl_handle const& outNativeHandle) {
fnStatus = toStatusT(status);
*buffer = outBuffer;
- *native_handle = NativeHandle::create(
+ *native_handle = outNativeHandle.getNativeHandle() == nullptr ?
+ nullptr : NativeHandle::create(
native_handle_clone(outNativeHandle), true);
}));
return transStatus == NO_ERROR ? fnStatus : transStatus;
diff --git a/media/libstagefright/omx/include/media/stagefright/omx/1.0/Conversion.h b/media/libstagefright/omx/include/media/stagefright/omx/1.0/Conversion.h
index 8d8a2d9..a79d403 100644
--- a/media/libstagefright/omx/include/media/stagefright/omx/1.0/Conversion.h
+++ b/media/libstagefright/omx/include/media/stagefright/omx/1.0/Conversion.h
@@ -1862,7 +1862,8 @@
inline size_t getFlattenedSize(HGraphicBufferProducer::QueueBufferInput const& t) {
return minFlattenedSize(t) +
getFenceFlattenedSize(t.fence) +
- getFlattenedSize(t.surfaceDamage);
+ getFlattenedSize(t.surfaceDamage) +
+ sizeof(HdrMetadata::validTypes);
}
/**
@@ -1916,7 +1917,12 @@
if (status != NO_ERROR) {
return status;
}
- return flatten(t.surfaceDamage, buffer, size);
+ status = flatten(t.surfaceDamage, buffer, size);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ FlattenableUtils::write(buffer, size, decltype(HdrMetadata::validTypes)(0));
+ return NO_ERROR;
}
/**
@@ -1968,6 +1974,7 @@
if (status != NO_ERROR) {
return status;
}
+ // HdrMetadata ignored
return unflatten(&(t->surfaceDamage), buffer, size);
}
diff --git a/packages/MediaUpdate/Android.mk b/packages/MediaUpdate/Android.mk
index e757098..4a71401 100644
--- a/packages/MediaUpdate/Android.mk
+++ b/packages/MediaUpdate/Android.mk
@@ -25,4 +25,10 @@
# TODO: create a separate key for this package.
LOCAL_CERTIFICATE := platform
+# TODO: Use System SDK once public APIs are approved
+# LOCAL_SDK_VERSION := system_current
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+LOCAL_PROGUARD_FLAG_FILES := proguard.cfg
+
include $(BUILD_PACKAGE)
diff --git a/packages/MediaUpdate/proguard.cfg b/packages/MediaUpdate/proguard.cfg
new file mode 100644
index 0000000..874dbf5
--- /dev/null
+++ b/packages/MediaUpdate/proguard.cfg
@@ -0,0 +1,20 @@
+#
+# Copyright 2017 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.
+#
+
+# Keep entry point for updatable Java classes
+-keep public class com.android.media.update.ApiFactory {
+ public static java.lang.Object initialize(android.content.Context);
+}
diff --git a/packages/MediaUpdate/src/com/android/media/update/ApiFactory.java b/packages/MediaUpdate/src/com/android/media/update/ApiFactory.java
new file mode 100644
index 0000000..1cdd177
--- /dev/null
+++ b/packages/MediaUpdate/src/com/android/media/update/ApiFactory.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+package com.android.media.update;
+
+import android.content.Context;
+import android.media.update.MediaController2Provider;
+import android.media.update.StaticProvider;
+import android.media.update.ViewProvider;
+import android.widget.MediaController2;
+
+import com.android.widget.MediaController2Impl;
+
+public class ApiFactory implements StaticProvider {
+ private final Context mContext;
+
+ public ApiFactory(Context context) {
+ mContext = context;
+ }
+
+ public static Object initialize(Context context) throws ReflectiveOperationException {
+ return new ApiFactory(context);
+ }
+
+ @Override
+ public MediaController2Provider createMediaController2(
+ MediaController2 instance, ViewProvider superProvider) {
+ return new MediaController2Impl(instance, superProvider);
+ }
+}
diff --git a/packages/MediaUpdate/src/com/android/widget/MediaController2Impl.java b/packages/MediaUpdate/src/com/android/widget/MediaController2Impl.java
new file mode 100644
index 0000000..d322a20
--- /dev/null
+++ b/packages/MediaUpdate/src/com/android/widget/MediaController2Impl.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+package com.android.widget;
+
+import android.graphics.Canvas;
+import android.media.session.MediaController;
+import android.media.update.MediaController2Provider;
+import android.media.update.ViewProvider;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.MediaController2;
+
+public class MediaController2Impl implements MediaController2Provider {
+ private final MediaController2 mInstance;
+ private final ViewProvider mSuperProvider;
+
+ public MediaController2Impl(MediaController2 instance, ViewProvider superProvider) {
+ mInstance = instance;
+ mSuperProvider = superProvider;
+
+ // TODO: Implement
+ }
+
+ @Override
+ public void setController_impl(MediaController controller) {
+ // TODO: Implement
+ }
+
+ @Override
+ public void setAnchorView_impl(View view) {
+ // TODO: Implement
+ }
+
+ @Override
+ public void show_impl() {
+ // TODO: Implement
+ }
+
+ @Override
+ public void show_impl(int timeout) {
+ // TODO: Implement
+ }
+
+ @Override
+ public boolean isShowing_impl() {
+ // TODO: Implement
+ return false;
+ }
+
+ @Override
+ public void hide_impl() {
+ // TODO: Implement
+ }
+
+ @Override
+ public void setPrevNextListeners_impl(OnClickListener next, OnClickListener prev) {
+ // TODO: Implement
+ }
+
+ @Override
+ public void showCCButton_impl() {
+ // TODO: Implement
+ }
+
+ @Override
+ public boolean isPlaying_impl() {
+ // TODO: Implement
+ return false;
+ }
+
+ @Override
+ public int getCurrentPosition_impl() {
+ // TODO: Implement
+ return 0;
+ }
+
+ @Override
+ public int getBufferPercentage_impl() {
+ // TODO: Implement
+ return 0;
+ }
+
+ @Override
+ public boolean canPause_impl() {
+ // TODO: Implement
+ return false;
+ }
+
+ @Override
+ public boolean canSeekBackward_impl() {
+ // TODO: Implement
+ return false;
+ }
+
+ @Override
+ public boolean canSeekForward_impl() {
+ // TODO: Implement
+ return false;
+ }
+
+ @Override
+ public void showSubtitle_impl() {
+ // TODO: Implement
+ }
+
+ @Override
+ public void hideSubtitle_impl() {
+ // TODO: Implement
+ }
+
+ @Override
+ public void onAttachedToWindow_impl() {
+ mSuperProvider.onAttachedToWindow_impl();
+ // TODO: Implement
+ }
+
+ @Override
+ public void onDetachedFromWindow_impl() {
+ mSuperProvider.onDetachedFromWindow_impl();
+ // TODO: Implement
+ }
+
+ @Override
+ public void onLayout_impl(boolean changed, int left, int top, int right, int bottom) {
+ mSuperProvider.onLayout_impl(changed, left, top, right, bottom);
+ // TODO: Implement
+ }
+
+ @Override
+ public void draw_impl(Canvas canvas) {
+ mSuperProvider.draw_impl(canvas);
+ // TODO: Implement
+ }
+
+ @Override
+ public CharSequence getAccessibilityClassName_impl() {
+ // TODO: Implement
+ return MediaController2.class.getName();
+ }
+
+ @Override
+ public boolean onTouchEvent_impl(MotionEvent ev) {
+ // TODO: Implement
+ return mSuperProvider.onTouchEvent_impl(ev);
+ }
+
+ @Override
+ public boolean onTrackballEvent_impl(MotionEvent ev) {
+ // TODO: Implement
+ return mSuperProvider.onTrackballEvent_impl(ev);
+ }
+
+ @Override
+ public boolean onKeyDown_impl(int keyCode, KeyEvent event) {
+ // TODO: Implement
+ return mSuperProvider.onKeyDown_impl(keyCode, event);
+ }
+
+ @Override
+ public void onFinishInflate_impl() {
+ mSuperProvider.onFinishInflate_impl();
+ // TODO: Implement
+ }
+
+ @Override
+ public boolean dispatchKeyEvent_impl(KeyEvent event) {
+ // TODO: Implement
+ return mSuperProvider.dispatchKeyEvent_impl(event);
+ }
+
+ @Override
+ public void setEnabled_impl(boolean enabled) {
+ mSuperProvider.setEnabled_impl(enabled);
+ // TODO: Implement
+ }
+}