Fixes #1937447. Home was not saving the appropriate state when losing focus.
diff --git a/src/com/android/launcher/ApplicationInfo.java b/src/com/android/launcher/ApplicationInfo.java
index c9c8c5c..cee9f3b 100644
--- a/src/com/android/launcher/ApplicationInfo.java
+++ b/src/com/android/launcher/ApplicationInfo.java
@@ -100,7 +100,7 @@
String titleStr = title != null ? title.toString() : null;
values.put(LauncherSettings.BaseLauncherColumns.TITLE, titleStr);
- String uri = intent != null ? intent.toURI() : null;
+ String uri = intent != null ? intent.toUri(0) : null;
values.put(LauncherSettings.BaseLauncherColumns.INTENT, uri);
if (customIcon) {
diff --git a/src/com/android/launcher/Launcher.java b/src/com/android/launcher/Launcher.java
index 2e72818..328a5ca 100644
--- a/src/com/android/launcher/Launcher.java
+++ b/src/com/android/launcher/Launcher.java
@@ -519,6 +519,8 @@
mRestoring = true;
}
+ mCurrentGesture = (Gesture) savedState.get(RUNTIME_STATE_PENDING_GESTURE);
+
boolean gesturesShowing = savedState.getBoolean(RUNTIME_STATE_GESTURES_PANEL, false);
if (gesturesShowing) {
final Gesture gesture = (Gesture) savedState.get(RUNTIME_STATE_GESTURES_PANEL_GESTURE);
@@ -536,8 +538,6 @@
}
});
}
-
- mCurrentGesture = (Gesture) savedState.get(RUNTIME_STATE_PENDING_GESTURE);
}
/**
@@ -1056,12 +1056,14 @@
outState.putParcelable(RUNTIME_STATE_PENDING_GESTURE, mCurrentGesture);
}
- if (mGesturesWindow != null && mGesturesWindow.isShowing() && isConfigurationChange) {
+ if (mGesturesWindow != null && mGesturesWindow.isShowing()) {
outState.putBoolean(RUNTIME_STATE_GESTURES_PANEL, true);
- final Gesture gesture = mGesturesOverlay.getGesture();
- if (gesture != null) {
- outState.putParcelable(RUNTIME_STATE_GESTURES_PANEL_GESTURE, gesture);
+ if (mCurrentGesture == null || !mWaitingForResult) {
+ final Gesture gesture = mGesturesOverlay.getGesture();
+ if (gesture != null) {
+ outState.putParcelable(RUNTIME_STATE_GESTURES_PANEL_GESTURE, gesture);
+ }
}
}
}
@@ -2427,6 +2429,10 @@
mMatcher.gesture = overlay.getGesture();
if (mMatcher.gesture.getLength() < GesturesConstants.LENGTH_THRESHOLD) {
overlay.clear(false);
+ if (mGesturesAction.intent != null) {
+ mGesturesAction.intent = null;
+ setGesturesNextPrompt(null, getString(R.string.gestures_unknown));
+ }
} else {
mMatcher.run();
}
@@ -2436,6 +2442,10 @@
mMatcher.gesture = overlay.getGesture();
if (mMatcher.gesture.getLength() < GesturesConstants.LENGTH_THRESHOLD) {
overlay.clear(false);
+ if (mGesturesAction.intent != null) {
+ mGesturesAction.intent = null;
+ setGesturesNextPrompt(null, getString(R.string.gestures_unknown));
+ }
} else {
overlay.postDelayed(mMatcher, GesturesConstants.MATCH_DELAY);
}
@@ -2473,6 +2483,7 @@
}
if (!match){
+ mGesturesAction.intent = null;
if (animate) {
setGesturesNextPrompt(null, getString(R.string.gestures_unknown));
} else {
@@ -2488,7 +2499,7 @@
private void updatePrompt(ApplicationInfo info, boolean animate) {
if (mGesturesAction.intent != null &&
- info.intent.toURI().equals(mGesturesAction.intent.toURI()) &&
+ info.intent.toUri(0).equals(mGesturesAction.intent.toUri(0)) &&
info.title.equals(((TextView) mGesturesPrompt.getCurrentView()).getText())) {
return;
}
diff --git a/src/com/android/launcher/LauncherModel.java b/src/com/android/launcher/LauncherModel.java
index cd0ffd2..a1398d4 100644
--- a/src/com/android/launcher/LauncherModel.java
+++ b/src/com/android/launcher/LauncherModel.java
@@ -641,7 +641,7 @@
final String intentUri = c.getString(intentIndex);
if (intentUri != null) {
- final Intent shortcut = Intent.getIntent(intentUri);
+ final Intent shortcut = Intent.parseUri(intentUri, 0);
if (Intent.ACTION_MAIN.equals(shortcut.getAction())) {
final ComponentName name = shortcut.getComponent();
if (name != null) {
@@ -773,7 +773,7 @@
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
intentDescription = c.getString(intentIndex);
try {
- intent = Intent.getIntent(intentDescription);
+ intent = Intent.parseUri(intentDescription, 0);
} catch (java.net.URISyntaxException e) {
continue;
}
@@ -843,7 +843,7 @@
intent = null;
if (intentDescription != null) {
try {
- intent = Intent.getIntent(intentDescription);
+ intent = Intent.parseUri(intentDescription, 0);
} catch (java.net.URISyntaxException e) {
// Ignore, a live folder might not have a base intent
}
@@ -1259,7 +1259,7 @@
final ContentResolver cr = context.getContentResolver();
Cursor c = cr.query(LauncherSettings.Favorites.CONTENT_URI,
new String[] { "title", "intent" }, "title=? and intent=?",
- new String[] { title, intent.toURI() }, null);
+ new String[] { title, intent.toUri(0) }, null);
boolean result = false;
try {
result = c.moveToFirst();
@@ -1437,7 +1437,7 @@
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
intentDescription = c.getString(intentIndex);
try {
- intent = Intent.getIntent(intentDescription);
+ intent = Intent.parseUri(intentDescription, 0);
} catch (java.net.URISyntaxException e) {
return null;
}
diff --git a/src/com/android/launcher/LauncherProvider.java b/src/com/android/launcher/LauncherProvider.java
index 5316fa8..fc38cdd 100644
--- a/src/com/android/launcher/LauncherProvider.java
+++ b/src/com/android/launcher/LauncherProvider.java
@@ -563,7 +563,7 @@
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
- values.put(Favorites.INTENT, intent.toURI());
+ values.put(Favorites.INTENT, intent.toUri(0));
values.put(Favorites.TITLE, info.loadLabel(packageManager).toString());
values.put(Favorites.ITEM_TYPE, Favorites.ITEM_TYPE_APPLICATION);
values.put(Favorites.SPANX, 1);
diff --git a/src/com/android/launcher/LauncherSettings.java b/src/com/android/launcher/LauncherSettings.java
index 062c8a6..8cc2559 100644
--- a/src/com/android/launcher/LauncherSettings.java
+++ b/src/com/android/launcher/LauncherSettings.java
@@ -32,7 +32,7 @@
/**
* The Intent URL of the gesture, describing what it points to. This
- * value is given to {@link android.content.Intent#getIntent} to create
+ * value is given to {@link android.content.Intent#parseUri(String, int)} to create
* an Intent that can be launched.
* <P>Type: TEXT</P>
*/
diff --git a/src/com/android/launcher/LiveFolderAdapter.java b/src/com/android/launcher/LiveFolderAdapter.java
index 4a5c077..c405041 100644
--- a/src/com/android/launcher/LiveFolderAdapter.java
+++ b/src/com/android/launcher/LiveFolderAdapter.java
@@ -116,7 +116,7 @@
if (holder.intentIndex != -1) {
try {
- holder.intent = Intent.getIntent(cursor.getString(holder.intentIndex));
+ holder.intent = Intent.parseUri(cursor.getString(holder.intentIndex), 0);
} catch (URISyntaxException e) {
// Ignore
}
diff --git a/src/com/android/launcher/LiveFolderInfo.java b/src/com/android/launcher/LiveFolderInfo.java
index 2432cc3..ec865a4 100644
--- a/src/com/android/launcher/LiveFolderInfo.java
+++ b/src/com/android/launcher/LiveFolderInfo.java
@@ -63,7 +63,7 @@
values.put(LauncherSettings.Favorites.TITLE, title.toString());
values.put(LauncherSettings.Favorites.URI, uri.toString());
if (baseIntent != null) {
- values.put(LauncherSettings.Favorites.INTENT, baseIntent.toURI());
+ values.put(LauncherSettings.Favorites.INTENT, baseIntent.toUri(0));
}
values.put(LauncherSettings.Favorites.ICON_TYPE, LauncherSettings.Favorites.ICON_TYPE_RESOURCE);
values.put(LauncherSettings.Favorites.DISPLAY_MODE, displayMode);
diff --git a/src/com/android/launcher/UninstallShortcutReceiver.java b/src/com/android/launcher/UninstallShortcutReceiver.java
index 3bcdcbe..9fd6298 100644
--- a/src/com/android/launcher/UninstallShortcutReceiver.java
+++ b/src/com/android/launcher/UninstallShortcutReceiver.java
@@ -53,7 +53,7 @@
try {
while (c.moveToNext()) {
try {
- if (intent.filterEquals(Intent.getIntent(c.getString(intentIndex)))) {
+ if (intent.filterEquals(Intent.parseUri(c.getString(intentIndex), 0))) {
final long id = c.getLong(idIndex);
final Uri uri = LauncherSettings.Favorites.getContentUri(id, false);
cr.delete(uri, null, null);