summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.xml39
-rw-r--r--core/java/android/provider/Settings.java34
-rw-r--r--core/java/android/widget/HorizontalScrollView.java11
-rw-r--r--core/java/android/widget/ScrollView.java12
-rw-r--r--core/java/android/widget/TextView.java9
-rw-r--r--core/java/com/android/internal/app/ShutdownThread.java15
-rw-r--r--core/java/com/android/internal/widget/LockPatternUtils.java38
-rw-r--r--libs/surfaceflinger/Layer.cpp16
-rw-r--r--libs/surfaceflinger/LayerBase.cpp9
-rw-r--r--libs/surfaceflinger/LayerBuffer.cpp14
-rw-r--r--libs/surfaceflinger/LayerBuffer.h3
-rw-r--r--media/libstagefright/colorconversion/SoftwareRenderer.cpp4
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java84
13 files changed, 195 insertions, 93 deletions
diff --git a/api/current.xml b/api/current.xml
index 2e434af..ba28d14 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -135548,6 +135548,39 @@
visibility="public"
>
</field>
+<field name="LOCK_PATTERN_ENABLED"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;lock_pattern_autolock&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;lock_pattern_tactile_feedback_enabled&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="LOCK_PATTERN_VISIBLE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;lock_pattern_visible_pattern&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="LOGGING_ID"
type="java.lang.String"
transient="false"
@@ -136525,7 +136558,7 @@
value="&quot;lock_pattern_autolock&quot;"
static="true"
final="true"
- deprecated="not deprecated"
+ deprecated="deprecated"
visibility="public"
>
</field>
@@ -136536,7 +136569,7 @@
value="&quot;lock_pattern_tactile_feedback_enabled&quot;"
static="true"
final="true"
- deprecated="not deprecated"
+ deprecated="deprecated"
visibility="public"
>
</field>
@@ -136547,7 +136580,7 @@
value="&quot;lock_pattern_visible_pattern&quot;"
static="true"
final="true"
- deprecated="not deprecated"
+ deprecated="deprecated"
visibility="public"
>
</field>
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 726f98a..fdde591 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -679,6 +679,9 @@ public final class Settings {
MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
+ MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED);
+ MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE);
+ MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
MOVED_TO_SECURE.add(Secure.LOGGING_ID);
MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
@@ -1160,18 +1163,25 @@ public final class Settings {
"bluetooth_discoverability_timeout";
/**
- * Whether autolock is enabled (0 = false, 1 = true)
+ * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED}
+ * instead
*/
- public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
+ @Deprecated
+ public static final String LOCK_PATTERN_ENABLED = Secure.LOCK_PATTERN_ENABLED;
/**
- * Whether lock pattern is visible as user enters (0 = false, 1 = true)
+ * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_VISIBLE}
+ * instead
*/
+ @Deprecated
public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
/**
- * Whether lock pattern will vibrate as user enters (0 = false, 1 = true)
+ * @deprecated Use
+ * {@link android.provider.Settings.Secure#LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED}
+ * instead
*/
+ @Deprecated
public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
"lock_pattern_tactile_feedback_enabled";
@@ -2297,6 +2307,22 @@ public final class Settings {
public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
/**
+ * Whether autolock is enabled (0 = false, 1 = true)
+ */
+ public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
+
+ /**
+ * Whether lock pattern is visible as user enters (0 = false, 1 = true)
+ */
+ public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
+
+ /**
+ * Whether lock pattern will vibrate as user enters (0 = false, 1 = true)
+ */
+ public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
+ "lock_pattern_tactile_feedback_enabled";
+
+ /**
* Whether assisted GPS should be enabled or not.
* @hide
*/
diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java
index acb7e02..d80a5e3 100644
--- a/core/java/android/widget/HorizontalScrollView.java
+++ b/core/java/android/widget/HorizontalScrollView.java
@@ -318,11 +318,7 @@ public class HorizontalScrollView extends FrameLayout {
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
// Let the focused view and/or our descendants get the key first
- boolean handled = super.dispatchKeyEvent(event);
- if (handled) {
- return true;
- }
- return executeKeyEvent(event);
+ return super.dispatchKeyEvent(event) || executeKeyEvent(event);
}
/**
@@ -509,8 +505,11 @@ public class HorizontalScrollView extends FrameLayout {
final int deltaX = (int) (mLastMotionX - x);
mLastMotionX = x;
+ final int oldX = mScrollX;
+ final int oldY = mScrollY;
overscrollBy(deltaX, 0, mScrollX, 0, getScrollRange(), 0,
getOverscrollMax(), 0);
+ onScrollChanged(mScrollX, mScrollY, oldX, oldY);
}
break;
case MotionEvent.ACTION_UP:
@@ -524,7 +523,7 @@ public class HorizontalScrollView extends FrameLayout {
fling(-initialVelocity);
} else {
final int right = getScrollRange();
- if (mScroller.springback(mScrollX, mScrollY, 0, 0, right, 0)) {
+ if (mScroller.springback(mScrollX, mScrollY, 0, right, 0, 0)) {
invalidate();
}
}
diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java
index 489c44d..d7dfa86 100644
--- a/core/java/android/widget/ScrollView.java
+++ b/core/java/android/widget/ScrollView.java
@@ -22,7 +22,6 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.util.AttributeSet;
-import android.util.Log;
import android.view.FocusFinder;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -52,8 +51,6 @@ import java.util.List;
* <p>ScrollView only supports vertical scrolling.
*/
public class ScrollView extends FrameLayout {
- private static final String TAG = "ScrollView";
-
static final int ANIMATED_SCROLL_GAP = 250;
static final float MAX_SCROLL_FACTOR = 0.5f;
@@ -318,11 +315,7 @@ public class ScrollView extends FrameLayout {
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
// Let the focused view and/or our descendants get the key first
- boolean handled = super.dispatchKeyEvent(event);
- if (handled) {
- return true;
- }
- return executeKeyEvent(event);
+ return super.dispatchKeyEvent(event) || executeKeyEvent(event);
}
/**
@@ -510,8 +503,11 @@ public class ScrollView extends FrameLayout {
final int deltaY = (int) (mLastMotionY - y);
mLastMotionY = y;
+ final int oldX = mScrollX;
+ final int oldY = mScrollY;
overscrollBy(0, deltaY, 0, mScrollY, 0, getScrollRange(),
0, getOverscrollMax());
+ onScrollChanged(mScrollX, mScrollY, oldX, oldY);
}
break;
case MotionEvent.ACTION_UP:
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 51e1c57..7b21be5 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -1376,15 +1376,18 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
dr.mDrawableLeft.setCallback(null);
}
dr.mDrawableLeft = left;
- if (dr.mDrawableTop != left && dr.mDrawableTop != null) {
+
+ if (dr.mDrawableTop != top && dr.mDrawableTop != null) {
dr.mDrawableTop.setCallback(null);
}
dr.mDrawableTop = top;
- if (dr.mDrawableRight != left && dr.mDrawableRight != null) {
+
+ if (dr.mDrawableRight != right && dr.mDrawableRight != null) {
dr.mDrawableRight.setCallback(null);
}
dr.mDrawableRight = right;
- if (dr.mDrawableBottom != left && dr.mDrawableBottom != null) {
+
+ if (dr.mDrawableBottom != bottom && dr.mDrawableBottom != null) {
dr.mDrawableBottom.setCallback(null);
}
dr.mDrawableBottom = bottom;
diff --git a/core/java/com/android/internal/app/ShutdownThread.java b/core/java/com/android/internal/app/ShutdownThread.java
index 2f48499..37898a1 100644
--- a/core/java/com/android/internal/app/ShutdownThread.java
+++ b/core/java/com/android/internal/app/ShutdownThread.java
@@ -28,6 +28,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Handler;
+import android.os.PowerManager;
import android.os.RemoteException;
import android.os.Power;
import android.os.ServiceManager;
@@ -56,6 +57,8 @@ public final class ShutdownThread extends Thread {
private final Object mBroadcastDoneSync = new Object();
private boolean mBroadcastDone;
private Context mContext;
+ private PowerManager mPowerManager;
+ private PowerManager.WakeLock mWakeLock;
private Handler mHandler;
private ShutdownThread() {
@@ -125,6 +128,18 @@ public final class ShutdownThread extends Thread {
// start the thread that initiates shutdown
sInstance.mContext = context;
+ sInstance.mPowerManager = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
+ sInstance.mWakeLock = null;
+ if (sInstance.mPowerManager.isScreenOn()) {
+ try {
+ sInstance.mWakeLock = sInstance.mPowerManager.newWakeLock(
+ PowerManager.FULL_WAKE_LOCK, "Shutdown");
+ sInstance.mWakeLock.acquire();
+ } catch (SecurityException e) {
+ Log.w(TAG, "No permission to acquire wake lock", e);
+ sInstance.mWakeLock = null;
+ }
+ }
sInstance.mHandler = new Handler() {
};
sInstance.start();
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index d6b0808..e8ba103 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -550,7 +550,7 @@ public class LockPatternUtils {
* @return Whether the lock pattern is enabled.
*/
public boolean isLockPatternEnabled() {
- return getBoolean(Settings.System.LOCK_PATTERN_ENABLED)
+ return getBoolean(Settings.Secure.LOCK_PATTERN_ENABLED)
&& getLong(PASSWORD_TYPE_KEY, MODE_PATTERN) == MODE_PATTERN;
}
@@ -558,35 +558,35 @@ public class LockPatternUtils {
* Set whether the lock pattern is enabled.
*/
public void setLockPatternEnabled(boolean enabled) {
- setBoolean(Settings.System.LOCK_PATTERN_ENABLED, enabled);
+ setBoolean(Settings.Secure.LOCK_PATTERN_ENABLED, enabled);
}
/**
* @return Whether the visible pattern is enabled.
*/
public boolean isVisiblePatternEnabled() {
- return getBoolean(Settings.System.LOCK_PATTERN_VISIBLE);
+ return getBoolean(Settings.Secure.LOCK_PATTERN_VISIBLE);
}
/**
* Set whether the visible pattern is enabled.
*/
public void setVisiblePatternEnabled(boolean enabled) {
- setBoolean(Settings.System.LOCK_PATTERN_VISIBLE, enabled);
+ setBoolean(Settings.Secure.LOCK_PATTERN_VISIBLE, enabled);
}
/**
* @return Whether tactile feedback for the pattern is enabled.
*/
public boolean isTactileFeedbackEnabled() {
- return getBoolean(Settings.System.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
+ return getBoolean(Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
}
/**
* Set whether tactile feedback for the pattern is enabled.
*/
public void setTactileFeedbackEnabled(boolean enabled) {
- setBoolean(Settings.System.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, enabled);
+ setBoolean(Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, enabled);
}
/**
@@ -648,30 +648,22 @@ public class LockPatternUtils {
return nextAlarm;
}
- private boolean getBoolean(String systemSettingKey) {
- // STOPSHIP: these need to be moved to secure settings!
+ private boolean getBoolean(String secureSettingKey) {
return 1 ==
- android.provider.Settings.System.getInt(
- mContentResolver,
- systemSettingKey, 0);
+ android.provider.Settings.Secure.getInt(mContentResolver, secureSettingKey, 0);
}
- private void setBoolean(String systemSettingKey, boolean enabled) {
- // STOPSHIP: these need to be moved to secure settings!
- android.provider.Settings.System.putInt(
- mContentResolver,
- systemSettingKey,
- enabled ? 1 : 0);
+ private void setBoolean(String secureSettingKey, boolean enabled) {
+ android.provider.Settings.Secure.putInt(mContentResolver, secureSettingKey,
+ enabled ? 1 : 0);
}
- private long getLong(String systemSettingKey, long def) {
- // STOPSHIP: these need to be moved to secure settings!
- return android.provider.Settings.System.getLong(mContentResolver, systemSettingKey, def);
+ private long getLong(String secureSettingKey, long def) {
+ return android.provider.Settings.Secure.getLong(mContentResolver, secureSettingKey, def);
}
- private void setLong(String systemSettingKey, long value) {
- // STOPSHIP: these need to be moved to secure settings!
- android.provider.Settings.System.putLong(mContentResolver, systemSettingKey, value);
+ private void setLong(String secureSettingKey, long value) {
+ android.provider.Settings.Secure.putLong(mContentResolver, secureSettingKey, value);
}
public boolean isSecure() {
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp
index c080513..7ca7875 100644
--- a/libs/surfaceflinger/Layer.cpp
+++ b/libs/surfaceflinger/Layer.cpp
@@ -156,7 +156,11 @@ void Layer::reloadTexture(const Region& dirty)
if (mFlags & DisplayHardware::DIRECT_TEXTURE) {
if (buffer->usage & GraphicBuffer::USAGE_HW_TEXTURE) {
if (mTextures[index].dirty) {
- initializeEglImage(buffer, &mTextures[index]);
+ if (initializeEglImage(buffer, &mTextures[index]) != NO_ERROR) {
+ // not sure what we can do here...
+ mFlags &= ~DisplayHardware::DIRECT_TEXTURE;
+ goto slowpath;
+ }
}
} else {
if (mHybridBuffer==0 || (mHybridBuffer->width != buffer->width ||
@@ -166,8 +170,13 @@ void Layer::reloadTexture(const Region& dirty)
buffer->width, buffer->height, buffer->format,
GraphicBuffer::USAGE_SW_WRITE_OFTEN |
GraphicBuffer::USAGE_HW_TEXTURE);
- initializeEglImage(
- mHybridBuffer, &mTextures[0]);
+ if (initializeEglImage(
+ mHybridBuffer, &mTextures[0]) != NO_ERROR) {
+ // not sure what we can do here...
+ mFlags &= ~DisplayHardware::DIRECT_TEXTURE;
+ mHybridBuffer.clear();
+ goto slowpath;
+ }
}
GGLSurface t;
@@ -236,6 +245,7 @@ void Layer::reloadTexture(const Region& dirty)
} else
#endif
{
+slowpath:
for (size_t i=0 ; i<NUM_BUFFERS ; i++) {
mTextures[i].image = EGL_NO_IMAGE_KHR;
}
diff --git a/libs/surfaceflinger/LayerBase.cpp b/libs/surfaceflinger/LayerBase.cpp
index b0109ca..63b5720 100644
--- a/libs/surfaceflinger/LayerBase.cpp
+++ b/libs/surfaceflinger/LayerBase.cpp
@@ -666,22 +666,15 @@ status_t LayerBase::initializeEglImage(
dpy, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID,
(EGLClientBuffer)clientBuf, attrs);
- LOGE_IF(texture->image == EGL_NO_IMAGE_KHR,
- "eglCreateImageKHR() failed. err=0x%4x",
- eglGetError());
-
if (texture->image != EGL_NO_IMAGE_KHR) {
glBindTexture(GL_TEXTURE_2D, texture->name);
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D,
(GLeglImageOES)texture->image);
GLint error = glGetError();
if (UNLIKELY(error != GL_NO_ERROR)) {
- // this failed, for instance, because we don't support NPOT.
- // FIXME: do something!
LOGE("layer=%p, glEGLImageTargetTexture2DOES(%p) "
"failed err=0x%04x",
this, texture->image, error);
- mFlags &= ~DisplayHardware::DIRECT_TEXTURE;
err = INVALID_OPERATION;
} else {
// Everything went okay!
@@ -691,6 +684,8 @@ status_t LayerBase::initializeEglImage(
texture->height = clientBuf->height;
}
} else {
+ LOGE("layer=%p, eglCreateImageKHR() failed. err=0x%4x",
+ this, eglGetError());
err = INVALID_OPERATION;
}
return err;
diff --git a/libs/surfaceflinger/LayerBuffer.cpp b/libs/surfaceflinger/LayerBuffer.cpp
index 6d1685b..5c21593 100644
--- a/libs/surfaceflinger/LayerBuffer.cpp
+++ b/libs/surfaceflinger/LayerBuffer.cpp
@@ -261,7 +261,8 @@ sp<OverlayRef> LayerBuffer::SurfaceLayerBuffer::createOverlay(
// LayerBuffer::Buffer
// ============================================================================
-LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset)
+LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers,
+ ssize_t offset, size_t bufferSize)
: mBufferHeap(buffers), mSupportsCopybit(false)
{
NativeBuffer& src(mNativeBuffer);
@@ -280,7 +281,7 @@ LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset)
if (module && module->perform) {
int err = module->perform(module,
GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER,
- buffers.heap->heapID(), buffers.heap->getSize(),
+ buffers.heap->heapID(), bufferSize,
offset, buffers.heap->base(),
&src.img.handle);
@@ -415,7 +416,7 @@ void LayerBuffer::BufferSource::postBuffer(ssize_t offset)
sp<Buffer> buffer;
if (buffers.heap != 0) {
- buffer = new LayerBuffer::Buffer(buffers, offset);
+ buffer = new LayerBuffer::Buffer(buffers, offset, mBufferSize);
if (buffer->getStatus() != NO_ERROR)
buffer.clear();
setBuffer(buffer);
@@ -469,6 +470,11 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const
if (mLayer.mFlags & DisplayHardware::DIRECT_TEXTURE) {
err = INVALID_OPERATION;
if (ourBuffer->supportsCopybit()) {
+
+ // there are constraints on buffers used by the GPU and these may not
+ // be honored here. We need to change the API so the buffers
+ // are allocated with gralloc. For now disable this code-path
+#if 0
// First, try to use the buffer as an EGLImage directly
if (mUseEGLImageDirectly) {
// NOTE: Assume the buffer is allocated with the proper USAGE flags
@@ -483,6 +489,8 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const
mUseEGLImageDirectly = false;
}
}
+#endif
+
copybit_device_t* copybit = mLayer.mBlitEngine;
if (copybit && err != NO_ERROR) {
// create our EGLImageKHR the first time
diff --git a/libs/surfaceflinger/LayerBuffer.h b/libs/surfaceflinger/LayerBuffer.h
index eb5b8eb..b176623 100644
--- a/libs/surfaceflinger/LayerBuffer.h
+++ b/libs/surfaceflinger/LayerBuffer.h
@@ -99,7 +99,8 @@ private:
class Buffer : public LightRefBase<Buffer> {
public:
- Buffer(const ISurface::BufferHeap& buffers, ssize_t offset);
+ Buffer(const ISurface::BufferHeap& buffers,
+ ssize_t offset, size_t bufferSize);
inline bool supportsCopybit() const {
return mSupportsCopybit;
}
diff --git a/media/libstagefright/colorconversion/SoftwareRenderer.cpp b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
index 4c11c36..a6dbf69 100644
--- a/media/libstagefright/colorconversion/SoftwareRenderer.cpp
+++ b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
@@ -45,7 +45,9 @@ SoftwareRenderer::SoftwareRenderer(
LOGI("Creating physical memory heap failed, reverting to regular heap.");
mMemoryHeap = new MemoryHeapBase(2 * mFrameSize);
} else {
- mMemoryHeap = new MemoryHeapPmem(mMemoryHeap);
+ sp<MemoryHeapPmem> pmemHeap = new MemoryHeapPmem(mMemoryHeap);
+ pmemHeap->slap();
+ mMemoryHeap = pmemHeap;
}
CHECK(mISurface.get() != NULL);
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index 18e247e..bccf7d2 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -38,6 +38,7 @@ import android.net.ConnectivityManager;
import android.os.Environment;
import android.os.SystemProperties;
import android.provider.Settings;
+import android.provider.Settings.Secure;
import android.speech.RecognitionService;
import android.speech.RecognizerIntent;
import android.text.TextUtils;
@@ -76,7 +77,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
// database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
// is properly propagated through your change. Not doing so will result in a loss of user
// settings.
- private static final int DATABASE_VERSION = 51;
+ private static final int DATABASE_VERSION = 52;
private Context mContext;
@@ -232,18 +233,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
}
if (upgradeVersion == 27) {
- // Copy settings values from 'system' to 'secure' and delete them from 'system'
- SQLiteStatement insertStmt = null;
- SQLiteStatement deleteStmt = null;
-
- db.beginTransaction();
- try {
- insertStmt =
- db.compileStatement("INSERT INTO secure (name,value) SELECT name,value FROM "
- + "system WHERE name=?");
- deleteStmt = db.compileStatement("DELETE FROM system WHERE name=?");
-
- String[] settingsToMove = {
+ String[] settingsToMove = {
Settings.Secure.ADB_ENABLED,
Settings.Secure.ANDROID_ID,
Settings.Secure.BLUETOOTH_ON,
@@ -276,24 +266,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
Settings.Secure.WIFI_WATCHDOG_PING_DELAY_MS,
Settings.Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS,
};
-
- for (String setting : settingsToMove) {
- insertStmt.bindString(1, setting);
- insertStmt.execute();
-
- deleteStmt.bindString(1, setting);
- deleteStmt.execute();
- }
- db.setTransactionSuccessful();
- } finally {
- db.endTransaction();
- if (insertStmt != null) {
- insertStmt.close();
- }
- if (deleteStmt != null) {
- deleteStmt.close();
- }
- }
+ moveFromSystemToSecure(db, settingsToMove);
upgradeVersion = 28;
}
@@ -661,6 +634,23 @@ public class DatabaseHelper extends SQLiteOpenHelper {
upgradeVersion = 51;
}
+ if (upgradeVersion == 51) {
+ /* Move the lockscreen related settings to Secure, including some private ones. */
+ String[] settingsToMove = {
+ Secure.LOCK_PATTERN_ENABLED,
+ Secure.LOCK_PATTERN_VISIBLE,
+ Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED,
+ "lockscreen.password_type",
+ "lockscreen.lockoutattemptdeadline",
+ "lockscreen.patterneverchosen",
+ "lock_pattern_autolock",
+ "lockscreen.lockedoutpermanently",
+ "lockscreen.password_salt"
+ };
+ moveFromSystemToSecure(db, settingsToMove);
+ upgradeVersion = 52;
+ }
+
if (upgradeVersion != currentVersion) {
Log.w(TAG, "Got stuck trying to upgrade from version " + upgradeVersion
+ ", must wipe the settings provider");
@@ -684,6 +674,38 @@ public class DatabaseHelper extends SQLiteOpenHelper {
}
}
+ private void moveFromSystemToSecure(SQLiteDatabase db, String [] settingsToMove) {
+ // Copy settings values from 'system' to 'secure' and delete them from 'system'
+ SQLiteStatement insertStmt = null;
+ SQLiteStatement deleteStmt = null;
+
+ db.beginTransaction();
+ try {
+ insertStmt =
+ db.compileStatement("INSERT INTO secure (name,value) SELECT name,value FROM "
+ + "system WHERE name=?");
+ deleteStmt = db.compileStatement("DELETE FROM system WHERE name=?");
+
+
+ for (String setting : settingsToMove) {
+ insertStmt.bindString(1, setting);
+ insertStmt.execute();
+
+ deleteStmt.bindString(1, setting);
+ deleteStmt.execute();
+ }
+ db.setTransactionSuccessful();
+ } finally {
+ db.endTransaction();
+ if (insertStmt != null) {
+ insertStmt.close();
+ }
+ if (deleteStmt != null) {
+ deleteStmt.close();
+ }
+ }
+ }
+
private void upgradeLockPatternLocation(SQLiteDatabase db) {
Cursor c = db.query("system", new String[] {"_id", "value"}, "name='lock_pattern'",
null, null, null, null);