Merge ~chihchun/libhybris/+git/libhybris-ubuntu:compat-marshmallow into ~libhybris-maintainers/libhybris/+git/libhybris:master
- Git
- lp:~chihchun/libhybris/+git/libhybris-ubuntu
- compat-marshmallow
- Merge into master
Proposed by
Rex Tsai
Status: | Merged |
---|---|
Approved by: | Simon Fels |
Approved revision: | 95cd65b69b53f612bad0b0e5ac4a2ff8b1422d59 |
Merged at revision: | 744c2b6da1a9170b76a0675585d463528075348a |
Proposed branch: | ~chihchun/libhybris/+git/libhybris-ubuntu:compat-marshmallow |
Merge into: | ~libhybris-maintainers/libhybris/+git/libhybris:master |
Diff against target: |
661 lines (+113/-48) 19 files modified
compat/camera/camera_compatibility_layer.cpp (+6/-6) compat/input/Android.mk (+1/-1) compat/input/input_compatibility_layer.cpp (+11/-3) compat/media/Android.mk (+3/-3) compat/media/decoding_service.cpp (+26/-6) compat/media/decoding_service_priv.h (+1/-1) compat/media/media_codec_layer.cpp (+2/-0) compat/media/media_codec_list.cpp (+13/-13) compat/media/media_codec_source_layer.cpp (+5/-1) compat/media/media_compatibility_layer.cpp (+5/-5) compat/media/media_recorder.cpp (+2/-1) compat/media/media_recorder.h (+2/-0) compat/media/media_recorder_client.cpp (+19/-0) compat/media/media_recorder_client.h (+4/-0) compat/media/media_recorder_factory.cpp (+5/-0) compat/media/surface_texture_client_hybris.cpp (+3/-3) compat/media/surface_texture_client_hybris_priv.h (+1/-1) compat/surface_flinger/surface_flinger_compatibility_layer.cpp (+3/-3) hybris/include/hybris/internal/camera_control.h (+1/-1) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Simon Fels | Approve | ||
Ondrej Kubik | Pending | ||
Libhybris Maintainers | Pending | ||
Review via email: mp+296418@code.launchpad.net |
Commit message
Description of the change
- bump ANDROID_
- Fix MediaCodecSourc
- Fix Interface::asBinder API in framework/native[1]
Note: The changes in compat/
To post a comment you must log in.
Revision history for this message
Rex Tsai (chihchun) : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/compat/camera/camera_compatibility_layer.cpp b/compat/camera/camera_compatibility_layer.cpp |
2 | index 817843e..435c593 100644 |
3 | --- a/compat/camera/camera_compatibility_layer.cpp |
4 | +++ b/compat/camera/camera_compatibility_layer.cpp |
5 | @@ -35,7 +35,7 @@ |
6 | #else |
7 | #include <gui/GLConsumer.h> |
8 | #endif |
9 | -#if ANDROID_VERSION_MAJOR==5 |
10 | +#if ANDROID_VERSION_MAJOR>=5 |
11 | #include <gui/IGraphicBufferProducer.h> |
12 | #endif |
13 | #include <ui/GraphicBuffer.h> |
14 | @@ -60,7 +60,7 @@ |
15 | using android::CompileTimeAssert; // So COMPILE_TIME_ASSERT works |
16 | |
17 | // From android::GLConsumer::FrameAvailableListener |
18 | -#if ANDROID_VERSION_MAJOR==5 && ANDROID_VERSION_MINOR>=1 |
19 | +#if ANDROID_VERSION_MAJOR==5 && ANDROID_VERSION_MINOR>=1 || ANDROID_VERSION_MAJOR>=6 |
20 | void CameraControl::onFrameAvailable(const android::BufferItem& item) |
21 | #else |
22 | void CameraControl::onFrameAvailable() |
23 | @@ -220,7 +220,7 @@ CameraControl* android_camera_connect_by_id(int32_t camera_id, struct CameraCont |
24 | |
25 | android::sp<CameraControl> cc = new CameraControl(); |
26 | cc->listener = listener; |
27 | -#if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR>=3 || ANDROID_VERSION_MAJOR==5 |
28 | +#if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR>=3 || ANDROID_VERSION_MAJOR==5 || ANDROID_VERSION_MAJOR>=6 |
29 | cc->camera = android::Camera::connect(camera_id, android::String16("hybris"), android::Camera::USE_CALLING_UID); |
30 | #else |
31 | cc->camera = android::Camera::connect(camera_id); |
32 | @@ -689,7 +689,7 @@ void android_camera_set_preview_texture(CameraControl* control, int texture_id) |
33 | new android::NativeBufferAlloc() |
34 | ); |
35 | |
36 | -#if ANDROID_VERSION_MAJOR==5 |
37 | +#if ANDROID_VERSION_MAJOR>=5 |
38 | android::sp<android::IGraphicBufferProducer> producer; |
39 | android::sp<android::IGraphicBufferConsumer> consumer; |
40 | android::BufferQueue::createBufferQueue(&producer, &consumer); |
41 | @@ -711,7 +711,7 @@ void android_camera_set_preview_texture(CameraControl* control, int texture_id) |
42 | control->preview_texture = android::sp<android::GLConsumer>( |
43 | new android::GLConsumer( |
44 | #endif |
45 | -#if ANDROID_VERSION_MAJOR==5 |
46 | +#if ANDROID_VERSION_MAJOR>=5 |
47 | consumer, |
48 | texture_id, |
49 | GL_TEXTURE_EXTERNAL_OES, |
50 | @@ -739,7 +739,7 @@ void android_camera_set_preview_texture(CameraControl* control, int texture_id) |
51 | android::sp<android::GLConsumer::FrameAvailableListener>(control)); |
52 | #endif |
53 | |
54 | -#if ANDROID_VERSION_MAJOR==5 |
55 | +#if ANDROID_VERSION_MAJOR>=5 |
56 | control->camera->setPreviewTarget(producer); |
57 | #elif ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=3 |
58 | control->camera->setPreviewTexture(control->preview_texture->getBufferQueue()); |
59 | diff --git a/compat/input/Android.mk b/compat/input/Android.mk |
60 | index c445d32..16ebf2b 100644 |
61 | --- a/compat/input/Android.mk |
62 | +++ b/compat/input/Android.mk |
63 | @@ -30,7 +30,7 @@ LOCAL_SHARED_LIBRARIES += libinputservice |
64 | LOCAL_C_INCLUDES += frameworks/base/services/input |
65 | endif |
66 | |
67 | -HAS_LIBINPUTFLINGER := $(shell test $(ANDROID_VERSION_MAJOR) -eq 5 && echo true) |
68 | +HAS_LIBINPUTFLINGER := $(shell test $(ANDROID_VERSION_MAJOR) -ge 5 && echo true) |
69 | ifeq ($(HAS_LIBINPUTFLINGER),true) |
70 | LOCAL_SHARED_LIBRARIES += libinputflinger libinputservice |
71 | LOCAL_C_INCLUDES += \ |
72 | diff --git a/compat/input/input_compatibility_layer.cpp b/compat/input/input_compatibility_layer.cpp |
73 | index 0e0db21..19e5e49 100644 |
74 | --- a/compat/input/input_compatibility_layer.cpp |
75 | +++ b/compat/input/input_compatibility_layer.cpp |
76 | @@ -22,7 +22,7 @@ |
77 | #if ANDROID_VERSION_MAJOR<=4 |
78 | #include "InputListener.h" |
79 | #include "InputReader.h" |
80 | -#elif ANDROID_VERSION_MAJOR==5 |
81 | +#elif ANDROID_VERSION_MAJOR>=5 |
82 | #include "inputflinger/InputListener.h" |
83 | #include "inputflinger/InputReader.h" |
84 | #endif |
85 | @@ -67,6 +67,14 @@ public: |
86 | ct, |
87 | SkAlphaType::kPremul_SkAlphaType), |
88 | 0); |
89 | +#elif ANDROID_VERSION_MAJOR==6 |
90 | +bitmap.setInfo( |
91 | + SkImageInfo::Make(bitmap_width, |
92 | + bitmap_height, |
93 | + kRGBA_8888_SkColorType, |
94 | + SkAlphaType::kPremul_SkAlphaType), |
95 | + 0); |
96 | + |
97 | #endif |
98 | bitmap.allocPixels(); |
99 | |
100 | @@ -160,7 +168,7 @@ public: |
101 | |
102 | #if ANDROID_VERSION_MAJOR<=4 |
103 | virtual android::sp<android::KeyCharacterMap> getKeyboardLayoutOverlay(const android::String8& inputDeviceDescriptor) { |
104 | -#elif ANDROID_VERSION_MAJOR==5 |
105 | +#elif ANDROID_VERSION_MAJOR>=5 |
106 | virtual android::sp<android::KeyCharacterMap> getKeyboardLayoutOverlay(const android::InputDeviceIdentifier& identifier) { |
107 | #endif |
108 | return NULL; |
109 | @@ -170,7 +178,7 @@ public: |
110 | return android::String8::empty(); |
111 | } |
112 | |
113 | -#if ANDROID_VERSION_MAJOR==5 |
114 | +#if ANDROID_VERSION_MAJOR>=5 |
115 | virtual android::TouchAffineTransformation getTouchAffineTransformation(const android::String8& inputDeviceDescriptor, int32_t surfaceRotation) { |
116 | return android::TouchAffineTransformation(); |
117 | } |
118 | diff --git a/compat/media/Android.mk b/compat/media/Android.mk |
119 | index a77e100..45fdca0 100644 |
120 | --- a/compat/media/Android.mk |
121 | +++ b/compat/media/Android.mk |
122 | @@ -21,9 +21,9 @@ LOCAL_C_INCLUDES := \ |
123 | frameworks/av/services/medialog \ |
124 | frameworks/av/services/camera/libcameraservice |
125 | |
126 | -HAS_ANDROID_5 := $(shell test $(ANDROID_VERSION_MAJOR) -ge 5 && echo true) |
127 | +IS_ANDROID_5 := $(shell test $(ANDROID_VERSION_MAJOR) -ge 5 && echo true) |
128 | |
129 | -ifeq ($(HAS_ANDROID_5),true) |
130 | +ifeq ($(IS_ANDROID_5),true) |
131 | LOCAL_C_INCLUDES += system/media/camera/include |
132 | |
133 | # All devices having Android 5.x also have MediaCodecSource |
134 | @@ -108,7 +108,7 @@ LOCAL_C_INCLUDES := \ |
135 | system/media/audio_utils/include \ |
136 | frameworks/av/services/camera/libcameraservice |
137 | |
138 | -IS_ANDROID_5 := $(shell test $(ANDROID_VERSION_MAJOR) -eq 5 && echo true) |
139 | +IS_ANDROID_5 := $(shell test $(ANDROID_VERSION_MAJOR) -ge 5 && echo true) |
140 | ifeq ($(IS_ANDROID_5),true) |
141 | LOCAL_C_INCLUDES += frameworks/native/include/media/openmax |
142 | endif |
143 | diff --git a/compat/media/decoding_service.cpp b/compat/media/decoding_service.cpp |
144 | index 96c62b0..0905bee 100644 |
145 | --- a/compat/media/decoding_service.cpp |
146 | +++ b/compat/media/decoding_service.cpp |
147 | @@ -63,8 +63,11 @@ status_t BnDecodingService::onTransact( |
148 | CHECK_INTERFACE(IDecodingService, data, reply); |
149 | sp<IGraphicBufferConsumer> gbc; |
150 | status_t res = getIGraphicBufferConsumer(&gbc); |
151 | - |
152 | +#if ANDROID_VERSION_MAJOR>=6 |
153 | + reply->writeStrongBinder(IInterface::asBinder(gbc)); |
154 | +#else |
155 | reply->writeStrongBinder(gbc->asBinder()); |
156 | +#endif |
157 | reply->writeInt32(res); |
158 | |
159 | return NO_ERROR; |
160 | @@ -74,7 +77,11 @@ status_t BnDecodingService::onTransact( |
161 | sp<IGraphicBufferProducer> gbp; |
162 | status_t res = getIGraphicBufferProducer(&gbp); |
163 | |
164 | +#if ANDROID_VERSION_MAJOR>=6 |
165 | + reply->writeStrongBinder(IInterface::asBinder(gbp)); |
166 | +#else |
167 | reply->writeStrongBinder(gbp->asBinder()); |
168 | +#endif |
169 | reply->writeInt32(res); |
170 | |
171 | return NO_ERROR; |
172 | @@ -124,7 +131,11 @@ status_t BpDecodingService::registerSession(const sp<IDecodingServiceSession>& s |
173 | ALOGD("Entering %s", __PRETTY_FUNCTION__); |
174 | Parcel data, reply; |
175 | data.writeInterfaceToken(IDecodingService::getInterfaceDescriptor()); |
176 | +#if ANDROID_VERSION_MAJOR>=6 |
177 | + data.writeStrongBinder(IInterface::asBinder(session)); |
178 | +#else |
179 | data.writeStrongBinder(session->asBinder()); |
180 | +#endif |
181 | data.writeInt32(handle); |
182 | remote()->transact(REGISTER_SESSION, data, &reply); |
183 | return NO_ERROR; |
184 | @@ -195,7 +206,7 @@ status_t DecodingService::getIGraphicBufferConsumer(sp<IGraphicBufferConsumer>* |
185 | pid_t pid = IPCThreadState::self()->getCallingPid(); |
186 | ALOGD("Calling Pid: %d", pid); |
187 | |
188 | -#if ANDROID_VERSION_MAJOR==5 |
189 | +#if ANDROID_VERSION_MAJOR>=5 |
190 | *gbc = consumer; |
191 | #else |
192 | *gbc = buffer_queue; |
193 | @@ -209,7 +220,7 @@ status_t DecodingService::getIGraphicBufferProducer(sp<IGraphicBufferProducer>* |
194 | pid_t pid = IPCThreadState::self()->getCallingPid(); |
195 | ALOGD("Calling Pid: %d", pid); |
196 | |
197 | -#if ANDROID_VERSION_MAJOR==5 |
198 | +#if ANDROID_VERSION_MAJOR>=5 |
199 | *gbp = producer; |
200 | #else |
201 | *gbp = buffer_queue; |
202 | @@ -223,8 +234,13 @@ status_t DecodingService::registerSession(const sp<IDecodingServiceSession>& ses |
203 | ALOGD("Entering %s", __PRETTY_FUNCTION__); |
204 | |
205 | // Add session/handle to running clients map and connect death observer |
206 | +#if ANDROID_VERSION_MAJOR>=6 |
207 | + status_t ret = IInterface::asBinder(session)->linkToDeath(sp<IBinder::DeathRecipient>(this)); |
208 | + clientCbs.add(IInterface::asBinder(session), clients.valueFor(handle)); |
209 | +#else |
210 | status_t ret = session->asBinder()->linkToDeath(sp<IBinder::DeathRecipient>(this)); |
211 | clientCbs.add(session->asBinder(), clients.valueFor(handle)); |
212 | +#endif |
213 | clients.removeItem(handle); |
214 | |
215 | // Create a new BufferQueue instance so that the next created client plays |
216 | @@ -239,11 +255,15 @@ status_t DecodingService::unregisterSession() |
217 | ALOGD("Entering %s", __PRETTY_FUNCTION__); |
218 | if (session != NULL) |
219 | { |
220 | +#if ANDROID_VERSION_MAJOR>=6 |
221 | + IInterface::asBinder(session)->unlinkToDeath(this); |
222 | +#else |
223 | session->asBinder()->unlinkToDeath(this); |
224 | +#endif |
225 | session.clear(); |
226 | // Reset the BufferQueue instance so that the next created client plays |
227 | // video correctly |
228 | -#if ANDROID_VERSION_MAJOR==5 |
229 | +#if ANDROID_VERSION_MAJOR>=5 |
230 | producer.clear(); |
231 | consumer.clear(); |
232 | #else |
233 | @@ -261,7 +281,7 @@ void DecodingService::createBufferQueue() |
234 | sp<IGraphicBufferAlloc> g_buffer_alloc(new GraphicBufferAlloc()); |
235 | |
236 | // This BuferQueue is shared between the client and the service |
237 | -#if ANDROID_VERSION_MAJOR==5 |
238 | +#if ANDROID_VERSION_MAJOR>=5 |
239 | BufferQueue::createBufferQueue(&producer, &consumer); |
240 | #elif ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=3 |
241 | sp<NativeBufferAlloc> native_alloc(new NativeBufferAlloc()); |
242 | @@ -270,7 +290,7 @@ void DecodingService::createBufferQueue() |
243 | buffer_queue = new BufferQueue(NULL); |
244 | ALOGD("buffer_queue: %p", (void*)buffer_queue.get()); |
245 | #endif |
246 | -#if ANDROID_VERSION_MAJOR==5 |
247 | +#if ANDROID_VERSION_MAJOR>=5 |
248 | producer->setBufferCount(5); |
249 | #else |
250 | buffer_queue->setBufferCount(5); |
251 | diff --git a/compat/media/decoding_service_priv.h b/compat/media/decoding_service_priv.h |
252 | index 2a7544d..bf7cfb3 100644 |
253 | --- a/compat/media/decoding_service_priv.h |
254 | +++ b/compat/media/decoding_service_priv.h |
255 | @@ -130,7 +130,7 @@ protected: |
256 | |
257 | private: |
258 | static sp<DecodingService> decoding_service; |
259 | -#if ANDROID_VERSION_MAJOR==5 |
260 | +#if ANDROID_VERSION_MAJOR>=5 |
261 | sp<IGraphicBufferProducer> producer; |
262 | sp<IGraphicBufferConsumer> consumer; |
263 | #else |
264 | diff --git a/compat/media/media_codec_layer.cpp b/compat/media/media_codec_layer.cpp |
265 | index 4e885e9..98e0da3 100644 |
266 | --- a/compat/media/media_codec_layer.cpp |
267 | +++ b/compat/media/media_codec_layer.cpp |
268 | @@ -42,7 +42,9 @@ |
269 | #include <media/stagefright/foundation/AMessage.h> |
270 | #include <media/stagefright/MediaCodec.h> |
271 | #include <media/stagefright/MediaErrors.h> |
272 | +#if ANDROID_VERSION_MAJOR<=5 |
273 | #include <media/stagefright/NativeWindowWrapper.h> |
274 | +#endif |
275 | |
276 | #include <gui/IGraphicBufferProducer.h> |
277 | #include <binder/IServiceManager.h> |
278 | diff --git a/compat/media/media_codec_list.cpp b/compat/media/media_codec_list.cpp |
279 | index 930c4c8..f47562d 100644 |
280 | --- a/compat/media/media_codec_list.cpp |
281 | +++ b/compat/media/media_codec_list.cpp |
282 | @@ -60,7 +60,7 @@ void media_codec_list_get_codec_info_at_id(size_t index) |
283 | const char *media_codec_list_get_codec_name(size_t index) |
284 | { |
285 | REPORT_FUNCTION() |
286 | -#if ANDROID_VERSION_MAJOR==5 |
287 | +#if ANDROID_VERSION_MAJOR>=5 |
288 | return MediaCodecList::getInstance()->getCodecInfo(index)->getCodecName(); |
289 | #else |
290 | return MediaCodecList::getInstance()->getCodecName(index); |
291 | @@ -70,7 +70,7 @@ const char *media_codec_list_get_codec_name(size_t index) |
292 | bool media_codec_list_is_encoder(size_t index) |
293 | { |
294 | REPORT_FUNCTION() |
295 | -#if ANDROID_VERSION_MAJOR==5 |
296 | +#if ANDROID_VERSION_MAJOR>=5 |
297 | return MediaCodecList::getInstance()->getCodecInfo(index)->isEncoder(); |
298 | #else |
299 | return MediaCodecList::getInstance()->isEncoder(index); |
300 | @@ -82,7 +82,7 @@ size_t media_codec_list_get_num_supported_types(size_t index) |
301 | REPORT_FUNCTION() |
302 | |
303 | Vector<AString> types; |
304 | -#if ANDROID_VERSION_MAJOR==5 |
305 | +#if ANDROID_VERSION_MAJOR>=5 |
306 | MediaCodecList::getInstance()->getCodecInfo(index)->getSupportedMimes(&types); |
307 | #else |
308 | status_t err = MediaCodecList::getInstance()->getSupportedTypes(index, &types); |
309 | @@ -102,7 +102,7 @@ size_t media_codec_list_get_nth_supported_type_len(size_t index, size_t n) |
310 | REPORT_FUNCTION() |
311 | |
312 | Vector<AString> types; |
313 | -#if ANDROID_VERSION_MAJOR==5 |
314 | +#if ANDROID_VERSION_MAJOR>=5 |
315 | MediaCodecList::getInstance()->getCodecInfo(index)->getSupportedMimes(&types); |
316 | #else |
317 | status_t err = MediaCodecList::getInstance()->getSupportedTypes(index, &types); |
318 | @@ -122,7 +122,7 @@ int media_codec_list_get_nth_supported_type(size_t index, char *type, size_t n) |
319 | } |
320 | |
321 | Vector<AString> types; |
322 | -#if ANDROID_VERSION_MAJOR==5 |
323 | +#if ANDROID_VERSION_MAJOR>=5 |
324 | MediaCodecList::getInstance()->getCodecInfo(index)->getSupportedMimes(&types); |
325 | #else |
326 | status_t err = MediaCodecList::getInstance()->getSupportedTypes(index, &types); |
327 | @@ -130,7 +130,7 @@ int media_codec_list_get_nth_supported_type(size_t index, char *type, size_t n) |
328 | for (size_t i=0; i<types[n].size(); ++i) |
329 | type[i] = types.itemAt(n).c_str()[i]; |
330 | |
331 | -#if ANDROID_VERSION_MAJOR==5 |
332 | +#if ANDROID_VERSION_MAJOR>=5 |
333 | return OK; |
334 | #else |
335 | return err; |
336 | @@ -141,14 +141,14 @@ static void media_codec_list_get_num_codec_capabilities(size_t index, const char |
337 | { |
338 | REPORT_FUNCTION() |
339 | |
340 | -#if ANDROID_VERSION_MAJOR==5 |
341 | +#if ANDROID_VERSION_MAJOR>=5 |
342 | Vector<MediaCodecInfo::ProfileLevel> profile_levels; |
343 | #else |
344 | Vector<MediaCodecList::ProfileLevel> profile_levels; |
345 | #endif |
346 | Vector<uint32_t> color_formats; |
347 | ALOGD("index: %d, type: '%s'", index, type); |
348 | -#if ANDROID_VERSION_MAJOR==5 |
349 | +#if ANDROID_VERSION_MAJOR>=5 |
350 | MediaCodecList::getInstance()->getCodecInfo(index)->getCapabilitiesFor(type)->getSupportedProfileLevels(&profile_levels); |
351 | MediaCodecList::getInstance()->getCodecInfo(index)->getCapabilitiesFor(type)->getSupportedColorFormats(&color_formats); |
352 | #elif ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=3 |
353 | @@ -213,13 +213,13 @@ int media_codec_list_get_nth_codec_profile_level(size_t index, const char *type, |
354 | return BAD_VALUE; |
355 | } |
356 | |
357 | -#if ANDROID_VERSION_MAJOR==5 |
358 | +#if ANDROID_VERSION_MAJOR>=5 |
359 | Vector<MediaCodecInfo::ProfileLevel> profile_levels; |
360 | #else |
361 | Vector<MediaCodecList::ProfileLevel> profile_levels; |
362 | #endif |
363 | Vector<uint32_t> formats; |
364 | -#if ANDROID_VERSION_MAJOR==5 |
365 | +#if ANDROID_VERSION_MAJOR>=5 |
366 | MediaCodecList::getInstance()->getCodecInfo(index)->getCapabilitiesFor(type)->getSupportedProfileLevels(&profile_levels); |
367 | #elif ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=3 |
368 | status_t err = MediaCodecList::getInstance()->getCodecCapabilities(index, type, &profile_levels, &formats); |
369 | @@ -238,7 +238,7 @@ int media_codec_list_get_nth_codec_profile_level(size_t index, const char *type, |
370 | pro_level->profile = profile_levels[n].mProfile; |
371 | pro_level->level = profile_levels[n].mLevel; |
372 | |
373 | -#if ANDROID_VERSION_MAJOR==5 |
374 | +#if ANDROID_VERSION_MAJOR>=5 |
375 | return OK; |
376 | #else |
377 | return err; |
378 | @@ -249,13 +249,13 @@ int media_codec_list_get_codec_color_formats(size_t index, const char *type, uin |
379 | { |
380 | REPORT_FUNCTION() |
381 | |
382 | -#if ANDROID_VERSION_MAJOR==5 |
383 | +#if ANDROID_VERSION_MAJOR>=5 |
384 | Vector<MediaCodecInfo::ProfileLevel> profile_levels; |
385 | #else |
386 | Vector<MediaCodecList::ProfileLevel> profile_levels; |
387 | #endif |
388 | Vector<uint32_t> formats; |
389 | -#if ANDROID_VERSION_MAJOR==5 |
390 | +#if ANDROID_VERSION_MAJOR>=5 |
391 | MediaCodecList::getInstance()->getCodecInfo(index)->getCapabilitiesFor(type)->getSupportedColorFormats(&formats); |
392 | #elif ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=3 |
393 | status_t err = MediaCodecList::getInstance()->getCodecCapabilities(index, type, &profile_levels, &formats); |
394 | diff --git a/compat/media/media_codec_source_layer.cpp b/compat/media/media_codec_source_layer.cpp |
395 | index 3eec21a..29200fb 100644 |
396 | --- a/compat/media/media_codec_source_layer.cpp |
397 | +++ b/compat/media/media_codec_source_layer.cpp |
398 | @@ -254,8 +254,12 @@ MediaCodecSourceWrapper* media_codec_source_create(MediaMessageWrapper *format, |
399 | MediaMessagePrivate *dm = MediaMessagePrivate::toPrivate(format); |
400 | |
401 | ALOGV("Creating media codec source"); |
402 | - |
403 | +#if ANDROID_VERSION_MAJOR>=6 |
404 | + // We don't use persistent input surface |
405 | + d->codec = android::MediaCodecSource::Create(d->looper, dm->msg, d->source, NULL, flags); |
406 | +#else |
407 | d->codec = android::MediaCodecSource::Create(d->looper, dm->msg, d->source, flags); |
408 | +#endif |
409 | |
410 | return d; |
411 | } |
412 | diff --git a/compat/media/media_compatibility_layer.cpp b/compat/media/media_compatibility_layer.cpp |
413 | index bb86e5c..82c00c3 100644 |
414 | --- a/compat/media/media_compatibility_layer.cpp |
415 | +++ b/compat/media/media_compatibility_layer.cpp |
416 | @@ -87,7 +87,7 @@ struct FrameAvailableListener : public android::GLConsumer::FrameAvailableListen |
417 | } |
418 | |
419 | // From android::GLConsumer/SurfaceTexture::FrameAvailableListener |
420 | -#if ANDROID_VERSION_MAJOR==5 && ANDROID_VERSION_MINOR>=1 |
421 | +#if ANDROID_VERSION_MAJOR==5 && ANDROID_VERSION_MINOR>=1 || ANDROID_VERSION_MAJOR>=6 |
422 | virtual void onFrameAvailable(const android::BufferItem& item) |
423 | #else |
424 | virtual void onFrameAvailable() |
425 | @@ -242,7 +242,7 @@ struct MediaPlayerWrapper : public android::MediaPlayer |
426 | source_fd = -1; |
427 | } |
428 | |
429 | -#if ANDROID_VERSION_MAJOR==5 |
430 | +#if ANDROID_VERSION_MAJOR>=5 |
431 | android::status_t setVideoSurfaceTexture(android::sp<android::IGraphicBufferProducer> bq, const android::sp<android::GLConsumer> &surfaceTexture) |
432 | #elif ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=2 |
433 | android::status_t setVideoSurfaceTexture(const android::sp<android::SurfaceTexture> &surfaceTexture) |
434 | @@ -492,7 +492,7 @@ int android_media_set_preview_texture(MediaPlayerWrapper *mp, int texture_id) |
435 | new android::NativeBufferAlloc() |
436 | ); |
437 | |
438 | -#if ANDROID_VERSION_MAJOR==5 |
439 | +#if ANDROID_VERSION_MAJOR>=5 |
440 | android::sp<IGraphicBufferProducer> producer; |
441 | android::sp<IGraphicBufferConsumer> consumer; |
442 | BufferQueue::createBufferQueue(&producer, &consumer); |
443 | @@ -508,7 +508,7 @@ int android_media_set_preview_texture(MediaPlayerWrapper *mp, int texture_id) |
444 | |
445 | static const bool allow_synchronous_mode = true; |
446 | // Create a new GLConsumer/SurfaceTexture from the texture_id in synchronous mode (don't wait on all data in the buffer) |
447 | -#if ANDROID_VERSION_MAJOR==5 |
448 | +#if ANDROID_VERSION_MAJOR>=5 |
449 | mp->setVideoSurfaceTexture(producer, android::sp<android::GLConsumer>( |
450 | new android::GLConsumer( |
451 | #elif ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=2 |
452 | @@ -518,7 +518,7 @@ int android_media_set_preview_texture(MediaPlayerWrapper *mp, int texture_id) |
453 | mp->setVideoSurfaceTexture(buffer_queue, android::sp<android::GLConsumer>( |
454 | new android::GLConsumer( |
455 | #endif |
456 | -#if ANDROID_VERSION_MAJOR==5 |
457 | +#if ANDROID_VERSION_MAJOR>=5 |
458 | consumer, |
459 | texture_id, |
460 | GL_TEXTURE_EXTERNAL_OES, |
461 | diff --git a/compat/media/media_recorder.cpp b/compat/media/media_recorder.cpp |
462 | index cdbf1c7..8db16a3 100644 |
463 | --- a/compat/media/media_recorder.cpp |
464 | +++ b/compat/media/media_recorder.cpp |
465 | @@ -262,7 +262,7 @@ status_t MediaRecorder::setAudioEncoder(int ae) |
466 | mIsAudioEncoderSet = true; |
467 | return ret; |
468 | } |
469 | - |
470 | +#if ANDROID_VERSION_MAJOR<=5 |
471 | status_t MediaRecorder::setOutputFile(const char* path) |
472 | { |
473 | ALOGV("setOutputFile(%s)", path); |
474 | @@ -288,6 +288,7 @@ status_t MediaRecorder::setOutputFile(const char* path) |
475 | mIsOutputFileSet = true; |
476 | return ret; |
477 | } |
478 | +#endif |
479 | |
480 | status_t MediaRecorder::setOutputFile(int fd, int64_t offset, int64_t length) |
481 | { |
482 | diff --git a/compat/media/media_recorder.h b/compat/media/media_recorder.h |
483 | index a73769b..d9c3d60 100644 |
484 | --- a/compat/media/media_recorder.h |
485 | +++ b/compat/media/media_recorder.h |
486 | @@ -221,7 +221,9 @@ public: |
487 | status_t setOutputFormat(int of); |
488 | status_t setVideoEncoder(int ve); |
489 | status_t setAudioEncoder(int ae); |
490 | +#if ANDROID_VERSION_MAJOR<=5 |
491 | status_t setOutputFile(const char* path); |
492 | +#endif |
493 | status_t setOutputFile(int fd, int64_t offset, int64_t length); |
494 | status_t setVideoSize(int width, int height); |
495 | status_t setVideoFrameRate(int frames_per_second); |
496 | diff --git a/compat/media/media_recorder_client.cpp b/compat/media/media_recorder_client.cpp |
497 | index 1814c00..b781dea 100644 |
498 | --- a/compat/media/media_recorder_client.cpp |
499 | +++ b/compat/media/media_recorder_client.cpp |
500 | @@ -38,7 +38,13 @@ MediaRecorderClient::MediaRecorderClient() |
501 | |
502 | media_recorder_observer = new BpMediaRecorderObserver(service); |
503 | |
504 | +#if ANDROID_VERSION_MAJOR>=6 |
505 | + // TODO: do we need to get valid package here? |
506 | + const String16 opPackageName("ubuntu"); |
507 | + recorder = new android::StagefrightRecorder(opPackageName); |
508 | +#else |
509 | recorder = new android::StagefrightRecorder; |
510 | +#endif |
511 | } |
512 | |
513 | MediaRecorderClient::~MediaRecorderClient() |
514 | @@ -125,6 +131,7 @@ status_t MediaRecorderClient::setAudioEncoder(int ae) |
515 | return recorder->setAudioEncoder((android::audio_encoder)ae); |
516 | } |
517 | |
518 | +#if ANDROID_VERSION_MAJOR<=5 |
519 | status_t MediaRecorderClient::setOutputFile(const char* path) |
520 | { |
521 | REPORT_FUNCTION(); |
522 | @@ -135,6 +142,18 @@ status_t MediaRecorderClient::setOutputFile(const char* path) |
523 | } |
524 | return recorder->setOutputFile(path); |
525 | } |
526 | +#else |
527 | +status_t MediaRecorderClient::setInputSurface(const sp<IGraphicBufferConsumer>& surface) |
528 | +{ |
529 | + REPORT_FUNCTION(); |
530 | + Mutex::Autolock lock(recorder_lock); |
531 | + if (recorder == NULL) { |
532 | + ALOGE("recorder must not be NULL"); |
533 | + return NO_INIT; |
534 | + } |
535 | + return recorder->setInputSurface(surface); |
536 | +} |
537 | +#endif |
538 | |
539 | status_t MediaRecorderClient::setOutputFile(int fd, int64_t offset, int64_t length) |
540 | { |
541 | diff --git a/compat/media/media_recorder_client.h b/compat/media/media_recorder_client.h |
542 | index e6a7800..6ee40dc 100644 |
543 | --- a/compat/media/media_recorder_client.h |
544 | +++ b/compat/media/media_recorder_client.h |
545 | @@ -49,7 +49,11 @@ public: |
546 | virtual status_t setOutputFormat(int of); |
547 | virtual status_t setVideoEncoder(int ve); |
548 | virtual status_t setAudioEncoder(int ae); |
549 | +#if ANDROID_VERSION_MAJOR<=5 |
550 | virtual status_t setOutputFile(const char* path); |
551 | +#else |
552 | + virtual status_t setInputSurface(const sp<IGraphicBufferConsumer>& surface); |
553 | +#endif |
554 | virtual status_t setOutputFile(int fd, int64_t offset, int64_t length); |
555 | virtual status_t setVideoSize(int width, int height); |
556 | virtual status_t setVideoFrameRate(int frames_per_second); |
557 | diff --git a/compat/media/media_recorder_factory.cpp b/compat/media/media_recorder_factory.cpp |
558 | index 178b48c..e4b6a5f 100644 |
559 | --- a/compat/media/media_recorder_factory.cpp |
560 | +++ b/compat/media/media_recorder_factory.cpp |
561 | @@ -69,7 +69,12 @@ status_t BnMediaRecorderFactory::onTransact( |
562 | case CREATE_MEDIA_RECORDER: { |
563 | CHECK_INTERFACE(IMediaRecorderFactory, data, reply); |
564 | sp<IMediaRecorder> recorder = createMediaRecorder(); |
565 | +#if ANDROID_VERSION_MAJOR>=6 |
566 | + reply->writeStrongBinder(IInterface::asBinder(recorder)); |
567 | +#else |
568 | reply->writeStrongBinder(recorder->asBinder()); |
569 | +#endif |
570 | + |
571 | return NO_ERROR; |
572 | } break; |
573 | default: |
574 | diff --git a/compat/media/surface_texture_client_hybris.cpp b/compat/media/surface_texture_client_hybris.cpp |
575 | index dfd3138..a3af4f2 100644 |
576 | --- a/compat/media/surface_texture_client_hybris.cpp |
577 | +++ b/compat/media/surface_texture_client_hybris.cpp |
578 | @@ -68,7 +68,7 @@ _SurfaceTextureClientHybris::_SurfaceTextureClientHybris() |
579 | } |
580 | #endif |
581 | |
582 | -#if ANDROID_VERSION_MAJOR==5 |
583 | +#if ANDROID_VERSION_MAJOR>=5 |
584 | _SurfaceTextureClientHybris::_SurfaceTextureClientHybris(const sp<IGraphicBufferProducer> &st) |
585 | : Surface::Surface(st, true), |
586 | refcount(1), |
587 | @@ -218,7 +218,7 @@ SurfaceTextureClientHybris surface_texture_client_create_by_id(unsigned int text |
588 | ALOGE("Cannot create new SurfaceTextureClientHybris, texture id must be > 0."); |
589 | return NULL; |
590 | } |
591 | -#if ANDROID_VERSION_MAJOR==5 |
592 | +#if ANDROID_VERSION_MAJOR>=5 |
593 | sp<IGraphicBufferProducer> producer; |
594 | sp<IGraphicBufferConsumer> consumer; |
595 | BufferQueue::createBufferQueue(&producer, &consumer); |
596 | @@ -242,7 +242,7 @@ SurfaceTextureClientHybris surface_texture_client_create_by_id(unsigned int text |
597 | stch->surface_texture.clear(); |
598 | |
599 | const bool allow_synchronous_mode = true; |
600 | -#if ANDROID_VERSION_MAJOR==5 |
601 | +#if ANDROID_VERSION_MAJOR>=5 |
602 | stch->surface_texture = new GLConsumer(consumer, texture_id, GL_TEXTURE_EXTERNAL_OES, true, true); |
603 | #elif ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=2 |
604 | stch->surface_texture = new SurfaceTexture(texture_id, allow_synchronous_mode, GL_TEXTURE_EXTERNAL_OES, true, buffer_queue); |
605 | diff --git a/compat/media/surface_texture_client_hybris_priv.h b/compat/media/surface_texture_client_hybris_priv.h |
606 | index 189dca6..e168bf8 100644 |
607 | --- a/compat/media/surface_texture_client_hybris_priv.h |
608 | +++ b/compat/media/surface_texture_client_hybris_priv.h |
609 | @@ -89,7 +89,7 @@ class _GLConsumerHybris : public GLConsumer |
610 | { |
611 | } |
612 | |
613 | -#if ANDROID_VERSION_MAJOR==5 && ANDROID_VERSION_MINOR>=1 |
614 | +#if ANDROID_VERSION_MAJOR==5 && ANDROID_VERSION_MINOR>=1 || ANDROID_VERSION_MAJOR>=6 |
615 | virtual void onFrameAvailable(const android::BufferItem& item) |
616 | #else |
617 | virtual void onFrameAvailable() |
618 | diff --git a/compat/surface_flinger/surface_flinger_compatibility_layer.cpp b/compat/surface_flinger/surface_flinger_compatibility_layer.cpp |
619 | index 90249e6..6a32f22 100644 |
620 | --- a/compat/surface_flinger/surface_flinger_compatibility_layer.cpp |
621 | +++ b/compat/surface_flinger/surface_flinger_compatibility_layer.cpp |
622 | @@ -28,7 +28,7 @@ |
623 | #include <ui/PixelFormat.h> |
624 | #include <ui/Region.h> |
625 | #include <ui/Rect.h> |
626 | -#if ANDROID_VERSION_MAJOR==5 |
627 | +#if ANDROID_VERSION_MAJOR>=5 |
628 | #include <hardware/hwcomposer_defs.h> |
629 | #endif |
630 | |
631 | @@ -85,7 +85,7 @@ void sf_blank(size_t display_id) |
632 | |
633 | #if ANDROID_VERSION_MAJOR<=4 |
634 | android::SurfaceComposerClient::blankDisplay(display); |
635 | -#elif ANDROID_VERSION_MAJOR==5 |
636 | +#elif ANDROID_VERSION_MAJOR>=5 |
637 | android::SurfaceComposerClient::setDisplayPowerMode(display, HWC_POWER_MODE_OFF); |
638 | #endif |
639 | } |
640 | @@ -107,7 +107,7 @@ void sf_unblank(size_t display_id) |
641 | |
642 | #if ANDROID_VERSION_MAJOR<=4 |
643 | android::SurfaceComposerClient::unblankDisplay(display); |
644 | -#elif ANDROID_VERSION_MAJOR==5 |
645 | +#elif ANDROID_VERSION_MAJOR>=5 |
646 | android::SurfaceComposerClient::setDisplayPowerMode(display, HWC_POWER_MODE_NORMAL); |
647 | #endif |
648 | } |
649 | diff --git a/hybris/include/hybris/internal/camera_control.h b/hybris/include/hybris/internal/camera_control.h |
650 | index 845513a..2ea1bb9 100644 |
651 | --- a/hybris/include/hybris/internal/camera_control.h |
652 | +++ b/hybris/include/hybris/internal/camera_control.h |
653 | @@ -51,7 +51,7 @@ struct CameraControl : public android::CameraListener, |
654 | android::sp<android::GLConsumer> preview_texture; |
655 | #endif |
656 | // From android::SurfaceTexture/GLConsumer::FrameAvailableListener |
657 | -#if ANDROID_VERSION_MAJOR==5 && ANDROID_VERSION_MINOR>=1 |
658 | +#if ANDROID_VERSION_MAJOR==5 && ANDROID_VERSION_MINOR>=1 || ANDROID_VERSION_MAJOR>=6 |
659 | void onFrameAvailable(const android::BufferItem& item); |
660 | #else |
661 | void onFrameAvailable(); |
LGTM