Package org.robolectric.shadows
Class ShadowLauncherApps
- java.lang.Object
-
- org.robolectric.shadows.ShadowLauncherApps
-
@Implements(value=android.content.pm.LauncherApps.class, minSdk=21) public class ShadowLauncherApps extends Object
Shadow ofLauncherApps
.
-
-
Constructor Summary
Constructors Constructor Description ShadowLauncherApps()
-
Method Summary
-
-
-
Method Detail
-
addDynamicShortcut
public void addDynamicShortcut(ShortcutInfo shortcutInfo)
Adds a dynamic shortcut to be returned bygetShortcuts(ShortcutQuery, UserHandle)
.- Parameters:
shortcutInfo
- the shortcut to add.
-
notifyPackageAdded
public void notifyPackageAdded(String packageName)
FiresLauncherApps.Callback.onPackageAdded(String, UserHandle)
on all of the registered callbacks, with the provided packageName.- Parameters:
packageName
- the package the was added.
-
addEnabledPackage
public void addEnabledPackage(UserHandle userHandle, String packageName)
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.
-
addShortcutConfigActivity
public void addShortcutConfigActivity(UserHandle userHandle, LauncherActivityInfo activityInfo)
Adds aLauncherActivityInfo
to be retrieved bygetShortcutConfigActivityList(String, UserHandle)
.- Parameters:
userHandle
- the user handle to be added.activityInfo
- theLauncherActivityInfo
to be added.
-
addActivity
public void addActivity(UserHandle userHandle, LauncherActivityInfo activityInfo)
Adds aLauncherActivityInfo
to be retrieved bygetActivityList(String, UserHandle)
.- Parameters:
userHandle
- the user handle to be added.activityInfo
- theLauncherActivityInfo
to be added.
-
notifyPackageRemoved
public void notifyPackageRemoved(String packageName)
FiresLauncherApps.Callback.onPackageRemoved(String, UserHandle)
on all of the registered callbacks, with the provided packageName.- Parameters:
packageName
- the package the was removed.
-
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
@Implementation protected boolean isPackageEnabled(String packageName, UserHandle user)
-
getActivityList
@Implementation(minSdk=21) protected List<LauncherActivityInfo> getActivityList(String packageName, UserHandle user)
-
getSuspendedPackageLauncherExtras
@Implementation(minSdk=28) @Nullable protected Bundle getSuspendedPackageLauncherExtras(String packageName, UserHandle user)
-
shouldHideFromSuggestions
@Implementation(minSdk=29) protected boolean shouldHideFromSuggestions(@NonNull String packageName, @NonNull UserHandle user)
-
isActivityEnabled
@Implementation protected boolean isActivityEnabled(ComponentName component, UserHandle user)
-
hasShortcutHostPermission
@Implementation(minSdk=24) protected boolean 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
@Implementation protected void registerCallback(LauncherApps.Callback callback)
-
registerCallback
@Implementation protected void registerCallback(LauncherApps.Callback callback, Handler handler)
-
unregisterCallback
@Implementation protected void unregisterCallback(LauncherApps.Callback callback)
-
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()
-
-