@Implements(value=android.content.pm.LauncherApps.class, minSdk=21) public class ShadowLauncherApps extends Object
Shadow of LauncherApps
.
Constructor and Description |
---|
ShadowLauncherApps() |
Modifier and Type | Method and Description |
---|---|
void |
addDynamicShortcut(ShortcutInfo shortcutInfo)
Adds a dynamic shortcut to be returned by
#getShortcuts(ShortcutQuery, UserHandle) . |
protected List<PackageInstaller.SessionInfo> |
getAllPackageInstallerSessions() |
protected IntentSender |
getShortcutConfigActivityIntent(LauncherActivityInfo info) |
protected 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 Bundle |
getSuspendedPackageLauncherExtras(String packageName,
UserHandle user) |
protected boolean |
hasShortcutHostPermission() |
protected boolean |
isActivityEnabled(ComponentName component,
UserHandle user) |
protected boolean |
isPackageEnabled(String packageName,
UserHandle user) |
void |
notifyPackageAdded(String packageName)
Fires
LauncherApps.Callback#onPackageAdded(String, UserHandle) on all of the registered callbacks, with the provided packageName. |
void |
notifyPackageRemoved(String packageName)
Fires
LauncherApps.Callback#onPackageRemoved(String, UserHandle) on all of the registered callbacks, with the provided packageName. |
protected void |
pinShortcuts(String packageName,
List<String> shortcutIds,
UserHandle user) |
protected void |
registerCallback(LauncherApps.Callback callback) |
protected void |
registerCallback(LauncherApps.Callback callback,
Handler handler) |
protected void |
registerPackageInstallerSessionCallback(Executor executor,
PackageInstaller.SessionCallback callback) |
protected boolean |
shouldHideFromSuggestions(String packageName,
UserHandle user) |
protected void |
startAppDetailsActivity(ComponentName component,
UserHandle user,
Rect sourceBounds,
Bundle opts) |
protected void |
startPackageInstallerSessionDetailsActivity(PackageInstaller.SessionInfo sessionInfo,
Rect sourceBounds,
Bundle opts) |
protected void |
startShortcut(ShortcutInfo shortcut,
Rect sourceBounds,
Bundle startActivityOptions) |
protected void |
startShortcut(String packageName,
String shortcutId,
Rect sourceBounds,
Bundle startActivityOptions,
UserHandle user) |
protected void |
unregisterCallback(LauncherApps.Callback callback) |
protected void |
unregisterPackageInstallerSessionCallback(PackageInstaller.SessionCallback callback) |
public void addDynamicShortcut(ShortcutInfo shortcutInfo)
Adds a dynamic shortcut to be returned by #getShortcuts(ShortcutQuery, UserHandle)
.
shortcutInfo
- the shortcut to add.public void notifyPackageAdded(String packageName)
Fires LauncherApps.Callback#onPackageAdded(String, UserHandle)
on all of the registered callbacks, with the provided packageName.
packageName
- the package the was added.public void notifyPackageRemoved(String packageName)
Fires LauncherApps.Callback#onPackageRemoved(String, UserHandle)
on all of the registered callbacks, with the provided packageName.
packageName
- the package the was removed.@Implementation(minSdk=10000) protected void startPackageInstallerSessionDetailsActivity(@NonNull PackageInstaller.SessionInfo sessionInfo, @Nullable Rect sourceBounds, @Nullable Bundle opts)
@Implementation protected void startAppDetailsActivity(ComponentName component, UserHandle user, Rect sourceBounds, Bundle opts)
@Implementation(minSdk=26) protected List<LauncherActivityInfo> getShortcutConfigActivityList(@Nullable String packageName, @NonNull UserHandle user)
@Implementation(minSdk=26) @Nullable protected IntentSender getShortcutConfigActivityIntent(@NonNull LauncherActivityInfo info)
@Implementation protected boolean isPackageEnabled(String packageName, UserHandle user)
@Implementation(minSdk=28) @Nullable protected Bundle getSuspendedPackageLauncherExtras(String packageName, UserHandle user)
@Implementation(minSdk=10000) protected boolean shouldHideFromSuggestions(@NonNull String packageName, @NonNull UserHandle user)
@Implementation protected boolean isActivityEnabled(ComponentName component, UserHandle user)
@Implementation(minSdk=24) protected boolean hasShortcutHostPermission()
@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 support LauncherApps.ShortcutQuery.setChangedSince(long)
.
@Implementation(minSdk=25) protected void pinShortcuts(@NonNull String packageName, @NonNull List<String> shortcutIds, @NonNull UserHandle user)
@Implementation(minSdk=25) protected void startShortcut(@NonNull String packageName, @NonNull String shortcutId, @Nullable Rect sourceBounds, @Nullable Bundle startActivityOptions, @NonNull UserHandle user)
@Implementation(minSdk=25) protected void startShortcut(@NonNull ShortcutInfo shortcut, @Nullable Rect sourceBounds, @Nullable Bundle startActivityOptions)
@Implementation protected void registerCallback(LauncherApps.Callback callback)
@Implementation protected void registerCallback(LauncherApps.Callback callback, Handler handler)
@Implementation protected void unregisterCallback(LauncherApps.Callback callback)
@Implementation(minSdk=10000) protected void registerPackageInstallerSessionCallback(@NonNull Executor executor, @NonNull PackageInstaller.SessionCallback callback)
@Implementation(minSdk=10000) protected void unregisterPackageInstallerSessionCallback(@NonNull PackageInstaller.SessionCallback callback)
@Implementation(minSdk=10000) @NonNull protected List<PackageInstaller.SessionInfo> getAllPackageInstallerSessions()