-
Notifications
You must be signed in to change notification settings - Fork 0
/
framework_rot.patch
84 lines (75 loc) · 4.3 KB
/
framework_rot.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Adapts the AOSP and CMParts frameworks to the YT-X703's screen
and volume button layout.
+-----------------------------------+
| P |
| O |
| R D |
| U T O |
| P R W | 1600px
| A N |
V+ | I |
V- | T |---+
+-----------------------------------+ /
PWR | 2560px | / kickstand
+-----------------------------------+/
The display is a 2560x1600 portrait display in:
* a portrait form factor with buttons on top (when you hold it by the grip)
* a landscape form factor with buttons on the left (when you use the kickstand)
This patch keeps the display as portrait, but:
* rotates the bootanimation so it appears normal when viewed in kickstand mode
* sets the initial screen orientation on boot to landscape
* tells CMParts that this tablet is landscape, because it makes certain
assumptions that are otherwise too simplistic (such as the fact that volume
buttons are on the side, and not on top of the display). This fixes the
reorient functionality for the volume buttons.
Signed-off-by: Matthias Lenk <[email protected]>
Signed-off-by: Vladimir Oltean <[email protected]>
diff --git a/frameworks/base/cmds/bootanimation/BootAnimation.cpp b/frameworks/base/cmds/bootanimation/BootAnimation.cpp
index 10fabcfb735..5f219910b03 100644
--- a/frameworks/base/cmds/bootanimation/BootAnimation.cpp
+++ b/frameworks/base/cmds/bootanimation/BootAnimation.cpp
@@ -267,10 +267,12 @@ status_t BootAnimation::readyToRun() {
status_t status = SurfaceComposerClient::getDisplayInfo(dtoken, &dinfo);
if (status)
return -1;
+
+ SurfaceComposerClient::setDisplayProjection(dtoken, 1, Rect(0,0,dinfo.h,dinfo.w), Rect(0,0,dinfo.h,dinfo.w));
// create the native surface
sp<SurfaceControl> control = session()->createSurface(String8("BootAnimation"),
- dinfo.w, dinfo.h, PIXEL_FORMAT_RGB_565);
+ dinfo.h, dinfo.w, PIXEL_FORMAT_RGB_565);
SurfaceComposerClient::openGlobalTransaction();
control->setLayer(0x40000000);
diff --git a/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java b/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
index 3c9170e65a7..c2ec7a45f30 100644
--- a/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -553,8 +553,8 @@ public class WindowManagerService extends IWindowManager.Stub
/** All DisplayContents in the world, kept here */
SparseArray<DisplayContent> mDisplayContents = new SparseArray<>(2);
- int mRotation = 0;
- int mLastOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
+ int mRotation = 1;
+ int mLastOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
boolean mAltOrientation = false;
private boolean mKeyguardWaitingForActivityDrawn;
diff -u -r a/packages/apps/CMParts/src/org/cyanogenmod/cmparts/input/ButtonSettings.java b/packages/apps/CMParts/src/org/cyanogenmod/cmparts/input/ButtonSettings.java
--- a/packages/apps/CMParts/src/org/cyanogenmod/cmparts/input/ButtonSettings.java
+++ b/packages/apps/CMParts/src/org/cyanogenmod/cmparts/input/ButtonSettings.java
@@ -734,16 +734,5 @@ public boolean onPreferenceTreeClick(Preference preference) {
if (preference == mSwapVolumeButtons) {
int value = mSwapVolumeButtons.isChecked()
? (ScreenType.isTablet(getActivity()) ? 2 : 1) : 0;
- if (value == 2) {
- Display defaultDisplay = getActivity().getWindowManager().getDefaultDisplay();
-
- DisplayInfo displayInfo = new DisplayInfo();
- defaultDisplay.getDisplayInfo(displayInfo);
-
- // Not all tablets are landscape
- if (displayInfo.getNaturalWidth() < displayInfo.getNaturalHeight()) {
- value = 1;
- }
- }
CMSettings.System.putInt(getActivity().getContentResolver(),
CMSettings.System.SWAP_VOLUME_KEYS_ON_ROTATION, value);