Loading core/java/android/content/pm/ILauncherApps.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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); Loading core/java/android/content/pm/LauncherApps.java +6 −8 Original line number Diff line number Diff line Loading @@ -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 + " : " Loading Loading @@ -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; } Loading Loading @@ -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); } } Loading @@ -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); } } Loading services/core/java/com/android/server/pm/LauncherAppsService.java +4 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading @@ -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); } Loading Loading
core/java/android/content/pm/ILauncherApps.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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); Loading
core/java/android/content/pm/LauncherApps.java +6 −8 Original line number Diff line number Diff line Loading @@ -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 + " : " Loading Loading @@ -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; } Loading Loading @@ -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); } } Loading @@ -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); } } Loading
services/core/java/com/android/server/pm/LauncherAppsService.java +4 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading @@ -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); } Loading