Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ceff6e18 authored by Mathias Agopian's avatar Mathias Agopian Committed by The Android Open Source Project
Browse files

Automated import from //branches/cupcake/...@142873,142873

parent 262453ce
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -82,6 +82,11 @@ public:
        eOrientationSwapMask    = 0x01
    };
    
    // flags for setOrientation
    enum {
        eOrientationAnimationDisable = 0x00000001
    };

    /* create connection with surface flinger, requires
     * ACCESS_SURFACE_FLINGER permission
     */
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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();
+15 −16
Original line number Diff line number Diff line
@@ -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()
{
@@ -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()
@@ -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);
+15 −3
Original line number Diff line number Diff line
@@ -36,11 +36,11 @@ public:
                 OrientationAnimation(const sp<SurfaceFlinger>& flinger);
        virtual ~OrientationAnimation();

   void onOrientationChanged();
   void onOrientationChanged(uint32_t type);
   void onAnimationFinished();
   inline bool run() {
       if (LIKELY(mState == DONE))
           return false;
           return done_impl();
       return run_impl();
   }

@@ -54,6 +54,17 @@ private:
    };

    bool run_impl();
    inline bool done_impl() {
        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;
    }
    
    bool done();    
    bool prepare();
    bool phase1();
@@ -64,6 +75,7 @@ private:
    sp<MemoryDealer> mTemporaryDealer;
    LayerOrientationAnimBase* mLayerOrientationAnim;
    int mState;
    uint32_t mType;
};

// ---------------------------------------------------------------------------
+6 −3
Original line number Diff line number Diff line
@@ -655,6 +655,7 @@ void SurfaceFlinger::handleTransaction(uint32_t transactionFlags)

            const int dpy = 0;
            const int orientation = mCurrentState.orientation;
            const uint32_t type = mCurrentState.orientationType;
            GraphicPlane& plane(graphicPlane(dpy));
            plane.setOrientation(orientation);

@@ -673,8 +674,8 @@ void SurfaceFlinger::handleTransaction(uint32_t transactionFlags)

            mVisibleRegionsDirty = true;
            mDirtyRegion.set(hw.bounds());

            mOrientationAnimation->onOrientationChanged();
            mFreezeDisplayTime = 0;
            mOrientationAnimation->onOrientationChanged(type);
        }

        if (mCurrentState.freezeDisplay != mDrawingState.freezeDisplay) {
@@ -1201,7 +1202,8 @@ status_t SurfaceFlinger::unfreezeDisplay(DisplayID dpy, uint32_t flags)
    return NO_ERROR;
}

int SurfaceFlinger::setOrientation(DisplayID dpy, int orientation)
int SurfaceFlinger::setOrientation(DisplayID dpy, 
        int orientation, uint32_t flags)
{
    if (UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT))
        return BAD_VALUE;
@@ -1209,6 +1211,7 @@ int SurfaceFlinger::setOrientation(DisplayID dpy, int orientation)
    Mutex::Autolock _l(mStateLock);
    if (mCurrentState.orientation != orientation) {
        if (uint32_t(orientation)<=eOrientation270 || orientation==42) {
            mCurrentState.orientationType = flags;
            mCurrentState.orientation = orientation;
            setTransactionFlags(eTransactionNeeded);
            mTransactionCV.wait(mStateLock);
Loading