Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #define LOG_TAG "SurfaceControl" |
| 18 | |
| 19 | #include <stdio.h> |
| 20 | |
| 21 | #include "jni.h" |
| 22 | #include "JNIHelp.h" |
| 23 | |
| 24 | #include "android_os_Parcel.h" |
| 25 | #include "android_util_Binder.h" |
| 26 | #include "android/graphics/GraphicsJNI.h" |
| 27 | #include "android/graphics/Region.h" |
| 28 | |
| 29 | #include <android_runtime/AndroidRuntime.h> |
Mathias Agopian | 0449a40 | 2013-03-01 23:01:51 -0800 | [diff] [blame] | 30 | #include <android_runtime/android_view_Surface.h> |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 31 | #include <android_runtime/android_view_SurfaceSession.h> |
| 32 | |
| 33 | #include <gui/Surface.h> |
| 34 | #include <gui/SurfaceComposerClient.h> |
| 35 | |
| 36 | #include <ui/DisplayInfo.h> |
Svetoslav | 1376d60 | 2014-03-13 11:17:26 -0700 | [diff] [blame] | 37 | #include <ui/FrameStats.h> |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 38 | #include <ui/Rect.h> |
| 39 | #include <ui/Region.h> |
| 40 | |
| 41 | #include <utils/Log.h> |
| 42 | |
| 43 | #include <ScopedUtfChars.h> |
| 44 | |
| 45 | // ---------------------------------------------------------------------------- |
| 46 | |
| 47 | namespace android { |
| 48 | |
| 49 | static const char* const OutOfResourcesException = |
| 50 | "android/view/Surface$OutOfResourcesException"; |
| 51 | |
| 52 | static struct { |
Dan Stoza | 0010105 | 2014-05-02 15:23:40 -0700 | [diff] [blame^] | 53 | jclass clazz; |
| 54 | jmethodID ctor; |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 55 | jfieldID width; |
| 56 | jfieldID height; |
| 57 | jfieldID refreshRate; |
| 58 | jfieldID density; |
| 59 | jfieldID xDpi; |
| 60 | jfieldID yDpi; |
| 61 | jfieldID secure; |
| 62 | } gPhysicalDisplayInfoClassInfo; |
| 63 | |
Leon Scroggins | 46cb9bd | 2014-03-06 15:36:39 -0500 | [diff] [blame] | 64 | // Implements SkMallocPixelRef::ReleaseProc, to delete the screenshot on unref. |
| 65 | void DeleteScreenshot(void* addr, void* context) { |
| 66 | SkASSERT(addr == ((ScreenshotClient*) context)->getPixels()); |
| 67 | delete ((ScreenshotClient*) context); |
| 68 | } |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 69 | |
Svetoslav | 1376d60 | 2014-03-13 11:17:26 -0700 | [diff] [blame] | 70 | static struct { |
| 71 | nsecs_t UNDEFINED_TIME_NANO; |
| 72 | jmethodID init; |
| 73 | } gWindowContentFrameStatsClassInfo; |
| 74 | |
| 75 | static struct { |
| 76 | nsecs_t UNDEFINED_TIME_NANO; |
| 77 | jmethodID init; |
| 78 | } gWindowAnimationFrameStatsClassInfo; |
| 79 | |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 80 | // ---------------------------------------------------------------------------- |
| 81 | |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 82 | static jlong nativeCreate(JNIEnv* env, jclass clazz, jobject sessionObj, |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 83 | jstring nameStr, jint w, jint h, jint format, jint flags) { |
| 84 | ScopedUtfChars name(env, nameStr); |
| 85 | sp<SurfaceComposerClient> client(android_view_SurfaceSession_getClient(env, sessionObj)); |
| 86 | sp<SurfaceControl> surface = client->createSurface( |
| 87 | String8(name.c_str()), w, h, format, flags); |
| 88 | if (surface == NULL) { |
| 89 | jniThrowException(env, OutOfResourcesException, NULL); |
| 90 | return 0; |
| 91 | } |
Mathias Agopian | b1d90c8 | 2013-03-06 17:45:42 -0800 | [diff] [blame] | 92 | surface->incStrong((void *)nativeCreate); |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 93 | return reinterpret_cast<jlong>(surface.get()); |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 94 | } |
| 95 | |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 96 | static void nativeRelease(JNIEnv* env, jclass clazz, jlong nativeObject) { |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 97 | sp<SurfaceControl> ctrl(reinterpret_cast<SurfaceControl *>(nativeObject)); |
Mathias Agopian | b1d90c8 | 2013-03-06 17:45:42 -0800 | [diff] [blame] | 98 | ctrl->decStrong((void *)nativeCreate); |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 99 | } |
| 100 | |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 101 | static void nativeDestroy(JNIEnv* env, jclass clazz, jlong nativeObject) { |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 102 | sp<SurfaceControl> ctrl(reinterpret_cast<SurfaceControl *>(nativeObject)); |
| 103 | ctrl->clear(); |
Mathias Agopian | b1d90c8 | 2013-03-06 17:45:42 -0800 | [diff] [blame] | 104 | ctrl->decStrong((void *)nativeCreate); |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 105 | } |
| 106 | |
Mathias Agopian | 0449a40 | 2013-03-01 23:01:51 -0800 | [diff] [blame] | 107 | static jobject nativeScreenshotBitmap(JNIEnv* env, jclass clazz, jobject displayTokenObj, |
Dan Stoza | 16ec12a | 2014-02-14 15:06:55 -0800 | [diff] [blame] | 108 | jint width, jint height, jint minLayer, jint maxLayer, bool allLayers, |
| 109 | bool useIdentityTransform) { |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 110 | sp<IBinder> displayToken = ibinderForJavaObject(env, displayTokenObj); |
| 111 | if (displayToken == NULL) { |
| 112 | return NULL; |
| 113 | } |
| 114 | |
Derek Sollenberger | b644a3b | 2014-01-17 15:45:10 -0500 | [diff] [blame] | 115 | ScreenshotClient* screenshot = new ScreenshotClient(); |
| 116 | status_t res; |
| 117 | if (width > 0 && height > 0) { |
| 118 | if (allLayers) { |
| 119 | res = screenshot->update(displayToken, width, height, useIdentityTransform); |
| 120 | } else { |
| 121 | res = screenshot->update(displayToken, width, height, minLayer, maxLayer, |
| 122 | useIdentityTransform); |
| 123 | } |
| 124 | } else { |
| 125 | res = screenshot->update(displayToken, useIdentityTransform); |
| 126 | } |
| 127 | if (res != NO_ERROR) { |
| 128 | delete screenshot; |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 129 | return NULL; |
| 130 | } |
| 131 | |
Derek Sollenberger | b644a3b | 2014-01-17 15:45:10 -0500 | [diff] [blame] | 132 | SkImageInfo screenshotInfo; |
| 133 | screenshotInfo.fWidth = screenshot->getWidth(); |
| 134 | screenshotInfo.fHeight = screenshot->getHeight(); |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 135 | |
Derek Sollenberger | b644a3b | 2014-01-17 15:45:10 -0500 | [diff] [blame] | 136 | switch (screenshot->getFormat()) { |
| 137 | case PIXEL_FORMAT_RGBX_8888: { |
| 138 | screenshotInfo.fColorType = kRGBA_8888_SkColorType; |
| 139 | screenshotInfo.fAlphaType = kIgnore_SkAlphaType; |
| 140 | break; |
| 141 | } |
| 142 | case PIXEL_FORMAT_RGBA_8888: { |
| 143 | screenshotInfo.fColorType = kRGBA_8888_SkColorType; |
| 144 | screenshotInfo.fAlphaType = kPremul_SkAlphaType; |
| 145 | break; |
| 146 | } |
| 147 | case PIXEL_FORMAT_RGB_565: { |
| 148 | screenshotInfo.fColorType = kRGB_565_SkColorType; |
| 149 | screenshotInfo.fAlphaType = kIgnore_SkAlphaType; |
| 150 | break; |
| 151 | } |
| 152 | default: { |
| 153 | delete screenshot; |
| 154 | return NULL; |
| 155 | } |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 156 | } |
| 157 | |
Derek Sollenberger | b644a3b | 2014-01-17 15:45:10 -0500 | [diff] [blame] | 158 | const ssize_t rowBytes = |
| 159 | screenshot->getStride() * android::bytesPerPixel(screenshot->getFormat()); |
| 160 | |
| 161 | SkBitmap* bitmap = new SkBitmap(); |
| 162 | bitmap->setConfig(screenshotInfo, (size_t)rowBytes); |
| 163 | if (screenshotInfo.fWidth > 0 && screenshotInfo.fHeight > 0) { |
Leon Scroggins | 46cb9bd | 2014-03-06 15:36:39 -0500 | [diff] [blame] | 164 | // takes ownership of ScreenshotClient |
| 165 | SkMallocPixelRef* pixels = SkMallocPixelRef::NewWithProc(screenshotInfo, |
| 166 | (size_t) rowBytes, NULL, (void*) screenshot->getPixels(), &DeleteScreenshot, |
| 167 | (void*) screenshot); |
| 168 | pixels->setImmutable(); |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 169 | bitmap->setPixelRef(pixels)->unref(); |
| 170 | bitmap->lockPixels(); |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 171 | } |
| 172 | |
Chris Craik | 1abf5d6 | 2013-08-16 12:47:03 -0700 | [diff] [blame] | 173 | return GraphicsJNI::createBitmap(env, bitmap, |
| 174 | GraphicsJNI::kBitmapCreateFlag_Premultiplied, NULL); |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 175 | } |
| 176 | |
Mathias Agopian | 0449a40 | 2013-03-01 23:01:51 -0800 | [diff] [blame] | 177 | static void nativeScreenshot(JNIEnv* env, jclass clazz, |
| 178 | jobject displayTokenObj, jobject surfaceObj, |
Dan Stoza | 16ec12a | 2014-02-14 15:06:55 -0800 | [diff] [blame] | 179 | jint width, jint height, jint minLayer, jint maxLayer, bool allLayers, |
| 180 | bool useIdentityTransform) { |
Mathias Agopian | 0449a40 | 2013-03-01 23:01:51 -0800 | [diff] [blame] | 181 | sp<IBinder> displayToken = ibinderForJavaObject(env, displayTokenObj); |
| 182 | if (displayToken != NULL) { |
| 183 | sp<Surface> consumer = android_view_Surface_getSurface(env, surfaceObj); |
| 184 | if (consumer != NULL) { |
| 185 | if (allLayers) { |
| 186 | minLayer = 0; |
| 187 | maxLayer = -1; |
| 188 | } |
| 189 | ScreenshotClient::capture( |
| 190 | displayToken, consumer->getIGraphicBufferProducer(), |
Dan Stoza | 16ec12a | 2014-02-14 15:06:55 -0800 | [diff] [blame] | 191 | width, height, uint32_t(minLayer), uint32_t(maxLayer), |
| 192 | useIdentityTransform); |
Mathias Agopian | 0449a40 | 2013-03-01 23:01:51 -0800 | [diff] [blame] | 193 | } |
| 194 | } |
| 195 | } |
| 196 | |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 197 | static void nativeOpenTransaction(JNIEnv* env, jclass clazz) { |
| 198 | SurfaceComposerClient::openGlobalTransaction(); |
| 199 | } |
| 200 | |
| 201 | static void nativeCloseTransaction(JNIEnv* env, jclass clazz) { |
| 202 | SurfaceComposerClient::closeGlobalTransaction(); |
| 203 | } |
| 204 | |
| 205 | static void nativeSetAnimationTransaction(JNIEnv* env, jclass clazz) { |
| 206 | SurfaceComposerClient::setAnimationTransaction(); |
| 207 | } |
| 208 | |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 209 | static void nativeSetLayer(JNIEnv* env, jclass clazz, jlong nativeObject, jint zorder) { |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 210 | SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); |
| 211 | status_t err = ctrl->setLayer(zorder); |
| 212 | if (err < 0 && err != NO_INIT) { |
| 213 | doThrowIAE(env); |
| 214 | } |
| 215 | } |
| 216 | |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 217 | static void nativeSetPosition(JNIEnv* env, jclass clazz, jlong nativeObject, jfloat x, jfloat y) { |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 218 | SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); |
| 219 | status_t err = ctrl->setPosition(x, y); |
| 220 | if (err < 0 && err != NO_INIT) { |
| 221 | doThrowIAE(env); |
| 222 | } |
| 223 | } |
| 224 | |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 225 | static void nativeSetSize(JNIEnv* env, jclass clazz, jlong nativeObject, jint w, jint h) { |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 226 | SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); |
| 227 | status_t err = ctrl->setSize(w, h); |
| 228 | if (err < 0 && err != NO_INIT) { |
| 229 | doThrowIAE(env); |
| 230 | } |
| 231 | } |
| 232 | |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 233 | static void nativeSetFlags(JNIEnv* env, jclass clazz, jlong nativeObject, jint flags, jint mask) { |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 234 | SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); |
| 235 | status_t err = ctrl->setFlags(flags, mask); |
| 236 | if (err < 0 && err != NO_INIT) { |
| 237 | doThrowIAE(env); |
| 238 | } |
| 239 | } |
| 240 | |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 241 | static void nativeSetTransparentRegionHint(JNIEnv* env, jclass clazz, jlong nativeObject, jobject regionObj) { |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 242 | SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); |
| 243 | SkRegion* region = android_graphics_Region_getSkRegion(env, regionObj); |
| 244 | if (!region) { |
| 245 | doThrowIAE(env); |
| 246 | return; |
| 247 | } |
| 248 | |
| 249 | const SkIRect& b(region->getBounds()); |
| 250 | Region reg(Rect(b.fLeft, b.fTop, b.fRight, b.fBottom)); |
| 251 | if (region->isComplex()) { |
| 252 | SkRegion::Iterator it(*region); |
| 253 | while (!it.done()) { |
| 254 | const SkIRect& r(it.rect()); |
| 255 | reg.addRectUnchecked(r.fLeft, r.fTop, r.fRight, r.fBottom); |
| 256 | it.next(); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | status_t err = ctrl->setTransparentRegionHint(reg); |
| 261 | if (err < 0 && err != NO_INIT) { |
| 262 | doThrowIAE(env); |
| 263 | } |
| 264 | } |
| 265 | |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 266 | static void nativeSetAlpha(JNIEnv* env, jclass clazz, jlong nativeObject, jfloat alpha) { |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 267 | SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); |
| 268 | status_t err = ctrl->setAlpha(alpha); |
| 269 | if (err < 0 && err != NO_INIT) { |
| 270 | doThrowIAE(env); |
| 271 | } |
| 272 | } |
| 273 | |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 274 | static void nativeSetMatrix(JNIEnv* env, jclass clazz, jlong nativeObject, |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 275 | jfloat dsdx, jfloat dtdx, jfloat dsdy, jfloat dtdy) { |
| 276 | SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); |
| 277 | status_t err = ctrl->setMatrix(dsdx, dtdx, dsdy, dtdy); |
| 278 | if (err < 0 && err != NO_INIT) { |
| 279 | doThrowIAE(env); |
| 280 | } |
| 281 | } |
| 282 | |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 283 | static void nativeSetWindowCrop(JNIEnv* env, jclass clazz, jlong nativeObject, |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 284 | jint l, jint t, jint r, jint b) { |
| 285 | SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); |
| 286 | Rect crop(l, t, r, b); |
| 287 | status_t err = ctrl->setCrop(crop); |
| 288 | if (err < 0 && err != NO_INIT) { |
| 289 | doThrowIAE(env); |
| 290 | } |
| 291 | } |
| 292 | |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 293 | static void nativeSetLayerStack(JNIEnv* env, jclass clazz, jlong nativeObject, jint layerStack) { |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 294 | SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); |
| 295 | status_t err = ctrl->setLayerStack(layerStack); |
| 296 | if (err < 0 && err != NO_INIT) { |
| 297 | doThrowIAE(env); |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | static jobject nativeGetBuiltInDisplay(JNIEnv* env, jclass clazz, jint id) { |
| 302 | sp<IBinder> token(SurfaceComposerClient::getBuiltInDisplay(id)); |
| 303 | return javaObjectForIBinder(env, token); |
| 304 | } |
| 305 | |
| 306 | static jobject nativeCreateDisplay(JNIEnv* env, jclass clazz, jstring nameObj, |
| 307 | jboolean secure) { |
| 308 | ScopedUtfChars name(env, nameObj); |
| 309 | sp<IBinder> token(SurfaceComposerClient::createDisplay( |
| 310 | String8(name.c_str()), bool(secure))); |
| 311 | return javaObjectForIBinder(env, token); |
| 312 | } |
| 313 | |
Jesse Hall | 6a6bc21 | 2013-08-08 12:15:03 -0700 | [diff] [blame] | 314 | static void nativeDestroyDisplay(JNIEnv* env, jclass clazz, jobject tokenObj) { |
| 315 | sp<IBinder> token(ibinderForJavaObject(env, tokenObj)); |
| 316 | if (token == NULL) return; |
| 317 | SurfaceComposerClient::destroyDisplay(token); |
| 318 | } |
| 319 | |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 320 | static void nativeSetDisplaySurface(JNIEnv* env, jclass clazz, |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 321 | jobject tokenObj, jlong nativeSurfaceObject) { |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 322 | sp<IBinder> token(ibinderForJavaObject(env, tokenObj)); |
| 323 | if (token == NULL) return; |
Mathias Agopian | ffddc9b | 2013-02-25 15:56:31 -0800 | [diff] [blame] | 324 | sp<IGraphicBufferProducer> bufferProducer; |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 325 | sp<Surface> sur(reinterpret_cast<Surface *>(nativeSurfaceObject)); |
Mathias Agopian | ffddc9b | 2013-02-25 15:56:31 -0800 | [diff] [blame] | 326 | if (sur != NULL) { |
| 327 | bufferProducer = sur->getIGraphicBufferProducer(); |
| 328 | } |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 329 | SurfaceComposerClient::setDisplaySurface(token, bufferProducer); |
| 330 | } |
| 331 | |
| 332 | static void nativeSetDisplayLayerStack(JNIEnv* env, jclass clazz, |
| 333 | jobject tokenObj, jint layerStack) { |
| 334 | sp<IBinder> token(ibinderForJavaObject(env, tokenObj)); |
| 335 | if (token == NULL) return; |
| 336 | |
| 337 | SurfaceComposerClient::setDisplayLayerStack(token, layerStack); |
| 338 | } |
| 339 | |
| 340 | static void nativeSetDisplayProjection(JNIEnv* env, jclass clazz, |
| 341 | jobject tokenObj, jint orientation, |
| 342 | jint layerStackRect_left, jint layerStackRect_top, jint layerStackRect_right, jint layerStackRect_bottom, |
| 343 | jint displayRect_left, jint displayRect_top, jint displayRect_right, jint displayRect_bottom) { |
| 344 | sp<IBinder> token(ibinderForJavaObject(env, tokenObj)); |
| 345 | if (token == NULL) return; |
| 346 | Rect layerStackRect(layerStackRect_left, layerStackRect_top, layerStackRect_right, layerStackRect_bottom); |
| 347 | Rect displayRect(displayRect_left, displayRect_top, displayRect_right, displayRect_bottom); |
| 348 | SurfaceComposerClient::setDisplayProjection(token, orientation, layerStackRect, displayRect); |
| 349 | } |
| 350 | |
Dan Stoza | 0010105 | 2014-05-02 15:23:40 -0700 | [diff] [blame^] | 351 | static jobjectArray nativeGetDisplayConfigs(JNIEnv* env, jclass clazz, |
| 352 | jobject tokenObj) { |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 353 | sp<IBinder> token(ibinderForJavaObject(env, tokenObj)); |
Dan Stoza | 0010105 | 2014-05-02 15:23:40 -0700 | [diff] [blame^] | 354 | if (token == NULL) return NULL; |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 355 | |
Dan Stoza | 0010105 | 2014-05-02 15:23:40 -0700 | [diff] [blame^] | 356 | Vector<DisplayInfo> configs; |
| 357 | if (SurfaceComposerClient::getDisplayConfigs(token, &configs) != NO_ERROR || |
| 358 | configs.size() == 0) { |
| 359 | return NULL; |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 360 | } |
| 361 | |
Dan Stoza | 0010105 | 2014-05-02 15:23:40 -0700 | [diff] [blame^] | 362 | jobjectArray configArray = env->NewObjectArray(configs.size(), |
| 363 | gPhysicalDisplayInfoClassInfo.clazz, NULL); |
| 364 | |
| 365 | for (size_t c = 0; c < configs.size(); ++c) { |
| 366 | const DisplayInfo& info = configs[c]; |
| 367 | jobject infoObj = env->NewObject(gPhysicalDisplayInfoClassInfo.clazz, |
| 368 | gPhysicalDisplayInfoClassInfo.ctor); |
| 369 | env->SetIntField(infoObj, gPhysicalDisplayInfoClassInfo.width, info.w); |
| 370 | env->SetIntField(infoObj, gPhysicalDisplayInfoClassInfo.height, info.h); |
| 371 | env->SetFloatField(infoObj, gPhysicalDisplayInfoClassInfo.refreshRate, info.fps); |
| 372 | env->SetFloatField(infoObj, gPhysicalDisplayInfoClassInfo.density, info.density); |
| 373 | env->SetFloatField(infoObj, gPhysicalDisplayInfoClassInfo.xDpi, info.xdpi); |
| 374 | env->SetFloatField(infoObj, gPhysicalDisplayInfoClassInfo.yDpi, info.ydpi); |
| 375 | env->SetBooleanField(infoObj, gPhysicalDisplayInfoClassInfo.secure, info.secure); |
| 376 | env->SetObjectArrayElement(configArray, static_cast<jsize>(c), infoObj); |
| 377 | env->DeleteLocalRef(infoObj); |
| 378 | } |
| 379 | |
| 380 | return configArray; |
| 381 | } |
| 382 | |
| 383 | static jint nativeGetActiveConfig(JNIEnv* env, jclass clazz, jobject tokenObj) { |
| 384 | sp<IBinder> token(ibinderForJavaObject(env, tokenObj)); |
| 385 | if (token == NULL) return -1; |
| 386 | return static_cast<jint>(SurfaceComposerClient::getActiveConfig(token)); |
| 387 | } |
| 388 | |
| 389 | static jboolean nativeSetActiveConfig(JNIEnv* env, jclass clazz, jobject tokenObj, jint id) { |
| 390 | sp<IBinder> token(ibinderForJavaObject(env, tokenObj)); |
| 391 | if (token == NULL) return JNI_FALSE; |
| 392 | status_t err = SurfaceComposerClient::setActiveConfig(token, static_cast<int>(id)); |
| 393 | return err == NO_ERROR ? JNI_TRUE : JNI_FALSE; |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 394 | } |
| 395 | |
| 396 | static void nativeBlankDisplay(JNIEnv* env, jclass clazz, jobject tokenObj) { |
| 397 | sp<IBinder> token(ibinderForJavaObject(env, tokenObj)); |
| 398 | if (token == NULL) return; |
| 399 | |
| 400 | ALOGD_IF_SLOW(100, "Excessive delay in blankDisplay() while turning screen off"); |
| 401 | SurfaceComposerClient::blankDisplay(token); |
| 402 | } |
| 403 | |
| 404 | static void nativeUnblankDisplay(JNIEnv* env, jclass clazz, jobject tokenObj) { |
| 405 | sp<IBinder> token(ibinderForJavaObject(env, tokenObj)); |
| 406 | if (token == NULL) return; |
| 407 | |
| 408 | ALOGD_IF_SLOW(100, "Excessive delay in unblankDisplay() while turning screen on"); |
| 409 | SurfaceComposerClient::unblankDisplay(token); |
| 410 | } |
| 411 | |
Svetoslav | 1376d60 | 2014-03-13 11:17:26 -0700 | [diff] [blame] | 412 | static jboolean nativeClearContentFrameStats(JNIEnv* env, jclass clazz, jlong nativeObject) { |
| 413 | SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); |
| 414 | status_t err = ctrl->clearLayerFrameStats(); |
| 415 | |
| 416 | if (err < 0 && err != NO_INIT) { |
| 417 | doThrowIAE(env); |
| 418 | } |
| 419 | |
| 420 | // The other end is not ready, just report we failed. |
| 421 | if (err == NO_INIT) { |
| 422 | return JNI_FALSE; |
| 423 | } |
| 424 | |
| 425 | return JNI_TRUE; |
| 426 | } |
| 427 | |
| 428 | static jboolean nativeGetContentFrameStats(JNIEnv* env, jclass clazz, jlong nativeObject, |
| 429 | jobject outStats) { |
| 430 | FrameStats stats; |
| 431 | |
| 432 | SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); |
| 433 | status_t err = ctrl->getLayerFrameStats(&stats); |
| 434 | if (err < 0 && err != NO_INIT) { |
| 435 | doThrowIAE(env); |
| 436 | } |
| 437 | |
| 438 | // The other end is not ready, fine just return empty stats. |
| 439 | if (err == NO_INIT) { |
| 440 | return JNI_FALSE; |
| 441 | } |
| 442 | |
| 443 | jlong refreshPeriodNano = static_cast<jlong>(stats.refreshPeriodNano); |
| 444 | size_t frameCount = stats.desiredPresentTimesNano.size(); |
| 445 | |
| 446 | jlongArray postedTimesNanoDst = env->NewLongArray(frameCount); |
| 447 | if (postedTimesNanoDst == NULL) { |
| 448 | return JNI_FALSE; |
| 449 | } |
| 450 | |
| 451 | jlongArray presentedTimesNanoDst = env->NewLongArray(frameCount); |
| 452 | if (presentedTimesNanoDst == NULL) { |
| 453 | return JNI_FALSE; |
| 454 | } |
| 455 | |
| 456 | jlongArray readyTimesNanoDst = env->NewLongArray(frameCount); |
| 457 | if (readyTimesNanoDst == NULL) { |
| 458 | return JNI_FALSE; |
| 459 | } |
| 460 | |
| 461 | nsecs_t postedTimesNanoSrc[frameCount]; |
| 462 | nsecs_t presentedTimesNanoSrc[frameCount]; |
| 463 | nsecs_t readyTimesNanoSrc[frameCount]; |
| 464 | |
| 465 | for (size_t i = 0; i < frameCount; i++) { |
| 466 | nsecs_t postedTimeNano = stats.desiredPresentTimesNano[i]; |
| 467 | if (postedTimeNano == INT64_MAX) { |
| 468 | postedTimeNano = gWindowContentFrameStatsClassInfo.UNDEFINED_TIME_NANO; |
| 469 | } |
| 470 | postedTimesNanoSrc[i] = postedTimeNano; |
| 471 | |
| 472 | nsecs_t presentedTimeNano = stats.actualPresentTimesNano[i]; |
| 473 | if (presentedTimeNano == INT64_MAX) { |
| 474 | presentedTimeNano = gWindowContentFrameStatsClassInfo.UNDEFINED_TIME_NANO; |
| 475 | } |
| 476 | presentedTimesNanoSrc[i] = presentedTimeNano; |
| 477 | |
| 478 | nsecs_t readyTimeNano = stats.frameReadyTimesNano[i]; |
| 479 | if (readyTimeNano == INT64_MAX) { |
| 480 | readyTimeNano = gWindowContentFrameStatsClassInfo.UNDEFINED_TIME_NANO; |
| 481 | } |
| 482 | readyTimesNanoSrc[i] = readyTimeNano; |
| 483 | } |
| 484 | |
| 485 | env->SetLongArrayRegion(postedTimesNanoDst, 0, frameCount, postedTimesNanoSrc); |
| 486 | env->SetLongArrayRegion(presentedTimesNanoDst, 0, frameCount, presentedTimesNanoSrc); |
| 487 | env->SetLongArrayRegion(readyTimesNanoDst, 0, frameCount, readyTimesNanoSrc); |
| 488 | |
| 489 | env->CallVoidMethod(outStats, gWindowContentFrameStatsClassInfo.init, refreshPeriodNano, |
| 490 | postedTimesNanoDst, presentedTimesNanoDst, readyTimesNanoDst); |
| 491 | |
| 492 | if (env->ExceptionCheck()) { |
| 493 | return JNI_FALSE; |
| 494 | } |
| 495 | |
| 496 | return JNI_TRUE; |
| 497 | } |
| 498 | |
| 499 | static jboolean nativeClearAnimationFrameStats(JNIEnv* env, jclass clazz) { |
| 500 | status_t err = SurfaceComposerClient::clearAnimationFrameStats(); |
| 501 | |
| 502 | if (err < 0 && err != NO_INIT) { |
| 503 | doThrowIAE(env); |
| 504 | } |
| 505 | |
| 506 | // The other end is not ready, just report we failed. |
| 507 | if (err == NO_INIT) { |
| 508 | return JNI_FALSE; |
| 509 | } |
| 510 | |
| 511 | return JNI_TRUE; |
| 512 | } |
| 513 | |
| 514 | static jboolean nativeGetAnimationFrameStats(JNIEnv* env, jclass clazz, jobject outStats) { |
| 515 | FrameStats stats; |
| 516 | |
| 517 | status_t err = SurfaceComposerClient::getAnimationFrameStats(&stats); |
| 518 | if (err < 0 && err != NO_INIT) { |
| 519 | doThrowIAE(env); |
| 520 | } |
| 521 | |
| 522 | // The other end is not ready, fine just return empty stats. |
| 523 | if (err == NO_INIT) { |
| 524 | return JNI_FALSE; |
| 525 | } |
| 526 | |
| 527 | jlong refreshPeriodNano = static_cast<jlong>(stats.refreshPeriodNano); |
| 528 | size_t frameCount = stats.desiredPresentTimesNano.size(); |
| 529 | |
| 530 | jlongArray presentedTimesNanoDst = env->NewLongArray(frameCount); |
| 531 | if (presentedTimesNanoDst == NULL) { |
| 532 | return JNI_FALSE; |
| 533 | } |
| 534 | |
| 535 | nsecs_t presentedTimesNanoSrc[frameCount]; |
| 536 | |
| 537 | for (size_t i = 0; i < frameCount; i++) { |
Allen Hair | ac5eda3 | 2014-04-24 11:50:37 -0700 | [diff] [blame] | 538 | nsecs_t presentedTimeNano = stats.actualPresentTimesNano[i]; |
Svetoslav | 1376d60 | 2014-03-13 11:17:26 -0700 | [diff] [blame] | 539 | if (presentedTimeNano == INT64_MAX) { |
| 540 | presentedTimeNano = gWindowContentFrameStatsClassInfo.UNDEFINED_TIME_NANO; |
| 541 | } |
| 542 | presentedTimesNanoSrc[i] = presentedTimeNano; |
| 543 | } |
| 544 | |
| 545 | env->SetLongArrayRegion(presentedTimesNanoDst, 0, frameCount, presentedTimesNanoSrc); |
| 546 | |
| 547 | env->CallVoidMethod(outStats, gWindowAnimationFrameStatsClassInfo.init, refreshPeriodNano, |
| 548 | presentedTimesNanoDst); |
| 549 | |
| 550 | if (env->ExceptionCheck()) { |
| 551 | return JNI_FALSE; |
| 552 | } |
| 553 | |
| 554 | return JNI_TRUE; |
| 555 | } |
| 556 | |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 557 | // ---------------------------------------------------------------------------- |
| 558 | |
| 559 | static JNINativeMethod sSurfaceControlMethods[] = { |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 560 | {"nativeCreate", "(Landroid/view/SurfaceSession;Ljava/lang/String;IIII)J", |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 561 | (void*)nativeCreate }, |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 562 | {"nativeRelease", "(J)V", |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 563 | (void*)nativeRelease }, |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 564 | {"nativeDestroy", "(J)V", |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 565 | (void*)nativeDestroy }, |
Dan Stoza | 16ec12a | 2014-02-14 15:06:55 -0800 | [diff] [blame] | 566 | {"nativeScreenshot", "(Landroid/os/IBinder;IIIIZZ)Landroid/graphics/Bitmap;", |
Mathias Agopian | 0449a40 | 2013-03-01 23:01:51 -0800 | [diff] [blame] | 567 | (void*)nativeScreenshotBitmap }, |
Dan Stoza | 16ec12a | 2014-02-14 15:06:55 -0800 | [diff] [blame] | 568 | {"nativeScreenshot", "(Landroid/os/IBinder;Landroid/view/Surface;IIIIZZ)V", |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 569 | (void*)nativeScreenshot }, |
| 570 | {"nativeOpenTransaction", "()V", |
| 571 | (void*)nativeOpenTransaction }, |
| 572 | {"nativeCloseTransaction", "()V", |
| 573 | (void*)nativeCloseTransaction }, |
| 574 | {"nativeSetAnimationTransaction", "()V", |
| 575 | (void*)nativeSetAnimationTransaction }, |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 576 | {"nativeSetLayer", "(JI)V", |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 577 | (void*)nativeSetLayer }, |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 578 | {"nativeSetPosition", "(JFF)V", |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 579 | (void*)nativeSetPosition }, |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 580 | {"nativeSetSize", "(JII)V", |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 581 | (void*)nativeSetSize }, |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 582 | {"nativeSetTransparentRegionHint", "(JLandroid/graphics/Region;)V", |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 583 | (void*)nativeSetTransparentRegionHint }, |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 584 | {"nativeSetAlpha", "(JF)V", |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 585 | (void*)nativeSetAlpha }, |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 586 | {"nativeSetMatrix", "(JFFFF)V", |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 587 | (void*)nativeSetMatrix }, |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 588 | {"nativeSetFlags", "(JII)V", |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 589 | (void*)nativeSetFlags }, |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 590 | {"nativeSetWindowCrop", "(JIIII)V", |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 591 | (void*)nativeSetWindowCrop }, |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 592 | {"nativeSetLayerStack", "(JI)V", |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 593 | (void*)nativeSetLayerStack }, |
| 594 | {"nativeGetBuiltInDisplay", "(I)Landroid/os/IBinder;", |
| 595 | (void*)nativeGetBuiltInDisplay }, |
| 596 | {"nativeCreateDisplay", "(Ljava/lang/String;Z)Landroid/os/IBinder;", |
| 597 | (void*)nativeCreateDisplay }, |
Jesse Hall | 6a6bc21 | 2013-08-08 12:15:03 -0700 | [diff] [blame] | 598 | {"nativeDestroyDisplay", "(Landroid/os/IBinder;)V", |
| 599 | (void*)nativeDestroyDisplay }, |
Ashok Bhat | 36bef0b | 2014-01-20 20:08:01 +0000 | [diff] [blame] | 600 | {"nativeSetDisplaySurface", "(Landroid/os/IBinder;J)V", |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 601 | (void*)nativeSetDisplaySurface }, |
| 602 | {"nativeSetDisplayLayerStack", "(Landroid/os/IBinder;I)V", |
| 603 | (void*)nativeSetDisplayLayerStack }, |
| 604 | {"nativeSetDisplayProjection", "(Landroid/os/IBinder;IIIIIIIII)V", |
| 605 | (void*)nativeSetDisplayProjection }, |
Dan Stoza | 0010105 | 2014-05-02 15:23:40 -0700 | [diff] [blame^] | 606 | {"nativeGetDisplayConfigs", "(Landroid/os/IBinder;)[Landroid/view/SurfaceControl$PhysicalDisplayInfo;", |
| 607 | (void*)nativeGetDisplayConfigs }, |
| 608 | {"nativeGetActiveConfig", "(Landroid/os/IBinder;)I", |
| 609 | (void*)nativeGetActiveConfig }, |
| 610 | {"nativeSetActiveConfig", "(Landroid/os/IBinder;I)Z", |
| 611 | (void*)nativeSetActiveConfig }, |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 612 | {"nativeBlankDisplay", "(Landroid/os/IBinder;)V", |
| 613 | (void*)nativeBlankDisplay }, |
| 614 | {"nativeUnblankDisplay", "(Landroid/os/IBinder;)V", |
| 615 | (void*)nativeUnblankDisplay }, |
Svetoslav | 1376d60 | 2014-03-13 11:17:26 -0700 | [diff] [blame] | 616 | {"nativeClearContentFrameStats", "(J)Z", |
| 617 | (void*)nativeClearContentFrameStats }, |
| 618 | {"nativeGetContentFrameStats", "(JLandroid/view/WindowContentFrameStats;)Z", |
| 619 | (void*)nativeGetContentFrameStats }, |
| 620 | {"nativeClearAnimationFrameStats", "()Z", |
| 621 | (void*)nativeClearAnimationFrameStats }, |
| 622 | {"nativeGetAnimationFrameStats", "(Landroid/view/WindowAnimationFrameStats;)Z", |
| 623 | (void*)nativeGetAnimationFrameStats }, |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 624 | }; |
| 625 | |
| 626 | int register_android_view_SurfaceControl(JNIEnv* env) |
| 627 | { |
| 628 | int err = AndroidRuntime::registerNativeMethods(env, "android/view/SurfaceControl", |
| 629 | sSurfaceControlMethods, NELEM(sSurfaceControlMethods)); |
| 630 | |
| 631 | jclass clazz = env->FindClass("android/view/SurfaceControl$PhysicalDisplayInfo"); |
Dan Stoza | 0010105 | 2014-05-02 15:23:40 -0700 | [diff] [blame^] | 632 | gPhysicalDisplayInfoClassInfo.clazz = static_cast<jclass>(env->NewGlobalRef(clazz)); |
| 633 | gPhysicalDisplayInfoClassInfo.ctor = env->GetMethodID(gPhysicalDisplayInfoClassInfo.clazz, |
| 634 | "<init>", "()V"); |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 635 | gPhysicalDisplayInfoClassInfo.width = env->GetFieldID(clazz, "width", "I"); |
| 636 | gPhysicalDisplayInfoClassInfo.height = env->GetFieldID(clazz, "height", "I"); |
| 637 | gPhysicalDisplayInfoClassInfo.refreshRate = env->GetFieldID(clazz, "refreshRate", "F"); |
| 638 | gPhysicalDisplayInfoClassInfo.density = env->GetFieldID(clazz, "density", "F"); |
| 639 | gPhysicalDisplayInfoClassInfo.xDpi = env->GetFieldID(clazz, "xDpi", "F"); |
| 640 | gPhysicalDisplayInfoClassInfo.yDpi = env->GetFieldID(clazz, "yDpi", "F"); |
| 641 | gPhysicalDisplayInfoClassInfo.secure = env->GetFieldID(clazz, "secure", "Z"); |
Svetoslav | 1376d60 | 2014-03-13 11:17:26 -0700 | [diff] [blame] | 642 | |
| 643 | jclass frameStatsClazz = env->FindClass("android/view/FrameStats"); |
| 644 | jfieldID undefined_time_nano_field = env->GetStaticFieldID(frameStatsClazz, "UNDEFINED_TIME_NANO", "J"); |
| 645 | nsecs_t undefined_time_nano = env->GetStaticLongField(frameStatsClazz, undefined_time_nano_field); |
| 646 | |
| 647 | jclass contFrameStatsClazz = env->FindClass("android/view/WindowContentFrameStats"); |
| 648 | gWindowContentFrameStatsClassInfo.init = env->GetMethodID(contFrameStatsClazz, "init", "(J[J[J[J)V"); |
| 649 | gWindowContentFrameStatsClassInfo.UNDEFINED_TIME_NANO = undefined_time_nano; |
| 650 | |
| 651 | jclass animFrameStatsClazz = env->FindClass("android/view/WindowAnimationFrameStats"); |
| 652 | gWindowAnimationFrameStatsClassInfo.init = env->GetMethodID(animFrameStatsClazz, "init", "(J[J)V"); |
| 653 | gWindowAnimationFrameStatsClassInfo.UNDEFINED_TIME_NANO = undefined_time_nano; |
| 654 | |
Mathias Agopian | 3866f0d | 2013-02-11 22:08:48 -0800 | [diff] [blame] | 655 | return err; |
| 656 | } |
| 657 | |
| 658 | }; |