Class AbstractInstallerFactory
- java.lang.Object
-
- com.android.repository.impl.installer.AbstractInstallerFactory
-
- All Implemented Interfaces:
InstallerFactory
- Direct Known Subclasses:
BasicInstallerFactory
public abstract class AbstractInstallerFactory extends java.lang.Object implements InstallerFactory
Framework for an actuallyInstallerFactory, with support for adding the listeners generated by theInstallerFactory.StatusChangeListenerFactoryto the generated installer or uninstaller.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.android.repository.api.InstallerFactory
InstallerFactory.StatusChangeListenerFactory
-
-
Field Summary
Fields Modifier and Type Field Description protected InstallerFactorymFallbackFactory
-
Constructor Summary
Constructors Constructor Description AbstractInstallerFactory()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleancanHandlePackage(RepoPackage pack, RepoManager manager)Subclasses should override this to indicate whether they can generate installers/uninstallers for the given package.InstallercreateInstaller(RemotePackage remote, RepoManager mgr, Downloader downloader)Canonical way to create instances ofInstaller.UninstallercreateUninstaller(LocalPackage local, RepoManager mgr)Canonical way to create instances ofUninstaller.protected abstract InstallerdoCreateInstaller(RemotePackage p, RepoManager mgr, Downloader downloader)Subclasses should override this to do the actual creation of anInstaller.protected abstract UninstallerdoCreateUninstaller(LocalPackage p, RepoManager mgr)Subclasses should override this to do the actual creation of anUninstaller.voidsetFallbackFactory(InstallerFactory fallback)If a factory can't itself create an installer for a given package, it will try again using the givenfallback, if provided.voidsetListenerFactory(InstallerFactory.StatusChangeListenerFactory listenerFactory)Sets the factory used to generate the list of listeners added to the generated installers/ uninstallers.
-
-
-
Field Detail
-
mFallbackFactory
protected InstallerFactory mFallbackFactory
-
-
Method Detail
-
setFallbackFactory
public void setFallbackFactory(@Nullable InstallerFactory fallback)Description copied from interface:InstallerFactoryIf a factory can't itself create an installer for a given package, it will try again using the givenfallback, if provided. If an operation fails, the operation can contain a reference to an operation created by the fallback factory to facilitate retrying the install.- Specified by:
setFallbackFactoryin interfaceInstallerFactory
-
setListenerFactory
public void setListenerFactory(@NonNull InstallerFactory.StatusChangeListenerFactory listenerFactory)Description copied from interface:InstallerFactorySets the factory used to generate the list of listeners added to the generated installers/ uninstallers.- Specified by:
setListenerFactoryin interfaceInstallerFactory
-
createInstaller
@NonNull public final Installer createInstaller(@NonNull RemotePackage remote, @NonNull RepoManager mgr, @NonNull Downloader downloader)
Description copied from interface:InstallerFactoryCanonical way to create instances ofInstaller.- Specified by:
createInstallerin interfaceInstallerFactory
-
doCreateInstaller
@NonNull protected abstract Installer doCreateInstaller(@NonNull RemotePackage p, @NonNull RepoManager mgr, @NonNull Downloader downloader)
Subclasses should override this to do the actual creation of anInstaller.
-
createUninstaller
@NonNull public final Uninstaller createUninstaller(@NonNull LocalPackage local, @NonNull RepoManager mgr)
Description copied from interface:InstallerFactoryCanonical way to create instances ofUninstaller.- Specified by:
createUninstallerin interfaceInstallerFactory
-
doCreateUninstaller
@NonNull protected abstract Uninstaller doCreateUninstaller(@NonNull LocalPackage p, @NonNull RepoManager mgr)
Subclasses should override this to do the actual creation of anUninstaller.
-
canHandlePackage
protected boolean canHandlePackage(@NonNull RepoPackage pack, @NonNull RepoManager manager)Subclasses should override this to indicate whether they can generate installers/uninstallers for the given package.
-
-