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

Commit 47c86748 authored by Sunny Goyal's avatar Sunny Goyal Committed by android-build-merger
Browse files

On some "non-standard" devices, load label can cause a security exception due...

On some "non-standard" devices, load label can cause a security exception due to modified platform code
am: 0d86a8dc

* commit '0d86a8dc':
  On some "non-standard" devices, load label can cause a security exception due to modified platform code

Change-Id: I7d65f2f39353c50a43334709f8b3bf970969a68c
parents f2ea0cdd 0d86a8dc
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.pm.PackageInfo;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.util.Log;


public class LauncherActivityInfoCompatV16 extends LauncherActivityInfoCompat {
@@ -51,7 +52,12 @@ public class LauncherActivityInfoCompatV16 extends LauncherActivityInfoCompat {
    }

    public CharSequence getLabel() {
        try {
            return mResolveInfo.loadLabel(mPm);
        } catch (SecurityException e) {
            Log.e("LAInfoCompat", "Failed to extract app display name from resolve info", e);
            return "";
        }
    }

    public Drawable getIcon(int density) {
+9 −1
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.util.Log;

import com.android.launcher3.LauncherAppWidgetProviderInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.AppWidgetManagerCompat;
@@ -91,7 +93,13 @@ public class WidgetsAndShortcutNameComparator implements Comparator<Object> {
            return Utilities.trim(mManager.loadLabel(widgetInfo));
        } else {
            ResolveInfo shortcutInfo = (ResolveInfo) o;
            try {
                return Utilities.trim(shortcutInfo.loadLabel(mPackageManager));
            } catch (Exception e) {
                Log.e("ShortcutNameComparator",
                        "Failed to extract app display name from resolve info", e);
                return "";
            }
        }
    }
};