am 889814ce: resolved conflicts for merge of 32912e0a to stage-aosp-master

* commit '889814cee0ebcf70069d04d3ae77c97c09efb5a1':
  wallpaper: limit wallpaper width to sys.max_texture_size
This commit is contained in:
Michael Wright
2014-05-20 09:28:40 +00:00
committed by Android Git Automerger

View File

@@ -45,6 +45,7 @@ import android.os.Message;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.util.Log;
import android.view.WindowManagerGlobal;
@@ -919,6 +920,35 @@ public class WallpaperManager {
*/
public void suggestDesiredDimensions(int minimumWidth, int minimumHeight) {
try {
/**
* The framework makes no attempt to limit the window size
* to the maximum texture size. Any window larger than this
* cannot be composited.
*
* Read maximum texture size from system property and scale down
* minimumWidth and minimumHeight accordingly.
*/
int maximumTextureSize;
try {
maximumTextureSize = SystemProperties.getInt("sys.max_texture_size", 0);
} catch (Exception e) {
maximumTextureSize = 0;
}
if (maximumTextureSize > 0) {
if ((minimumWidth > maximumTextureSize) ||
(minimumHeight > maximumTextureSize)) {
float aspect = (float)minimumHeight / (float)minimumWidth;
if (minimumWidth > minimumHeight) {
minimumWidth = maximumTextureSize;
minimumHeight = (int)((minimumWidth * aspect) + 0.5);
} else {
minimumHeight = maximumTextureSize;
minimumWidth = (int)((minimumHeight / aspect) + 0.5);
}
}
}
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
} else {