android.content.pm.IPackageInstallObserver Java Examples
The following examples show how to use
android.content.pm.IPackageInstallObserver.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InstallerPrivilegedReflection.java From YalpStore with GNU General Public License v2.0 | 6 votes |
@Override protected void install(App app) { PackageManager pm = context.getPackageManager(); Class<?>[] types = new Class[] {Uri.class, IPackageInstallObserver.class, int.class, String.class}; try { pm.getClass().getMethod("installPackage", types).invoke( pm, Uri.fromFile(Paths.getApkPath(context, app.getPackageName(), app.getVersionCode())), new InstallObserver(), INSTALL_REPLACE_EXISTING, BuildConfig.APPLICATION_ID ); } catch (NoSuchMethodException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) { fail(e, app.getPackageName()); } }
Example #2
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@Override public void installPackage(Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName) { final VerificationParams verificationParams = new VerificationParams(null, null, null, VerificationParams.NO_UID, null); installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags, installerPackageName, verificationParams, null); }
Example #3
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@Override public void installPackageWithVerification(Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName, Uri verificationURI, ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams) { final VerificationParams verificationParams = new VerificationParams(verificationURI, null, null, VerificationParams.NO_UID, manifestDigest); installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags, installerPackageName, verificationParams, encryptionParams); }
Example #4
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@Override public void installPackageWithVerificationAndEncryption(Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName, VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) { installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags, installerPackageName, verificationParams, encryptionParams); }
Example #5
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@Override public void installPackage(Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName) { try { mPM.installPackage(packageURI, observer, flags, installerPackageName); } catch (RemoteException e) { // Should never happen! } }
Example #6
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@Override public void installPackageWithVerification(Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName, Uri verificationURI, ManifestDigest manifestDigest) { try { mPM.installPackageWithVerification(packageURI, observer, flags, installerPackageName, verificationURI, manifestDigest); } catch (RemoteException e) { // Should never happen! } }
Example #7
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@Override public void installPackage(Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName) { final VerificationParams verificationParams = new VerificationParams(null, null, null, VerificationParams.NO_UID, null); installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags, installerPackageName, verificationParams, null); }
Example #8
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@Override public void installPackageWithVerification(Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName, Uri verificationURI, ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams) { final VerificationParams verificationParams = new VerificationParams(verificationURI, null, null, VerificationParams.NO_UID, manifestDigest); installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags, installerPackageName, verificationParams, encryptionParams); }
Example #9
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@Override public void installPackageWithVerificationAndEncryption(Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName, VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) { installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags, installerPackageName, verificationParams, encryptionParams); }
Example #10
Source File: ApplicationManager.java From Demo_Public with MIT License | 5 votes |
public ApplicationManager(Context context) throws SecurityException, NoSuchMethodException { observer = new PackageInstallObserver(); observerdelete = new PackageDeleteObserver(); pm = context.getPackageManager(); Class<?>[] types = new Class[] {Uri.class, IPackageInstallObserver.class, int.class, String.class}; Class<?>[] uninstalltypes = new Class[] {String.class, IPackageDeleteObserver.class, int.class}; method = pm.getClass().getMethod("installPackage", types); uninstallmethod = pm.getClass().getMethod("deletePackage", uninstalltypes); }
Example #11
Source File: SystemInstallOnSubscribe.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public void call(Subscriber<? super Void> subscriber) { final IPackageInstallObserver.Stub silentObserver = new IPackageInstallObserver.Stub() { @Override public void packageInstalled(String packageName, int returnCode) throws RemoteException { if (returnCode == INSTALL_SUCCEEDED) { if (!subscriber.isUnsubscribed()) { subscriber.onNext(null); subscriber.onCompleted(); } } else { if (!subscriber.isUnsubscribed()) { subscriber.onError( new InstallationException("Package not installed with error code: " + returnCode)); } } } }; if (isSystem(context)) { try { Method installPackage = packageManager.getClass() .getMethod("installPackage", Uri.class, IPackageInstallObserver.class, int.class, String.class); Object[] params = new Object[] { packageUri, silentObserver, INSTALL_REPLACE_EXISTING, "" }; installPackage.invoke(packageManager, params); } catch (Exception e) { if (!subscriber.isUnsubscribed()) { subscriber.onError(new InstallationException(e)); } } } else { if (!subscriber.isUnsubscribed()) { subscriber.onError(new InstallationException("Aptoide does not hold system privilege!")); } } }
Example #12
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
@Override public void installPackage(Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName) { installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags, installerPackageName, mContext.getUserId()); }
Example #13
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
@Override public void installPackage(Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName) { installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags, installerPackageName, mContext.getUserId()); }
Example #14
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
@Override public void installPackage(Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName) { installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags, installerPackageName, mContext.getUserId()); }
Example #15
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
@Override public void installPackage(Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName) { installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags, installerPackageName, mContext.getUserId()); }
Example #16
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
@Override public void installPackage(Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName) { installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags, installerPackageName, mContext.getUserId()); }