[ English | 简体中文 ]
PMS API
Package Manager Service (PMS) is the package management module in the openvela XMS system.
Features
- Package installation
- Package information query
- Package uninstallation
Examples
Package management via command line
Install a package:
pm install [packagename]
List installed packages:
pm list
Package management via source code
Install a package:
#include <pm/PackageManager.h>
PackageManager pm;
InstallParam parms;
pm.installPackage(parms);
Get all package information:
#include <pm/PackageManager.h>
PackageManager pm;
std::vector<PackageInfo> pgInfos;
pm.getAllPackageInfo(&pgInfos);
Uninstall a package:
#include <pm/PackageManager.h>
PackageManager pm;
UninstallParam parms;
pm.uninstallPackage(parms);
Core Classes
PackageManager
Header: #include <pm/PackageManager.h>
The facade class for accessing PMS capabilities on the client side. Main operations:
installPackage(InstallParam)— Install an application packageuninstallPackage(UninstallParam)— Uninstall an application packagegetAllPackageInfo(std::vector<PackageInfo>*)— Query all installed package informationgetPackageInfo(packageName, PackageInfo*)— Query information for a specific packagegetAllPackageName(std::vector<std::string>*)— Query all installed package namesgetPackageSizeInfo(packageName, ...)— Query package storage usageclearAppCache(packageName)— Clear application cacheisFirstBoot()— Query whether this is the first boot
Applications typically construct a PackageManager instance and call the above methods directly. Internally it communicates with PackageManagerService via Binder.
PackageManagerService
Header: #include <pm/PackageManagerService.h>
The server-side implementation class of PMS, registered as a system service. It maintains installed package metadata, performs actual install/uninstall operations, and handles permission and signature verification. Developers generally do not use this class directly.
PackageInfo
Header: #include <pm/PackageInfo.h>
A structure describing the metadata of a single installed package. Main fields include:
packageName/name— Package name and application nameversion/priority/appType— Version, priority, and application typeinstalledPath/installTime/size— Installation path, installation time, and storage sizeexecfile/entry/manifest— Executable file, entry point, and manifestactivitiesInfo/servicesInfo— Internal Activity and Service listsshasum— Signature digestuserId/isSystemUI— User ID and whether it is a system UIwindowEnterAnim/windowExitAnim— Window enter/exit animation configuration
Query interfaces of PackageManager return results of this type.
PackageTrace
Header: #include <PackageTrace.h>
A collection of trace macros for PMS, used to trace package management operation paths. Works with openvela trace tools for performance analysis.