Added getLeanbackLaunchIntentForPackage()
Change-Id: I23be3bfa59be812a915adc37e08fdf59be8ad90f
This commit is contained in:
@ -7263,6 +7263,7 @@ package android.content.pm {
|
|||||||
method public abstract java.lang.String getInstallerPackageName(java.lang.String);
|
method public abstract java.lang.String getInstallerPackageName(java.lang.String);
|
||||||
method public abstract android.content.pm.InstrumentationInfo getInstrumentationInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
|
method public abstract android.content.pm.InstrumentationInfo getInstrumentationInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
|
||||||
method public abstract android.content.Intent getLaunchIntentForPackage(java.lang.String);
|
method public abstract android.content.Intent getLaunchIntentForPackage(java.lang.String);
|
||||||
|
method public abstract android.content.Intent getLeanbackLaunchIntentForPackage(java.lang.String);
|
||||||
method public abstract java.lang.String getNameForUid(int);
|
method public abstract java.lang.String getNameForUid(int);
|
||||||
method public android.content.pm.PackageInfo getPackageArchiveInfo(java.lang.String, int);
|
method public android.content.pm.PackageInfo getPackageArchiveInfo(java.lang.String, int);
|
||||||
method public abstract int[] getPackageGids(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException;
|
method public abstract int[] getPackageGids(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException;
|
||||||
@ -24262,6 +24263,7 @@ package android.test.mock {
|
|||||||
method public java.lang.String getInstallerPackageName(java.lang.String);
|
method public java.lang.String getInstallerPackageName(java.lang.String);
|
||||||
method public android.content.pm.InstrumentationInfo getInstrumentationInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
|
method public android.content.pm.InstrumentationInfo getInstrumentationInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
|
||||||
method public android.content.Intent getLaunchIntentForPackage(java.lang.String);
|
method public android.content.Intent getLaunchIntentForPackage(java.lang.String);
|
||||||
|
method public android.content.Intent getLeanbackLaunchIntentForPackage(java.lang.String);
|
||||||
method public java.lang.String getNameForUid(int);
|
method public java.lang.String getNameForUid(int);
|
||||||
method public int[] getPackageGids(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException;
|
method public int[] getPackageGids(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException;
|
||||||
method public android.content.pm.PackageInfo getPackageInfo(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException;
|
method public android.content.pm.PackageInfo getPackageInfo(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException;
|
||||||
|
@ -128,6 +128,24 @@ final class ApplicationPackageManager extends PackageManager {
|
|||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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
|
@Override
|
||||||
public int[] getPackageGids(String packageName)
|
public int[] getPackageGids(String packageName)
|
||||||
throws NameNotFoundException {
|
throws NameNotFoundException {
|
||||||
|
@ -970,6 +970,7 @@ public abstract class PackageManager {
|
|||||||
* @hide
|
* @hide
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@SdkConstant(SdkConstantType.FEATURE)
|
@SdkConstant(SdkConstantType.FEATURE)
|
||||||
public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce";
|
public static final String FEATURE_NFC_HCE = "android.hardware.nfc.hce";
|
||||||
|
|
||||||
@ -1266,6 +1267,7 @@ public abstract class PackageManager {
|
|||||||
* something like a DPAD, not through touch or mouse.
|
* something like a DPAD, not through touch or mouse.
|
||||||
* @deprecated use {@link #FEATURE_LEANBACK} instead.
|
* @deprecated use {@link #FEATURE_LEANBACK} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@SdkConstant(SdkConstantType.FEATURE)
|
@SdkConstant(SdkConstantType.FEATURE)
|
||||||
public static final String FEATURE_TELEVISION = "android.hardware.type.television";
|
public static final String FEATURE_TELEVISION = "android.hardware.type.television";
|
||||||
|
|
||||||
@ -1455,17 +1457,33 @@ public abstract class PackageManager {
|
|||||||
public abstract Intent getLaunchIntentForPackage(String packageName);
|
public abstract Intent getLaunchIntentForPackage(String packageName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array of all of the secondary group-ids that have been
|
* Return a "good" intent to launch a front-door Leanback activity in a
|
||||||
* assigned to a package.
|
* package, for use for example to implement an "open" button when browsing
|
||||||
*
|
* through packages. The current implementation will look for a main
|
||||||
* <p>Throws {@link NameNotFoundException} if a package with the given
|
* activity in the category {@link Intent#CATEGORY_LEANBACK_LAUNCHER}, or
|
||||||
* name cannot be found on the system.
|
* return null if no main leanback activities are found.
|
||||||
*
|
* <p>
|
||||||
|
* Throws {@link NameNotFoundException} if a package with the given name
|
||||||
|
* cannot be found on the system.
|
||||||
|
*
|
||||||
|
* @param packageName The name of the package to inspect.
|
||||||
|
* @return Returns either a fully-qualified Intent that can be used to launch
|
||||||
|
* the main Leanback activity in the package, or null if the package
|
||||||
|
* does not contain such an activity.
|
||||||
|
*/
|
||||||
|
public abstract Intent getLeanbackLaunchIntentForPackage(String packageName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an array of all of the secondary group-ids that have been assigned
|
||||||
|
* to a package.
|
||||||
|
* <p>
|
||||||
|
* Throws {@link NameNotFoundException} if a package with the given name
|
||||||
|
* cannot be found on the system.
|
||||||
|
*
|
||||||
* @param packageName The full name (i.e. com.google.apps.contacts) of the
|
* @param packageName The full name (i.e. com.google.apps.contacts) of the
|
||||||
* desired package.
|
* desired package.
|
||||||
*
|
* @return Returns an int array of the assigned gids, or null if there are
|
||||||
* @return Returns an int array of the assigned gids, or null if there
|
* none.
|
||||||
* are none.
|
|
||||||
*/
|
*/
|
||||||
public abstract int[] getPackageGids(String packageName)
|
public abstract int[] getPackageGids(String packageName)
|
||||||
throws NameNotFoundException;
|
throws NameNotFoundException;
|
||||||
@ -2449,7 +2467,7 @@ public abstract class PackageManager {
|
|||||||
/**
|
/**
|
||||||
* Return the generic icon for an activity that is used when no specific
|
* Return the generic icon for an activity that is used when no specific
|
||||||
* icon is defined.
|
* icon is defined.
|
||||||
*
|
*
|
||||||
* @return Drawable Image of the icon.
|
* @return Drawable Image of the icon.
|
||||||
*/
|
*/
|
||||||
public abstract Drawable getDefaultActivityIcon();
|
public abstract Drawable getDefaultActivityIcon();
|
||||||
|
@ -80,6 +80,12 @@ public class MockPackageManager extends PackageManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public Intent getLeanbackLaunchIntentForPackage(String packageName) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
|
||||||
public int[] getPackageGids(String packageName) throws NameNotFoundException {
|
public int[] getPackageGids(String packageName) throws NameNotFoundException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user