de.robv.android.xposed.XposedBridge Java Examples

The following examples show how to use de.robv.android.xposed.XposedBridge. 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: BuildPropEditor.java    From buildprop with Apache License 2.0 6 votes vote down vote up
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
    prefs = new XSharedPreferences(BuildPropEditor.class.getPackage().getName());
    prefs.makeWorldReadable();
    reloadPreferences();
    debug = prefs.getBoolean(Common.PREF_ENABLE_DEBUG, true);
    boolean enableViewServer = prefs.getBoolean(Common.PREF_ENABLE_VIEW_SERVER, false);
    roDebuggable = prefs.getString(Common.PREF_RO_DEBUGGABLE, "-1");
    enableDebugWebview = prefs.getBoolean(Common.PREF_ENABLE_DEBUG_WEBVIEW, true);

    roSecure = prefs.getString(Common.PREF_RO_SECURE, "-1");
    if (enableViewServer)
        roSecure = "0"; //关闭ro.secure才能开启viewServer

    XposedBridge.log("debug=" + debug + " enableViewServer=" + enableViewServer + " roDebuggable=" + roDebuggable + " roSecure=" + roSecure);
}
 
Example #2
Source File: XposedModule.java    From ForceDoze with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
    if (loadPackageParam.packageName.equals("android")) {
        prefs = new XSharedPreferences("com.suyashsrijan.forcedoze");
        usePermanentDoze = prefs.getBoolean("usePermanentDoze", false);
        useXposedSensorWorkaround = prefs.getBoolean("useXposedSensorWorkaround", false);
        serviceEnabled = prefs.getBoolean("serviceEnabled", false);
        XposedBridge.log("ForceDozeXposed: usePermanentDoze: " + usePermanentDoze + ", useXposedSensorWorkaround: " +
                useXposedSensorWorkaround + ", serviceEnabled: " + serviceEnabled);
        if (useXposedSensorWorkaround && serviceEnabled) {
            XposedBridge.log("ForceDozeXposed: Hooking DeviceIdleController");
            final Class DeviceIdleController = XposedHelpers.findClass("com.android.server.DeviceIdleController", loadPackageParam.classLoader);

            XposedHelpers.findAndHookMethod(DeviceIdleController, "startMonitoringMotionLocked", XC_MethodReplacement.DO_NOTHING);
            XposedHelpers.findAndHookMethod(DeviceIdleController, "stopMonitoringMotionLocked", XC_MethodReplacement.DO_NOTHING);
            XposedHelpers.findAndHookMethod(DeviceIdleController, "startMonitoringSignificantMotion", XC_MethodReplacement.DO_NOTHING);
            XposedHelpers.findAndHookMethod(DeviceIdleController, "stopMonitoringSignificantMotion", XC_MethodReplacement.DO_NOTHING);
            XposedHelpers.findAndHookMethod(DeviceIdleController, "motionLocked", XC_MethodReplacement.DO_NOTHING);

            XposedBridge.log("ForceDozeXposed: Hooked DeviceIdleController");
        }
    }
}
 
Example #3
Source File: GmsLocationHack.java    From AppOpsXposed with GNU General Public License v3.0 6 votes vote down vote up
private static void hookCtorForContextGrab(Class<?> clazz)
{
	XposedBridge.hookAllConstructors(clazz, new XC_MethodHook() {
		@Override
		protected void afterHookedMethod(MethodHookParam param) throws Throwable
		{
			for(Object arg : param.args)
			{
				if(arg instanceof Context)
				{
					XposedHelpers.setAdditionalInstanceField(param.thisObject, "context",
							new WeakReference<Context>((Context) arg));
					break;
				}
			}
		}

	});
}
 
Example #4
Source File: Log.java    From XQuickEnergy with Apache License 2.0 6 votes vote down vote up
public static void i(String tag, String s)
{
 StringBuilder sb = new StringBuilder(tag + ", " + s);
 try
 {
  for(int i = 0; i < sb.length(); i += 2000)
  {
   if(sb.length() < i + 2000)
    XposedBridge.log(sb.substring(i, sb.length()));
   else
    XposedBridge.log(sb.substring(i, i + 2000));
  }
 }catch(Throwable t)
 {
  // when hooking self, this XposedBridge.class will
  // not be found, ignore it.
  android.util.Log.i(tag, s);
 }
 FileUtils.append2RuntimeLogFile(sb.toString());
}
 
