2

我目前正在开发一个应用程序(API 级别 23),它允许用户选择启用复制和粘贴功能的应用程序。我正在与 Xposed 合作。

我目前有 2 个文件。MainActivity.java 和 Main.java 和我的代码没有错误,但由于某些原因不起作用。经过大量研究,我选择修改 SetPrimaryClip 和 GetPrimaryClip 的行为如下:

修改 Main.java 中的 SetPrimaryClip:

if (isBlackListed())
{
    //if app checked

    //TO DO: Add block copy and paste functionality for UI

    //Here the context is passing
    ClipboardManager clipBoard = (ClipboardManager) c.getSystemService(Context.CLIPBOARD_SERVICE);
    ClipData data = ClipData.newPlainText("", "");
    clipBoard.setPrimaryClip(data);


    Toast.makeText(c, "Hack Enabled for copy func", Toast.LENGTH_SHORT).show();

    //debug hack enabled
    XposedBridge.log(" hack enabled for copy func");
    XposedBridge.log(packName);
    log_call(", hack enabled for copy func");


} else {
    //if app not checked
    Toast.makeText(c, "Hack disabled for copy func", Toast.LENGTH_SHORT).show();

    //debug hack disabled
    XposedBridge.log(" hack disabled for copy func");
    XposedBridge.log(packName);
    log_call(", hack disabled for copy func");

}

修改 Main.java 中的 GetPrimaryClip:

if (isBlackListed())
{
    ClipboardManager clipBoard = (ClipboardManager) c.getSystemService(Context.CLIPBOARD_SERVICE);


    ClipData cp = clipBoard.getPrimaryClip();
    ClipData.Item item = cp.getItemAt(0);
    String text = item.getText().toString(); text=null;


    //if app not checked
    Toast.makeText(c, "Hack enabled for paste func", Toast.LENGTH_SHORT).show();

    //debug hack disabled
    XposedBridge.log("hack enabled for paste func");
    XposedBridge.log(packName);
    log_call(", hack enabled for paste func");


    param.setResult(null);

} else {



    //if app not checked
    Toast.makeText(c, "Hack disabled for paste func", Toast.LENGTH_SHORT).show();

    //debug hack disabled
    XposedBridge.log("hack disabled for paste func");
    XposedBridge.log(packName);
    log_call(", hack disabled for paste func");


}

请注意,我根本没有任何编译错误。我在这里使用了错误的方法吗?

4

0 回答 0