Pingping Lin
Committed by Gerrit Code Review

completer should work as command description, enable delete intent by key

Change-Id: Ibc4574f97f69a4c8e266708c0440baa09ee361f3
...@@ -39,7 +39,7 @@ public class IntentIdCompleter implements Completer { ...@@ -39,7 +39,7 @@ public class IntentIdCompleter implements Completer {
39 Iterator<Intent> it = service.getIntents().iterator(); 39 Iterator<Intent> it = service.getIntents().iterator();
40 SortedSet<String> strings = delegate.getStrings(); 40 SortedSet<String> strings = delegate.getStrings();
41 while (it.hasNext()) { 41 while (it.hasNext()) {
42 - strings.add(it.next().key().toString()); 42 + strings.add(it.next().id().toString());
43 } 43 }
44 44
45 // Now let the completer do the work for figuring out what to offer. 45 // Now let the completer do the work for figuring out what to offer.
......
...@@ -77,13 +77,16 @@ public class IntentRemoveCommand extends AbstractShellCommand { ...@@ -77,13 +77,16 @@ public class IntentRemoveCommand extends AbstractShellCommand {
77 } 77 }
78 } 78 }
79 79
80 + final Key key;
80 if (id.startsWith("0x")) { 81 if (id.startsWith("0x")) {
81 id = id.replaceFirst("0x", ""); 82 id = id.replaceFirst("0x", "");
83 + key = Key.of(new BigInteger(id, 16).longValue(), appId);
84 + } else {
85 + // This line is to use the intent key to delete an intent
86 + key = Key.of(id, appId);
82 } 87 }
83 88
84 - Key key = Key.of(new BigInteger(id, 16).longValue(), appId);
85 Intent intent = intentService.getIntent(key); 89 Intent intent = intentService.getIntent(key);
86 -
87 if (intent != null) { 90 if (intent != null) {
88 IntentListener listener = null; 91 IntentListener listener = null;
89 final CountDownLatch withdrawLatch, purgeLatch; 92 final CountDownLatch withdrawLatch, purgeLatch;
......