java类android.content.pm.ApplicationInfo的实例源码

InstalledAppTestUtils.java 文件源码 项目:mobile-store 阅读 35 收藏 0 点赞 0 评论 0
public static void install(Context context,
                           String packageName,
                           int versionCode, String versionName,
                           @Nullable String signingCert,
                           @Nullable String hash) {
    PackageInfo info = new PackageInfo();
    info.packageName = packageName;
    info.versionCode = versionCode;
    info.versionName = versionName;
    info.applicationInfo = new ApplicationInfo();
    info.applicationInfo.publicSourceDir = "/tmp/mock-location";
    if (signingCert != null) {
        info.signatures = new Signature[]{new Signature(signingCert)};
    }

    String hashType = "sha256";
    if (hash == null) {
        hash = "00112233445566778899aabbccddeeff";
    }

    InstalledAppProviderService.insertAppIntoDb(context, info, hashType, hash);
}
SystemWebViewClient.java 文件源码 项目:COB 阅读 38 收藏 0 点赞 0 评论 0
/**
 * Notify the host application that an SSL error occurred while loading a resource.
 * The host application must call either handler.cancel() or handler.proceed().
 * Note that the decision may be retained for use in response to future SSL errors.
 * The default behavior is to cancel the load.
 *
 * @param view          The WebView that is initiating the callback.
 * @param handler       An SslErrorHandler object that will handle the user's response.
 * @param error         The SSL error object.
 */
@TargetApi(8)
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {

    final String packageName = parentEngine.cordova.getActivity().getPackageName();
    final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager();

    ApplicationInfo appInfo;
    try {
        appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
        if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
            // debug = true
            handler.proceed();
            return;
        } else {
            // debug = false
            super.onReceivedSslError(view, handler, error);
        }
    } catch (NameNotFoundException e) {
        // When it doubt, lock it out!
        super.onReceivedSslError(view, handler, error);
    }
}
RootsCache.java 文件源码 项目:FireFiles 阅读 27 收藏 0 点赞 0 评论 0
private void handleDocumentsProvider(ProviderInfo info) {
    // Ignore stopped packages for now; we might query them
    // later during UI interaction.
    if ((info.applicationInfo.flags & ApplicationInfo.FLAG_STOPPED) != 0) {
        if (LOGD) Log.d(TAG, "Ignoring stopped authority " + info.authority);
        mTaskStoppedAuthorities.add(info.authority);
        return;
    }

    // Try using cached roots if filtering
    boolean cacheHit = false;
    if (mAuthority != null && !mAuthority.equals(info.authority)) {
        synchronized (mLock) {
            if (mTaskRoots.putAll(info.authority, mRoots.get(info.authority))) {
                if (LOGD) Log.d(TAG, "Used cached roots for " + info.authority);
                cacheHit = true;
            }
        }
    }

    // Cache miss, or loading everything
    if (!cacheHit) {
        mTaskRoots.putAll(info.authority,
                loadRootsForAuthority(mContext.getContentResolver(), info.authority));
    }
}
ManifestParser.java 文件源码 项目:MVVMFrames 阅读 39 收藏 0 点赞 0 评论 0
public List<ConfigModule> parse() {
    List<ConfigModule> modules = new ArrayList<ConfigModule>();
    try {
        ApplicationInfo appInfo = context.getPackageManager().getApplicationInfo(
                context.getPackageName(), PackageManager.GET_META_DATA);
        if (appInfo.metaData != null) {
            for (String key : appInfo.metaData.keySet()) {
                if (MODULE_VALUE.equals(appInfo.metaData.get(key))) {
                    modules.add(parseModule(key));
                }
            }
        }
    } catch (PackageManager.NameNotFoundException e) {
        throw new RuntimeException("Unable to find metadata to parse ConfigModule", e);
    }

    return modules;
}
UpdateService.java 文件源码 项目:ServiceDownLoadApp-master 阅读 50 收藏 0 点赞 0 评论 0
private int getIcon(Context context){

            final PackageManager packageManager = context.getPackageManager();
            ApplicationInfo appInfo = null;
            try {
                appInfo = packageManager.getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
            } catch (PackageManager.NameNotFoundException e) {
                e.printStackTrace();
            }
            if (appInfo != null){
                return appInfo.icon;
            }
            return 0;
        }
