summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaj Yengisetty <rajesh@cyngn.com>2015-03-25 16:48:36 (GMT)
committerStephen Bird <sbird@cyngn.com>2015-06-10 17:28:55 (GMT)
commit9986a55e745d222a3a374b27b9f73f36bc49668b (patch)
treea5750cbcf4c8bf0a4a009f26b929d975791ec44b
parent416bb9198c56dec89e8d01cff3824d80094388a5 (diff)
downloadandroid_packages_apps_Trebuchet-9986a55e745d222a3a374b27b9f73f36bc49668b.zip
android_packages_apps_Trebuchet-9986a55e745d222a3a374b27b9f73f36bc49668b.tar.gz
android_packages_apps_Trebuchet-9986a55e745d222a3a374b27b9f73f36bc49668b.tar.bz2
ProtectedApps: Fix protecting shortcuts with no ComponentNames
Repro: - Create a shortcut using the contacts widget - Add to a folder and open app protection screen - Observe: Trebuchet force closes Change-Id: I76f6a8b1d024beb36fa804bb3a866913edc335c1 (cherry picked from commit d8bdb0eef3f1799e8b829bcf114f1c3573bce8d6) (cherry picked from commit 42427c9b63936e82f9fbe934bddb376074a8e331)
-rw-r--r--src/com/android/launcher3/Folder.java4
-rw-r--r--src/com/android/launcher3/HiddenFolderFragment.java10
2 files changed, 10 insertions, 4 deletions
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 6c1296b..ff8f347 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -297,7 +297,9 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
public void modifyProtectedApps(boolean protect) {
ArrayList<ComponentName> components = new ArrayList<ComponentName>();
for (Pair<ComponentName, CharSequence> item : getComponents()) {
- components.add(item.first);
+ if (item.first != null) {
+ components.add(item.first);
+ }
}
Intent intent = new Intent();
diff --git a/src/com/android/launcher3/HiddenFolderFragment.java b/src/com/android/launcher3/HiddenFolderFragment.java
index 94e1d2d..db5e51f 100644
--- a/src/com/android/launcher3/HiddenFolderFragment.java
+++ b/src/com/android/launcher3/HiddenFolderFragment.java
@@ -227,7 +227,10 @@ public class HiddenFolderFragment extends Fragment {
viewHolder.title.setText(app.title);
- Drawable icon = mIcons.get(app.componentName.getPackageName());
+ Drawable icon = null;
+ if (app.componentName != null) {
+ icon = mIcons.get(app.componentName.getPackageName());
+ }
viewHolder.icon.setImageDrawable(icon != null ? icon : mDefaultImg);
viewHolder.remove.setOnClickListener(new OnClickListener() {
@Override
@@ -284,8 +287,9 @@ public class HiddenFolderFragment extends Fragment {
protected Void doInBackground(AppEntry... apps) {
for (AppEntry app : apps) {
try {
- if (mIcons.containsKey(app.componentName
- .getPackageName())) {
+ // Widget icons do not have a
+ if (app.componentName == null ||
+ mIcons.containsKey(app.componentName.getPackageName())) {
continue;
}
Drawable icon = mPackageManager