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
Nested ClassesModifier and TypeClassDescriptionstatic classShadow for PackageInstaller.Session.static classShadow for PackageInstaller.SessionInfo. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidabandonSession(int sessionId) protected intprotected List<PackageInstaller.SessionInfo>getLastUninstalledStatusReceiver(String packageName) getLastUninstalledVersion(String packageName) protected List<PackageInstaller.SessionInfo>protected PackageInstaller.SessionInfogetSessionInfo(int sessionId) protected PackageInstaller.SessionopenSession(int sessionId) protected voidregisterSessionCallback(PackageInstaller.SessionCallback callback, Handler handler) voidsetPreapprovalDialogApproved(int sessionId) Approve the preapproval dialog.voidsetPreapprovalDialogDenied(int sessionId) Deny the preapproval dialog.voidsetPreapprovalDialogDismissed(int sessionId) Close the preapproval dialog.voidsetSessionActiveState(int sessionId, boolean active) voidsetSessionFails(int sessionId) voidsetSessionProgress(int sessionId, float progress) voidsetSessionSucceeds(int sessionId) Deprecated.protected voiduninstall(VersionedPackage versionedPackage, int flags, IntentSender statusReceiver) protected voiduninstall(VersionedPackage versionedPackage, IntentSender statusReceiver) protected voiduninstall(String packageName, IntentSender statusReceiver) protected voiduninstallExistingPackage(String packageName, IntentSender statusReceiver) protected voidprotected voidupdateSessionAppIcon(int sessionId, Bitmap appIcon) protected voidupdateSessionAppLabel(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
-