SenderFilter.java 文件源码 项目:IFWManager 阅读 36 收藏 0 点赞 0 评论 0
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;
}
X5WebViewClient.java 文件源码 项目:cordova.plugins.X5WebView 阅读 35 收藏 0 点赞 0 评论 0
/**
 * Notify the host application that an SSL error occurred while loading a resource.
 * The host application must call either handler.cancel() or handler.proceed().
 * Note that the decision may be retained for use in response to future SSL errors.
 * The default behavior is to cancel the load.
 *
 * @param view          The WebView that is initiating the callback.
 * @param handler       An SslErrorHandler object that will handle the user's response.
 * @param error         The SSL error object.
 */
@TargetApi(8)
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {

    final String packageName = parentEngine.cordova.getActivity().getPackageName();
    final PackageManager pm = parentEngine.cordova.getActivity().getPackageManager();

    ApplicationInfo appInfo;
    try {
        appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
        if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
            // debug = true
            handler.proceed();
            return;
        } else {
            // debug = false
            super.onReceivedSslError(view, handler, error);
        }
    } catch (NameNotFoundException e) {
        // When it doubt, lock it out!
        super.onReceivedSslError(view, handler, error);
    }
}
LocationManagerImplementation.java 文件源码 项目:Leanplum-Android-SDK 阅读 38 收藏 0 点赞 0 评论 0
private boolean isMetaDataSet() {
  Context context = Leanplum.getContext();
  try {
    ApplicationInfo appInfo = context.getPackageManager().getApplicationInfo(
        context.getPackageName(), PackageManager.GET_META_DATA);
    if (appInfo != null) {
      if (appInfo.metaData != null) {
        Object value = appInfo.metaData.get(METADATA);
        if (value != null) {
          return true;
        }
      }
    }
    return false;
  } catch (NameNotFoundException e) {
    return false;
  }
}
NSLoggerClient.java 文件源码 项目:CustomLogger 阅读 43 收藏 0 点赞 0 评论 0
void pushClientInfoToFrontOfQueue()
{
    if (DEBUG_LOGGER)
        Log.v("NSLogger", "Pushing client info to front of queue");

    LogMessage lm = new LogMessage(LogMessage.LOGMSG_TYPE_CLIENTINFO, nextSequenceNumber.getAndIncrement());
    lm.addString(Build.MANUFACTURER + " " + Build.MODEL, LogMessage.PART_KEY_CLIENT_MODEL);
    lm.addString("Android", LogMessage.PART_KEY_OS_NAME);
    lm.addString(Build.VERSION.RELEASE, LogMessage.PART_KEY_OS_VERSION);
    lm.addString(Secure.getString(currentContext.getContentResolver(), Secure.ANDROID_ID), LogMessage.PART_KEY_UNIQUEID);
    ApplicationInfo ai = currentContext.getApplicationInfo();
    String appName = ai.packageName;
    if (appName == null)
    {
        appName = ai.processName;
        if (appName == null)
        {
            appName = ai.taskAffinity;
            if (appName == null)
                appName = ai.toString();
        }
    }
    lm.addString(appName, LogMessage.PART_KEY_CLIENT_NAME);
    logs.add(0, lm);
    clientInfoAdded = true;
}
IconsManager.java 文件源码 项目:LaunchEnr 阅读 41 收藏 0 点赞 0 评论 0
List<String> getMatchingDrawables(String packageName) {
    List<String> matchingDrawables = new ArrayList<>();
    ApplicationInfo info = null;
    try {
        info = mPackageManager.getApplicationInfo(packageName, 0);
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }
    String packageLabel = (info != null ? mPackageManager.getApplicationLabel(info).toString()
            : packageName).replaceAll("[^a-zA-Z]", "").toLowerCase().trim();
    for (String drawable : mDrawables) {
        if (drawable == null) continue;
        String filteredDrawable = drawable.replaceAll("[^a-zA-Z]", "").toLowerCase().trim();
        if (filteredDrawable.length() > 2 && (packageLabel.contains(filteredDrawable)
                || filteredDrawable.contains(packageLabel))) {
            matchingDrawables.add(drawable);
        }
    }
    return matchingDrawables;
}
VActivityManagerService.java 文件源码 项目:TPlayer 阅读 89 收藏 0 点赞 0 评论 0
@Override
public void processRestarted(String packageName, String processName, int userId) {
    int callingPid = getCallingPid();
    int appId = VAppManagerService.get().getAppId(packageName);
    int uid = VUserHandle.getUid(userId, appId);
    synchronized (this) {
        ProcessRecord app = findProcessLocked(callingPid);
        if (app == null) {
            ApplicationInfo appInfo = VPackageManagerService.get().getApplicationInfo(packageName, 0, userId);
            appInfo.flags |= ApplicationInfo.FLAG_HAS_CODE;
            String stubProcessName = getProcessName(callingPid);
            int vpid = parseVPid(stubProcessName);
            if (vpid != -1) {
                performStartProcessLocked(uid, vpid, appInfo, processName);
            }
        }
    }
}
AppDiff.java 文件源码 项目:mobile-store 阅读 34 收藏 0 点赞 0 评论 0
private void init() {
    String pkgName = pkgInfo.packageName;
    // Check if there is already a package on the device with this name
    // but it has been renamed to something else.
    final String[] oldName = pm.canonicalToCurrentPackageNames(new String[]{pkgName});
    if (oldName != null && oldName.length > 0 && oldName[0] != null) {
        pkgName = oldName[0];
        pkgInfo.packageName = pkgName;
        pkgInfo.applicationInfo.packageName = pkgName;
    }
    // Check if package is already installed
    try {
        // This is a little convoluted because we want to get all uninstalled
        // apps, but this may include apps with just data, and if it is just
        // data we still want to count it as "installed".
        //noinspection WrongConstant (lint is actually wrong here!)
        installedAppInfo = pm.getApplicationInfo(pkgName,
                PackageManager.GET_UNINSTALLED_PACKAGES);
        if ((installedAppInfo.flags & ApplicationInfo.FLAG_INSTALLED) == 0) {
            installedAppInfo = null;
        }
    } catch (PackageManager.NameNotFoundException e) {
        installedAppInfo = null;
    }
}
ApplicationUtil.java 文件源码 项目:AndroidDevSamples 阅读 41 收藏 0 点赞 0 评论 0
public static String getMetaData(Context context, @NonNull String key) {
    String metaDataValue = "";
    try {
        PackageManager packageManager = context.getPackageManager();
        if (packageManager != null) {
            ApplicationInfo applicationInfo = packageManager.getApplicationInfo(
                    context.getPackageName(), PackageManager.GET_META_DATA);
            if (applicationInfo != null && applicationInfo.metaData != null) {
                metaDataValue = applicationInfo.metaData.getString(key);
            }
        }
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }

    return metaDataValue;
}
IActivityManagerHookHandle.java 文件源码 项目:DroidPlugin 阅读 36 收藏 0 点赞 0 评论 0
@Override
protected boolean beforeInvoke(Object receiver, Method method, Object[] args) throws Throwable {
    //API 2.3,15,16,17,18,19, 21
/* public boolean bindBackupAgent(ApplicationInfo appInfo, int backupRestoreMode)
    throws RemoteException;*/
    final int index = 0;
    if (args != null && args.length > index) {
        if (args[index] != null && args[index] instanceof ApplicationInfo) {
            ApplicationInfo appInfo = (ApplicationInfo) args[index];
            if (isPackagePlugin(appInfo.packageName)) {
                args[index] = mHostContext.getApplicationInfo();
            }
        }
    }
    return super.beforeInvoke(receiver, method, args);
}
AppLinkNavigation.java 文件源码 项目:letv 阅读 32 收藏 0 点赞 0 评论 0
private Bundle buildAppLinkDataForNavigation(Context context) {
    Bundle data = new Bundle();
    Bundle refererAppLinkData = new Bundle();
    if (context != null) {
        String refererAppPackage = context.getPackageName();
        if (refererAppPackage != null) {
            refererAppLinkData.putString(KEY_NAME_REFERER_APP_LINK_PACKAGE, refererAppPackage);
        }
        ApplicationInfo appInfo = context.getApplicationInfo();
        if (appInfo != null) {
            String refererAppName = context.getString(appInfo.labelRes);
            if (refererAppName != null) {
                refererAppLinkData.putString("app_name", refererAppName);
            }
        }
    }
    data.putAll(getAppLinkData());
    data.putString("target_url", getAppLink().getSourceUrl().toString());
    data.putString("version", "1.0");
    data.putString(KEY_NAME_USER_AGENT, "Bolts Android 1.2.1");
    data.putBundle(KEY_NAME_REFERER_APP_LINK, refererAppLinkData);
    data.putBundle("extras", getExtras());
    return data;
}
ManifestParser.java 文件源码 项目:MoligyMvpArms 阅读 39 收藏 0 点赞 0 评论 0
public List<ConfigModule> parse() {
    List<ConfigModule> modules = new ArrayList<ConfigModule>();
    try {
        ApplicationInfo appInfo = context.getPackageManager().getApplicationInfo(
                context.getPackageName(), PackageManager.GET_META_DATA);
        if (appInfo.metaData != null) {
            for (String key : appInfo.metaData.keySet()) {
                if (MODULE_VALUE.equals(appInfo.metaData.get(key))) {
                    modules.add(parseModule(key));
                }
            }
        }
    } catch (PackageManager.NameNotFoundException e) {
        throw new RuntimeException("Unable to find metadata to parse ConfigModule", e);
    }

    return modules;
}
VActivityManagerService.java 文件源码 项目:VirtualHook 阅读 37 收藏 0 点赞 0 评论 0
@Override
public void processRestarted(String packageName, String processName, int userId) {
    int callingPid = getCallingPid();
    int appId = VAppManagerService.get().getAppId(packageName);
    int uid = VUserHandle.getUid(userId, appId);
    synchronized (this) {
        ProcessRecord app = findProcessLocked(callingPid);
        if (app == null) {
            ApplicationInfo appInfo = VPackageManagerService.get().getApplicationInfo(packageName, 0, userId);
            appInfo.flags |= ApplicationInfo.FLAG_HAS_CODE;
            String stubProcessName = getProcessName(callingPid);
            int vpid = parseVPid(stubProcessName);
            if (vpid != -1) {
                performStartProcessLocked(uid, vpid, appInfo, processName);
            }
        }
    }
}
AppUtils.java 文件源码 项目:https-github.com-hyb1996-NoRootScriptDroid 阅读 43 收藏 0 点赞 0 评论 0
@ScriptInterface
public String getAppName(String packageName) {
    PackageManager packageManager = mContext.getPackageManager();
    try {
        ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 0);
        CharSequence appName = packageManager.getApplicationLabel(applicationInfo);
        return appName == null ? null : appName.toString();
    } catch (PackageManager.NameNotFoundException e) {
        return null;
    }
}
VPackageManagerService.java 文件源码 项目:container 阅读 42 收藏 0 点赞 0 评论 0
@Override
public VParceledListSlice<ApplicationInfo> getInstalledApplications(int flags, int userId) {
    checkUserId(userId);
    ArrayList<ApplicationInfo> list = new ArrayList<>(mPackages.size());
    synchronized (mPackages) {
        for (PackageParser.Package pkg : mPackages.values()) {
            list.add(getApplicationInfo(pkg.packageName, flags, userId));
        }
    }
    return new VParceledListSlice<>(list);
}
GetInstalledApplications.java 文件源码 项目:container 阅读 30 收藏 0 点赞 0 评论 0
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {

    int flags = (Integer) args[0];
    int userId = VUserHandle.myUserId();
    List<ApplicationInfo> appInfos = VPackageManager.get().getInstalledApplications(flags, userId);
    if (ParceledListSliceCompat.isReturnParceledListSlice(method)) {
        return ParceledListSliceCompat.create(appInfos);
    }
    return appInfos;
}
InstalledApplication.java 文件源码 项目:lockit 阅读 34 收藏 0 点赞 0 评论 0
private boolean isInstalledApp(ApplicationInfo appInfo) {
        if (context.getPackageName().equals(appInfo.packageName))
            return false;
//        if ((appInfo.flags & appInfo.FLAG_SYSTEM) != 0)
//            return false;
//        if ((appInfo.flags & appInfo.FLAG_UPDATED_SYSTEM_APP) != 0)
//            return false;
        return true;
    }
