Package org.robolectric.shadows
Class ShadowLauncherApps
java.lang.Object
org.robolectric.shadows.ShadowLauncherApps
Shadow of
LauncherApps.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddActivity(UserHandle userHandle, LauncherActivityInfo activityInfo) Adds aLauncherActivityInfoto be retrieved bygetActivityList(String, UserHandle).voidaddApplicationInfo(UserHandle userHandle, String packageName, ApplicationInfo applicationInfo) Adds aApplicationInfoto be retrieved bygetApplicationInfo(String, int, UserHandle).voidaddDynamicShortcut(ShortcutInfo shortcutInfo) Adds a dynamic shortcut to be returned bygetShortcuts(ShortcutQuery, UserHandle).voidaddEnabledPackage(UserHandle userHandle, String packageName) Adds an enabled package to be checked byisPackageEnabled(String, UserHandle).voidaddShortcutConfigActivity(UserHandle userHandle, LauncherActivityInfo activityInfo) Adds aLauncherActivityInfoto be retrieved bygetShortcutConfigActivityList(String, UserHandle).voidaddSuspendedPackageLauncherExtras(UserHandle userHandle, String packageName, Bundle bundle) Adds aBundleto be retrieved bygetSuspendedPackageLauncherExtras(String, UserHandle).protected List<LauncherActivityInfo> getActivityList(String packageName, UserHandle user) protected List<PackageInstaller.SessionInfo> protected ApplicationInfogetApplicationInfo(String packageName, int flags, UserHandle user) protected IntentSenderprotected List<LauncherActivityInfo> getShortcutConfigActivityList(String packageName, UserHandle user) protected List<ShortcutInfo> getShortcuts(LauncherApps.ShortcutQuery query, UserHandle user) This method is an incomplete implementation of this API that only supports querying for pinned dynamic shortcuts.protected BundlegetSuspendedPackageLauncherExtras(String packageName, UserHandle user) protected booleanprotected booleanisActivityEnabled(ComponentName component, UserHandle user) protected booleanisPackageEnabled(String packageName, UserHandle user) voidnotifyPackageAdded(String packageName) FiresLauncherApps.Callback.onPackageAdded(String, UserHandle)on all of the registered callbacks, with the provided packageName.voidnotifyPackageRemoved(String packageName) FiresLauncherApps.Callback.onPackageRemoved(String, UserHandle)on all of the registered callbacks, with the provided packageName.protected voidpinShortcuts(String packageName, List<String> shortcutIds, UserHandle user) protected voidregisterCallback(LauncherApps.Callback callback) protected voidregisterCallback(LauncherApps.Callback callback, Handler handler) protected voidregisterPackageInstallerSessionCallback(Executor executor, PackageInstaller.SessionCallback callback) static voidreset()voidsetActivityEnabled(UserHandle userHandle, ComponentName componentName) Sets an activity referenced by ComponentName as enabled, to be checked byisActivityEnabled(ComponentName, UserHandle).voidsetHasShortcutHostPermission(boolean permission) Sets the return value ofhasShortcutHostPermission().protected booleanshouldHideFromSuggestions(String packageName, UserHandle user) protected voidstartAppDetailsActivity(ComponentName component, UserHandle user, Rect sourceBounds, Bundle opts) protected voidstartPackageInstallerSessionDetailsActivity(PackageInstaller.SessionInfo sessionInfo, Rect sourceBounds, Bundle opts) protected voidstartShortcut(ShortcutInfo shortcut, Rect sourceBounds, Bundle startActivityOptions) protected voidstartShortcut(String packageName, String shortcutId, Rect sourceBounds, Bundle startActivityOptions, UserHandle user) protected voidunregisterCallback(LauncherApps.Callback callback) protected void
-
Constructor Details
-
ShadowLauncherApps
public ShadowLauncherApps()
-
-
Method Details
-
reset
-
addDynamicShortcut
Adds a dynamic shortcut to be returned bygetShortcuts(ShortcutQuery, UserHandle).- Parameters:
shortcutInfo- the shortcut to add.
-
notifyPackageAdded
FiresLauncherApps.Callback.onPackageAdded(String, UserHandle)on all of the registered callbacks, with the provided packageName.- Parameters:
packageName- the package the was added.
-
addEnabledPackage
Adds an enabled package to be checked byisPackageEnabled(String, UserHandle).- Parameters:
userHandle- the user handle to be added.packageName- the package name to be added.
-
setActivityEnabled
Sets an activity referenced by ComponentName as enabled, to be checked byisActivityEnabled(ComponentName, UserHandle).- Parameters:
userHandle- the user handle to be set.componentName- the component name of the activity to be enabled.
-
addShortcutConfigActivity
Adds aLauncherActivityInfoto be retrieved bygetShortcutConfigActivityList(String, UserHandle).- Parameters:
userHandle- the user handle to be added.activityInfo- theLauncherActivityInfoto be added.
-
addActivity
Adds aLauncherActivityInfoto be retrieved bygetActivityList(String, UserHandle).- Parameters:
userHandle- the user handle to be added.activityInfo- theLauncherActivityInfoto be added.
-
notifyPackageRemoved
FiresLauncherApps.Callback.onPackageRemoved(String, UserHandle)on all of the registered callbacks, with the provided packageName.- Parameters:
packageName- the package the was removed.
-
addApplicationInfo
public void addApplicationInfo(UserHandle userHandle, String packageName, ApplicationInfo applicationInfo) Adds aApplicationInfoto be retrieved bygetApplicationInfo(String, int, UserHandle).- Parameters:
userHandle- the user handle to be added.packageName- the package name to be added.applicationInfo- the application info to be added.
-
startPackageInstallerSessionDetailsActivity
@Implementation(minSdk=29) protected void startPackageInstallerSessionDetailsActivity(@Nonnull PackageInstaller.SessionInfo sessionInfo, @Nullable Rect sourceBounds, @Nullable Bundle opts) -
startAppDetailsActivity
@Implementation protected void startAppDetailsActivity(ComponentName component, UserHandle user, Rect sourceBounds, Bundle opts) -
getShortcutConfigActivityList
@Implementation(minSdk=26) protected List<LauncherActivityInfo> getShortcutConfigActivityList(@Nullable String packageName, @Nonnull UserHandle user) -
getShortcutConfigActivityIntent
@Implementation(minSdk=26) @Nullable protected IntentSender getShortcutConfigActivityIntent(@Nonnull LauncherActivityInfo info) -
isPackageEnabled
-
getActivityList
@Implementation(minSdk=21) protected List<LauncherActivityInfo> getActivityList(String packageName, UserHandle user) -
getApplicationInfo
@Implementation(minSdk=26) protected ApplicationInfo getApplicationInfo(@Nonnull String packageName, int flags, @Nonnull UserHandle user) throws PackageManager.NameNotFoundException -
addSuspendedPackageLauncherExtras
public void addSuspendedPackageLauncherExtras(UserHandle userHandle, String packageName, Bundle bundle) Adds aBundleto be retrieved bygetSuspendedPackageLauncherExtras(String, UserHandle).- Parameters:
userHandle- the user handle to be added.packageName- the package name to be added.bundle- the bundle for the extras.
-
getSuspendedPackageLauncherExtras
@Implementation(minSdk=28) @Nullable protected Bundle getSuspendedPackageLauncherExtras(String packageName, UserHandle user) throws PackageManager.NameNotFoundException -
shouldHideFromSuggestions
@Implementation(minSdk=29) protected boolean shouldHideFromSuggestions(@Nonnull String packageName, @Nonnull UserHandle user) -
isActivityEnabled
@Implementation(minSdk=21) protected boolean isActivityEnabled(ComponentName component, UserHandle user) -
setHasShortcutHostPermission
public void setHasShortcutHostPermission(boolean permission) Sets the return value ofhasShortcutHostPermission(). If this isn't explicitly set,hasShortcutHostPermission()defaults to returning false.- Parameters:
permission- boolean to be returned
-
hasShortcutHostPermission
-
getShortcuts
@Implementation(minSdk=25) @Nullable protected List<ShortcutInfo> getShortcuts(@Nonnull LauncherApps.ShortcutQuery query, @Nonnull UserHandle user) This method is an incomplete implementation of this API that only supports querying for pinned dynamic shortcuts. It also doesn't not supportLauncherApps.ShortcutQuery.setChangedSince(long). -
pinShortcuts
@Implementation(minSdk=25) protected void pinShortcuts(@Nonnull String packageName, @Nonnull List<String> shortcutIds, @Nonnull UserHandle user) -
startShortcut
@Implementation(minSdk=25) protected void startShortcut(@Nonnull String packageName, @Nonnull String shortcutId, @Nullable Rect sourceBounds, @Nullable Bundle startActivityOptions, @Nonnull UserHandle user) -
startShortcut
@Implementation(minSdk=25) protected void startShortcut(@Nonnull ShortcutInfo shortcut, @Nullable Rect sourceBounds, @Nullable Bundle startActivityOptions) -
registerCallback
-
registerCallback
-
unregisterCallback
-
registerPackageInstallerSessionCallback
@Implementation(minSdk=29) protected void registerPackageInstallerSessionCallback(@Nonnull Executor executor, @Nonnull PackageInstaller.SessionCallback callback) -
unregisterPackageInstallerSessionCallback
@Implementation(minSdk=29) protected void unregisterPackageInstallerSessionCallback(@Nonnull PackageInstaller.SessionCallback callback) -
getAllPackageInstallerSessions
@Implementation(minSdk=29) @Nonnull protected List<PackageInstaller.SessionInfo> getAllPackageInstallerSessions()
-