2626import android .graphics .Rect ;
2727import android .graphics .Region .Op ;
2828import android .opengl .GLUtils ;
29+ import android .os .SystemProperties ;
2930import android .renderscript .Matrix4f ;
3031import android .service .wallpaper .WallpaperService ;
3132import 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