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

Commit bd413f6c authored by Christopher Tate's avatar Christopher Tate
Browse files

Support for "not the home app you're looking for" metadata

* Make sure that pm.getHomeActivities() returns the activity metadata
  as well, so that the caller can trace the reference

* Add a public canonical name for that metadata key

Bug 10749961

Change-Id: Ic4d0750d61001ffe5af180398f042afa30eea1ce
parent dc333542
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2942,6 +2942,7 @@ package android.app {
    method public void moveTaskToFront(int, int);
    method public void moveTaskToFront(int, int, android.os.Bundle);
    method public deprecated void restartPackage(java.lang.String);
    field public static final java.lang.String META_HOME_ALTERNATE = "android.app.home.alternate";
    field public static final int MOVE_TASK_NO_USER_ACTION = 2; // 0x2
    field public static final int MOVE_TASK_WITH_HOME = 1; // 0x1
    field public static final int RECENT_IGNORE_UNAVAILABLE = 2; // 0x2
+7 −0
Original line number Diff line number Diff line
@@ -67,6 +67,13 @@ public class ActivityManager {
    private final Context mContext;
    private final Handler mHandler;

    /**
     * <meta-data> string for a 'home' Activity that names a package that is to be
     * uninstalled in lieu of the declaring one.  The package named here must be
     * signed with the same certificate as the one declaring the <meta-data>.
     */
    public static final String META_HOME_ALTERNATE = "android.app.home.alternate";

    /**
     * Result for IActivityManager.startActivity: an error where the
     * start had to be canceled.
+2 −1
Original line number Diff line number Diff line
@@ -9884,7 +9884,8 @@ public class PackageManagerService extends IPackageManager.Stub {
        intent.addCategory(Intent.CATEGORY_HOME);

        final int callingUserId = UserHandle.getCallingUserId();
        List<ResolveInfo> list = queryIntentActivities(intent, null, 0, callingUserId);
        List<ResolveInfo> list = queryIntentActivities(intent, null,
                PackageManager.GET_META_DATA, callingUserId);
        ResolveInfo preferred = findPreferredActivity(intent, null, 0, list, 0,
                true, false, callingUserId);