本文整理汇总了Java中android.content.pm.IPackageManager类的典型用法代码示例。如果您正苦于以下问题:Java IPackageManager类的具体用法?Java IPackageManager怎么用?Java IPackageManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPackageManager类属于android.content.pm包,在下文中一共展示了IPackageManager类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: matches
import android.content.pm.IPackageManager; //导入依赖的package包/类
@Override
public boolean matches(IntentFirewall ifw, ComponentName resolvedComponent, Intent intent,
int callerUid, int callerPid, String resolvedType, int receivingUid) {
IPackageManager pm = AppGlobals.getPackageManager();
int packageUid = -1;
try {
// USER_SYSTEM here is not important. Only app id is used and getPackageUid() will
// return a uid whether the app is installed for a user or not.
packageUid = pm.getPackageUid(mPackageName, PackageManager.MATCH_UNINSTALLED_PACKAGES,
UserHandle.USER_SYSTEM);
} catch (RemoteException ex) {
// handled below
}
if (packageUid == -1) {
return false;
}
return UserHandle.isSameApp(packageUid, callerUid);
}
示例2: isPrivilegedApp
import android.content.pm.IPackageManager; //导入依赖的package包/类
static boolean isPrivilegedApp(int callerUid, int callerPid) {
if (callerUid == Process.SYSTEM_UID || callerUid == 0 ||
callerPid == Process.myPid() || callerPid == 0) {
return true;
}
IPackageManager pm = AppGlobals.getPackageManager();
try {
return (pm.getPrivateFlagsForUid(callerUid) & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED)
!= 0;
} catch (RemoteException ex) {
Slog.e(IntentFirewall.TAG, "Remote exception while retrieving uid flags",
ex);
}
return false;
}
示例3: signaturesMatch
import android.content.pm.IPackageManager; //导入依赖的package包/类
boolean signaturesMatch(int uid1, int uid2) {
try {
IPackageManager pm = AppGlobals.getPackageManager();
return pm.checkUidSignatures(uid1, uid2) == PackageManager.SIGNATURE_MATCH;
} catch (RemoteException ex) {
Slog.e(TAG, "Remote exception while checking signatures", ex);
return false;
}
}
示例4: installPackageLowApi
import android.content.pm.IPackageManager; //导入依赖的package包/类
/**
* 适配 5.0以下系统
*
* @param path
* @param iInstallerCallback
* @throws Exception
*/
private void installPackageLowApi(String path, final IInstallerCallback iInstallerCallback) throws Exception {
final Uri uri = Uri.parse(path);
final int flags = PMFlags.INSTALL_REPLACE_EXISTING;
final PackageInstallObserver observer = new PackageInstallObserver(iInstallerCallback);
final IPackageManager ipm = getIPackageManager();
RefInvoke.invokeMethodWithException(ipm.getClass(), "installPackage", ipm, new Class[] { Uri.class, IPackageInstallObserver.class, int.class, String.class }, new Object[] { uri, observer, flags, null });
}
示例5: getPackageManager
import android.content.pm.IPackageManager; //导入依赖的package包/类
public static IPackageManager getPackageManager() {
if (sPackageManager != null) {
//Slog.v("PackageManager", "returning cur default = " + sPackageManager);
return sPackageManager;
}
IBinder b = ServiceManager.getService("package");
//Slog.v("PackageManager", "default service binder = " + b);
sPackageManager = IPackageManager.Stub.asInterface(b);
//Slog.v("PackageManager", "default service = " + sPackageManager);
return sPackageManager;
}
示例6: BackupManagerController
import android.content.pm.IPackageManager; //导入依赖的package包/类
public BackupManagerController() {
backupManager = IBackupManager.Stub.asInterface(ServiceManager.getService("backup"));
packageManager = IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
}
示例7: queryIntentReceivers
import android.content.pm.IPackageManager; //导入依赖的package包/类
public static List queryIntentReceivers(IPackageManager pm, Intent intent, int uid) {
return pm.queryIntentReceivers(intent, null, 0, uid);
}
示例8: queryIntentActivities
import android.content.pm.IPackageManager; //导入依赖的package包/类
public static List queryIntentActivities(IPackageManager pm, Intent intent, int uid) {
return pm.queryIntentActivities(intent, null, 0, uid);
}
示例9: getPackageManager
import android.content.pm.IPackageManager; //导入依赖的package包/类
private static IPackageManager getPackageManager() {
return IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
}
示例10: getPackageManager
import android.content.pm.IPackageManager; //导入依赖的package包/类
public static IPackageManager getPackageManager() {
throw new UnsupportedOperationException();
}
示例11: getPackageManager
import android.content.pm.IPackageManager; //导入依赖的package包/类
public static IPackageManager getPackageManager() {
return null;
}
示例12: getIPackageManager
import android.content.pm.IPackageManager; //导入依赖的package包/类
/**
* 反射系统IPackageManager
*
* @return
*/
private IPackageManager getIPackageManager() {
IBinder iBinder = (IBinder) RefInvoke.invokeStaticMethod("android.os.ServiceManager", "getService", new Class[] { String.class }, new Object[] { "package" });
IPackageManager ipm = IPackageManager.Stub.asInterface(iBinder);
return ipm;
}