diff --git a/samples/ShortcutDemo/common/src/com/example/android/pm/shortcutdemo/ShortcutAdapter.java b/samples/ShortcutDemo/common/src/com/example/android/pm/shortcutdemo/ShortcutAdapter.java index b4568ba86..2263d1a1c 100644 --- a/samples/ShortcutDemo/common/src/com/example/android/pm/shortcutdemo/ShortcutAdapter.java +++ b/samples/ShortcutDemo/common/src/com/example/android/pm/shortcutdemo/ShortcutAdapter.java @@ -165,7 +165,7 @@ public abstract class ShortcutAdapter extends BaseAdapter implements OnClickList if (showLine2()) { line2.setText( si.getId() + (si.isDynamic() ? " [dynamic]" : "") - + (si.isManifestShortcut() ? " [manifest]" : "") + + (si.isDeclaredInManifest() ? " [manifest]" : "") + (si.isPinned() ? " [pinned]" : "") + "\n" + "Long label: " + si.getLongLabel() + "\n" + "App: " + mAppLabelCache.getAppLabel(si.getPackage())); diff --git a/samples/ShortcutDemo/launcher/src/com/example/android/pm/shortcutlauncherdemo/AppListFragment.java b/samples/ShortcutDemo/launcher/src/com/example/android/pm/shortcutlauncherdemo/AppListFragment.java index 9ffe144ed..c32826724 100644 --- a/samples/ShortcutDemo/launcher/src/com/example/android/pm/shortcutlauncherdemo/AppListFragment.java +++ b/samples/ShortcutDemo/launcher/src/com/example/android/pm/shortcutlauncherdemo/AppListFragment.java @@ -161,9 +161,9 @@ public class AppListFragment extends MyBaseListFragment { v.setVisibility(View.INVISIBLE); if (mLauncherApps.hasShortcutHostPermission()) { mQuery.setPackage(ai.getComponentName().getPackageName()); - mQuery.setQueryFlags(ShortcutQuery.FLAG_GET_DYNAMIC - | ShortcutQuery.FLAG_GET_PINNED - | ShortcutQuery.FLAG_GET_MANIFEST + mQuery.setQueryFlags(ShortcutQuery.FLAG_MATCH_DYNAMIC + | ShortcutQuery.FLAG_MATCH_PINNED + | ShortcutQuery.FLAG_MATCH_MANIFEST | ShortcutQuery.FLAG_GET_KEY_FIELDS_ONLY); mQuery.setActivity(ai.getComponentName()); diff --git a/samples/ShortcutDemo/launcher/src/com/example/android/pm/shortcutlauncherdemo/ShortcutLauncherMain.java b/samples/ShortcutDemo/launcher/src/com/example/android/pm/shortcutlauncherdemo/ShortcutLauncherMain.java index 00a96b823..993fe4fd5 100644 --- a/samples/ShortcutDemo/launcher/src/com/example/android/pm/shortcutlauncherdemo/ShortcutLauncherMain.java +++ b/samples/ShortcutDemo/launcher/src/com/example/android/pm/shortcutlauncherdemo/ShortcutLauncherMain.java @@ -24,7 +24,6 @@ import android.app.FragmentManager; import android.app.FragmentTransaction; import android.content.pm.LauncherApps; import android.os.Bundle; -import android.os.UserHandle; import android.support.v13.app.FragmentStatePagerAdapter; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; diff --git a/samples/ShortcutDemo/launcher/src/com/example/android/pm/shortcutlauncherdemo/ShortcutListFragment.java b/samples/ShortcutDemo/launcher/src/com/example/android/pm/shortcutlauncherdemo/ShortcutListFragment.java index e03217e5f..9e08a5724 100644 --- a/samples/ShortcutDemo/launcher/src/com/example/android/pm/shortcutlauncherdemo/ShortcutListFragment.java +++ b/samples/ShortcutDemo/launcher/src/com/example/android/pm/shortcutlauncherdemo/ShortcutListFragment.java @@ -125,9 +125,9 @@ public class ShortcutListFragment extends MyBaseListFragment { for (UserHandle user : getTargetUsers()) { final Bundle b = getArguments(); mQuery.setQueryFlags( - (b.getBoolean(ARG_INCLUDE_DYNAMIC) ? ShortcutQuery.FLAG_GET_DYNAMIC : 0) | - (b.getBoolean(ARG_INCLUDE_MANIFEST) ? ShortcutQuery.FLAG_GET_MANIFEST : 0) | - (b.getBoolean(ARG_INCLUDE_PINNED) ? ShortcutQuery.FLAG_GET_PINNED : 0)); + (b.getBoolean(ARG_INCLUDE_DYNAMIC) ? ShortcutQuery.FLAG_MATCH_DYNAMIC : 0) | + (b.getBoolean(ARG_INCLUDE_MANIFEST) ? ShortcutQuery.FLAG_MATCH_MANIFEST : 0) | + (b.getBoolean(ARG_INCLUDE_PINNED) ? ShortcutQuery.FLAG_MATCH_PINNED : 0)); mQuery.setPackage(b.getString(ARG_TARGET_PACKAGE)); mQuery.setActivity(b.getParcelable(ARG_TARGET_ACTIVITY)); diff --git a/samples/ShortcutDemo/publisher/src/com/example/android/pm/shortcutdemo/ShortcutPublisher.java b/samples/ShortcutDemo/publisher/src/com/example/android/pm/shortcutdemo/ShortcutPublisher.java index 97982f632..ea13b9901 100644 --- a/samples/ShortcutDemo/publisher/src/com/example/android/pm/shortcutdemo/ShortcutPublisher.java +++ b/samples/ShortcutDemo/publisher/src/com/example/android/pm/shortcutdemo/ShortcutPublisher.java @@ -119,7 +119,7 @@ public class ShortcutPublisher extends Activity { private final Comparator mShortcutComparator = (ShortcutInfo s1, ShortcutInfo s2) -> { int ret = 0; - ret = (s1.isManifestShortcut() ? 0 : 1) - (s2.isManifestShortcut() ? 0 : 1); + ret = (s1.isDeclaredInManifest() ? 0 : 1) - (s2.isDeclaredInManifest() ? 0 : 1); if (ret != 0) return ret; ret = (s1.isDynamic() ? 0 : 1) - (s2.isDynamic() ? 0 : 1); @@ -197,21 +197,18 @@ public class ShortcutPublisher extends Activity { final ComponentName activity = new ComponentName(this, ShortcutPublisher.class); - final ShortcutInfo si1 = addRandomIntents(this, new ShortcutInfo.Builder(this) - .setId("shortcut1")) + final ShortcutInfo si1 = addRandomIntents(this, new ShortcutInfo.Builder(this, "shortcut1")) .setActivity(activity) .build(); - final ShortcutInfo si2 = new ShortcutInfo.Builder(this) - .setId(SETUP_SHORTCUT_ID) + final ShortcutInfo si2 = new ShortcutInfo.Builder(this, SETUP_SHORTCUT_ID) .setActivity(activity) .setShortLabel("Shortcut Demo Main") .setIcon(icon2) .setIntent(intent2) .build(); - final ShortcutInfo si3 = new ShortcutInfo.Builder(this) - .setId("shortcut3") + final ShortcutInfo si3 = new ShortcutInfo.Builder(this, "shortcut3") .setActivity(activity) .setShortLabel("Shortcut Demo Main with extras") .setIcon(icon3) @@ -237,8 +234,8 @@ public class ShortcutPublisher extends Activity { } public void onAddPressed(View view) { - final ShortcutInfo si = addRandomIntents(this, new ShortcutInfo.Builder(this) - .setId("shortcut-" + formatTime(System.currentTimeMillis()) + "-" + final ShortcutInfo si = addRandomIntents(this, new ShortcutInfo.Builder(this, + "shortcut-" + formatTime(System.currentTimeMillis()) + "-" + sSequenceNumber.getAndIncrement())) .setActivity(new ComponentName(this, ShortcutPublisher.class)) .build(); @@ -251,8 +248,7 @@ public class ShortcutPublisher extends Activity { for (ShortcutInfo si : getAllShortcuts()) { if (SETUP_SHORTCUT_ID.equals(si.getId())) continue; - updateList.add(addRandomIntents(this, new ShortcutInfo.Builder(this) - .setId(si.getId())) + updateList.add(addRandomIntents(this, new ShortcutInfo.Builder(this, si.getId())) .build()); } callApi(this, () -> mShortcutManager.updateShortcuts(updateList)); diff --git a/samples/ShortcutDemo/publisher/src/com/example/android/pm/shortcutdemo/ShortcutPublishingService.java b/samples/ShortcutDemo/publisher/src/com/example/android/pm/shortcutdemo/ShortcutPublishingService.java index 509498202..0724038dd 100644 --- a/samples/ShortcutDemo/publisher/src/com/example/android/pm/shortcutdemo/ShortcutPublishingService.java +++ b/samples/ShortcutDemo/publisher/src/com/example/android/pm/shortcutdemo/ShortcutPublishingService.java @@ -49,8 +49,7 @@ public class ShortcutPublishingService extends IntentService { private void addShortcut() { final ShortcutInfo si1 = ShortcutPublisher.addRandomIntents( - this, new ShortcutInfo.Builder(this) - .setId("shortcut-" + System.currentTimeMillis())) + this, new ShortcutInfo.Builder(this, ("shortcut-" + System.currentTimeMillis()))) .setActivity(new ComponentName(this, ShortcutPublisher.class)) .build(); ShortcutPublisher.callApi(this, () ->