Package org.robolectric.shadows
Class ShadowPackageInstaller
java.lang.Object
org.robolectric.shadows.ShadowPackageInstaller
@Implements(android.content.pm.PackageInstaller.class)
public class ShadowPackageInstaller
extends Object
Shadow for PackageInstaller.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Shadow for PackageInstaller.Session.static class
Shadow for PackageInstaller.SessionInfo. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
abandonSession
(int sessionId) protected int
protected List<PackageInstaller.SessionInfo>
getLastUninstalledStatusReceiver
(String packageName) getLastUninstalledVersion
(String packageName) protected List<PackageInstaller.SessionInfo>
protected PackageInstaller.SessionInfo
getSessionInfo
(int sessionId) protected PackageInstaller.Session
openSession
(int sessionId) protected void
registerSessionCallback
(PackageInstaller.SessionCallback callback, Handler handler) void
setPreapprovalDialogApproved
(int sessionId) Approve the preapproval dialog.void
setPreapprovalDialogDenied
(int sessionId) Deny the preapproval dialog.void
setPreapprovalDialogDismissed
(int sessionId) Close the preapproval dialog.void
setSessionActiveState
(int sessionId, boolean active) void
setSessionFails
(int sessionId) void
setSessionProgress
(int sessionId, float progress) void
setSessionSucceeds
(int sessionId) Deprecated.protected void
uninstall
(VersionedPackage versionedPackage, int flags, IntentSender statusReceiver) protected void
uninstall
(VersionedPackage versionedPackage, IntentSender statusReceiver) protected void
uninstall
(String packageName, IntentSender statusReceiver) protected void
uninstallExistingPackage
(String packageName, IntentSender statusReceiver) protected void
protected void
updateSessionAppIcon
(int sessionId, Bitmap appIcon) protected void
updateSessionAppLabel
(int sessionId, CharSequence appLabel)
-
Constructor Details
-
ShadowPackageInstaller
public ShadowPackageInstaller()
-
-
Method Details
-
getAllSessions
-
getMySessions
-
registerSessionCallback
@Implementation protected void registerSessionCallback(PackageInstaller.SessionCallback callback, Handler handler) -
unregisterSessionCallback
-
getSessionInfo
-
createSession
@Implementation protected int createSession(PackageInstaller.SessionParams params) throws IOException - Throws:
IOException
-
abandonSession
-
openSession
- Throws:
IOException
-
updateSessionAppIcon
-
updateSessionAppLabel
-
uninstall
@Implementation(minSdk=34) protected void uninstall(VersionedPackage versionedPackage, int flags, IntentSender statusReceiver) -
uninstall
@Implementation(minSdk=26) protected void uninstall(VersionedPackage versionedPackage, IntentSender statusReceiver) -
uninstall
-
uninstallExistingPackage
@Implementation(minSdk=31) protected void uninstallExistingPackage(String packageName, IntentSender statusReceiver) -
getLastUninstalledVersion
-
getLastUninstalledStatusReceiver
-
getAllSessionCallbacks
-
setSessionProgress
public void setSessionProgress(int sessionId, float progress) -
setSessionActiveState
public void setSessionActiveState(int sessionId, boolean active) -
setSessionSucceeds
Deprecated.Prefer instead to use the Android APIs to close the sessionPackageInstaller.Session.commit(IntentSender)
-
setSessionFails
public void setSessionFails(int sessionId) -
setPreapprovalDialogApproved
Approve the preapproval dialog.- Throws:
IntentSender.SendIntentException
-
setPreapprovalDialogDenied
Deny the preapproval dialog.- Throws:
IntentSender.SendIntentException
-
setPreapprovalDialogDismissed
Close the preapproval dialog.- Throws:
IntentSender.SendIntentException
-