initial version
[android_pandora.git] / patches / all.patch
1
2 project frameworks/base/
3 diff --git a/frameworks/base/libs/ui/InputReader.cpp b/frameworks/base/libs/ui/InputReader.cpp
4 index 79cb87a..d8cd717 100644
5 --- a/frameworks/base/libs/ui/InputReader.cpp
6 +++ b/frameworks/base/libs/ui/InputReader.cpp
7 @@ -1668,12 +1668,36 @@ bool TouchInputMapper::configureSurfaceLocked() {
8  
9          // Configure X and Y factors.
10          if (mRawAxes.x.valid && mRawAxes.y.valid) {
11 -            mLocked.xOrigin = mRawAxes.x.minValue;
12 -            mLocked.yOrigin = mRawAxes.y.minValue;
13 -            mLocked.xScale = float(width) / mRawAxes.x.getRange();
14 -            mLocked.yScale = float(height) / mRawAxes.y.getRange();
15 -            mLocked.xPrecision = 1.0f / mLocked.xScale;
16 -            mLocked.yPrecision = 1.0f / mLocked.yScale;
17 +            int a[7], have_pointercal = 0;
18 +            const char *fname = "/vendor/pointercal";
19 +            FILE *f = fopen(fname, "r");
20 +            int ret;
21 +            if (f) {
22 +              ret = fscanf(f, "%d %d %d %d %d %d %d",
23 +                &a[0], &a[1], &a[2], &a[3], &a[4], &a[5], &a[6]);
24 +              if (ret == 7)
25 +                have_pointercal = 1;
26 +              else
27 +                LOGW("Failed to parse %s", fname);
28 +              fclose(f);
29 +            }
30 +            else
31 +              LOGW("Failed to open %s", fname);
32 +
33 +            if (have_pointercal) {
34 +                mLocked.xScale = float(a[0]) / float(a[6]);
35 +                mLocked.yScale = float(a[4]) / float(a[6]);
36 +               // a[2] / mLocked.xScale / a[6]
37 +                mLocked.xOrigin = -a[2] / a[0];
38 +                mLocked.yOrigin = -a[5] / a[4];
39 +            } else {
40 +                mLocked.xOrigin = mRawAxes.x.minValue;
41 +                mLocked.yOrigin = mRawAxes.y.minValue;
42 +                mLocked.xScale = float(width) / mRawAxes.x.getRange();
43 +                mLocked.yScale = float(height) / mRawAxes.y.getRange();
44 +            }
45 +            mLocked.xPrecision = fabsf(1.0f / mLocked.xScale);
46 +            mLocked.yPrecision = fabsf(1.0f / mLocked.yScale);
47  
48              configureVirtualKeysLocked();
49          } else {
50 @@ -1689,7 +1713,7 @@ bool TouchInputMapper::configureSurfaceLocked() {
51          // Scale factor for terms that are not oriented in a particular axis.
52          // If the pixels are square then xScale == yScale otherwise we fake it
53          // by choosing an average.
54 -        mLocked.geometricScale = avg(mLocked.xScale, mLocked.yScale);
55 +        mLocked.geometricScale = avg(fabsf(mLocked.xScale), fabsf(mLocked.yScale));
56  
57          // Size of diagonal axis.
58          float diagonalSize = pythag(width, height);
59
60 project hardware/libhardware/
61 diff --git a/hardware/libhardware/modules/gralloc/framebuffer.cpp b/hardware/libhardware/modules/gralloc/framebuffer.cpp
62 index fe57a8a..b5465e4 100644
63 --- a/hardware/libhardware/modules/gralloc/framebuffer.cpp
64 +++ b/hardware/libhardware/modules/gralloc/framebuffer.cpp
65 @@ -109,6 +109,12 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer)
66          }
67          m->currentBuffer = buffer;
68          
69 +#ifndef FBIO_WAITFORVSYNC
70 +#define FBIO_WAITFORVSYNC _IOW ('F', 32, unsigned int)
71 +#endif
72 +        int mode = 0;
73 +        ioctl(m->framebuffer->fd, FBIO_WAITFORVSYNC, &mode);
74 +
75      } else {
76          // If we can't do the page_flip, just copy the buffer to the front 
77          // FIXME: use copybit HAL instead of memcpy
78
79 project system/core/
80 diff --git a/system/core/libsysutils/src/NetlinkListener.cpp b/system/core/libsysutils/src/NetlinkListener.cpp
81 index fb088e1..f99227c 100644
82 --- a/system/core/libsysutils/src/NetlinkListener.cpp
83 +++ b/system/core/libsysutils/src/NetlinkListener.cpp
84 @@ -45,21 +45,21 @@ bool NetlinkListener::onDataAvailable(SocketClient *cli)
85      }
86  
87      if ((snl.nl_groups != 1) || (snl.nl_pid != 0)) {
88 -        SLOGE("ignoring non-kernel netlink multicast message");
89 -        return false;
90 +        //SLOGE("ignoring non-kernel netlink multicast message");
91 +        return true;
92      }
93  
94      struct cmsghdr * cmsg = CMSG_FIRSTHDR(&hdr);
95  
96      if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) {
97          SLOGE("ignoring message with no sender credentials");
98 -        return false;
99 +        return true;
100      }
101  
102      struct ucred * cred = (struct ucred *)CMSG_DATA(cmsg);
103      if (cred->uid != 0) {
104          SLOGE("ignoring message from non-root UID %d", cred->uid);
105 -        return false;
106 +        return true;
107      }
108  
109      NetlinkEvent *evt = new NetlinkEvent();
110
111 project system/extras/
112 diff --git a/system/extras/su/su.c b/system/extras/su/su.c
113 index b87cece..bddc37d 100644
114 --- a/system/extras/su/su.c
115 +++ b/system/extras/su/su.c
116 @@ -59,10 +59,12 @@ int main(int argc, char **argv)
117  
118      /* Until we have something better, only root and the shell can use su. */
119      myuid = getuid();
120 +#if 0
121      if (myuid != AID_ROOT && myuid != AID_SHELL) {
122          fprintf(stderr,"su: uid %d not allowed to su\n", myuid);
123          return 1;
124      }
125 +#endif
126      
127      if(setgid(gid) || setuid(uid)) {
128          fprintf(stderr,"su: permission denied\n");