Search in sources :

Example 11 with PluginPackageParser

use of com.morgoo.droidplugin.pm.parser.PluginPackageParser in project DroidPlugin by DroidPluginTeam.

the class IPluginManagerImpl method deleteApplicationCacheFiles.

@Override
public void deleteApplicationCacheFiles(String packageName, IPackageDataObserver observer) throws RemoteException {
    boolean success = false;
    try {
        if (TextUtils.isEmpty(packageName)) {
            return;
        }
        PluginPackageParser parser = mPluginCache.get(packageName);
        if (parser == null) {
            return;
        }
        ApplicationInfo applicationInfo = parser.getApplicationInfo(0);
        Utils.deleteDir(new File(applicationInfo.dataDir, "caches").getName());
        success = true;
    } catch (Exception e) {
        handleException(e);
    } finally {
        if (observer != null) {
            observer.onRemoveCompleted(packageName, success);
        }
    }
}
Also used : ApplicationInfo(android.content.pm.ApplicationInfo) PluginPackageParser(com.morgoo.droidplugin.pm.parser.PluginPackageParser) File(java.io.File) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) RemoteException(android.os.RemoteException)

Example 12 with PluginPackageParser

use of com.morgoo.droidplugin.pm.parser.PluginPackageParser in project DroidPlugin by DroidPluginTeam.

the class IPluginManagerImpl method getInstalledApplications.

@Override
public List<ApplicationInfo> getInstalledApplications(int flags) throws RemoteException {
    waitForReadyInner();
    try {
        enforcePluginFileExists();
        List<ApplicationInfo> infos = new ArrayList<ApplicationInfo>(mPluginCache.size());
        if (shouldNotBlockOtherInfo()) {
            for (PluginPackageParser pluginPackageParser : mPluginCache.values()) {
                infos.add(pluginPackageParser.getApplicationInfo(flags));
            }
        } else {
            List<String> pkgs = mActivityManagerService.getPackageNamesByPid(Binder.getCallingPid());
            for (PluginPackageParser pluginPackageParser : mPluginCache.values()) {
                if (pkgs.contains(pluginPackageParser.getPackageName())) {
                    infos.add(pluginPackageParser.getApplicationInfo(flags));
                }
            }
        }
        return infos;
    } catch (Exception e) {
        handleException(e);
    }
    return null;
}
Also used : ArrayList(java.util.ArrayList) ApplicationInfo(android.content.pm.ApplicationInfo) PluginPackageParser(com.morgoo.droidplugin.pm.parser.PluginPackageParser) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) RemoteException(android.os.RemoteException)

Example 13 with PluginPackageParser

use of com.morgoo.droidplugin.pm.parser.PluginPackageParser in project DroidPlugin by DroidPluginTeam.

the class IPluginManagerImpl method getProviderInfo.

@Override
public ProviderInfo getProviderInfo(ComponentName className, int flags) throws RemoteException {
    waitForReadyInner();
    try {
        String pkg = getAndCheckCallingPkg(className.getPackageName());
        if (pkg != null) {
            enforcePluginFileExists();
            PluginPackageParser parser = mPluginCache.get(className.getPackageName());
            if (parser != null) {
                return parser.getProviderInfo(className, flags);
            }
        }
    } catch (Exception e) {
        handleException(e);
    }
    return null;
}
Also used : PluginPackageParser(com.morgoo.droidplugin.pm.parser.PluginPackageParser) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) RemoteException(android.os.RemoteException)

Example 14 with PluginPackageParser

use of com.morgoo.droidplugin.pm.parser.PluginPackageParser in project DroidPlugin by DroidPluginTeam.

the class IPluginManagerImpl method getPackageInfo.

@Override
public PackageInfo getPackageInfo(String packageName, int flags) throws RemoteException {
    waitForReadyInner();
    try {
        String pkg = getAndCheckCallingPkg(packageName);
        if (pkg != null && !TextUtils.equals(packageName, mContext.getPackageName())) {
            enforcePluginFileExists();
            PluginPackageParser parser = mPluginCache.get(pkg);
            if (parser != null) {
                PackageInfo packageInfo = parser.getPackageInfo(flags);
                if (packageInfo != null && (flags & PackageManager.GET_SIGNATURES) != 0 && packageInfo.signatures == null) {
                    packageInfo.signatures = mSignatureCache.get(packageName);
                }
                return packageInfo;
            }
        }
    } catch (Exception e) {
        handleException(e);
    }
    return null;
}
Also used : PackageInfo(android.content.pm.PackageInfo) PluginPackageParser(com.morgoo.droidplugin.pm.parser.PluginPackageParser) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) RemoteException(android.os.RemoteException)

Example 15 with PluginPackageParser

use of com.morgoo.droidplugin.pm.parser.PluginPackageParser in project DroidPlugin by DroidPluginTeam.

the class IPluginManagerImpl method queryPermissionsByGroup.

@Override
public List<PermissionInfo> queryPermissionsByGroup(String group, int flags) throws RemoteException {
    waitForReadyInner();
    try {
        enforcePluginFileExists();
        List<PermissionInfo> list = new ArrayList<PermissionInfo>();
        if (shouldNotBlockOtherInfo()) {
            for (PluginPackageParser pluginPackageParser : mPluginCache.values()) {
                List<PermissionInfo> permissionInfos = pluginPackageParser.getPermissions();
                for (PermissionInfo permissionInfo : permissionInfos) {
                    if (TextUtils.equals(permissionInfo.group, group) && !list.contains(permissionInfo)) {
                        list.add(permissionInfo);
                    }
                }
            }
        } else {
            List<String> pkgs = mActivityManagerService.getPackageNamesByPid(Binder.getCallingPid());
            for (PluginPackageParser pluginPackageParser : mPluginCache.values()) {
                List<PermissionInfo> permissionInfos = pluginPackageParser.getPermissions();
                for (PermissionInfo permissionInfo : permissionInfos) {
                    if (pkgs.contains(permissionInfo.packageName) && TextUtils.equals(permissionInfo.group, group) && !list.contains(permissionInfo)) {
                        list.add(permissionInfo);
                    }
                }
            }
        }
        return list;
    } catch (Exception e) {
        handleException(e);
    }
    return null;
}
Also used : PermissionInfo(android.content.pm.PermissionInfo) ArrayList(java.util.ArrayList) PluginPackageParser(com.morgoo.droidplugin.pm.parser.PluginPackageParser) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) RemoteException(android.os.RemoteException)

Aggregations

PluginPackageParser (com.morgoo.droidplugin.pm.parser.PluginPackageParser)15 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)14 RemoteException (android.os.RemoteException)14 ArrayList (java.util.ArrayList)5 PackageInfo (android.content.pm.PackageInfo)4 File (java.io.File)4 ApplicationInfo (android.content.pm.ApplicationInfo)3 PackageManager (android.content.pm.PackageManager)1 PermissionGroupInfo (android.content.pm.PermissionGroupInfo)1 PermissionInfo (android.content.pm.PermissionInfo)1 Signature (android.content.pm.Signature)1