diff options
11 files changed, 37 insertions, 21 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index 0ae9187..5fc3437 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -529,7 +529,8 @@ public class ActivityManager { static public boolean isHighEndGfx() { return (!isLowRamDeviceStatic() && !Resources.getSystem().getBoolean(com.android.internal.R.bool.config_avoidGfxAccel)) - || isForcedHighEndGfx(); + || isForcedHighEndGfx() + || "0".equals(SystemProperties.get("ro.softwaregl", "0")); } /** diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index d598291..fa3d9c9 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -189,7 +189,7 @@ public abstract class WallpaperService extends Service { final BaseSurfaceHolder mSurfaceHolder = new BaseSurfaceHolder() { { - mRequestedFormat = PixelFormat.RGBX_8888; + mRequestedFormat = PixelFormat.RGBA_8888; } @Override diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index 5e58250..f67bb9c 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -19,6 +19,7 @@ package android.view; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Rect; +import android.os.SystemProperties; import android.view.Surface.OutOfResourcesException; import java.io.File; @@ -161,14 +162,14 @@ public abstract class HardwareRenderer { * * @hide */ - public static boolean sRendererDisabled = false; + public static boolean sRendererDisabled = SystemProperties.get("ro.softwaregl").equals("1") ? true : false; /** * Further hardware renderer disabling for the system process. * * @hide */ - public static boolean sSystemRendererDisabled = false; + public static boolean sSystemRendererDisabled = SystemProperties.get("ro.softwaregl").equals("1") ? true : false; private boolean mEnabled; private boolean mRequested = true; diff --git a/core/jni/android_view_DisplayListCanvas.cpp b/core/jni/android_view_DisplayListCanvas.cpp index ef1e4ab..fedb37d 100644 --- a/core/jni/android_view_DisplayListCanvas.cpp +++ b/core/jni/android_view_DisplayListCanvas.cpp @@ -222,14 +222,19 @@ static void android_view_DisplayListCanvas_drawLayer(JNIEnv* env, jobject clazz, static jboolean android_view_DisplayListCanvas_isAvailable(JNIEnv* env, jobject clazz) { char prop[PROPERTY_VALUE_MAX]; - if (property_get("ro.kernel.qemu", prop, NULL) == 0) { - // not in the emulator + char software_rendering[PROPERTY_VALUE_MAX]; + + property_get("ro.softwaregl", software_rendering, "0"); + + if (property_get("ro.kernel.qemu", prop, NULL) == 0 && !atoi(software_rendering)) { + // not in the emulator and device has hardware acceleration return JNI_TRUE; } + // In the emulator this property will be set to 1 when hardware GLES is // enabled, 0 otherwise. On old emulator versions it will be undefined. property_get("ro.kernel.qemu.gles", prop, "0"); - return atoi(prop) == 1 ? JNI_TRUE : JNI_FALSE; + return (atoi(prop) == 1 && !atoi(software_rendering)) ? JNI_TRUE : JNI_FALSE; } // ---------------------------------------------------------------------------- diff --git a/core/res/res/raw/color_fade_frag.frag b/core/res/res/raw/color_fade_frag.frag index a66a5a7..df3d704 100644 --- a/core/res/res/raw/color_fade_frag.frag +++ b/core/res/res/raw/color_fade_frag.frag @@ -7,6 +7,7 @@ uniform float saturation; uniform float gamma; varying vec2 UV; +/* vec3 rgb2hsl(vec3 rgb) { float e = 1.0e-7; @@ -32,11 +33,14 @@ vec3 hsl2rgb(vec3 hsl) float c = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y; return (rgb - vec3(0.5)) * c + hsl.z; } +*/ void main() { +/* vec4 color = texture2D(texUnit, UV); vec3 hsl = rgb2hsl(color.xyz); vec3 rgb = pow(hsl2rgb(vec3(hsl.x, hsl.y * saturation, hsl.z * opacity)), vec3(gamma)); - gl_FragColor = vec4(rgb, 1.0); +*/ + gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); } diff --git a/opengl/java/android/opengl/GLSurfaceView.java b/opengl/java/android/opengl/GLSurfaceView.java index 359a7a9..7e3439c 100644 --- a/opengl/java/android/opengl/GLSurfaceView.java +++ b/opengl/java/android/opengl/GLSurfaceView.java @@ -940,7 +940,7 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback int a = findConfigAttrib(egl, display, config, EGL10.EGL_ALPHA_SIZE, 0); if ((r == mRedSize) && (g == mGreenSize) - && (b == mBlueSize) && (a == mAlphaSize)) { + && (b == mBlueSize) && (a >= mAlphaSize)) { return config; } } diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index 9ecbfdd..a3a5aaa 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -41,6 +41,7 @@ <bool name="def_screen_brightness_automatic_mode">false</bool> <fraction name="def_window_animation_scale">100%</fraction> <fraction name="def_window_transition_scale">100%</fraction> + <fraction name="def_animator_duration_scale">100%</fraction> <bool name="def_haptic_feedback">true</bool> <bool name="def_dozeEnabledByDefault">false</bool> diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index e4b2409..68fde92 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -441,7 +441,6 @@ class DatabaseHelper extends SQLiteOpenHelper { + Settings.System.TRANSITION_ANIMATION_SCALE + "'"); stmt = db.compileStatement("INSERT INTO system(name,value)" + " VALUES(?,?);"); - loadDefaultAnimationSettings(stmt); db.setTransactionSuccessful(); } finally { db.endTransaction(); @@ -572,7 +571,6 @@ class DatabaseHelper extends SQLiteOpenHelper { + Settings.System.TRANSITION_ANIMATION_SCALE + "'"); stmt = db.compileStatement("INSERT INTO system(name,value)" + " VALUES(?,?);"); - loadDefaultAnimationSettings(stmt); db.setTransactionSuccessful(); } finally { db.endTransaction(); @@ -978,7 +976,6 @@ class DatabaseHelper extends SQLiteOpenHelper { + Settings.System.TRANSITION_ANIMATION_SCALE + "'"); stmt = db.compileStatement("INSERT INTO system(name,value)" + " VALUES(?,?);"); - loadDefaultAnimationSettings(stmt); db.setTransactionSuccessful(); } finally { db.endTransaction(); @@ -2588,8 +2585,6 @@ class DatabaseHelper extends SQLiteOpenHelper { loadBooleanSetting(stmt, Settings.System.SCREEN_BRIGHTNESS_MODE, R.bool.def_screen_brightness_automatic_mode); - loadDefaultAnimationSettings(stmt); - loadBooleanSetting(stmt, Settings.System.ACCELEROMETER_ROTATION, R.bool.def_accelerometer_rotation); @@ -2644,10 +2639,12 @@ class DatabaseHelper extends SQLiteOpenHelper { } private void loadDefaultAnimationSettings(SQLiteStatement stmt) { - loadFractionSetting(stmt, Settings.System.WINDOW_ANIMATION_SCALE, + loadFractionSetting(stmt, Settings.Global.WINDOW_ANIMATION_SCALE, R.fraction.def_window_animation_scale, 1); - loadFractionSetting(stmt, Settings.System.TRANSITION_ANIMATION_SCALE, + loadFractionSetting(stmt, Settings.Global.TRANSITION_ANIMATION_SCALE, R.fraction.def_window_transition_scale, 1); + loadFractionSetting(stmt, Settings.Global.ANIMATOR_DURATION_SCALE, + R.fraction.def_animator_duration_scale, 1); } private void loadDefaultHapticSettings(SQLiteStatement stmt) { @@ -2837,6 +2834,8 @@ class DatabaseHelper extends SQLiteOpenHelper { loadSetting(stmt, Settings.Global.MODE_RINGER, AudioManager.RINGER_MODE_NORMAL); + loadDefaultAnimationSettings(stmt); + // --- Previously in 'secure' loadBooleanSetting(stmt, Settings.Global.PACKAGE_VERIFIER_ENABLE, R.bool.def_package_verifier_enable); diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java index 5a6f3c9..b4634ab 100644 --- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java +++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java @@ -60,6 +60,7 @@ public class ImageWallpaper extends WallpaperService { private static final String GL_LOG_TAG = "ImageWallpaperGL"; private static final boolean DEBUG = false; private static final String PROPERTY_KERNEL_QEMU = "ro.kernel.qemu"; + private static final String PROPERTY_RENDERING_SOFTWARE = "ro.softwaregl"; static final boolean FIXED_SIZED_SURFACE = true; static final boolean USE_OPENGL = true; @@ -77,7 +78,7 @@ public class ImageWallpaper extends WallpaperService { //noinspection PointlessBooleanExpression,ConstantConditions if (FIXED_SIZED_SURFACE && USE_OPENGL) { - if (!isEmulator()) { + if (!isEmulator() && !needsSoftwareRendering()) { mIsHwAccelerated = ActivityManager.isHighEndGfx(); } } @@ -94,6 +95,10 @@ public class ImageWallpaper extends WallpaperService { return "1".equals(SystemProperties.get(PROPERTY_KERNEL_QEMU, "0")); } + private static boolean needsSoftwareRendering() { + return "1".equals(SystemProperties.get(PROPERTY_RENDERING_SOFTWARE, "0")); + } + @Override public Engine onCreateEngine() { mEngine = new DrawableEngine(); @@ -701,7 +706,7 @@ public class ImageWallpaper extends WallpaperService { mEglConfig = chooseEglConfig(); if (mEglConfig == null) { - throw new RuntimeException("eglConfig not initialized"); + return false; } mEglContext = createContext(mEgl, mEglDisplay, mEglConfig); diff --git a/services/core/java/com/android/server/connectivity/NetworkMonitor.java b/services/core/java/com/android/server/connectivity/NetworkMonitor.java index 5108564..5b632d6 100644 --- a/services/core/java/com/android/server/connectivity/NetworkMonitor.java +++ b/services/core/java/com/android/server/connectivity/NetworkMonitor.java @@ -270,9 +270,6 @@ public class NetworkMonitor extends StateMachine { mLingerDelayMs = SystemProperties.getInt(LINGER_DELAY_PROPERTY, DEFAULT_LINGER_DELAY_MS); - mIsCaptivePortalCheckEnabled = Settings.Global.getInt(mContext.getContentResolver(), - Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED, 1) == 1; - start(); } diff --git a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java index 7e5c807..36a2474 100644 --- a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java +++ b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java @@ -260,6 +260,9 @@ class ScreenRotationAnimation { if (isSecure) { flags |= SurfaceControl.SECURE; } + if (android.os.SystemProperties.get("ro.softwaregl").equals("1")) { + flags |= SurfaceControl.FX_SURFACE_DIM; + } if (WindowManagerService.DEBUG_SURFACE_TRACE) { mSurfaceControl = new SurfaceTrace(session, "ScreenshotSurface", |