From 410d1d0b6ce80fdfb0be6a217557008b405f4b5d Mon Sep 17 00:00:00 2001 From: Matthew Date: Thu, 5 Sep 2024 19:06:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=85=A5=E5=AF=86?= =?UTF-8?q?=E9=92=A5=E7=9B=B8=E5=85=B3=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xypower/mpapp/BridgeProvider.java | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/xypower/mpapp/BridgeProvider.java b/app/src/main/java/com/xypower/mpapp/BridgeProvider.java index 90bfd72f..455c4177 100644 --- a/app/src/main/java/com/xypower/mpapp/BridgeProvider.java +++ b/app/src/main/java/com/xypower/mpapp/BridgeProvider.java @@ -73,7 +73,6 @@ public class BridgeProvider extends ContentProvider { matcher.addURI(AUTHORITY, PATH_QUERY_SEC_VERSION, 1); matcher.addURI(AUTHORITY, PATH_QUERY_BATTERY_VOLTAGE, 2); - Cursor cursor = null; int matched = matcher.match(uri); switch (matched) { @@ -131,7 +130,6 @@ public class BridgeProvider extends ContentProvider { } private Cursor querySecVersion() { - // String resultFile = intent.getStringExtra("resultFile"); String version = MicroPhotoService.querySecVersion(); String[] columns = { "version" }; MatrixCursor matrixCursor = new MatrixCursor(columns, 1); @@ -154,7 +152,7 @@ public class BridgeProvider extends ContentProvider { private int importPrivateKey(Uri uri, ContentValues values) { String cert = values.containsKey("cert") ? values.getAsString("cert") : null; String path = values.containsKey("path") ? values.getAsString("path") : null; - String resultFile = values.containsKey("resultFile") ? values.getAsString("path") : null; + String resultFile = values.containsKey("resultFile") ? values.getAsString("resultFile") : null; int index = values.containsKey("index") ? values.getAsInteger("index").intValue() : 0; boolean res = false; @@ -172,21 +170,18 @@ public class BridgeProvider extends ContentProvider { } } - return res ? 1 : 0; - /* - Log.i(TAG, "Import Private Key result=" + (res ? "1" : "0")); - if (!TextUtils.isEmpty(resultFile)) { FilesUtils.ensureParentDirectoryExisted(resultFile); FilesUtils.writeTextFile(resultFile, res ? "1" : "0"); } - */ + + return res ? 1 : 0; } private int importPublicKey(Uri uri, ContentValues values) { String cert = values.containsKey("cert") ? values.getAsString("cert") : null; String path = values.containsKey("path") ? values.getAsString("path") : null; - String resultFile = values.containsKey("resultFile") ? values.getAsString("path") : null; + String resultFile = values.containsKey("resultFile") ? values.getAsString("resultFile") : null; int index = values.containsKey("index") ? values.getAsInteger("index").intValue() : 0; boolean res = false; @@ -204,15 +199,12 @@ public class BridgeProvider extends ContentProvider { } } - return res ? 1 : 0; - /* - Log.i(TAG, "Import Private Key result=" + (res ? "1" : "0")); - if (!TextUtils.isEmpty(resultFile)) { FilesUtils.ensureParentDirectoryExisted(resultFile); FilesUtils.writeTextFile(resultFile, res ? "1" : "0"); } - */ + + return res ? 1 : 0; } private int genKeys(Uri uri, ContentValues values) {