ActivityInjector.java 文件源码 项目:springreplugin 阅读 34 收藏 0 点赞 0 评论 0
/**
 * 获取 activity 的 icon 属性
 */
private static Bitmap getIcon(Activity activity, ActivityInfo ai) {
    Drawable iconDrawable;
    Resources res = activity.getResources();

    // 获取 Activity icon
    iconDrawable = getIconById(res, ai.icon);

    // 获取插件 Application Icon
    if (iconDrawable == null) {
        iconDrawable = getIconById(res, ai.applicationInfo.icon);
    }

    // 获取 App(Host) Icon
    if (iconDrawable == null) {
        Context appContext = RePluginInternal.getAppContext();
        Resources appResource = appContext.getResources();
        ApplicationInfo appInfo = appContext.getApplicationInfo();
        iconDrawable = getIconById(appResource, appInfo.icon);
    }

    Bitmap bitmap = null;
    if (iconDrawable instanceof BitmapDrawable) {
        bitmap = ((BitmapDrawable) iconDrawable).getBitmap();
    }

    if (LOG) {
        LogDebug.d(TAG, "bitmap = " + bitmap);
    }
    return bitmap;
}
MainActivity.java 文件源码 项目:OpenAPK 阅读 34 收藏 0 点赞 0 评论 0
@Override
protected Void doInBackground(Void... params) {
    List<PackageInfo> packages = packageManager.getInstalledPackages(PackageManager.GET_META_DATA);
    for (PackageInfo packageInfo : packages) {
        AppItem appItem = new AppItem(packageInfo);
        if (!packageInfo.applicationInfo.enabled) {
            appItem.disable = true;
            appDisabledList.add(appItem);
        } else if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
            appItem.system = true;
            appSystemList.add(appItem);
        } else {
            appInstalledList.add(appItem);
        }
    }

    appInstalledList = sortAdapter(appInstalledList);
    appSystemList = sortAdapter(appSystemList);
    appDisabledList = sortAdapter(appDisabledList);

    appInstalledAdapter = new AppAdapter(context, appInstalledList);
    appSystemAdapter = new AppAdapter(context, appSystemList);
    appDisabledAdapter = new AppAdapter(context, appDisabledList);

    appHiddenList = sortAdapter(appHiddenList);
    appHiddenAdapter = new AppAdapter(context, appHiddenList);

    appFavoriteList = sortAdapter(appFavoriteList);
    appFavoriteAdapter = new AppAdapter(context, appFavoriteList);
    return null;
}
PackageAppData.java 文件源码 项目:VirtualHook 阅读 29 收藏 0 点赞 0 评论 0
private void loadData(Context context, ApplicationInfo appInfo) {
    if (appInfo == null) {
        return;
    }
    PackageManager pm = context.getPackageManager();
    try {
        CharSequence sequence = appInfo.loadLabel(pm);
        if (sequence != null) {
            name = sequence.toString();
        }
        icon = appInfo.loadIcon(pm);
    } catch (Throwable e) {
        e.printStackTrace();
    }
}
WebViewFragment.java 文件源码 项目:Ghost-Android 阅读 44 收藏 0 点赞 0 评论 0
@SuppressLint("SetJavaScriptEnabled")
@NonNull @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    @LayoutRes int layoutId = getArguments().getInt(KEY_LAYOUT_ID);
    View view = inflater.inflate(layoutId, container, false);
    // not using ButterKnife to ensure WebView is private
    // but still need to call bindView() to maintain base class contract
    bindView(view);
    mWebView = (WebView) view.findViewById(R.id.web_view);
    mUrl = getArguments().getString(BundleKeys.URL);
    if (TextUtils.isEmpty(mUrl)) {
        throw new IllegalArgumentException("Empty URL passed to WebViewFragment!");
    }
    Log.i(TAG, "Loading URL: %s", mUrl);

    WebSettings settings = mWebView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setDomStorageEnabled(true);

    // enable remote debugging
    if (0 != (getActivity().getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE) &&
            Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        WebView.setWebContentsDebuggingEnabled(true);
    }

    mWebView.setWebViewClient(new DefaultWebViewClient());
    mWebView.loadUrl(mUrl);

    return view;
}
AppUtils.java 文件源码 项目:GitHub 阅读 50 收藏 0 点赞 0 评论 0
/**
 * 得到AppInfo的Bean
 *
 * @param pm 包的管理
 * @param pi 包的信息
 * @return AppInfo类
 */
private static AppInfo getBean(final PackageManager pm, final PackageInfo pi) {
    if (pm == null || pi == null) return null;
    ApplicationInfo ai = pi.applicationInfo;
    String packageName = pi.packageName;
    String name = ai.loadLabel(pm).toString();
    Drawable icon = ai.loadIcon(pm);
    String packagePath = ai.sourceDir;
    String versionName = pi.versionName;
    int versionCode = pi.versionCode;
    boolean isSystem = (ApplicationInfo.FLAG_SYSTEM & ai.flags) != 0;
    return new AppInfo(packageName, name, icon, packagePath, versionName, versionCode, isSystem);
}
Util.java 文件源码 项目:AutoInteraction-Library 阅读 35 收藏 0 点赞 0 评论 0
/**
 * 获取布局的ID
 */
public static int getLayoutResId(Context context, String name) {
    ApplicationInfo appInfo = context.getApplicationInfo();
    int resID = context.getResources().getIdentifier(name, "layout", appInfo.packageName);
    return resID;
}
LabelLoader.java 文件源码 项目:prevent 阅读 41 收藏 0 点赞 0 评论 0
private void loadLabelIfNeeded(final ApplicationInfo info) {
    executor.submit(new Runnable() {
        @Override
        public void run() {
            String packageName = info.packageName;
            String label = StringUtils.trim(info.loadLabel(mPm)).toString();
            if (!label.equals(mSp.getString(packageName, packageName))) {
                mSp.edit().putString(packageName, label).apply();
            }
        }
    });
}
MonoPackageManager.java 文件源码 项目:XamarinForms-Encryption 阅读 107 收藏 0 点赞 0 评论 0
public static void LoadApplication (Context context, ApplicationInfo runtimePackage, String[] apks)
{
    synchronized (lock) {
        if (context instanceof android.app.Application) {
            Context = context;
        }
        if (!initialized) {
            android.content.IntentFilter timezoneChangedFilter  = new android.content.IntentFilter (
                    android.content.Intent.ACTION_TIMEZONE_CHANGED
            );
            context.registerReceiver (new mono.android.app.NotifyTimeZoneChanges (), timezoneChangedFilter);

            System.loadLibrary("monodroid");
            Locale locale       = Locale.getDefault ();
            String language     = locale.getLanguage () + "-" + locale.getCountry ();
            String filesDir     = context.getFilesDir ().getAbsolutePath ();
            String cacheDir     = context.getCacheDir ().getAbsolutePath ();
            String dataDir      = getNativeLibraryPath (context);
            ClassLoader loader  = context.getClassLoader ();

            Runtime.init (
                    language,
                    apks,
                    getNativeLibraryPath (runtimePackage),
                    new String[]{
                        filesDir,
                        cacheDir,
                        dataDir,
                    },
                    loader,
                    new java.io.File (
                        android.os.Environment.getExternalStorageDirectory (),
                        "Android/data/" + context.getPackageName () + "/files/.__override__").getAbsolutePath (),
                    MonoPackageManager_Resources.Assemblies,
                    context.getPackageName ());

            mono.android.app.ApplicationRegistration.registerApplications ();

            initialized = true;
        }
    }
}
CondomProcess.java 文件源码 项目:MiPushFramework 阅读 40 收藏 0 点赞 0 评论 0
/**
 * Install the condom protection for current process if its process name matches. This method should be called in {@link Application#onCreate()}.
 *
 * @param process_names list of processes where Condom process should NOT be installed, in the form exactly as defined
 *                      by <code>"android:process"</code> attribute of components in <code>AndroidManifest.xml</code>.
 *                      <b>BEWARE: Default process must be explicitly listed here if it is expected to be excluded.</b>
 */
public static void installExcept(final Application app, final CondomOptions options, final String... process_names) {
    if (process_names.length == 0) throw new IllegalArgumentException("At lease one process name must be specified");
    validateCondomOptions(options);
    final String current_process_name = getProcessName(app);
    if (current_process_name == null) return;
    for (final String process_name : process_names)
        if (! current_process_name.equals(getFullProcessName(app, process_name))) {
            install(app, current_process_name, options);
            return;
        }

    if ((app.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) validateProcessNames(app, process_names);
}


问题


面经


文章

微信
公众号

扫码关注公众号