Java Code Examples for de.robv.android.xposed.XposedHelpers#findConstructorExact()

The following examples show how to use de.robv.android.xposed.XposedHelpers#findConstructorExact() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XposedHelpersWraper.java    From MIUIAnesthetist with MIT License 5 votes vote down vote up
public static Constructor<?> findConstructorExact(Class<?> clazz, Object... parameterTypes) {
    try {
        return XposedHelpers.findConstructorExact(clazz, parameterTypes);
    } catch (Throwable t) {
        log(t);
    }
    return null;
}
 
Example 2
Source File: XposedHelpersWraper.java    From MIUIAnesthetist with MIT License 5 votes vote down vote up
public static Constructor<?> findConstructorExact(String className, ClassLoader classLoader, Object... parameterTypes) {
    try {
        return XposedHelpers.findConstructorExact(className, classLoader, parameterTypes);
    } catch (Throwable t) {
        log(t);
    }
    return null;
}
 
Example 3
Source File: XposedHelpersWraper.java    From MIUIAnesthetist with MIT License 5 votes vote down vote up
public static Constructor<?> findConstructorExact(Class<?> clazz, Class<?>... parameterTypes) {
    try {
        return XposedHelpers.findConstructorExact(clazz, parameterTypes);
    } catch (Throwable t) {
        log(t);
    }
    return null;
}
 
Example 4
Source File: AppLauncher.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public void startActivity(Context context, Intent intent, ActivityOptions opts) throws Exception {
    // if intent is a GB action of broadcast type, handle it directly here
    if (ShortcutActivity.isGbBroadcastShortcut(intent)) {
        boolean isLaunchBlocked = SysUiManagers.KeyguardMonitor.isShowing() &&
                    SysUiManagers.KeyguardMonitor.isLocked() &&
                    !ShortcutActivity.isActionSafe(intent.getStringExtra(
                            ShortcutActivity.EXTRA_ACTION));
        if (DEBUG) log("isLaunchBlocked: " + isLaunchBlocked);

        if (!isLaunchBlocked) {
            Intent newIntent = new Intent(intent.getStringExtra(ShortcutActivity.EXTRA_ACTION));
            newIntent.putExtras(intent);
            context.sendBroadcast(newIntent);
        }
    // otherwise start activity dismissing keyguard
    } else {
        if (SysUiManagers.KeyguardMonitor.isShowing() && mStatusBar != null) {
            try {
                XposedHelpers.callMethod(mStatusBar, "postStartActivityDismissingKeyguard", intent, 0);
            } catch (Throwable t) {
                XposedBridge.log(t);
            }
        } else {
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
            Constructor<?> uhConst = XposedHelpers.findConstructorExact(UserHandle.class, int.class);
            UserHandle uh = (UserHandle) uhConst.newInstance(-2);
            if (opts != null) {
                XposedHelpers.callMethod(context, "startActivityAsUser", intent, opts.toBundle(), uh);
            } else {
                XposedHelpers.callMethod(context, "startActivityAsUser", intent, uh);
            }
        }
    }
}
 
Example 5
Source File: QsTile.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
private Object createTileObject() throws Throwable {
    String hostTileClassName = getHostTileClassInfo(mContext.getClassLoader()).className;
    if (hostTileClassName.endsWith("AirplaneModeTile")) {
        Constructor<?> c = XposedHelpers.findConstructorExact(hostTileClassName,
                mContext.getClassLoader(), XposedHelpers.findClass(
                        "com.android.systemui.qs.QSTile.Host",
                            mContext.getClassLoader()));
        return c.newInstance(mHost);
    } else {
        return XposedHelpers.callStaticMethod(XposedHelpers.findClass(
                hostTileClassName, mContext.getClassLoader()),
                "create", mHost, "intent(dummy)");
    }
}
 
Example 6
Source File: Utils.java    From GravityBox with Apache License 2.0 4 votes vote down vote up
public static UserHandle getUserHandle(int userId) throws Exception {
    Constructor<?> uhConst = XposedHelpers.findConstructorExact(UserHandle.class, int.class);
    return (UserHandle) uhConst.newInstance(userId);
}