All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.virjar.android.hidden.helper.AndroidAppHelper Maven / Gradle / Ivy

The newest version!
package com.virjar.android.hidden.helper;


import android.app.ActivityThread;
import android.app.Application;
import android.app.LoadedApk;
import android.content.pm.ApplicationInfo;
import android.content.res.CompatibilityInfo;


/**
 * 代理ActivityThread
 */
public final class AndroidAppHelper {
    private AndroidAppHelper() {
    }

    public static String currentProcessName() {
        return ActivityThread.currentProcessName();
    }

    public static Application currentApplication() {
        return ActivityThread.currentApplication();
    }

    public static String currentPackageName() {
        return ActivityThread.currentPackageName();
    }

    public static LoadedApk getPackageInfoNoCheck(ApplicationInfo ai, CompatibilityInfo compatInfo) {
        return ActivityThread.currentActivityThread().getPackageInfoNoCheck(ai, compatInfo);
    }

    public static boolean isSystem() {
        return ActivityThread.isSystem();
    }

    public static ActivityThread currentActivityThread() {
        return ActivityThread.currentActivityThread();
    }


//    public ContextImpl getSystemContext() {
//        return ActivityThread.currentActivityThread().getSystemContext();
//    }
//
//
//    public static ApplicationInfo currentApplicationInfo() {
//        ActivityThread am = ActivityThread.currentActivityThread();
//        if (am == null)
//            return null;
//
//        Object boundApplication = getObjectField(am, "mBoundApplication");
//        if (boundApplication == null)
//            return null;
//
//        return (ApplicationInfo) getObjectField(boundApplication, "appInfo");
//    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy