diff options
author | Nick Pelly <npelly@google.com> | 2012-03-06 13:44:36 -0800 |
---|---|---|
committer | Nick Pelly <npelly@google.com> | 2012-03-06 13:45:20 -0800 |
commit | 6e5a69a21f2a29e5e1d415bb788bbc1f576363f0 (patch) | |
tree | 6fbd5f22dd9d3796459fb81ecef6f6c0d5dde200 /src/com/android/nfc | |
parent | 49913d6a0ed709ff6edde40bb040605997b561f3 (diff) | |
download | packages_apps_nfc-6e5a69a21f2a29e5e1d415bb788bbc1f576363f0.zip packages_apps_nfc-6e5a69a21f2a29e5e1d415bb788bbc1f576363f0.tar.gz packages_apps_nfc-6e5a69a21f2a29e5e1d415bb788bbc1f576363f0.tar.bz2 |
Perform default Beam behavior from system apps.
1) Launch the app if its installed on the other device.
2) Lanch market with a search for the app if it is not installed.
Bug: 6091238
Change-Id: Ifc593f1f2ad120ef1b3b2e90ac157f99c0df5b16
Diffstat (limited to 'src/com/android/nfc')
-rwxr-xr-x | src/com/android/nfc/P2pLinkManager.java | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/com/android/nfc/P2pLinkManager.java b/src/com/android/nfc/P2pLinkManager.java index 3ccd19f..675aba6 100755 --- a/src/com/android/nfc/P2pLinkManager.java +++ b/src/com/android/nfc/P2pLinkManager.java @@ -280,17 +280,10 @@ public class P2pLinkManager implements Handler.Callback, P2pEventListener.Callba List<RunningTaskInfo> tasks = mActivityManager.getRunningTasks(1); if (tasks.size() > 0) { String pkg = tasks.get(0).baseActivity.getPackageName(); - try { - ApplicationInfo appInfo = mPackageManager.getApplicationInfo(pkg, 0); - if (0 == (appInfo.flags & ApplicationInfo.FLAG_SYSTEM)) { - NdefRecord appUri = NdefRecord.createUri( - Uri.parse("http://market.android.com/search?q=pname:" + pkg)); - NdefRecord appRecord = NdefRecord.createApplicationRecord(pkg); - return new NdefMessage(new NdefRecord[] { appUri, appRecord }); - } - } catch (NameNotFoundException e) { - Log.e(TAG, "Bad package returned from ActivityManager: " + pkg); - } + NdefRecord appUri = NdefRecord.createUri( + Uri.parse("http://market.android.com/search?q=pname:" + pkg)); + NdefRecord appRecord = NdefRecord.createApplicationRecord(pkg); + return new NdefMessage(new NdefRecord[] { appUri, appRecord }); } else { Log.d(TAG, "no foreground activity"); } |