當前位置: 首頁>>代碼示例>>Java>>正文


Java PackageManager.GET_META_DATA屬性代碼示例

本文整理匯總了Java中android.content.pm.PackageManager.GET_META_DATA屬性的典型用法代碼示例。如果您正苦於以下問題:Java PackageManager.GET_META_DATA屬性的具體用法?Java PackageManager.GET_META_DATA怎麽用?Java PackageManager.GET_META_DATA使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.content.pm.PackageManager的用法示例。


在下文中一共展示了PackageManager.GET_META_DATA屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generateProviderInfo

public static ProviderInfo generateProviderInfo(VPackage.ProviderComponent p, int flags,
                                                PackageUserState state, int userId) {
    if (p == null) return null;
    if (!checkUseInstalledOrHidden(state, flags)) {
        return null;
    }
    // Make shallow copies so we can store the metadata safely
    ProviderInfo pi = new ProviderInfo(p.info);
    if ((flags & PackageManager.GET_META_DATA) != 0
            && (p.metaData != null)) {
        pi.metaData = p.metaData;
    }

    if ((flags & PackageManager.GET_URI_PERMISSION_PATTERNS) == 0) {
        pi.uriPermissionPatterns = null;
    }
    pi.applicationInfo = generateApplicationInfo(p.owner, flags, state, userId);
    return pi;
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:19,代碼來源:PackageParserEx.java

示例2: generateApplicationInfo

public static ApplicationInfo generateApplicationInfo(VPackage p, int flags,
                                                      PackageUserState state, int userId) {
    if (p == null) return null;
    if (!checkUseInstalledOrHidden(state, flags)) {
        return null;
    }

    // Make shallow copy so we can store the metadata/libraries safely
    ApplicationInfo ai = new ApplicationInfo(p.applicationInfo);
    if ((flags & PackageManager.GET_META_DATA) != 0) {
        ai.metaData = p.mAppMetaData;
    }
    initApplicationAsUser(ai, userId);
    return ai;
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:15,代碼來源:PackageParserEx.java

示例3: generateActivityInfo

public static ActivityInfo generateActivityInfo(VPackage.ActivityComponent a, int flags,
                                                PackageUserState state, int userId) {
    if (a == null) return null;
    if (!checkUseInstalledOrHidden(state, flags)) {
        return null;
    }
    // Make shallow copies so we can store the metadata safely
    ActivityInfo ai = new ActivityInfo(a.info);
    if ((flags & PackageManager.GET_META_DATA) != 0
            && (a.metaData != null)) {
        ai.metaData = a.metaData;
    }
    ai.applicationInfo = generateApplicationInfo(a.owner, flags, state, userId);
    return ai;
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:15,代碼來源:PackageParserEx.java

示例4: generateServiceInfo

public static ServiceInfo generateServiceInfo(VPackage.ServiceComponent s, int flags,
                                              PackageUserState state, int userId) {
    if (s == null) return null;
    if (!checkUseInstalledOrHidden(state, flags)) {
        return null;
    }
    ServiceInfo si = new ServiceInfo(s.info);
    // Make shallow copies so we can store the metadata safely
    if ((flags & PackageManager.GET_META_DATA) != 0 && s.metaData != null) {
        si.metaData = s.metaData;
    }
    si.applicationInfo = generateApplicationInfo(s.owner, flags, state, userId);
    return si;
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:14,代碼來源:PackageParserEx.java

示例5: generateInstrumentationInfo

public static InstrumentationInfo generateInstrumentationInfo(
        VPackage.InstrumentationComponent i, int flags) {
    if (i == null) return null;
    if ((flags & PackageManager.GET_META_DATA) == 0) {
        return i.info;
    }
    InstrumentationInfo ii = new InstrumentationInfo(i.info);
    ii.metaData = i.metaData;
    return ii;
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:10,代碼來源:PackageParserEx.java

示例6: generatePermissionInfo

public static PermissionInfo generatePermissionInfo(
        VPackage.PermissionComponent p, int flags) {
    if (p == null) return null;
    if ((flags & PackageManager.GET_META_DATA) == 0) {
        return p.info;
    }
    PermissionInfo pi = new PermissionInfo(p.info);
    pi.metaData = p.metaData;
    return pi;
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:10,代碼來源:PackageParserEx.java

示例7: generatePermissionGroupInfo

public static PermissionGroupInfo generatePermissionGroupInfo(
        VPackage.PermissionGroupComponent pg, int flags) {
    if (pg == null) return null;
    if ((flags & PackageManager.GET_META_DATA) == 0) {
        return pg.info;
    }
    PermissionGroupInfo pgi = new PermissionGroupInfo(pg.info);
    pgi.metaData = pg.metaData;
    return pgi;
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:10,代碼來源:PackageParserEx.java

示例8: installLocked

private PluginInfo installLocked(String path) {
    final boolean verifySignEnable = RePlugin.getConfig().getVerifySign();
    final int flags = verifySignEnable ? PackageManager.GET_META_DATA | PackageManager.GET_SIGNATURES : PackageManager.GET_META_DATA;

    // 1. 讀取APK內容
    PackageInfo pi = mContext.getPackageManager().getPackageArchiveInfo(path, flags);
    if (pi == null) {
        if (LogDebug.LOG) {
            LogDebug.e(TAG, "installLocked: Not a valid apk. path=" + path);
        }

        RePlugin.getConfig().getEventCallbacks().onInstallPluginFailed(path, RePluginEventCallbacks.InstallResult.READ_PKG_INFO_FAIL);
        return null;
    }

    // 2. 校驗插件簽名
    if (verifySignEnable) {
        if (!verifySignature(pi, path)) {
            return null;
        }
    }

    // 3. 解析出名字和三元組
    PluginInfo instPli = PluginInfo.parseFromPackageInfo(pi, path);
    if (LogDebug.LOG) {
        LogDebug.i(TAG, "installLocked: Info=" + instPli);
    }
    instPli.setType(PluginInfo.TYPE_NOT_INSTALL);

    // 若要安裝的插件版本小於或等於當前版本,則安裝失敗
    // NOTE 絕大多數情況下,應該在調用RePlugin.install方法前,根據雲端回傳的信息來判斷,以防止下載舊插件,浪費流量
    // NOTE 這裏僅做雙保險,或通過特殊渠道安裝時會有用

    // 注意:這裏必須用“非Clone過的”PluginInfo,因為要修改裏麵的內容
    PluginInfo curPli = RePluginOS.getPlugin(instPli.getName(), false);
    if (curPli != null) {
        if (LogDebug.LOG) {
            LogDebug.i(TAG, "installLocked: Has installed plugin. current=" + curPli);
        }

        // 版本較老?直接返回
        final int checkResult = checkVersion(instPli, curPli);
        if (checkResult < 0) {
            RePlugin.getConfig().getEventCallbacks().onInstallPluginFailed(path, RePluginEventCallbacks.InstallResult.VERIFY_VER_FAIL);
            return null;
        } else if (checkResult == 0){
            instPli.setIsPendingCover(true);
        }
    }

    // 4. 將合法的APK改名後,移動(或複製,見RePluginConfig.isMoveFileWhenInstalling)到新位置
    // 注意:不能和p-n的最終釋放位置相同,因為管理方式不一樣
    if (!copyOrMoveApk(path, instPli)) {
        RePlugin.getConfig().getEventCallbacks().onInstallPluginFailed(path, RePluginEventCallbacks.InstallResult.COPY_APK_FAIL);
        return null;
    }

    // 5. 從插件中釋放 So 文件
    PluginNativeLibsHelper.install(instPli.getPath(), instPli.getNativeLibsDir());

    // 6. 若已經安裝舊版本插件,則嘗試更新插件信息,否則直接加入到列表中
    if (curPli != null) {
        updateOrLater(curPli, instPli);
    } else {
        mList.add(instPli);
    }

    // 7. 保存插件信息到文件中,下次可直接使用
    mList.save(mContext);

    return instPli;
}
 
開發者ID:wangyupeng1-iri,項目名稱:springreplugin,代碼行數:72,代碼來源:PluginManagerServer.java


注:本文中的android.content.pm.PackageManager.GET_META_DATA屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。