• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IPackageManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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);
}
 
开发者ID:TaRGroup,项目名称:IFWManager,代码行数:22,代码来源:SenderPackageFilter.java


示例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;
}
 
开发者ID:TaRGroup,项目名称:IFWManager,代码行数:18,代码来源:SenderFilter.java


示例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;
    }
}
 
开发者ID:TaRGroup,项目名称:IFWManager,代码行数:10,代码来源:IntentFirewall.java


示例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 });
}
 
开发者ID:messnoTrace,项目名称:SlienceInstall,代码行数:15,代码来源:PM.java


示例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;
}
 
开发者ID:cuplv,项目名称:droidel,代码行数:12,代码来源:ActivityThread.java


示例6: BackupManagerController

import android.content.pm.IPackageManager; //导入依赖的package包/类
public BackupManagerController() {
    backupManager = IBackupManager.Stub.asInterface(ServiceManager.getService("backup"));
    packageManager = IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
}
 
开发者ID:stevesoltys,项目名称:backup,代码行数:5,代码来源:BackupManagerController.java


示例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);
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:4,代码来源:HideApiOverrideM.java


示例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);
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:4,代码来源:HideApiOverrideM.java


示例9: getPackageManager

import android.content.pm.IPackageManager; //导入依赖的package包/类
private static IPackageManager getPackageManager() {
    return IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:4,代码来源:OpsItemAdapter.java


示例10: getPackageManager

import android.content.pm.IPackageManager; //导入依赖的package包/类
public static IPackageManager getPackageManager() {
    throw new UnsupportedOperationException();
}
 
开发者ID:brevent,项目名称:prevent,代码行数:4,代码来源:AppGlobals.java


示例11: getPackageManager

import android.content.pm.IPackageManager; //导入依赖的package包/类
public static IPackageManager getPackageManager() {
  return null;
}
 
开发者ID:8enet,项目名称:AppOpsX,代码行数:4,代码来源:ActivityThread.java


示例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;
}
 
开发者ID:messnoTrace,项目名称:SlienceInstall,代码行数:11,代码来源:PM.java



注:本文中的android.content.pm.IPackageManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OptimizerFactory类代码示例发布时间:2022-05-22
下一篇:
Java MacOutputStream类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap