diff options
-rw-r--r-- | res/values-sw/strings.xml | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/InstallShortcutReceiver.java | 29 |
2 files changed, 21 insertions, 10 deletions
diff --git a/res/values-sw/strings.xml b/res/values-sw/strings.xml index 606a80d3b..d78b53671 100644 --- a/res/values-sw/strings.xml +++ b/res/values-sw/strings.xml @@ -104,7 +104,7 @@ <string name="first_run_cling_search_bar_hint" msgid="5909062802402452582"></string> <string name="first_run_cling_create_screens_hint" msgid="6950729526680114157">"Unda skrini zaidi za programu na folda"</string> <string name="workspace_cling_title" msgid="5626202359865825661">"Panga nafasi yako"</string> - <string name="workspace_cling_move_item" msgid="528201129978005352">"Gusa na ushikile mandharinyuma ili udhibiti mandhari, wijeti, na mipangilio."</string> + <string name="workspace_cling_move_item" msgid="528201129978005352">"Gusa na ushikilie mandharinyuma ili udhibiti mandhari, wijeti, na mipangilio."</string> <string name="all_apps_cling_title" msgid="34929250753095858">"Chagua programu kadhaa"</string> <string name="all_apps_cling_add_item" msgid="400866858451850784">"Ili kuongeza programu kwenye Skrini yako Kuu, iguse na uishikilie."</string> <string name="folder_cling_title" msgid="3894908818693254164">"Folda hii hapa"</string> diff --git a/src/com/android/launcher3/InstallShortcutReceiver.java b/src/com/android/launcher3/InstallShortcutReceiver.java index cda2e891e..a9d237a2d 100644 --- a/src/com/android/launcher3/InstallShortcutReceiver.java +++ b/src/com/android/launcher3/InstallShortcutReceiver.java @@ -36,6 +36,9 @@ import java.util.Set; import org.json.*; public class InstallShortcutReceiver extends BroadcastReceiver { + private static final String TAG = "InstallShortcutReceiver"; + private static final boolean DBG = false; + public static final String ACTION_INSTALL_SHORTCUT = "com.android.launcher.action.INSTALL_SHORTCUT"; @@ -94,10 +97,11 @@ public class InstallShortcutReceiver extends BroadcastReceiver { } json = json.endObject(); SharedPreferences.Editor editor = sharedPrefs.edit(); + if (DBG) Log.d(TAG, "Adding to APPS_PENDING_INSTALL: " + json); addToStringSet(sharedPrefs, editor, APPS_PENDING_INSTALL, json.toString()); editor.commit(); } catch (org.json.JSONException e) { - Log.d("InstallShortcutReceiver", "Exception when adding shortcut: " + e); + Log.d(TAG, "Exception when adding shortcut: " + e); } } } @@ -109,9 +113,15 @@ public class InstallShortcutReceiver extends BroadcastReceiver { } synchronized(sLock) { Set<String> strings = sharedPrefs.getStringSet(APPS_PENDING_INSTALL, null); + if (DBG) { + Log.d(TAG, "APPS_PENDING_INSTALL: " + strings + + ", removing packages: " + packageNames); + } if (strings != null) { Set<String> newStrings = new HashSet<String>(strings); - for (String json : newStrings) { + Iterator<String> newStringsIter = newStrings.iterator(); + while (newStringsIter.hasNext()) { + String json = newStringsIter.next(); try { JSONObject object = (JSONObject) new JSONTokener(json).nextValue(); Intent launchIntent = Intent.parseUri(object.getString(LAUNCH_INTENT_KEY), 0); @@ -120,12 +130,12 @@ public class InstallShortcutReceiver extends BroadcastReceiver { pn = launchIntent.getComponent().getPackageName(); } if (packageNames.contains(pn)) { - newStrings.remove(json); + newStringsIter.remove(); } } catch (org.json.JSONException e) { - Log.d("InstallShortcutReceiver", "Exception reading shortcut to remove: " + e); + Log.d(TAG, "Exception reading shortcut to remove: " + e); } catch (java.net.URISyntaxException e) { - Log.d("InstallShortcutReceiver", "Exception reading shortcut to remove: " + e); + Log.d(TAG, "Exception reading shortcut to remove: " + e); } } sharedPrefs.edit().putStringSet(APPS_PENDING_INSTALL, @@ -138,6 +148,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { SharedPreferences sharedPrefs) { synchronized(sLock) { Set<String> strings = sharedPrefs.getStringSet(APPS_PENDING_INSTALL, null); + if (DBG) Log.d(TAG, "Getting and clearing APPS_PENDING_INSTALL: " + strings); if (strings == null) { return new ArrayList<PendingInstallShortcutInfo>(); } @@ -170,11 +181,9 @@ public class InstallShortcutReceiver extends BroadcastReceiver { new PendingInstallShortcutInfo(data, name, launchIntent); infos.add(info); } catch (org.json.JSONException e) { - Log.d("InstallShortcutReceiver", - "Exception reading shortcut to add: " + e); + Log.d(TAG, "Exception reading shortcut to add: " + e); } catch (java.net.URISyntaxException e) { - Log.d("InstallShortcutReceiver", - "Exception reading shortcut to add: " + e); + Log.d(TAG, "Exception reading shortcut to add: " + e); } } sharedPrefs.edit().putStringSet(APPS_PENDING_INSTALL, new HashSet<String>()).commit(); @@ -206,6 +215,8 @@ public class InstallShortcutReceiver extends BroadcastReceiver { return; } + if (DBG) Log.d(TAG, "Got INSTALL_SHORTCUT: " + data.toUri(0)); + Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT); if (intent == null) { return; |