Skip to content

Commit

Permalink
Init display orientation according to panel orientation
Browse files Browse the repository at this point in the history
   - Initialize the display default orientation to panel orientation.
   - honor the panel orientation only after the end of boot animation
     or the new orientation is as same as panel orientation.

Change-Id: Ieece097ff7c3710e379f47028900aed59a96c8d5
  • Loading branch information
darkpewds6969 authored and hyperb1iss committed Jul 14, 2014
1 parent 934d46a commit 2326d76
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 6 additions & 1 deletion services/surfaceflinger/DisplayDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,14 @@ DisplayDevice::DisplayDevice(
mDisplayName = "Virtual Screen"; // e.g. Overlay #n
break;
}
char property[PROPERTY_VALUE_MAX];
int panelOrientation = DisplayState::eOrientationDefault;
// Set the panel orientation from the property.
property_get("persist.panel.orientation", property, "0");
panelOrientation = atoi(property) / 90;

// initialize the display orientation transform.
setProjection(DisplayState::eOrientationDefault, mViewport, mFrame);
setProjection(panelOrientation, mViewport, mFrame);
}

DisplayDevice::~DisplayDevice() {
Expand Down
11 changes: 9 additions & 2 deletions services/surfaceflinger/SurfaceFlinger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ int32_t SurfaceFlinger::allocateHwcDisplayId(DisplayDevice::DisplayType type) {

void SurfaceFlinger::startBootAnim() {
// start boot animation
mBootFinished = false;
property_set("service.bootanim.exit", "0");
property_set("ctl.start", "bootanim");
}
Expand Down Expand Up @@ -1502,8 +1503,14 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags)
|| (state.viewport != draw[i].viewport)
|| (state.frame != draw[i].frame))
{
disp->setProjection(state.orientation,
state.viewport, state.frame);
// Honor the orientation change after boot
// animation completes or the new orientation is
// same as panel orientation..
if(mBootFinished ||
state.orientation == disp->getOrientation()) {
disp->setProjection(state.orientation,
state.viewport, state.frame);
}
}
}
}
Expand Down

0 comments on commit 2326d76

Please sign in to comment.