修复导入密钥相关的bug

nx2024TEMP
Matthew 10 months ago
parent 4875fcc8fd
commit 410d1d0b6c

@ -73,7 +73,6 @@ public class BridgeProvider extends ContentProvider {
matcher.addURI(AUTHORITY, PATH_QUERY_SEC_VERSION, 1); matcher.addURI(AUTHORITY, PATH_QUERY_SEC_VERSION, 1);
matcher.addURI(AUTHORITY, PATH_QUERY_BATTERY_VOLTAGE, 2); matcher.addURI(AUTHORITY, PATH_QUERY_BATTERY_VOLTAGE, 2);
Cursor cursor = null; Cursor cursor = null;
int matched = matcher.match(uri); int matched = matcher.match(uri);
switch (matched) { switch (matched) {
@ -131,7 +130,6 @@ public class BridgeProvider extends ContentProvider {
} }
private Cursor querySecVersion() { private Cursor querySecVersion() {
// String resultFile = intent.getStringExtra("resultFile");
String version = MicroPhotoService.querySecVersion(); String version = MicroPhotoService.querySecVersion();
String[] columns = { "version" }; String[] columns = { "version" };
MatrixCursor matrixCursor = new MatrixCursor(columns, 1); MatrixCursor matrixCursor = new MatrixCursor(columns, 1);
@ -154,7 +152,7 @@ public class BridgeProvider extends ContentProvider {
private int importPrivateKey(Uri uri, ContentValues values) { private int importPrivateKey(Uri uri, ContentValues values) {
String cert = values.containsKey("cert") ? values.getAsString("cert") : null; String cert = values.containsKey("cert") ? values.getAsString("cert") : null;
String path = values.containsKey("path") ? values.getAsString("path") : 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; int index = values.containsKey("index") ? values.getAsInteger("index").intValue() : 0;
boolean res = false; 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)) { if (!TextUtils.isEmpty(resultFile)) {
FilesUtils.ensureParentDirectoryExisted(resultFile); FilesUtils.ensureParentDirectoryExisted(resultFile);
FilesUtils.writeTextFile(resultFile, res ? "1" : "0"); FilesUtils.writeTextFile(resultFile, res ? "1" : "0");
} }
*/
return res ? 1 : 0;
} }
private int importPublicKey(Uri uri, ContentValues values) { private int importPublicKey(Uri uri, ContentValues values) {
String cert = values.containsKey("cert") ? values.getAsString("cert") : null; String cert = values.containsKey("cert") ? values.getAsString("cert") : null;
String path = values.containsKey("path") ? values.getAsString("path") : 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; int index = values.containsKey("index") ? values.getAsInteger("index").intValue() : 0;
boolean res = false; 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)) { if (!TextUtils.isEmpty(resultFile)) {
FilesUtils.ensureParentDirectoryExisted(resultFile); FilesUtils.ensureParentDirectoryExisted(resultFile);
FilesUtils.writeTextFile(resultFile, res ? "1" : "0"); FilesUtils.writeTextFile(resultFile, res ? "1" : "0");
} }
*/
return res ? 1 : 0;
} }
private int genKeys(Uri uri, ContentValues values) { private int genKeys(Uri uri, ContentValues values) {

Loading…
Cancel
Save