CherryPick 043a6b from master: do not merge.
Don't use OpenGL ES 2.0 to render the wallpaper on the emulator. Bug #5352896 The emulator doesn't support OpenGL ES 2.0. Change-Id: I3d60f8e4b5c5431e9e21471c576f4a9382f4693f
This commit is contained in:
committed by
Xavier Ducrohet
parent
ce9756d06d
commit
0e8fb15da2
@@ -26,6 +26,7 @@ import android.graphics.Canvas;
|
|||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.Region.Op;
|
import android.graphics.Region.Op;
|
||||||
import android.opengl.GLUtils;
|
import android.opengl.GLUtils;
|
||||||
|
import android.os.SystemProperties;
|
||||||
import android.renderscript.Matrix4f;
|
import android.renderscript.Matrix4f;
|
||||||
import android.service.wallpaper.WallpaperService;
|
import android.service.wallpaper.WallpaperService;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -56,6 +57,7 @@ public class ImageWallpaper extends WallpaperService {
|
|||||||
private static final String TAG = "ImageWallpaper";
|
private static final String TAG = "ImageWallpaper";
|
||||||
private static final String GL_LOG_TAG = "ImageWallpaperGL";
|
private static final String GL_LOG_TAG = "ImageWallpaperGL";
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
private static final String PROPERTY_KERNEL_QEMU = "ro.kernel.qemu";
|
||||||
|
|
||||||
static final boolean FIXED_SIZED_SURFACE = true;
|
static final boolean FIXED_SIZED_SURFACE = true;
|
||||||
static final boolean USE_OPENGL = true;
|
static final boolean USE_OPENGL = true;
|
||||||
@@ -71,12 +73,19 @@ public class ImageWallpaper extends WallpaperService {
|
|||||||
|
|
||||||
//noinspection PointlessBooleanExpression,ConstantConditions
|
//noinspection PointlessBooleanExpression,ConstantConditions
|
||||||
if (FIXED_SIZED_SURFACE && USE_OPENGL) {
|
if (FIXED_SIZED_SURFACE && USE_OPENGL) {
|
||||||
WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
|
if (!isEmulator()) {
|
||||||
Display display = windowManager.getDefaultDisplay();
|
WindowManager windowManager =
|
||||||
mIsHwAccelerated = ActivityManager.isHighEndGfx(display);
|
(WindowManager) getSystemService(Context.WINDOW_SERVICE);
|
||||||
|
Display display = windowManager.getDefaultDisplay();
|
||||||
|
mIsHwAccelerated = ActivityManager.isHighEndGfx(display);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isEmulator() {
|
||||||
|
return "1".equals(SystemProperties.get(PROPERTY_KERNEL_QEMU, "0"));
|
||||||
|
}
|
||||||
|
|
||||||
public Engine onCreateEngine() {
|
public Engine onCreateEngine() {
|
||||||
return new DrawableEngine();
|
return new DrawableEngine();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user