Skip to content

Commit 05aa1fe

Browse files
ducrohetAndroid (Google) Code Review
authored andcommitted
Merge "Don't use OpenGL ES 2.0 to render the wallpaper on the emulator. Bug #5352896"
2 parents d4fb497 + 043a6b1 commit 05aa1fe

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

packages/SystemUI/src/com/android/systemui/ImageWallpaper.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import android.graphics.Rect;
2727
import android.graphics.Region.Op;
2828
import android.opengl.GLUtils;
29+
import android.os.SystemProperties;
2930
import android.renderscript.Matrix4f;
3031
import android.service.wallpaper.WallpaperService;
3132
import android.util.Log;
@@ -56,6 +57,7 @@ public class ImageWallpaper extends WallpaperService {
5657
private static final String TAG = "ImageWallpaper";
5758
private static final String GL_LOG_TAG = "ImageWallpaperGL";
5859
private static final boolean DEBUG = false;
60+
private static final String PROPERTY_KERNEL_QEMU = "ro.kernel.qemu";
5961

6062
static final boolean FIXED_SIZED_SURFACE = true;
6163
static final boolean USE_OPENGL = true;
@@ -71,12 +73,19 @@ public void onCreate() {
7173

7274
//noinspection PointlessBooleanExpression,ConstantConditions
7375
if (FIXED_SIZED_SURFACE && USE_OPENGL) {
74-
WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
75-
Display display = windowManager.getDefaultDisplay();
76-
mIsHwAccelerated = ActivityManager.isHighEndGfx(display);
76+
if (!isEmulator()) {
77+
WindowManager windowManager =
78+
(WindowManager) getSystemService(Context.WINDOW_SERVICE);
79+
Display display = windowManager.getDefaultDisplay();
80+
mIsHwAccelerated = ActivityManager.isHighEndGfx(display);
81+
}
7782
}
7883
}
7984

85+
private static boolean isEmulator() {
86+
return "1".equals(SystemProperties.get(PROPERTY_KERNEL_QEMU, "0"));
87+
}
88+
8089
public Engine onCreateEngine() {
8190
return new DrawableEngine();
8291
}

0 commit comments

Comments
 (0)