diff options
24 files changed, 214 insertions, 52 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/hardware/Camera.java b/core/java/android/hardware/Camera.java index dd15d38..16727fe 100644 --- a/core/java/android/hardware/Camera.java +++ b/core/java/android/hardware/Camera.java @@ -1147,7 +1147,16 @@ public class Camera { // Set to oneshot mode again. setHasPreviewCallback(true, false); } - pCb.onPreviewFrame((byte[])msg.obj, mCamera); + + byte[] luminances = (byte[])msg.obj; + if(getParameters().getPreviewFormat() == ImageFormat.RGB_565) + // Convert to greyscale + // Apps expect YUV as default format. Greyscale is + // only the first layer of YUV, but it's all that's + // needed by barcode scanner apps. + rgbToBw(luminances); + + pCb.onPreviewFrame(luminances, mCamera); } return; @@ -1216,6 +1225,17 @@ public class Camera { } } + private void rgbToBw(byte[] pixels) + { + Size previewsize = getParameters().getPreviewSize(); + int height = previewsize.height; + int width = previewsize.width; + + native_rgbToBw(pixels, width, height); + } + + private native void native_rgbToBw(byte[] pixelBuffer, int bufWidth, int bufHeight); + private static void postEventFromNative(Object camera_ref, int what, int arg1, int arg2, Object obj) { diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 3ab16fe..e6f1f4a 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -4926,6 +4926,13 @@ public final class Settings { "lock_screen_allow_private_notifications"; /** + * Separate password for encryption and the lockscreen. + * @hide + */ + public static final String LOCK_SEPARATE_ENCRYPTION_PASSWORD = + "lock_separate_encryption_password"; + + /** * Set by the system to track if the user needs to see the call to action for * the lockscreen notification policy. * @hide 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/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 5dc91d2..d25f995 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -462,7 +462,8 @@ public class LockPatternUtils { // well, we tried... } - if (userHandle == UserHandle.USER_OWNER) { + if (userHandle == UserHandle.USER_OWNER + && !isSeparateEncryptionPasswordEnabled()) { // Set the encryption password to default. updateEncryptionPassword(StorageManager.CRYPT_TYPE_DEFAULT, null); } @@ -523,7 +524,8 @@ public class LockPatternUtils { // Update the device encryption password. if (userId == UserHandle.USER_OWNER - && LockPatternUtils.isDeviceEncryptionEnabled()) { + && LockPatternUtils.isDeviceEncryptionEnabled() + && !isSeparateEncryptionPasswordEnabled()) { if (!shouldEncryptWithCredentials(true)) { clearEncryptionPassword(); } else { @@ -732,7 +734,8 @@ public class LockPatternUtils { // Update the device encryption password. if (userHandle == UserHandle.USER_OWNER - && LockPatternUtils.isDeviceEncryptionEnabled()) { + && LockPatternUtils.isDeviceEncryptionEnabled() + && !isSeparateEncryptionPasswordEnabled()) { if (!shouldEncryptWithCredentials(true)) { clearEncryptionPassword(); } else { @@ -1089,6 +1092,69 @@ public class LockPatternUtils { } } + private void updateEncryptionPasswordFromPassword(String password) { + if (!TextUtils.isEmpty(password)) { + int computedQuality = computePasswordQuality(password); + boolean numeric = computedQuality + == DevicePolicyManager.PASSWORD_QUALITY_NUMERIC; + boolean numericComplex = computedQuality + == DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX; + int type = numeric || numericComplex ? StorageManager.CRYPT_TYPE_PIN + : StorageManager.CRYPT_TYPE_PASSWORD; + updateEncryptionPassword(type, password); + } else { + clearEncryptionPassword(); + } + } + + /** + * Set the encryption password separately from the lockscreen password. + * + * @param password The password to save + */ + public void setSeparateEncryptionPassword(String password) { + updateEncryptionPasswordFromPassword(password); + setSeparateEncryptionPasswordEnabled(true); + } + + /** + * Replace the separate encryption password by tying it to the lockscreen + * password. No change will occur if the provided lockscreen password is + * incorrect. + * + * @param password The current lockscreen password + * @return Whether the lockscreen password was correct. + */ + public void replaceSeparateEncryptionPassword(String password) { + updateEncryptionPasswordFromPassword(password); + setSeparateEncryptionPasswordEnabled(false); + } + + /** + * Replace the separate encryption password by tying it to the lockscreen + * pattern. No change will occur if the provided lockscreen password is + * incorrect. + * + * @param pattern The current lockscreen pattern + * @return Whether the lockscreen pattern was correct. + */ + public void replaceSeparateEncryptionPasswordWithPattern(List<LockPatternView.Cell> pattern, int userId) { + String stringPattern = patternToString(pattern, userId); + updateEncryptionPassword(StorageManager.CRYPT_TYPE_PATTERN, stringPattern); + setSeparateEncryptionPasswordEnabled(false); + } + + /** + * @return Whether the encryption password is separate from the lockscreen password. + */ + public boolean isSeparateEncryptionPasswordEnabled() { + return getBoolean(Settings.Secure.LOCK_SEPARATE_ENCRYPTION_PASSWORD, false, UserHandle.USER_OWNER); + } + + private void setSeparateEncryptionPasswordEnabled(boolean enabled) { + setBoolean(Settings.Secure.LOCK_SEPARATE_ENCRYPTION_PASSWORD, enabled, UserHandle.USER_OWNER); + } + /** * @return Whether tactile feedback for the pattern is enabled. */ diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp index 4cf317e..3bb6af3 100644 --- a/core/jni/android_hardware_Camera.cpp +++ b/core/jni/android_hardware_Camera.cpp @@ -79,6 +79,8 @@ struct fields_t { static fields_t fields; static Mutex sLock; +int bwDataSize = 0; + // provides persistent context for calls from native code to Java class JNICameraContext: public CameraListener { @@ -933,6 +935,44 @@ static jstring android_hardware_Camera_getParameters(JNIEnv *env, jobject thiz) return env->NewStringUTF(params8.string()); } +static void android_hardware_Camera_rgbToBw(JNIEnv *env, jobject thiz, jbyteArray pixelBuffer, jint bufWidth, jint bufHeight) +{ + int width = bufWidth; + int height = bufHeight; + int size = width * height; + + static jbyte* pixeldata; + static jbyte* luminances; + + if(bwDataSize != size) { + pixeldata = (jbyte *)malloc(size*2); + luminances = (jbyte *)malloc(size); + bwDataSize = size; + ALOGV("Allocated buffer of size %d", size); + } + + env->GetByteArrayRegion(pixelBuffer, 0, size*2, pixeldata); + + // Convert the entire image to grayscale + for (int y = 0; y < height; y++) { + int offset = y * width *2; + for (int x = 0; x < width *2; x+=2) { + jbyte pixel = pixeldata[offset +x]; + jbyte pixel2 = pixeldata[offset +x + 1]; + // little endian + // GGGBBBBB | RRRRRGGG + jbyte b = (jbyte)(pixel & 0x1f); // 5 bits + jbyte g = (jbyte)(((pixel >> 5) & 0x07) | ((pixel2 & 0x07) << 3)); // 6 bits + jbyte r = (jbyte)((pixel2 >> 3) & 0x1f); // 5 bits + + // Calculate luminance cheaply, favoring green. + luminances[(offset + x)/2] = (jbyte)((r + g + b) << 1); + } + } + + env->SetByteArrayRegion(pixelBuffer, 0, size, luminances); +} + static void android_hardware_Camera_reconnect(JNIEnv *env, jobject thiz) { ALOGV("reconnect"); @@ -1146,6 +1186,9 @@ static JNINativeMethod camMethods[] = { { "native_getParameters", "()Ljava/lang/String;", (void *)android_hardware_Camera_getParameters }, + { "native_rgbToBw", + "([BII)V", + (void *)android_hardware_Camera_rgbToBw }, { "reconnect", "()V", (void*)android_hardware_Camera_reconnect }, 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/drawable-nodpi/stat_sys_adb.xml b/core/res/res/drawable-nodpi/stat_sys_adb.xml index d72d801..8cc9961 100644 --- a/core/res/res/drawable-nodpi/stat_sys_adb.xml +++ b/core/res/res/drawable-nodpi/stat_sys_adb.xml @@ -1,5 +1,5 @@ <!-- -Copyright (C) 2017 The LineageOS Project +Copyright (C) 2014 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,8 +19,18 @@ Copyright (C) 2017 The LineageOS Project android:viewportWidth="24.0" android:viewportHeight="24.0"> <path - android:fillColor="#FFFFFFFF" - android:pathData="M12,6 C15.3,6,18,8.7,18,12 S15.3,18,12,18 S6,15.3,6,12 S8.7,6,12,6 M12,4 -C7.6,4,4,7.6,4,12 S7.6,20,12,20 S20,16.4,20,12 S16.4,4,12,4 Z M12,9 -C10.3,9,9,10.3,9,12 S10.3,15,12,15 S15,13.7,15,12 S13.7,9,12,9 Z" /> + android:pathData="M8.4,5.3c-0.2,0.0 -0.4,-0.2 -0.5,-0.4L7.1,1.6C7.0,1.4 7.2,1.1 7.4,1.0C7.7,0.9 8.0,1.1 8.0,1.4l0.8,3.3c0.1,0.3 -0.1,0.5 -0.4,0.6C8.5,5.3 8.4,5.3 8.4,5.3z" + android:fillColor="#FFFFFF"/> + <path + android:pathData="M15.6,5.3c0.0,0.0 -0.1,0.0 -0.1,0.0c-0.3,-0.1 -0.4,-0.3 -0.4,-0.6L16.0,1.4C16.0,1.1 16.3,0.9 16.6,1.0c0.3,0.1 0.4,0.3 0.4,0.6l-0.8,3.3C16.1,5.1 15.9,5.3 15.6,5.3z" + android:fillColor="#FFFFFF"/> + <path + android:pathData="M18.6,5.4c-0.1,-0.1 -0.2,-0.1 -0.3,-0.2c0.2,0.2 0.3,0.3 0.3,0.5c0.0,0.9 -2.9,1.7 -6.6,1.7S5.4,6.7 5.4,5.7c0.0,-0.2 0.1,-0.3 0.3,-0.5C5.6,5.3 5.5,5.4 5.4,5.4C5.0,5.9 4.0,8.0 4.0,12.0s1.0,6.1 1.4,6.6C5.9,19.0 8.0,20.0 12.0,20.0s6.1,-1.0 6.6,-1.4C19.0,18.1 20.0,16.0 20.0,12.0S19.0,5.9 18.6,5.4zM8.0,13.0c-0.6,0.0 -1.0,-0.4 -1.0,-1.0c0.0,-0.6 0.4,-1.0 1.0,-1.0s1.0,0.4 1.0,1.0C9.0,12.6 8.6,13.0 8.0,13.0zM16.0,13.0c-0.6,0.0 -1.0,-0.4 -1.0,-1.0c0.0,-0.6 0.4,-1.0 1.0,-1.0s1.0,0.4 1.0,1.0C17.0,12.6 16.6,13.0 16.0,13.0z" + android:fillColor="#FFFFFF"/> + <path + android:pathData="M5.35,5.7 + a 6.6 1.75 0 1 1 13.25 0 + a 6.6 1.75 0 1 1 -13.25 0 + z" + android:fillColor="#BBFFFFFF" /> </vector> 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/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java index 827b378..f8d7fc9 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -20,6 +20,7 @@ import android.app.AlertDialog; import android.app.admin.DevicePolicyManager; import android.content.Context; import android.os.RemoteException; +import android.os.PowerManager; import android.os.UserHandle; import android.util.AttributeSet; import android.util.Log; @@ -294,6 +295,11 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe if (timeoutMs > 0) { showTimeoutDialog(timeoutMs); } + + if (mLockPatternUtils.isSeparateEncryptionPasswordEnabled() && failedAttempts >= 5) { + final PowerManager powerManager = mContext.getSystemService(PowerManager.class); + powerManager.reboot(null); + } } /** diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java index 70a9f5c..33f8da8 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -69,8 +69,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map.Entry; -import cyanogenmod.providers.CMSettings; - import static android.os.BatteryManager.BATTERY_HEALTH_UNKNOWN; import static android.os.BatteryManager.BATTERY_STATUS_FULL; import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN; @@ -1132,8 +1130,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } private boolean isDeviceProvisionedInSettingsDb() { - return CMSettings.Secure.getInt(mContext.getContentResolver(), - CMSettings.Secure.CM_SETUP_WIZARD_COMPLETED, 0) != 0; + return Settings.Global.getInt(mContext.getContentResolver(), + Settings.Global.DEVICE_PROVISIONED, 0) != 0; } private void watchForDeviceProvisioning() { @@ -1150,7 +1148,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { }; mContext.getContentResolver().registerContentObserver( - CMSettings.Secure.getUriFor(CMSettings.Secure.CM_SETUP_WIZARD_COMPLETED), + Settings.Global.getUriFor(Settings.Global.DEVICE_PROVISIONED), false, mDeviceProvisionedObserver); // prevent a race condition between where we check the flag and where we register the diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index 7a14241..e9169bf 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -34,6 +34,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 42c1aa7..a57ddc1 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(); @@ -1931,8 +1928,6 @@ class DatabaseHelper extends SQLiteOpenHelper { } if (upgradeVersion < 115) { - moveSettingsToNewTable(db, TABLE_SYSTEM, TABLE_SECURE, - new String[] { CMSettings.Secure.STATS_COLLECTION }, true); if (mUserHandle == UserHandle.USER_OWNER) { db.beginTransaction(); SQLiteStatement stmt = null; @@ -2588,8 +2583,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); @@ -2641,10 +2634,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) { @@ -2834,6 +2829,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/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index d45b52b..4b49196 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -109,6 +109,7 @@ <uses-permission android:name="android.permission.TRUST_LISTENER" /> <uses-permission android:name="android.permission.USE_FINGERPRINT" /> <uses-permission android:name="android.permission.RESET_FINGERPRINT_LOCKOUT" /> + <uses-permission android:name="android.permission.REBOOT" /> <!-- Needed for WallpaperManager.clear in ImageWallpaper.updateWallpaperLocked --> <uses-permission android:name="android.permission.SET_WALLPAPER"/> 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/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index e958ee1..8511107 100755 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -118,8 +118,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; -import cyanogenmod.providers.CMSettings; - import static com.android.keyguard.KeyguardHostView.OnDismissAction; public abstract class BaseStatusBar extends SystemUI implements @@ -270,8 +268,8 @@ public abstract class BaseStatusBar extends SystemUI implements protected final ContentObserver mSettingsObserver = new ContentObserver(mHandler) { @Override public void onChange(boolean selfChange) { - final boolean provisioned = 0 != CMSettings.Secure.getInt( - mContext.getContentResolver(), CMSettings.Secure.CM_SETUP_WIZARD_COMPLETED, 0); + final boolean provisioned = 0 != Settings.Global.getInt( + mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0); if (provisioned != mDeviceProvisioned) { mDeviceProvisioned = provisioned; updateNotifications(); @@ -582,8 +580,8 @@ public abstract class BaseStatusBar extends SystemUI implements mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); mContext.getContentResolver().registerContentObserver( - CMSettings.Secure.getUriFor(CMSettings.Secure.CM_SETUP_WIZARD_COMPLETED), false, - mSettingsObserver, UserHandle.USER_ALL); + Settings.Global.getUriFor(Settings.Global.DEVICE_PROVISIONED), true, + mSettingsObserver); mContext.getContentResolver().registerContentObserver( Settings.Global.getUriFor(Settings.Global.ZEN_MODE), false, mSettingsObserver); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 7df8346..6b44688 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -3600,12 +3600,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } else if (cyanogenmod.content.Intent.ACTION_SCREEN_CAMERA_GESTURE.equals(action)) { boolean userSetupComplete = Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 0) != 0; - if (!userSetupComplete || !isDeviceProvisioned()) { - if (DEBUG) { - Log.d(TAG, String.format("userSetupComplete = $1%s, " + - "deviceProvisioned = $2%s, ignoring camera launch gesture.", - userSetupComplete, isDeviceProvisioned())); - } + if (!userSetupComplete) { + if (DEBUG) Log.d(TAG, String.format( + "userSetupComplete = %s, ignoring camera launch gesture.", + userSetupComplete)); return; } diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java index 10b0bdd..81cbc19 100644 --- a/services/core/java/com/android/server/LockSettingsService.java +++ b/services/core/java/com/android/server/LockSettingsService.java @@ -839,6 +839,7 @@ public class LockSettingsService extends ILockSettings.Stub { Secure.LOCK_PATTERN_SIZE, Secure.LOCK_DOTS_VISIBLE, Secure.LOCK_SHOW_ERROR_PATH, + Secure.LOCK_SEPARATE_ENCRYPTION_PASSWORD }; // Reading these settings needs the contacts permission 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/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 6339007..f0c4a62 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -1443,8 +1443,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { } boolean isUserSetupComplete() { - return CMSettings.Secure.getIntForUser(mContext.getContentResolver(), - CMSettings.Secure.CM_SETUP_WIZARD_COMPLETED, 0, UserHandle.USER_CURRENT) != 0; + return Settings.Secure.getIntForUser(mContext.getContentResolver(), + Settings.Secure.USER_SETUP_COMPLETE, 0, UserHandle.USER_CURRENT) != 0; } private void handleShortPressOnHome() { diff --git a/services/core/java/com/android/server/power/ShutdownThread.java b/services/core/java/com/android/server/power/ShutdownThread.java index 36a9ca2..76acf9d 100644 --- a/services/core/java/com/android/server/power/ShutdownThread.java +++ b/services/core/java/com/android/server/power/ShutdownThread.java @@ -174,7 +174,7 @@ public final class ShutdownThread extends Thread { KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); boolean keyguardLocked = km.inKeyguardRestrictedInputMode() && km.isKeyguardSecure(); boolean advancedRebootEnabled = CMSettings.Secure.getInt(context.getContentResolver(), - CMSettings.Secure.ADVANCED_REBOOT, 0) == 1; + CMSettings.Secure.ADVANCED_REBOOT, 1) == 1; boolean isPrimaryUser = UserHandle.getCallingUserId() == UserHandle.USER_OWNER; return advancedRebootEnabled && !keyguardLocked && isPrimaryUser; 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", |