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

Commit c3fa6ab2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "getApplicationInfo() should throw NameNotFoundException" into oc-dev

parents ff4e132c 7c7fbf6f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -10341,7 +10341,7 @@ 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.content.pm.ApplicationInfo getApplicationInfo(java.lang.String, int, android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
    method public android.content.pm.LauncherApps.PinItemRequest getPinItemRequest(android.content.Intent);
    method public java.util.List<android.os.UserHandle> getProfiles();
    method public android.graphics.drawable.Drawable getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo, int);
+1 −1
Original line number Diff line number Diff line
@@ -11004,7 +11004,7 @@ 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.content.pm.ApplicationInfo getApplicationInfo(java.lang.String, int, android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
    method public android.content.pm.LauncherApps.PinItemRequest getPinItemRequest(android.content.Intent);
    method public java.util.List<android.os.UserHandle> getProfiles();
    method public android.graphics.drawable.Drawable getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo, int);
+1 −1
Original line number Diff line number Diff line
@@ -10378,7 +10378,7 @@ package android.content.pm {
  public class LauncherApps {
    ctor public LauncherApps(android.content.Context);
    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.content.pm.ApplicationInfo getApplicationInfo(java.lang.String, int, android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
    method public android.content.pm.LauncherApps.PinItemRequest getPinItemRequest(android.content.Intent);
    method public java.util.List<android.os.UserHandle> getProfiles();
    method public android.graphics.drawable.Drawable getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo, int);
+7 −2
Original line number Diff line number Diff line
@@ -498,8 +498,13 @@ public class AppWidgetHostView extends FrameLayout {
    private void updateContentDescription(AppWidgetProviderInfo info) {
        if (info != null) {
            LauncherApps launcherApps = getContext().getSystemService(LauncherApps.class);
            ApplicationInfo appInfo = launcherApps.getApplicationInfo(
            ApplicationInfo appInfo = null;
            try {
                appInfo = launcherApps.getApplicationInfo(
                        info.provider.getPackageName(), 0, info.getProfile());
            } catch (NameNotFoundException e) {
                // ignore -- use null.
            }
            if (appInfo != null &&
                    (appInfo.flags & ApplicationInfo.FLAG_SUSPENDED) != 0) {
                setContentDescription(
+14 −3
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@ import android.os.UserManager;
import android.util.DisplayMetrics;
import android.util.Log;

import com.android.internal.util.Preconditions;

import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -612,11 +614,20 @@ public class LauncherApps {
     *         null if the package isn't installed for the given user, or the target user
     *         is not enabled.
     */
    public ApplicationInfo getApplicationInfo(String packageName, @ApplicationInfoFlags int flags,
            UserHandle user) {
    public ApplicationInfo getApplicationInfo(@NonNull String packageName,
            @ApplicationInfoFlags int flags, @NonNull UserHandle user)
            throws PackageManager.NameNotFoundException {
        Preconditions.checkNotNull(packageName, "packageName");
        Preconditions.checkNotNull(packageName, "user");
        logErrorForInvalidProfileAccess(user);
        try {
            return mService.getApplicationInfo(mContext.getPackageName(), packageName, flags, user);
            final ApplicationInfo ai = mService
                    .getApplicationInfo(mContext.getPackageName(), packageName, flags, user);
            if (ai == null) {
                throw new NameNotFoundException("Package " + packageName + " not found for user "
                        + user.getIdentifier());
            }
            return ai;
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
        }