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

Commit 96146d11 authored by Yifan Hong's avatar Yifan Hong Committed by Automerger Merge Worker
Browse files

Merge "charger: fix charger display stuck" am: e026eff9

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1813694

Change-Id: I4db565498062a459f8df180a01d02588772c917d
parents 492e972c e026eff9
Loading
Loading
Loading
Loading
+8 −8
Original line number Original line Diff line number Diff line
@@ -46,14 +46,6 @@ static int get_split_offset() {


HealthdDraw::HealthdDraw(animation* anim)
HealthdDraw::HealthdDraw(animation* anim)
    : kSplitScreen(get_split_screen()), kSplitOffset(get_split_offset()) {
    : kSplitScreen(get_split_screen()), kSplitOffset(get_split_offset()) {
    int ret = gr_init();

    if (ret < 0) {
        LOGE("gr_init failed\n");
        graphics_available = false;
        return;
    }

    graphics_available = true;
    graphics_available = true;
    sys_font = gr_sys_font();
    sys_font = gr_sys_font();
    if (sys_font == nullptr) {
    if (sys_font == nullptr) {
@@ -235,3 +227,11 @@ void HealthdDraw::draw_unknown(GRSurface* surf_unknown) {
      LOGW("Charging, level unknown\n");
      LOGW("Charging, level unknown\n");
  }
  }
}
}

std::unique_ptr<HealthdDraw> HealthdDraw::Create(animation *anim) {
    if (gr_init() < 0) {
        LOGE("gr_init failed\n");
        return nullptr;
    }
    return std::unique_ptr<HealthdDraw>(new HealthdDraw(anim));
}
+6 −2
Original line number Original line Diff line number Diff line
@@ -26,8 +26,6 @@ using namespace android;


class HealthdDraw {
class HealthdDraw {
 public:
 public:
  // Configures font using given animation.
  HealthdDraw(animation* anim);
  virtual ~HealthdDraw();
  virtual ~HealthdDraw();


  // Redraws screen.
  // Redraws screen.
@@ -36,6 +34,8 @@ class HealthdDraw {
  // Blanks screen if true, unblanks if false.
  // Blanks screen if true, unblanks if false.
  virtual void blank_screen(bool blank);
  virtual void blank_screen(bool blank);


  static std::unique_ptr<HealthdDraw> Create(animation *anim);

 protected:
 protected:
  virtual void clear_screen();
  virtual void clear_screen();


@@ -76,6 +76,10 @@ class HealthdDraw {


  // true if minui init'ed OK, false if minui init failed
  // true if minui init'ed OK, false if minui init failed
  bool graphics_available;
  bool graphics_available;

 private:
  // Configures font using given animation.
  HealthdDraw(animation* anim);
};
};


#endif  // HEALTHD_DRAW_H
#endif  // HEALTHD_DRAW_H
+2 −5
Original line number Original line Diff line number Diff line
@@ -218,9 +218,7 @@ static void dump_last_kmsg(void) {
    char* ptr;
    char* ptr;
    size_t len;
    size_t len;


    LOGW("\n");
    LOGW("*************** LAST KMSG ***************\n");
    LOGW("*************** LAST KMSG ***************\n");
    LOGW("\n");
    const char* kmsg[] = {
    const char* kmsg[] = {
        // clang-format off
        // clang-format off
        "/sys/fs/pstore/console-ramoops-0",
        "/sys/fs/pstore/console-ramoops-0",
@@ -263,9 +261,7 @@ static void dump_last_kmsg(void) {
    }
    }


out:
out:
    LOGW("\n");
    LOGW("************* END LAST KMSG *************\n");
    LOGW("************* END LAST KMSG *************\n");
    LOGW("\n");
}
}


static int request_suspend(bool enable) {
static int request_suspend(bool enable) {
@@ -325,7 +321,8 @@ void Charger::UpdateScreenState(int64_t now) {
            }
            }
        }
        }


        healthd_draw_.reset(new HealthdDraw(&batt_anim_));
        healthd_draw_ = HealthdDraw::Create(&batt_anim_);
        if (healthd_draw_ == nullptr) return;


        if (android::sysprop::ChargerProperties::disable_init_blank().value_or(false)) {
        if (android::sysprop::ChargerProperties::disable_init_blank().value_or(false)) {
            healthd_draw_->blank_screen(true);
            healthd_draw_->blank_screen(true);