diff options
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/app/ActivityManager.java | 3 | ||||
-rw-r--r-- | core/java/android/hardware/Camera.java | 22 | ||||
-rw-r--r-- | core/java/android/provider/Settings.java | 7 | ||||
-rw-r--r-- | core/java/android/service/wallpaper/WallpaperService.java | 2 | ||||
-rw-r--r-- | core/java/android/view/HardwareRenderer.java | 5 | ||||
-rw-r--r-- | core/java/com/android/internal/widget/LockPatternUtils.java | 72 |
6 files changed, 103 insertions, 8 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. */ |