Loading core/java/android/view/Surface.java +18 −1 Original line number Diff line number Diff line Loading @@ -118,6 +118,12 @@ public class Surface implements Parcelable { public static final int ROTATION_180 = 2; public static final int ROTATION_270 = 3; /** * Disable the orientation animation * {@hide} */ public static final int FLAGS_ORIENTATION_ANIMATION_DISABLE = 0x000000001; @SuppressWarnings("unused") private int mSurface; @SuppressWarnings("unused") Loading Loading @@ -222,12 +228,23 @@ public class Surface implements Parcelable { */ public static native void unfreezeDisplay(int display); /** * set the orientation of the given display. * @param display * @param orientation * @param flags * {@hide} */ public static native void setOrientation(int display, int orientation, int flags); /** * set the orientation of the given display. * @param display * @param orientation */ public static native void setOrientation(int display, int orientation); public static void setOrientation(int display, int orientation) { setOrientation(display, orientation, 0); } /** * set surface parameters. Loading core/jni/android_view_Surface.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -324,9 +324,9 @@ static void Surface_closeTransaction( } static void Surface_setOrientation( JNIEnv* env, jobject clazz, jint display, jint orientation) JNIEnv* env, jobject clazz, jint display, jint orientation, jint flags) { int err = SurfaceComposerClient::setOrientation(display, orientation); int err = SurfaceComposerClient::setOrientation(display, orientation, flags); if (err < 0) { doThrow(env, "java/lang/IllegalArgumentException", NULL); } Loading Loading @@ -565,7 +565,7 @@ static JNINativeMethod gSurfaceMethods[] = { {"unlockCanvas", "(Landroid/graphics/Canvas;)V", (void*)Surface_unlockCanvas }, {"openTransaction", "()V", (void*)Surface_openTransaction }, {"closeTransaction", "()V", (void*)Surface_closeTransaction }, {"setOrientation", "(II)V", (void*)Surface_setOrientation }, {"setOrientation", "(III)V", (void*)Surface_setOrientation }, {"freezeDisplay", "(I)V", (void*)Surface_freezeDisplay }, {"unfreezeDisplay", "(I)V", (void*)Surface_unfreezeDisplay }, {"setLayer", "(I)V", (void*)Surface_setLayer }, Loading include/ui/ISurfaceComposer.h +6 −1 Original line number Diff line number Diff line Loading @@ -82,6 +82,11 @@ public: eOrientationSwapMask = 0x01 }; // flags for setOrientation enum { eOrientationAnimationDisable = 0x00000001 }; /* create connection with surface flinger, requires * ACCESS_SURFACE_FLINGER permission */ Loading @@ -100,7 +105,7 @@ public: virtual status_t unfreezeDisplay(DisplayID dpy, uint32_t flags) = 0; /* Set display orientation. recquires ACCESS_SURFACE_FLINGER permission */ virtual int setOrientation(DisplayID dpy, int orientation) = 0; virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags) = 0; /* signal that we're done booting. * recquires ACCESS_SURFACE_FLINGER permission Loading include/ui/SurfaceComposerClient.h +1 −1 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ public: static status_t unfreezeDisplay(DisplayID dpy, uint32_t flags = 0); //! Set the orientation of the given display static int setOrientation(DisplayID dpy, int orientation); static int setOrientation(DisplayID dpy, int orientation, uint32_t flags); // Query the number of displays static ssize_t getNumberOfDisplays(); Loading libs/surfaceflinger/OrientationAnimation.cpp +15 −16 Original line number Diff line number Diff line Loading @@ -44,11 +44,15 @@ OrientationAnimation::~OrientationAnimation() { } void OrientationAnimation::onOrientationChanged() void OrientationAnimation::onOrientationChanged(uint32_t type) { if (mState == DONE) if (mState == DONE) { mType = type; if (!(type & ISurfaceComposer::eOrientationAnimationDisable)) { mState = PREPARE; } } } void OrientationAnimation::onAnimationFinished() { Loading Loading @@ -82,14 +86,7 @@ bool OrientationAnimation::run_impl() bool OrientationAnimation::done() { if (mFlinger->isFrozen()) { // we are not allowed to draw, but pause a bit to make sure // apps don't end up using the whole CPU, if they depend on // surfaceflinger for synchronization. usleep(8333); // 8.3ms ~ 120fps return true; } return false; return done_impl(); } bool OrientationAnimation::prepare() Loading @@ -115,11 +112,13 @@ bool OrientationAnimation::prepare() LayerOrientationAnimBase* l; if (mType & 0x80) { l = new LayerOrientationAnimRotate( mFlinger.get(), 0, this, bitmap, bitmapIn); } else { l = new LayerOrientationAnim( mFlinger.get(), 0, this, bitmap, bitmapIn); //l = new LayerOrientationAnimRotate( // mFlinger.get(), 0, this, bitmap, bitmapIn); } l->initStates(w, h, 0); l->setLayer(INT_MAX-1); Loading Loading
core/java/android/view/Surface.java +18 −1 Original line number Diff line number Diff line Loading @@ -118,6 +118,12 @@ public class Surface implements Parcelable { public static final int ROTATION_180 = 2; public static final int ROTATION_270 = 3; /** * Disable the orientation animation * {@hide} */ public static final int FLAGS_ORIENTATION_ANIMATION_DISABLE = 0x000000001; @SuppressWarnings("unused") private int mSurface; @SuppressWarnings("unused") Loading Loading @@ -222,12 +228,23 @@ public class Surface implements Parcelable { */ public static native void unfreezeDisplay(int display); /** * set the orientation of the given display. * @param display * @param orientation * @param flags * {@hide} */ public static native void setOrientation(int display, int orientation, int flags); /** * set the orientation of the given display. * @param display * @param orientation */ public static native void setOrientation(int display, int orientation); public static void setOrientation(int display, int orientation) { setOrientation(display, orientation, 0); } /** * set surface parameters. Loading
core/jni/android_view_Surface.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -324,9 +324,9 @@ static void Surface_closeTransaction( } static void Surface_setOrientation( JNIEnv* env, jobject clazz, jint display, jint orientation) JNIEnv* env, jobject clazz, jint display, jint orientation, jint flags) { int err = SurfaceComposerClient::setOrientation(display, orientation); int err = SurfaceComposerClient::setOrientation(display, orientation, flags); if (err < 0) { doThrow(env, "java/lang/IllegalArgumentException", NULL); } Loading Loading @@ -565,7 +565,7 @@ static JNINativeMethod gSurfaceMethods[] = { {"unlockCanvas", "(Landroid/graphics/Canvas;)V", (void*)Surface_unlockCanvas }, {"openTransaction", "()V", (void*)Surface_openTransaction }, {"closeTransaction", "()V", (void*)Surface_closeTransaction }, {"setOrientation", "(II)V", (void*)Surface_setOrientation }, {"setOrientation", "(III)V", (void*)Surface_setOrientation }, {"freezeDisplay", "(I)V", (void*)Surface_freezeDisplay }, {"unfreezeDisplay", "(I)V", (void*)Surface_unfreezeDisplay }, {"setLayer", "(I)V", (void*)Surface_setLayer }, Loading
include/ui/ISurfaceComposer.h +6 −1 Original line number Diff line number Diff line Loading @@ -82,6 +82,11 @@ public: eOrientationSwapMask = 0x01 }; // flags for setOrientation enum { eOrientationAnimationDisable = 0x00000001 }; /* create connection with surface flinger, requires * ACCESS_SURFACE_FLINGER permission */ Loading @@ -100,7 +105,7 @@ public: virtual status_t unfreezeDisplay(DisplayID dpy, uint32_t flags) = 0; /* Set display orientation. recquires ACCESS_SURFACE_FLINGER permission */ virtual int setOrientation(DisplayID dpy, int orientation) = 0; virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags) = 0; /* signal that we're done booting. * recquires ACCESS_SURFACE_FLINGER permission Loading
include/ui/SurfaceComposerClient.h +1 −1 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ public: static status_t unfreezeDisplay(DisplayID dpy, uint32_t flags = 0); //! Set the orientation of the given display static int setOrientation(DisplayID dpy, int orientation); static int setOrientation(DisplayID dpy, int orientation, uint32_t flags); // Query the number of displays static ssize_t getNumberOfDisplays(); Loading
libs/surfaceflinger/OrientationAnimation.cpp +15 −16 Original line number Diff line number Diff line Loading @@ -44,11 +44,15 @@ OrientationAnimation::~OrientationAnimation() { } void OrientationAnimation::onOrientationChanged() void OrientationAnimation::onOrientationChanged(uint32_t type) { if (mState == DONE) if (mState == DONE) { mType = type; if (!(type & ISurfaceComposer::eOrientationAnimationDisable)) { mState = PREPARE; } } } void OrientationAnimation::onAnimationFinished() { Loading Loading @@ -82,14 +86,7 @@ bool OrientationAnimation::run_impl() bool OrientationAnimation::done() { if (mFlinger->isFrozen()) { // we are not allowed to draw, but pause a bit to make sure // apps don't end up using the whole CPU, if they depend on // surfaceflinger for synchronization. usleep(8333); // 8.3ms ~ 120fps return true; } return false; return done_impl(); } bool OrientationAnimation::prepare() Loading @@ -115,11 +112,13 @@ bool OrientationAnimation::prepare() LayerOrientationAnimBase* l; if (mType & 0x80) { l = new LayerOrientationAnimRotate( mFlinger.get(), 0, this, bitmap, bitmapIn); } else { l = new LayerOrientationAnim( mFlinger.get(), 0, this, bitmap, bitmapIn); //l = new LayerOrientationAnimRotate( // mFlinger.get(), 0, this, bitmap, bitmapIn); } l->initStates(w, h, 0); l->setLayer(INT_MAX-1); Loading