Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19415763 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Fix launching of activities that I broke.

Change-Id: I39f4189bad6bdecdc7f9362410f36453fd816121
parent 4f3867e3
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -101,24 +101,23 @@ final class ApplicationPackageManager extends PackageManager {
        Intent intentToResolve = new Intent(Intent.ACTION_MAIN);
        intentToResolve.addCategory(Intent.CATEGORY_INFO);
        intentToResolve.setPackage(packageName);
        ResolveInfo resolveInfo = resolveActivity(intentToResolve, 0);
        List<ResolveInfo> ris = queryIntentActivities(intentToResolve, 0);

        // Otherwise, try to find a main launcher activity.
        if (resolveInfo == null) {
        if (ris == null || ris.size() <= 0) {
            // reuse the intent instance
            intentToResolve.removeCategory(Intent.CATEGORY_INFO);
            intentToResolve.addCategory(Intent.CATEGORY_LAUNCHER);
            intentToResolve.setPackage(packageName);
            resolveInfo = resolveActivity(intentToResolve, 0);
            ris = queryIntentActivities(intentToResolve, 0);
        }
        if (resolveInfo == null) {
        if (ris == null || ris.size() <= 0) {
            return null;
        }
        Intent intent = new Intent(intentToResolve);
        // Note: we do NOT fill in the component name; we'll leave the
        // Intent unspecified, so if there are multiple matches within the
        // package something reasonable will happen.
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setClassName(ris.get(0).activityInfo.packageName,
                ris.get(0).activityInfo.name);
        return intent;
    }

+1 −1
Original line number Diff line number Diff line
@@ -926,7 +926,7 @@ public abstract class PackageManager {
     *
     * @param packageName The name of the package to inspect.
     * 
     * @return Returns either an Intent that can be used to
     * @return Returns either a fully-qualified Intent that can be used to
     * launch the main activity in the package, or null if the package does
     * not contain such an activity.
     */