aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Zongker2011-10-28 17:13:10 -0500
committerDoug Zongker2011-10-31 16:15:02 -0500
commit211aebc4e09ce7ca37003be4f01c83111cf0bb49 (patch)
tree395aa8bc2d1d0412a52d42a3bb2d75a54f96685c /verifier.cpp
parent0890a0ce8ecc47afb1f892dcd770e8dc519add14 (diff)
downloadplatform-bootable-recovery-211aebc4e09ce7ca37003be4f01c83111cf0bb49.tar.gz
platform-bootable-recovery-211aebc4e09ce7ca37003be4f01c83111cf0bb49.tar.xz
platform-bootable-recovery-211aebc4e09ce7ca37003be4f01c83111cf0bb49.zip
refactor ui functions into a class
Move all the functions in ui.c to be members of a ScreenRecoveryUI class, which is a subclass of an abstract RecoveryUI class. Recovery then creates a global singleton instance of this class and then invoke the methods to drive the UI. We use this to allow substitution of a different RecoveryUI implementation for devices with radically different form factors (eg, that don't have a screen). Change-Id: I76bdd34eca506149f4cc07685df6a4890473f3d9
Diffstat (limited to 'verifier.cpp')
-rw-r--r--verifier.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/verifier.cpp b/verifier.cpp
index 58ca7239..1c5a41d1 100644
--- a/verifier.cpp
+++ b/verifier.cpp
@@ -25,6 +25,8 @@
25#include <stdio.h> 25#include <stdio.h>
26#include <errno.h> 26#include <errno.h>
27 27
28extern RecoveryUI* ui;
29
28// Look for an RSA signature embedded in the .ZIP file comment given 30// Look for an RSA signature embedded in the .ZIP file comment given
29// the path to the zip. Verify it matches one of the given public 31// the path to the zip. Verify it matches one of the given public
30// keys. 32// keys.
@@ -33,7 +35,7 @@
33// or no key matches the signature). 35// or no key matches the signature).
34 36
35int verify_file(const char* path, const RSAPublicKey *pKeys, unsigned int numKeys) { 37int verify_file(const char* path, const RSAPublicKey *pKeys, unsigned int numKeys) {
36 ui_set_progress(0.0); 38 ui->SetProgress(0.0);
37 39
38 FILE* f = fopen(path, "rb"); 40 FILE* f = fopen(path, "rb");
39 if (f == NULL) { 41 if (f == NULL) {
@@ -161,7 +163,7 @@ int verify_file(const char* path, const RSAPublicKey *pKeys, unsigned int numKey
161 so_far += size; 163 so_far += size;
162 double f = so_far / (double)signed_len; 164 double f = so_far / (double)signed_len;
163 if (f > frac + 0.02 || size == so_far) { 165 if (f > frac + 0.02 || size == so_far) {
164 ui_set_progress(f); 166 ui->SetProgress(f);
165 frac = f; 167 frac = f;
166 } 168 }
167 } 169 }