Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f5b69f33 authored by Roman Birg's avatar Roman Birg
Browse files

Lockscreen shortcuts: don't allow specific activities



The picker allowed users to pick specific activities from an app that it
did not explicitly expose to the user.

This is not good UX as many activities are not meant to be user facing
and are expecting certain input. Users can pick apps themselves, or apps
can opt-in to shortcuts and publish things themselves.

Ticket: CYNGNOS-2684

Change-Id: I9199d442dbe9eaa4140a706166a6fde87bc8957c
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent 9f7fc271
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -83,6 +83,11 @@ public class ShortcutPickHelper {
    }

    public void pickShortcut(String[] names, ShortcutIconResource[] icons, int fragmentId) {
        pickShortcut(names, icons, fragmentId, true);
    }

    public void pickShortcut(String[] names, ShortcutIconResource[] icons, int fragmentId,
            boolean showActivityPicker) {
        Bundle bundle = new Bundle();

        ArrayList<String> shortcutNames = new ArrayList<String>();
@@ -92,7 +97,9 @@ public class ShortcutPickHelper {
            }
        }
        shortcutNames.add(mParent.getString(R.string.profile_applist_title));
        if (showActivityPicker) {
            shortcutNames.add(mParent.getString(R.string.picker_activities));
        }
        bundle.putStringArrayList(Intent.EXTRA_SHORTCUT_NAME, shortcutNames);

        ArrayList<ShortcutIconResource> shortcutIcons = new ArrayList<ShortcutIconResource>();
@@ -102,7 +109,10 @@ public class ShortcutPickHelper {
            }
        }
        shortcutIcons.add(ShortcutIconResource.fromContext(mParent, android.R.drawable.sym_def_app_icon));
        shortcutIcons.add(ShortcutIconResource.fromContext(mParent, R.drawable.activities_icon));
        if (showActivityPicker) {
            shortcutIcons.add(
                    ShortcutIconResource.fromContext(mParent, R.drawable.activities_icon));
        }
        bundle.putParcelableArrayList(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, shortcutIcons);

        Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
+1 −1
Original line number Diff line number Diff line
@@ -241,7 +241,7 @@ public class LockscreenShortcutsActivity extends Activity implements View.OnClic
        }

        if (uri.equals(ACTION_APP)) {
            mPicker.pickShortcut(null, null, 0);
            mPicker.pickShortcut(null, null, 0, false);
        } else {
            mSelectedView.setTag(uri);
            saveCustomActions();