diff options
-rw-r--r-- | core/java/android/content/pm/ILauncherApps.aidl | 3 | ||||
-rw-r--r-- | core/java/android/content/pm/LauncherApps.java | 14 | ||||
-rw-r--r-- | services/core/java/com/android/server/pm/LauncherAppsService.java | 7 |
3 files changed, 12 insertions, 12 deletions
diff --git a/core/java/android/content/pm/ILauncherApps.aidl b/core/java/android/content/pm/ILauncherApps.aidl index d9005b2ae114..658642662d21 100644 --- a/core/java/android/content/pm/ILauncherApps.aidl +++ b/core/java/android/content/pm/ILauncherApps.aidl @@ -19,6 +19,7 @@ package android.content.pm; import android.content.ComponentName; import android.content.Intent; import android.content.pm.IOnAppsChangedListener; +import android.content.pm.ParceledListSlice; import android.content.pm.ResolveInfo; import android.graphics.Rect; import android.os.Bundle; @@ -31,7 +32,7 @@ import java.util.List; interface ILauncherApps { void addOnAppsChangedListener(in IOnAppsChangedListener listener); void removeOnAppsChangedListener(in IOnAppsChangedListener listener); - List<ResolveInfo> getLauncherActivities(String packageName, in UserHandle user); + ParceledListSlice getLauncherActivities(String packageName, in UserHandle user); ResolveInfo resolveActivity(in Intent intent, in UserHandle user); void startActivityAsUser(in ComponentName component, in Rect sourceBounds, in Bundle opts, in UserHandle user); diff --git a/core/java/android/content/pm/LauncherApps.java b/core/java/android/content/pm/LauncherApps.java index f7d8013827f9..6e67af41b682 100644 --- a/core/java/android/content/pm/LauncherApps.java +++ b/core/java/android/content/pm/LauncherApps.java @@ -142,19 +142,17 @@ public class LauncherApps { * @return List of launchable activities. Can be an empty list but will not be null. */ public List<LauncherActivityInfo> getActivityList(String packageName, UserHandle user) { - List<ResolveInfo> activities = null; + ParceledListSlice<ResolveInfo> activities = null; try { activities = mService.getLauncherActivities(packageName, user); } catch (RemoteException re) { - throw new RuntimeException("Failed to call LauncherAppsService"); + throw new RuntimeException("Failed to call LauncherAppsService", re); } if (activities == null) { return Collections.EMPTY_LIST; } ArrayList<LauncherActivityInfo> lais = new ArrayList<LauncherActivityInfo>(); - final int count = activities.size(); - for (int i = 0; i < count; i++) { - ResolveInfo ri = activities.get(i); + for (ResolveInfo ri : activities.getList()) { LauncherActivityInfo lai = new LauncherActivityInfo(mContext, ri, user); if (DEBUG) { Log.v(TAG, "Returning activity for profile " + user + " : " @@ -185,7 +183,7 @@ public class LauncherApps { return info; } } catch (RemoteException re) { - throw new RuntimeException("Failed to call LauncherAppsService"); + throw new RuntimeException("Failed to call LauncherAppsService", re); } return null; } @@ -240,7 +238,7 @@ public class LauncherApps { try { return mService.isPackageEnabled(packageName, user); } catch (RemoteException re) { - throw new RuntimeException("Failed to call LauncherAppsService"); + throw new RuntimeException("Failed to call LauncherAppsService", re); } } @@ -256,7 +254,7 @@ public class LauncherApps { try { return mService.isActivityEnabled(component, user); } catch (RemoteException re) { - throw new RuntimeException("Failed to call LauncherAppsService"); + throw new RuntimeException("Failed to call LauncherAppsService", re); } } diff --git a/services/core/java/com/android/server/pm/LauncherAppsService.java b/services/core/java/com/android/server/pm/LauncherAppsService.java index 458282827dbe..0796811d6ad3 100644 --- a/services/core/java/com/android/server/pm/LauncherAppsService.java +++ b/services/core/java/com/android/server/pm/LauncherAppsService.java @@ -26,6 +26,7 @@ import android.content.pm.IOnAppsChangedListener; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.content.pm.PackageInfo; +import android.content.pm.ParceledListSlice; import android.content.pm.ResolveInfo; import android.content.pm.UserInfo; import android.graphics.Rect; @@ -187,11 +188,11 @@ public class LauncherAppsService extends SystemService { } @Override - public List<ResolveInfo> getLauncherActivities(String packageName, UserHandle user) + public ParceledListSlice<ResolveInfo> getLauncherActivities(String packageName, UserHandle user) throws RemoteException { ensureInUserProfiles(user, "Cannot retrieve activities for unrelated profile " + user); if (!isUserEnabled(user)) { - return new ArrayList<ResolveInfo>(); + return null; } final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); @@ -201,7 +202,7 @@ public class LauncherAppsService extends SystemService { try { List<ResolveInfo> apps = mPm.queryIntentActivitiesAsUser(mainIntent, 0 /* flags */, user.getIdentifier()); - return apps; + return new ParceledListSlice<>(apps); } finally { Binder.restoreCallingIdentity(ident); } |