Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6809c51f authored by Doug Zongker's avatar Doug Zongker
Browse files

make recovery UI images more general; allow for installation animation

Change some of the UI parameters (# of indeterminate progress bar
frames, fps, etc.) from #defined constants to variables that can be
set by the device-specific recovery_ui code (via a new function).

Support overlaying different images on top of the base installation
icon to animate it.  Make the FPS control more accurate.

Change-Id: I9268b389b7ea6b3ed9e0c7eae37baf4272e60edd
parent c007b961
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -107,4 +107,23 @@ typedef struct {
                              // (that much).
} Volume;

typedef struct {
    // number of frames in indeterminate progress bar animation
    int indeterminate_frames;

    // number of frames per second to try to maintain when animating
    int update_fps;

    // number of frames in installing animation.  may be zero for a
    // static installation icon.
    int installing_frames;

    // the install icon is animated by drawing images containing the
    // changing part over the base icon.  These specify the
    // coordinates of the upper-left corner.
    int install_overlay_offset_x;
    int install_overlay_offset_y;

} UIParameters;

#endif  // RECOVERY_COMMON_H
+3 −0
Original line number Diff line number Diff line
@@ -29,6 +29,9 @@ char* MENU_ITEMS[] = { "reboot system now",
                       "wipe cache partition",
                       NULL };

void device_ui_init(UIParameters* ui_parameters) {
}

int device_recovery_start() {
    return 0;
}
+2 −0
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ int res_create_surface(const char* name, gr_surface* pSurface) {
    png_structp png_ptr = NULL;
    png_infop info_ptr = NULL;

    *pSurface = NULL;

    snprintf(resPath, sizeof(resPath)-1, "/res/images/%s.png", name);
    resPath[sizeof(resPath)-1] = '\0';
    FILE* fp = fopen(resPath, "rb");
+3 −0
Original line number Diff line number Diff line
@@ -56,6 +56,8 @@ static const char *SDCARD_ROOT = "/sdcard";
static const char *TEMPORARY_LOG_FILE = "/tmp/recovery.log";
static const char *SIDELOAD_TEMP_DIR = "/tmp/sideload";

extern UIParameters ui_parameters;    // from ui.c

/*
 * The recovery tool communicates with the main system through /cache files.
 *   /cache/recovery/command - INPUT - command line for tool, one arg per line
@@ -688,6 +690,7 @@ main(int argc, char **argv) {
    freopen(TEMPORARY_LOG_FILE, "a", stderr); setbuf(stderr, NULL);
    printf("Starting recovery on %s", ctime(&start));

    device_ui_init(&ui_parameters);
    ui_init();
    ui_set_background(BACKGROUND_ICON_INSTALLING);
    load_volume_table();
+6 −0
Original line number Diff line number Diff line
@@ -17,6 +17,12 @@
#ifndef _RECOVERY_UI_H
#define _RECOVERY_UI_H

#include "common.h"

// Called before UI library is initialized.  Can change things like
// how many frames are included in various animations, etc.
extern void device_ui_init(UIParameters* ui_parameters);

// Called when recovery starts up.  Returns 0.
extern int device_recovery_start();

Loading