diff options
| author | Jose Lima <joselima@google.com> | 2014-04-11 19:01:21 +0000 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2014-04-11 19:01:21 +0000 |
| commit | 68b9d97593d2ec79892813ab06f1b89c41de64b0 (patch) | |
| tree | 90d86ee22188e6d44850508eecd1f6fdd940f9ba /core/java/android/app/ApplicationPackageManager.java | |
| parent | ae3f7cca5235b9c3da080e7f8210a21ecf48285b (diff) | |
| parent | 9e99cab7d9a0ec2315140c21bb1958eb7ff76a09 (diff) | |
| download | frameworks_base-68b9d97593d2ec79892813ab06f1b89c41de64b0.zip frameworks_base-68b9d97593d2ec79892813ab06f1b89c41de64b0.tar.gz frameworks_base-68b9d97593d2ec79892813ab06f1b89c41de64b0.tar.bz2 | |
am 9e99cab7: am 970417c7: Added getLeanbackLaunchIntentForPackage()
* commit '9e99cab7d9a0ec2315140c21bb1958eb7ff76a09':
Added getLeanbackLaunchIntentForPackage()
Diffstat (limited to 'core/java/android/app/ApplicationPackageManager.java')
| -rw-r--r-- | core/java/android/app/ApplicationPackageManager.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java index 6ca5244..ab62427 100644 --- a/core/java/android/app/ApplicationPackageManager.java +++ b/core/java/android/app/ApplicationPackageManager.java @@ -128,6 +128,24 @@ final class ApplicationPackageManager extends PackageManager { } @Override + public Intent getLeanbackLaunchIntentForPackage(String packageName) { + // Try to find a main leanback_launcher activity. + Intent intentToResolve = new Intent(Intent.ACTION_MAIN); + intentToResolve.addCategory(Intent.CATEGORY_LEANBACK_LAUNCHER); + intentToResolve.setPackage(packageName); + List<ResolveInfo> ris = queryIntentActivities(intentToResolve, 0); + + if (ris == null || ris.size() <= 0) { + return null; + } + Intent intent = new Intent(intentToResolve); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.setClassName(ris.get(0).activityInfo.packageName, + ris.get(0).activityInfo.name); + return intent; + } + + @Override public int[] getPackageGids(String packageName) throws NameNotFoundException { try { |
