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

Commit bc46e0ad authored by Ramanan Rajeswaran's avatar Ramanan Rajeswaran Committed by Android (Google) Code Review
Browse files

Merge "Revert "Added display initialization method"" into jb-mr1-dev

parents 8f971ff6 f1bf89dd
Loading
Loading
Loading
Loading
+9 −35
Original line number Original line Diff line number Diff line
@@ -137,8 +137,15 @@ void SurfaceFlinger::binderDied(const wp<IBinder>& who)
{
{
    // the window manager died on us. prepare its eulogy.
    // the window manager died on us. prepare its eulogy.


    // restore initial conditions (default device unblank, etc)
    // reset screen orientation
    initializeDisplays();
    Vector<ComposerState> state;
    Vector<DisplayState> displays;
    DisplayState d;
    d.what = DisplayState::eOrientationChanged;
    d.token = mDefaultDisplays[DisplayDevice::DISPLAY_ID_MAIN];
    d.orientation = DisplayState::eOrientationDefault;
    displays.add(d);
    setTransactionState(state, displays, 0);


    // restart the boot-animation
    // restart the boot-animation
    startBootAnim();
    startBootAnim();
@@ -424,9 +431,6 @@ status_t SurfaceFlinger::readyToRun()
    // We're now ready to accept clients...
    // We're now ready to accept clients...
    mReadyToRunBarrier.open();
    mReadyToRunBarrier.open();


    // set initial conditions (e.g. unblank default device)
    initializeDisplays();

    // start boot animation
    // start boot animation
    startBootAnim();
    startBootAnim();


@@ -1697,36 +1701,6 @@ status_t SurfaceFlinger::onLayerDestroyed(const wp<LayerBaseClient>& layer)


// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------


void SurfaceFlinger::onInitializeDisplays() {
    // reset screen orientation
    Vector<ComposerState> state;
    Vector<DisplayState> displays;
    DisplayState d;
    d.what = DisplayState::eOrientationChanged;
    d.token = mDefaultDisplays[DisplayDevice::DISPLAY_ID_MAIN];
    d.orientation = DisplayState::eOrientationDefault;
    displays.add(d);
    setTransactionState(state, displays, 0);

    // XXX: this should init default device to "unblank" and all other devices to "blank"
    onScreenAcquired();
}

void SurfaceFlinger::initializeDisplays() {
    class MessageScreenInitialized : public MessageBase {
        SurfaceFlinger* flinger;
    public:
        MessageScreenInitialized(SurfaceFlinger* flinger) : flinger(flinger) { }
        virtual bool handler() {
            flinger->onInitializeDisplays();
            return true;
        }
    };
    sp<MessageBase> msg = new MessageScreenInitialized(this);
    postMessageAsync(msg);  // we may be called from main thread, use async message
}


void SurfaceFlinger::onScreenAcquired() {
void SurfaceFlinger::onScreenAcquired() {
    ALOGD("Screen about to return, flinger = %p", this);
    ALOGD("Screen about to return, flinger = %p", this);
    sp<const DisplayDevice> hw(getDefaultDisplayDevice()); // XXX: this should be per DisplayDevice
    sp<const DisplayDevice> hw(getDefaultDisplayDevice()); // XXX: this should be per DisplayDevice
+2 −7
Original line number Original line Diff line number Diff line
@@ -231,11 +231,9 @@ private:
    void signalLayerUpdate();
    void signalLayerUpdate();
    void signalRefresh();
    void signalRefresh();


    // called on the main thread in response to initializeDisplays()
    // called on the main thread in response to screenReleased()
    void onInitializeDisplays();
    // called on the main thread in response to blank()
    void onScreenReleased();
    void onScreenReleased();
    // called on the main thread in response to unblank()
    // called on the main thread in response to screenAcquired()
    void onScreenAcquired();
    void onScreenAcquired();


    void handleMessageTransaction();
    void handleMessageTransaction();
@@ -323,9 +321,6 @@ private:
    /* ------------------------------------------------------------------------
    /* ------------------------------------------------------------------------
     * Display and layer stack management
     * Display and layer stack management
     */
     */
    // called when starting, or restarting after system_server death
    void initializeDisplays();

    sp<const DisplayDevice> getDisplayDevice(DisplayID dpy) const {
    sp<const DisplayDevice> getDisplayDevice(DisplayID dpy) const {
        return mDisplays.valueFor(dpy);
        return mDisplays.valueFor(dpy);
    }
    }