Merge commit 'goog/master' into froyo-release
diff --git a/src/com/android/launcher2/AllApps3D.java b/src/com/android/launcher2/AllApps3D.java
index 8467b39..d81b442 100644
--- a/src/com/android/launcher2/AllApps3D.java
+++ b/src/com/android/launcher2/AllApps3D.java
@@ -194,8 +194,10 @@
}
public void surrender() {
- sRS.contextSetSurface(0, 0, null);
- sRS.mMessageCallback = null;
+ if (sRS != null) {
+ sRS.contextSetSurface(0, 0, null);
+ sRS.mMessageCallback = null;
+ }
mSurrendered = true;
}
@@ -1022,11 +1024,15 @@
}
void pause() {
- sRS.contextBindRootScript(null);
+ if (sRS != null) {
+ sRS.contextBindRootScript(null);
+ }
}
void resume() {
- sRS.contextBindRootScript(mScript);
+ if (sRS != null) {
+ sRS.contextBindRootScript(mScript);
+ }
}
class Params extends BaseAlloc {
diff --git a/src/com/android/launcher2/LauncherProvider.java b/src/com/android/launcher2/LauncherProvider.java
index 4bf4421..a02e449 100644
--- a/src/com/android/launcher2/LauncherProvider.java
+++ b/src/com/android/launcher2/LauncherProvider.java
@@ -366,22 +366,28 @@
version = 4;
}
- if (version < 5) {
+ // Where's version 5?
+ // - Donut and sholes on 2.0 shipped with version 4 of launcher1.
+ // - Passion shipped on 2.1 with version 6 of launcher2
+ // - Sholes shipped on 2.1r1 (aka Mr. 3) with version 5 of launcher 1
+ // but version 5 on there was the updateContactsShortcuts change
+ // which was version 6 in launcher 2 (first shipped on passion 2.1r1).
+ // The updateContactsShortcuts change is idempotent, so running it twice
+ // is okay so we'll do that when upgrading the devices that shipped with it.
+ if (version < 6) {
// We went from 3 to 5 screens. Move everything 1 to the right
db.beginTransaction();
try {
db.execSQL("UPDATE favorites SET screen=(screen + 1);");
db.setTransactionSuccessful();
- version = 5;
} catch (SQLException ex) {
// Old version remains, which means we wipe old data
Log.e(TAG, ex.getMessage(), ex);
} finally {
db.endTransaction();
}
- }
- if (version < 6) {
+ // We added the fast track.
if (updateContactsShortcuts(db)) {
version = 6;
}
@@ -480,9 +486,10 @@
db.beginTransaction();
Cursor c = null;
+ SQLiteStatement update = null;
try {
boolean logged = false;
- final SQLiteStatement update = db.compileStatement("UPDATE favorites "
+ update = db.compileStatement("UPDATE favorites "
+ "SET icon=? WHERE _id=?");
c = db.rawQuery("SELECT _id, icon FROM favorites WHERE iconType=" +
@@ -506,8 +513,6 @@
update.execute();
}
bitmap.recycle();
- //noinspection UnusedAssignment
- bitmap = null;
}
} catch (Exception e) {
if (!logged) {
@@ -523,6 +528,9 @@
Log.w(TAG, "Problem while allocating appWidgetIds for existing widgets", ex);
} finally {
db.endTransaction();
+ if (update != null) {
+ update.close();
+ }
if (c != null) {
c.close();
}