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

Commit 45d3e977 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Changing LauncherApps to resolve activity by component name

This makes the behavior of resolveActivity similar to isActivityEnabled.
Not that starting this activity may still fail due to other reasons.

Bug: 27549770
Change-Id: I924d7aa2305c64fd319ca1e38058f9f956c0c256
parent 6e1e880f
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -9497,7 +9497,6 @@ package android.content.pm {
  public class LauncherApps {
    method public java.util.List<android.content.pm.LauncherActivityInfo> getActivityList(java.lang.String, android.os.UserHandle);
    method public android.content.pm.ApplicationInfo getApplicationInfo(java.lang.String, int, android.os.UserHandle);
    method public android.os.ParcelFileDescriptor getShortcutIconFd(android.content.pm.ShortcutInfo);
    method public android.os.ParcelFileDescriptor getShortcutIconFd(java.lang.String, java.lang.String, android.os.UserHandle);
    method public int getShortcutIconResId(android.content.pm.ShortcutInfo);
+0 −1
Original line number Diff line number Diff line
@@ -9835,7 +9835,6 @@ package android.content.pm {
  public class LauncherApps {
    method public java.util.List<android.content.pm.LauncherActivityInfo> getActivityList(java.lang.String, android.os.UserHandle);
    method public android.content.pm.ApplicationInfo getApplicationInfo(java.lang.String, int, android.os.UserHandle);
    method public android.os.ParcelFileDescriptor getShortcutIconFd(android.content.pm.ShortcutInfo);
    method public android.os.ParcelFileDescriptor getShortcutIconFd(java.lang.String, java.lang.String, android.os.UserHandle);
    method public int getShortcutIconResId(android.content.pm.ShortcutInfo);
+0 −1
Original line number Diff line number Diff line
@@ -9506,7 +9506,6 @@ package android.content.pm {
  public class LauncherApps {
    method public java.util.List<android.content.pm.LauncherActivityInfo> getActivityList(java.lang.String, android.os.UserHandle);
    method public android.content.pm.ApplicationInfo getApplicationInfo(java.lang.String, int, android.os.UserHandle);
    method public android.os.ParcelFileDescriptor getShortcutIconFd(android.content.pm.ShortcutInfo);
    method public android.os.ParcelFileDescriptor getShortcutIconFd(java.lang.String, java.lang.String, android.os.UserHandle);
    method public int getShortcutIconResId(android.content.pm.ShortcutInfo);
+2 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.content.pm;

import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.IOnAppsChangedListener;
import android.content.pm.ParceledListSlice;
@@ -37,7 +38,7 @@ interface ILauncherApps {
    void addOnAppsChangedListener(String callingPackage, in IOnAppsChangedListener listener);
    void removeOnAppsChangedListener(in IOnAppsChangedListener listener);
    ParceledListSlice getLauncherActivities(String packageName, in UserHandle user);
    ResolveInfo resolveActivity(in Intent intent, in UserHandle user);
    ActivityInfo resolveActivity(in ComponentName component, in UserHandle user);
    void startActivityAsUser(in ComponentName component, in Rect sourceBounds,
            in Bundle opts, in UserHandle user);
    void showAppDetailsAsUser(in ComponentName component, in Rect sourceBounds,
+6 −8
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ public class LauncherActivityInfo {

    private ActivityInfo mActivityInfo;
    private ComponentName mComponentName;
    private ResolveInfo mResolveInfo;
    private UserHandle mUser;

    /**
@@ -49,11 +48,10 @@ public class LauncherActivityInfo {
     * @param info ResolveInfo from which to create the LauncherActivityInfo.
     * @param user The UserHandle of the profile to which this activity belongs.
     */
    LauncherActivityInfo(Context context, ResolveInfo info, UserHandle user) {
    LauncherActivityInfo(Context context, ActivityInfo info, UserHandle user) {
        this(context);
        mResolveInfo = info;
        mActivityInfo = info.activityInfo;
        mComponentName = LauncherApps.getComponentName(info);
        mActivityInfo = info;
        mComponentName =  new ComponentName(info.packageName, info.name);
        mUser = user;
    }

@@ -91,7 +89,7 @@ public class LauncherActivityInfo {
     * @return The label for the activity.
     */
    public CharSequence getLabel() {
        return mResolveInfo.loadLabel(mPm);
        return mActivityInfo.loadLabel(mPm);
    }

    /**
@@ -103,7 +101,7 @@ public class LauncherActivityInfo {
     * @return The drawable associated with the activity.
     */
    public Drawable getIcon(int density) {
        final int iconRes = mResolveInfo.getIconResourceInternal();
        final int iconRes = mActivityInfo.getIconResource();
        Drawable icon = null;
        // Get the preferred density icon from the app's resources
        if (density != 0 && iconRes != 0) {
@@ -116,7 +114,7 @@ public class LauncherActivityInfo {
        }
        // Get the default density icon
        if (icon == null) {
            icon = mResolveInfo.loadIcon(mPm);
            icon = mActivityInfo.loadIcon(mPm);
        }
        return icon;
    }
Loading