Merge "Add missing resources"
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index ebc1882..2cb8a86 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -241,7 +241,7 @@
// don't use the intent to figure out if network is connected, just check
// ConnectivityManager directly.
- mDataConnectionIsConnected = isNetworkConnected();
+ mDataConnectionIsConnected = readDataConnectionState();
if (mDataConnectionIsConnected) {
if (!wasConnected) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
@@ -254,7 +254,7 @@
}
};
- private boolean isNetworkConnected() {
+ private boolean readDataConnectionState() {
NetworkInfo networkInfo = getConnectivityManager().getActiveNetworkInfo();
return (networkInfo != null) && networkInfo.isConnected();
}
@@ -1429,7 +1429,7 @@
// to have the most recent value used.
try {
waitUntilReadyToRun();
- mDataConnectionIsConnected = isNetworkConnected();
+ mDataConnectionIsConnected = readDataConnectionState();
mSyncManagerWakeLock.acquire();
// Always do this first so that we be sure that any periodic syncs that
// are ready to run have been converted into pending syncs. This allows the
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index a4d5f35..05f40ba 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -2641,9 +2641,11 @@
int32_t c2 = signExtendNybble(in.orientation & 0x0f);
if (c1 != 0 || c2 != 0) {
orientation = atan2f(c1, c2) * 0.5f;
- float minorAxisScale = (16.0f - pythag(c1, c2)) / 16.0f;
- toolMinor *= minorAxisScale;
- touchMinor *= minorAxisScale;
+ float scale = 1.0f + pythag(c1, c2) / 16.0f;
+ touchMajor *= scale;
+ touchMinor /= scale;
+ toolMajor *= scale;
+ toolMinor /= scale;
} else {
orientation = 0;
}
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index fde8e67..0f7d639 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -142,7 +142,8 @@
sp<LayerBaseClient::Surface> Layer::createSurface() const
{
- return mSurface;
+ sp<Surface> sur(new SurfaceLayer(mFlinger, const_cast<Layer *>(this)));
+ return sur;
}
status_t Layer::ditch()
@@ -152,9 +153,6 @@
// the layer is not on screen anymore. free as much resources as possible
mFreezeLock.clear();
- // Free our own reference to ISurface
- mSurface.clear();
-
Mutex::Autolock _l(mLock);
mWidth = mHeight = 0;
return NO_ERROR;
@@ -202,7 +200,6 @@
int layerRedsize = info.getSize(PixelFormatInfo::INDEX_RED);
mNeedsDithering = layerRedsize > displayRedSize;
- mSurface = new SurfaceLayer(mFlinger, this);
return NO_ERROR;
}
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index d9a8be3..2b38414 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -213,7 +213,6 @@
ClientRef mUserClientRef;
// constants
- sp<Surface> mSurface;
PixelFormat mFormat;
const GLExtensions& mGLExtensions;
bool mNeedsBlending;
diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp
index 86057f8..6025ed4 100644
--- a/services/surfaceflinger/LayerBase.cpp
+++ b/services/surfaceflinger/LayerBase.cpp
@@ -540,7 +540,9 @@
LayerBaseClient::LayerBaseClient(SurfaceFlinger* flinger, DisplayID display,
const sp<Client>& client)
- : LayerBase(flinger, display), mClientRef(client),
+ : LayerBase(flinger, display),
+ mHasSurface(false),
+ mClientRef(client),
mIdentity(uint32_t(android_atomic_inc(&sIdentity)))
{
}
@@ -557,12 +559,13 @@
{
sp<Surface> s;
Mutex::Autolock _l(mLock);
- s = mClientSurface.promote();
- if (s == 0) {
- s = createSurface();
- mClientSurface = s;
- mClientSurfaceBinder = s->asBinder();
- }
+
+ LOG_ALWAYS_FATAL_IF(mHasSurface,
+ "LayerBaseClient::getSurface() has already been called");
+
+ mHasSurface = true;
+ s = createSurface();
+ mClientSurfaceBinder = s->asBinder();
return s;
}
diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h
index 184edd7..bfe92e6 100644
--- a/services/surfaceflinger/LayerBase.h
+++ b/services/surfaceflinger/LayerBase.h
@@ -337,7 +337,7 @@
private:
mutable Mutex mLock;
- mutable wp<Surface> mClientSurface;
+ mutable bool mHasSurface;
wp<IBinder> mClientSurfaceBinder;
const wp<Client> mClientRef;
// only read