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

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

There is a newer version: 1.3
Show newest version
package com.virjar.android.hidden.helper;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInstaller;
import android.content.res.AssetManager;
import android.content.res.CompatibilityInfo;
import android.content.res.Resources;
import android.content.res.ResourcesImpl;
import android.os.Binder;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
import android.os.IBinder;
import android.os.UserHandle;
import android.system.ErrnoException;
import android.system.Int32Ref;
import android.system.Os;
import android.util.MutableInt;

import androidx.annotation.RequiresApi;

import java.io.File;
import java.io.FileDescriptor;

public class HiddenApiBridge {
    public static String ApplicationInfo_credentialProtectedDataDir(ApplicationInfo applicationInfo) {
        return applicationInfo.credentialProtectedDataDir;
    }

    public static void ApplicationInfo_credentialProtectedDataDir(ApplicationInfo applicationInfo, String dir) {
        applicationInfo.credentialProtectedDataDir = dir;
    }

    public static String[] ApplicationInfo_resourceDirs(ApplicationInfo applicationInfo) {
        return applicationInfo.resourceDirs;
    }

    public static void ApplicationInfo_resourceDirs(ApplicationInfo applicationInfo, String[] resourceDirs) {
        applicationInfo.resourceDirs = resourceDirs;
    }

    @RequiresApi(31)
    public static String[] ApplicationInfo_overlayPaths(ApplicationInfo applicationInfo) {
        return applicationInfo.overlayPaths;
    }

    @RequiresApi(31)
    public static void ApplicationInfo_overlayPaths(ApplicationInfo applicationInfo, String[] overlayPaths) {
        applicationInfo.overlayPaths = overlayPaths;
    }

    public static int AssetManager_addAssetPath(AssetManager am, String path) {
        return am.addAssetPath(path);
    }


    public static IBinder Binder_allowBlocking(IBinder binder) {
        return Binder.allowBlocking(binder);
    }


    public static IBinder Context_getActivityToken(Context ctx) {
        return ctx.getActivityToken();
    }

    public static Intent Context_registerReceiverAsUser(Context ctx, BroadcastReceiver receiver, UserHandle user,
                                                        IntentFilter filter, String broadcastPermission, Handler scheduler) {
        return ctx.registerReceiverAsUser(receiver, user, filter, broadcastPermission, scheduler);
    }

    public static File Environment_getDataProfilesDePackageDirectory(int userId, String packageName) {
        return Environment.getDataProfilesDePackageDirectory(userId, packageName);
    }

    public static int Os_ioctlInt(FileDescriptor fd, int cmd, int arg) throws ErrnoException {
        if (Build.VERSION.SDK_INT == Build.VERSION_CODES.O_MR1) {
            return Os.ioctlInt(fd, cmd, new MutableInt(arg));
        } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
            return Os.ioctlInt(fd, cmd, new Int32Ref(arg));
        } else {
            return Os.ioctlInt(fd, cmd);
        }
    }


    public static int PackageInstaller_SessionParams_installFlags(PackageInstaller.SessionParams params) {
        return params.installFlags;
    }

    public static void PackageInstaller_SessionParams_installFlags(PackageInstaller.SessionParams params, int flags) {
        params.installFlags = flags;
    }

    public static void Resources_setImpl(Resources resources, ResourcesImpl impl) {
        resources.setImpl(impl);
    }
    public static CompatibilityInfo Resources_getCompatibilityInfo(Resources res) {
        return res.getCompatibilityInfo();
    }


    public static UserHandle UserHandle_ALL() {
        return UserHandle.ALL;
    }

    public static UserHandle UserHandle(int h) {
        return new UserHandle(h);
    }





}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy