diff options
author | Brian Carlstrom <bdc@google.com> | 2011-07-06 17:12:06 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2011-07-06 17:12:06 -0700 |
commit | a921a7f6b86e2564f70e841c0b10b368f6b8d495 (patch) | |
tree | 2eed24482a47a7d8b24dabf4a1cff7e96f926264 | |
parent | 00736f76392c742e9c72c51f158ad7020f22524c (diff) | |
download | android_packages_apps_CertInstaller-a921a7f6b86e2564f70e841c0b10b368f6b8d495.tar.gz android_packages_apps_CertInstaller-a921a7f6b86e2564f70e841c0b10b368f6b8d495.tar.bz2 android_packages_apps_CertInstaller-a921a7f6b86e2564f70e841c0b10b368f6b8d495.zip |
Canceling cert installation should not delete the file
Also fix to exit CertFileList when list becomes empty
Bug: 4600283
Change-Id: Ib0a27f8d2f9ee4be8da02625e9f919bcfa6e791b
-rw-r--r-- | src/com/android/certinstaller/CertFile.java | 12 | ||||
-rw-r--r-- | src/com/android/certinstaller/CertFileList.java | 2 | ||||
-rw-r--r-- | src/com/android/certinstaller/CertInstaller.java | 2 |
3 files changed, 11 insertions, 5 deletions
diff --git a/src/com/android/certinstaller/CertFile.java b/src/com/android/certinstaller/CertFile.java index 7d89591..5c75517 100644 --- a/src/com/android/certinstaller/CertFile.java +++ b/src/com/android/certinstaller/CertFile.java @@ -70,7 +70,7 @@ public class CertFile extends PreferenceActivity implements FileFilter { protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_INSTALL_CODE) { boolean success = (resultCode == RESULT_OK - && mCertFile == null || Util.deleteFile(mCertFile)); + && (mCertFile == null || Util.deleteFile(mCertFile))); onInstallationDone(success); mCertFile = null; } else { @@ -108,11 +108,15 @@ public class CertFile extends PreferenceActivity implements FileFilter { File download = new File(root, DOWNLOAD_DIR); if (download != null) { File[] files = download.listFiles(this); - if (files != null) Collections.addAll(allFiles, files); + if (files != null) { + Collections.addAll(allFiles, files); + } } File[] files = root.listFiles(this); - if (files != null) Collections.addAll(allFiles, files); + if (files != null) { + Collections.addAll(allFiles, files); + } return allFiles; } @@ -147,7 +151,7 @@ public class CertFile extends PreferenceActivity implements FileFilter { } } - public boolean accept(File file) { + @Override public boolean accept(File file) { if (!file.isDirectory()) { return isFileAcceptable(file.getPath()); } else { diff --git a/src/com/android/certinstaller/CertFileList.java b/src/com/android/certinstaller/CertFileList.java index 9c43ec1..5e2b681 100644 --- a/src/com/android/certinstaller/CertFileList.java +++ b/src/com/android/certinstaller/CertFileList.java @@ -115,6 +115,8 @@ public class CertFileList extends CertFile if (allFiles.isEmpty()) { Toast.makeText(this, R.string.no_cert_file_found, Toast.LENGTH_SHORT).show(); + finish(); + return; } else { int prefixEnd = Environment.getExternalStorageDirectory() .getCanonicalPath().length() + 1; diff --git a/src/com/android/certinstaller/CertInstaller.java b/src/com/android/certinstaller/CertInstaller.java index e07fc96..7eedc4a 100644 --- a/src/com/android/certinstaller/CertInstaller.java +++ b/src/com/android/certinstaller/CertInstaller.java @@ -79,7 +79,7 @@ public class CertInstaller extends Activity private CredentialHelper createCredentialHelper(Intent intent) { try { - return new CredentialHelper(getIntent()); + return new CredentialHelper(intent); } catch (Throwable t) { Log.w(TAG, "createCredentialHelper", t); toastErrorAndFinish(R.string.invalid_cert); |