public interface

PackageManagerPrivileged

bymason.platform.PackageManagerPrivileged

Class Overview

Privileged package management operations. Runs in system_server context \u2014 can grant/revoke runtime permissions synchronously.

Summary

Public Methods
abstract void grantRuntimePermission(String packageName, String permissionName)
Grant a runtime permission to an application which the application does not already have.
abstract void installPackage(Uri targetApkUri)
Install an APK from the device storage.
abstract void uninstallPackage(String packageName)
Uninstall an APK.

Public Methods

public abstract void grantRuntimePermission (String packageName, String permissionName)

Grant a runtime permission to an application which the application does not already have. The permission must have been requested by the application. If the application is not allowed to hold the permission, a SecurityException is thrown.

See also: PackageManager.PermissionFlags

Parameters
packageName String: The package to which to grant the permission.
permissionName String: The permission name to grant.

public abstract void installPackage (Uri targetApkUri)

Install an APK from the device storage.

Note: This method is currently not available. It will be enabled in a future OS release. Calling it will not produce an error, but the installation will not be performed.

Parameters
targetApkUri Uri: the Uri to the apk file. Must be readable by other applications. Use Uri format as file:///LOCATION-OF-THE-APP. For example: file:///Downloads/myapp.apk

public abstract void uninstallPackage (String packageName)

Uninstall an APK.

Note: This method is currently not available. It will be enabled in a future OS release. Calling it will not produce an error, but the uninstallation will not be performed.

Parameters
packageName String: package name of the apk to uninstall. Not valid for system applications.