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

Commit 700a52ac authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge changes 8935,8936

* changes:
  Fix the IOException in wallpaper restore -- the padding isn't required at the end.
  Fix bug 1982892 - batteryservice turns off device even while plugged in
parents e1c00aab 8d72569e
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -196,6 +196,7 @@ BackupDataReader::Status()
            } else { \
                m_status = errno; \
            } \
            LOGD("CHECK_SIZE failed with at line %d m_status='%s'", __LINE__, strerror(m_status)); \
            return m_status; \
        } \
    } while(0)
@@ -203,6 +204,7 @@ BackupDataReader::Status()
    do { \
        status_t err = skip_padding(); \
        if (err != NO_ERROR) { \
            LOGD("SKIP_PADDING FAILED at line %d", __LINE__); \
            m_status = err; \
            return err; \
        } \
@@ -218,10 +220,19 @@ BackupDataReader::ReadNextHeader(bool* done, int* type)

    int amt;

    // No error checking here, in case we're at the end of the stream.  Just let read() fail.
    skip_padding();
    amt = skip_padding();
    if (amt == EIO) {
        *done = true;
        return NO_ERROR;
    }
    else if (amt != NO_ERROR) {
        return amt;
    }
    amt = read(m_fd, &m_header, sizeof(m_header));
    *done = m_done = (amt == 0);
    if (*done) {
        return NO_ERROR;
    }
    CHECK_SIZE(amt, sizeof(m_header));
    m_pos += sizeof(m_header);
    if (type) {
+6 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;

import com.android.internal.app.ShutdownThread;


/**
@@ -183,6 +184,11 @@ class BatteryService extends Binder {
        boolean logOutlier = false;
        long dischargeDuration = 0;

        // shut down gracefully if our battery is critically low and we are not powered
        if (mBatteryLevel == 0 && isPowered(0xffffffff)) {
            ShutdownThread.shutdown(mContext, false);
        }
        
        mBatteryLevelCritical = mBatteryLevel <= CRITICAL_BATTERY_LEVEL;
        if (mAcOnline) {
            mPlugType = BatteryManager.BATTERY_PLUGGED_AC;