Example #5
Source File: MitmProvider.java    From pokemon-go-xposed-mitm with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Processes single package going from server to client
 * roData is created by allocate and had to have array
 *
 * @param roData Read-only buffer to be processed
 * @return ByteBuffer with new content if data was changed, null otherwise
 */
public static ByteBuffer processInboundPackage(ByteBuffer roData, int exchangeId, boolean connectionOk) {
    roData.rewind();

    if (BuildConfig.DEBUG) {
        XposedBridge.log("Processing inbound package of size " + Integer.toString(roData.remaining()));
    }

    try {
        //byte[] buffer = new byte[roData.remaining()];
        //roData.get(buffer);

        synchronized (sync) {
            // use all of this
            // buffer
            // exchangeId
            // connectionOk
        }
    } catch (Throwable e) {
        XposedBridge.log(e);
    }

    return null;
}
 
Example #6
Source File: Utils.java    From QNotified with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 仅仅为群发器而使用本模块的用户往往有两个鲜明的特征
 * 1.使用某个虚拟框架
 * 2.显而易见的昵称,见{@link #isBadNick(String)}
 * 仍然提供本模块的全部功能
 * 只是隐藏我的联系方式
 * 未必是完全正确的方法, but just do it.
 **/
private static boolean isExp() {
    try {
        Object pathList = iget_object_or_null(XposedBridge.class.getClassLoader(), "pathList");
        Object[] dexElements = (Object[]) iget_object_or_null(pathList, "dexElements");
        for (Object entry : dexElements) {
            DexFile dexFile = (DexFile) iget_object_or_null(entry, "dexFile");
            Enumeration<String> entries = dexFile.entries();
            while (entries.hasMoreElements()) {
                String className = entries.nextElement();
                if (className.matches(".+?(epic|weishu).+")) {
                    return true;
                }
            }
        }
    } catch (Throwable e) {
        if (!(e instanceof NullPointerException) &&
                !(e instanceof NoClassDefFoundError)) {
            log(e);
        }
    }
    return false;
}
 
Example #7
Source File: ModStatusbarColor.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
private static void updateSettingsButton() {
    if (mPhoneStatusBar == null || SysUiManagers.IconManager == null) return;
    try {
        Object header = XposedHelpers.getObjectField(mPhoneStatusBar, "mHeader");
        ImageView settingsButton = (ImageView) XposedHelpers.getObjectField(
                header, Utils.isSamsungRom() ? "mSettingButton" : "mSettingsButton");
        if (SysUiManagers.IconManager.isColoringEnabled()) {
            settingsButton.setColorFilter(SysUiManagers.IconManager.getIconColor(),
                    PorterDuff.Mode.SRC_IN);
        } else {
            settingsButton.clearColorFilter();
        }
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
Example #8
Source File: MainHook.java    From ZhihuXposed with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
    if (ZhihuConstant.PACKAGE_NAME.equals(loadPackageParam.packageName)) {
        // 反制Xposed检测
        hookXposedUtil(loadPackageParam);
        // 去除广告
        boolean disableFeedAdvert = PreferenceUtils.disableFeedAdvert(),
                disableMarketCard = PreferenceUtils.disableMarketCard();
        if (disableFeedAdvert || disableMarketCard) {
            hookFeedAdvert(loadPackageParam, disableFeedAdvert, disableMarketCard);
        }
        if (PreferenceUtils.disableAnswerPageAdvert()) {
            hookAnswerPageAdvert(loadPackageParam);
        }
        //开屏广告
        hookLaunchActivity(loadPackageParam);

        if (PreferenceUtils.openUrlInExternalBrowser()) {
            hookExternalBrowser(loadPackageParam);
        }

        XposedBridge.log("ZhihuXposed:inject into zhihu!");
    }
}
 
Example #9
Source File: ModLedControl.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
private static boolean notificationRecordHasLight(Object record) {
    boolean hasLight = false;
    if (record != null) {
        try {
            String key = (String) XposedHelpers.callMethod(record, "getKey");
            List<?> lights = (List<?>) XposedHelpers.getObjectField(
                    mNotifManagerService, "mLights");
            hasLight = lights.contains(key);
        } catch (Throwable t) {
            log("Error in notificationRecordHasLight: " + t.getMessage());
            if (DEBUG) XposedBridge.log(t);
        }
    }
    if (DEBUG) log("notificationRecordHasLight: " + hasLight);
    return hasLight;
}
 
Example #10
Source File: ModHwKeys.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
private static void changeExpandedDesktopState(Intent intent) {
    try {
        if (mExpandedDesktopMode == GravityBoxSettings.ED_DISABLED) {
            Utils.postToast(mContext, R.string.hwkey_action_expanded_desktop_disabled);
            return;
        }

        final ContentResolver resolver = mContext.getContentResolver();
        int state;
        if (intent.hasExtra(AShortcut.EXTRA_ENABLE)) {
            state = intent.getBooleanExtra(AShortcut.EXTRA_ENABLE, false) ? 1 : 0;
        } else {
            final int currentState = Settings.Global.getInt(resolver,
                    ModExpandedDesktop.SETTING_EXPANDED_DESKTOP_STATE, 0);
            state = currentState == 0 ? 1 : 0;
        }
        Settings.Global.putInt(resolver,
                ModExpandedDesktop.SETTING_EXPANDED_DESKTOP_STATE, state);
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
Example #11
Source File: CellularTile.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
private void createHooks() {
    try {
        mCreateTileViewHook = XposedHelpers.findAndHookMethod(
                mTile.getClass().getName(), mContext.getClassLoader(),
                "createTileView", Context.class, new XC_MethodHook() {
            @Override
            protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                if (mKey.equals(XposedHelpers.getAdditionalInstanceField(
                        param.thisObject, BaseTile.TILE_KEY_NAME))) {
                    onCreateTileView((View)param.getResult());
                }
            }
        });
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
Example #12
Source File: ModLedControl.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
private static Object getOldNotificationRecord(Object pkg, Object tag, Object id, Object userId) {
    Object oldNotifRecord = null;
    try {
        ArrayList<?> notifList = (ArrayList<?>) XposedHelpers.getObjectField(
                mNotifManagerService, "mNotificationList");
        synchronized (notifList) {
            int index = (Integer) XposedHelpers.callMethod(
                    mNotifManagerService, "indexOfNotificationLocked",
                    pkg, tag, id, userId);
            if (index >= 0) {
                oldNotifRecord = notifList.get(index);
            }
        }
    } catch (Throwable t) {
        log("Error in getOldNotificationRecord: " + t.getMessage());
        if (DEBUG) XposedBridge.log(t);
    }
    if (DEBUG) log("getOldNotificationRecord: has old record: " + (oldNotifRecord != null));
    return oldNotifRecord;
}
 
Example #13
Source File: RedClock.java    From AppTroy with Apache License 2.0 6 votes vote down vote up
public void hookDebug() {
    try {
        Method start = Process.class.getMethod("start", String.class, String.class,
                Integer.TYPE, Integer.TYPE, int[].class, Integer.TYPE, Integer.TYPE,
                Integer.TYPE, String.class, String[].class);

        XposedBridge.hookMethod(start, new XC_MethodHook() {
            @Override
            protected void beforeHookedMethod(MethodHookParam methodHookParam) throws Throwable {
                int id = 5;
                int flags = (Integer) methodHookParam.args[id];
                if ((flags & DEBUG_ENABLE_DEBUGGER) == 0) {
                    flags |= DEBUG_ENABLE_DEBUGGER;
                }
                methodHookParam.args[id] = flags;
                if (BuildConfig.DEBUG) {
                    XposedBridge.log("set debuggable flags to: " + flags);
                    Log.d("cc", "set it debuggable");
                }
            }
        });
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }
}
 
Example #14
Source File: ConnectivityServiceWrapper.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
private static void changeMobileDataState(Intent intent) {
    if (mTelephonyManager == null) return;
    try {
        boolean enabled;
        if (intent.hasExtra(AShortcut.EXTRA_ENABLE)) {
            enabled = intent.getBooleanExtra(AShortcut.EXTRA_ENABLE, false);
        } else {
            enabled = !(Boolean) XposedHelpers.callMethod(
                    mTelephonyManager, "getDataEnabled");
        }
        setMobileDataEnabled(enabled);
        if (intent.getBooleanExtra(AShortcut.EXTRA_SHOW_TOAST, false)) {
            Utils.postToast(mContext, enabled ? R.string.mobile_data_on :
                R.string.mobile_data_off);
        }
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
Example #15
Source File: MtkFixDevOptions.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
public static void init(final XSharedPreferences prefs, final ClassLoader classLoader) {
    try {
        final Class<?> classDevSettings = XposedHelpers.findClass(CLASS_DEV_SETTINGS, classLoader);

        if (DEBUG) log("hooking DeveloperSettings.onCreate method");
        XposedHelpers.findAndHookMethod(classDevSettings, "onCreate", Bundle.class, new XC_MethodHook() {
            @Override
            protected void beforeHookedMethod(final MethodHookParam param) throws Throwable {
                PreferenceFragment pf = (PreferenceFragment) param.thisObject;
                mResId = pf.getResources().getIdentifier("development_prefs", "xml", PACKAGE_NAME);
                if (DEBUG) log("mResId=" + mResId);
            }
        });
    }
    catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
Example #16
Source File: AppRulesUtils.java    From fuckView with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 删除一个 App 规则
 *
 * @param context  context
 * @param fileName 一个App一个文件, 使用包名
 * @return
 */
public static boolean delRule(Context context, String fileName) {
    File path = context.getDir(RULES_DIR, Context.MODE_PRIVATE);
    if (path == null) {
        return false;
    }
    File file = new File(path, fileName);
    if (!file.exists()) {
        return true;
    } else if (file.isFile()) {
        try {
            return file.delete();
        } catch (Exception e) {
            XposedBridge.log(e);
        }
    }
    return false;
}
 
Example #17
Source File: AppRulesUtils.java    From fuckView with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 修改文件权限
 * setFilePermissions(file, 0777, -1, -1);
 *
 * @param file
 * @param chmod
 * @param uid
 * @param gid
 * @return
 */
public static boolean setFilePermissions(File file, int chmod, int uid, int gid) {
    if (file != null) {
        Class<?> fileUtils;
        try {
            fileUtils = Class.forName("android.os.FileUtils");
            Method setPermissions = fileUtils.getMethod("setPermissions", File.class, int.class, int.class, int.class);
            int result = (Integer) setPermissions.invoke(null, file, chmod, uid, gid);

            return result == 0;
        } catch (Exception e) {
            XposedBridge.log(e);
        }

        return false;
    } else {
        return false;
    }
}
 
Example #18
Source File: PhoneWrapper.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
public static boolean hasMsimSupport() {
    if (mHasMsimSupport != null) return mHasMsimSupport;

    try {
        Object mtm = XposedHelpers.callStaticMethod(getTelephonyManagerClass(), "getDefault");
        mHasMsimSupport = (Boolean) XposedHelpers.callMethod(mtm, "isMultiSimEnabled") &&
                getPhoneCount() > 1;
        if (DEBUG) log("isMultiSimEnabled: " +
                (Boolean) XposedHelpers.callMethod(mtm, "isMultiSimEnabled"));
        if (DEBUG) log("getPhoneCount: " + getPhoneCount());
    } catch (Throwable t) {
        if (DEBUG) XposedBridge.log(t);
        mHasMsimSupport = false;
    }

    if (DEBUG) log("hasMsimSupport: " + mHasMsimSupport);
    return mHasMsimSupport;
}
 
Example #19
Source File: ModSettings.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
public static void initPackageResources(final XSharedPreferences prefs, final InitPackageResourcesParam resparam) {
    try {
        XModuleResources modRes = XModuleResources.createInstance(GravityBox.MODULE_PATH, resparam.res);
        resparam.res.setReplacement(PACKAGE_NAME, "array", "window_animation_scale_entries",
                modRes.fwd(R.array.window_animation_scale_entries));
        resparam.res.setReplacement(PACKAGE_NAME, "array", "window_animation_scale_values",
                modRes.fwd(R.array.window_animation_scale_values));
        resparam.res.setReplacement(PACKAGE_NAME, "array", "transition_animation_scale_entries",
                modRes.fwd(R.array.transition_animation_scale_entries));
        resparam.res.setReplacement(PACKAGE_NAME, "array", "transition_animation_scale_values",
                modRes.fwd(R.array.transition_animation_scale_values));
        resparam.res.setReplacement(PACKAGE_NAME, "array", "animator_duration_scale_entries",
                modRes.fwd(R.array.animator_duration_scale_entries));
        resparam.res.setReplacement(PACKAGE_NAME, "array", "animator_duration_scale_values",
                modRes.fwd(R.array.animator_duration_scale_values));
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
Example #20
Source File: MainActivity.java    From JavaHooker with The Unlicense 6 votes vote down vote up
@Override
protected void onCreate(final Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	
	System.loadLibrary("javahooker");
	System.loadLibrary("sbxa");
	for (final Member method : Activity.class.getDeclaredMethods()) {
		if (!Modifier.isPublic(method.getModifiers())) continue;
		if (method.getName().startsWith("on")) continue;
		
		XposedBridge.hookMethod(method, new XC_MethodHook() {
			@Override
			protected void beforeHookedMethod(final MethodHookParam param) {
				XposedBridge.log(param.method.getName());
			}
		});
	}
}
 
Example #21
Source File: ModHwKeys.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
public static void injectKey(final int keyCode) {
    Handler handler = (Handler) XposedHelpers.getObjectField(mPhoneWindowManager, "mHandler");
    if (handler == null) return;

    handler.post(new Runnable() {
        @Override
        public void run() {
            try {
                final long eventTime = SystemClock.uptimeMillis();
                final InputManager inputManager = (InputManager)
                        mContext.getSystemService(Context.INPUT_SERVICE);
                int flags = KeyEvent.FLAG_FROM_SYSTEM;
                XposedHelpers.callMethod(inputManager, "injectInputEvent",
                        new KeyEvent(eventTime - 50, eventTime - 50, KeyEvent.ACTION_DOWN,
                                keyCode, 0, 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, flags,
                                InputDevice.SOURCE_UNKNOWN), 0);
                XposedHelpers.callMethod(inputManager, "injectInputEvent",
                        new KeyEvent(eventTime - 50, eventTime - 25, KeyEvent.ACTION_UP,
                                keyCode, 0, 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, flags,
                                InputDevice.SOURCE_UNKNOWN), 0);
            } catch (Throwable t) {
                XposedBridge.log(t);
            }
        }
    });
}
 
Example #22
Source File: ModLockscreen.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
private static Drawable tryGetStockPhoneIcon(Drawable def) {
    try {
        int resId = mContext.getResources().getIdentifier(
                "ic_phone_24dp", "drawable", PACKAGE_NAME);
        return (resId == 0 ? def : mContext.getDrawable(resId));
    } catch (Throwable t) {
        XposedBridge.log(t);
        return def;
    }
}
 
Example #23
Source File: ModStatusBar.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
private static void prepareGestureDetector() {
    try {
        mGestureDetector = new GestureDetector(mContext,
                new GestureDetector.SimpleOnGestureListener() {
                    @Override
                    public boolean onDoubleTap(MotionEvent e) {
                        Intent intent = new Intent(ModHwKeys.ACTION_SLEEP);
                        mContext.sendBroadcast(intent);
                        return true;
                    }
                });
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
Example #24
Source File: LogHooks.java    From BadIntent with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void hookLogs(){
    XposedBridge.hookAllMethods(Log.class, "d", new XposedAndroidLogMethodHook("debug"));
    XposedBridge.hookAllMethods(Log.class, "v", new XposedAndroidLogMethodHook("verbose"));
    XposedBridge.hookAllMethods(Log.class, "i", new XposedAndroidLogMethodHook("info"));
    XposedBridge.hookAllMethods(Log.class, "w", new XposedAndroidLogMethodHook("warning"));
    XposedBridge.hookAllMethods(Log.class, "e", new XposedAndroidLogMethodHook("exception"));
    XposedBridge.hookAllMethods(Log.class, "wtf", new XposedAndroidLogMethodHook("wtf"));
}
 
Example #25
Source File: CommonHook.java    From WechatHook-Dusan with Apache License 2.0 5 votes vote down vote up
public static void hook_method(Class<?> clazz, String methodName, Object... parameterTypesAndCallback) {
    try {
        findAndHookMethod(clazz, methodName, parameterTypesAndCallback);
    } catch (Exception e) {
        XposedBridge.log(e);
    }
}
 
Example #26
Source File: CommonHook.java    From WechatHook-Dusan with Apache License 2.0 5 votes vote down vote up
public static void hook_method(String className, ClassLoader classLoader, String methodName,
                               Object... parameterTypesAndCallback) {
    try {
        findAndHookMethod(className, classLoader, methodName, parameterTypesAndCallback);
    } catch (Exception e) {
        XposedBridge.log(e);
    }
}
 
Example #27
Source File: CommonHook.java    From WechatHook-Dusan with Apache License 2.0 5 votes vote down vote up
public static void hook_methods(String className, String methodName, XC_MethodHook xmh) {
    try {
        Class<?> clazz = Class.forName(className);

        for (Method method : clazz.getDeclaredMethods())
            if (method.getName().equals(methodName)
                    && !Modifier.isAbstract(method.getModifiers())
                    && Modifier.isPublic(method.getModifiers())) {
                XposedBridge.hookMethod(method, xmh);
            }
    } catch (Exception e) {
        XposedBridge.log(e);
    }
}
 
Example #28
Source File: ModTrustManager.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
private static void onWifiConnectivityChanged() {
    try {
        NetworkInfo nwInfo = mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
        boolean connectedChanged = mWifiConnected != nwInfo.isConnected();
        mWifiConnected = nwInfo.isConnected();
        if (DEBUG) log("onWifiConnectivityChanged: connected=" + mWifiConnected);
        if ((mWifiTrusted.size() > 0 || mForceRefreshAgentList) && connectedChanged) {
            updateTrustAll();
        }
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
Example #29
Source File: FakeSignatures.java    From FakeGApps with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initZygote(StartupParam startupParam) throws Throwable {

    final Class<?> PackageParser = XposedHelpers.findClass("android.content.pm.PackageParser", null);
    XposedBridge.hookAllMethods(PackageParser, "generatePackageInfo", new XC_MethodHook() {
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            PackageInfo pi = (PackageInfo) param.getResult();
            if (pi != null) {
                String packageName = pi.packageName;
                if (packageName.contains("com.google.android.gms") || packageName.contains("com.android.vending")) {

                    try {
                        PackageNameServiceManager manager = PackageNameServiceManager.getService();
                        String callerPackageName = manager.getPackageName(Binder.getCallingUid());

                        XposedBridge.log("FakeGApps: returning fake signature to " + callerPackageName);
                    } catch (NullPointerException e) {
                        XposedBridge.log("FakeGApps: caught the NullPointerException");
                    }

                    String sig = "308204433082032ba003020102020900c2e08746644a308d300d06092a864886f70d01010405003074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f6964301e170d3038303832313233313333345a170d3336303130373233313333345a3074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f696430820120300d06092a864886f70d01010105000382010d00308201080282010100ab562e00d83ba208ae0a966f124e29da11f2ab56d08f58e2cca91303e9b754d372f640a71b1dcb130967624e4656a7776a92193db2e5bfb724a91e77188b0e6a47a43b33d9609b77183145ccdf7b2e586674c9e1565b1f4c6a5955bff251a63dabf9c55c27222252e875e4f8154a645f897168c0b1bfc612eabf785769bb34aa7984dc7e2ea2764cae8307d8c17154d7ee5f64a51a44a602c249054157dc02cd5f5c0e55fbef8519fbe327f0b1511692c5a06f19d18385f5c4dbc2d6b93f68cc2979c70e18ab93866b3bd5db8999552a0e3b4c99df58fb918bedc182ba35e003c1b4b10dd244a8ee24fffd333872ab5221985edab0fc0d0b145b6aa192858e79020103a381d93081d6301d0603551d0e04160414c77d8cc2211756259a7fd382df6be398e4d786a53081a60603551d2304819e30819b8014c77d8cc2211756259a7fd382df6be398e4d786a5a178a4763074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f6964820900c2e08746644a308d300c0603551d13040530030101ff300d06092a864886f70d010104050003820101006dd252ceef85302c360aaace939bcff2cca904bb5d7a1661f8ae46b2994204d0ff4a68c7ed1a531ec4595a623ce60763b167297a7ae35712c407f208f0cb109429124d7b106219c084ca3eb3f9ad5fb871ef92269a8be28bf16d44c8d9a08e6cb2f005bb3fe2cb96447e868e731076ad45b33f6009ea19c161e62641aa99271dfd5228c5c587875ddb7f452758d661f6cc0cccb7352e424cc4365c523532f7325137593c4ae341f4db41edda0d0b1071a7c440f0fe9ea01cb627ca674369d084bd2fd911ff06cdbf2cfa10dc0f893ae35762919048c7efc64c7144178342f70581c9de573af55b390dd7fdb9418631895d5f759f30112687ff621410c069308a";
                    
                    Signature[] signatures = new Signature[]{new Signature(sig)};
                    pi.signatures = signatures;
                    param.setResult(pi);
                }
            }
        }
    });
}
 
Example #30
Source File: BaseTile.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public void collapsePanels() {
    try {
        XposedHelpers.callMethod(mHost, "collapsePanels");
    } catch (Throwable t) {
        log("Error in collapsePanels: ");
        XposedBridge.log(t);
    }
}