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

Commit 8466e76f authored by Kun Liang's avatar Kun Liang
Browse files

QuickBoot: add execption restore mechanism

There may be some exceptions like battery unplugged When device
is put into QuickBoot mode. Then device will be in airplane
mode after next boot. We don't want such kind of things happen.
So start restore task to check if need restore before main
screen shows.

Change-Id: I3d0967c2f446fd71eca87ff085617edca549c984
parent 9aafd361
Loading
Loading
Loading
Loading
+15 −0
Original line number Original line Diff line number Diff line
@@ -51,6 +51,7 @@ import android.app.IActivityManager;
import android.app.StatusBarManager;
import android.app.StatusBarManager;
import android.app.admin.DevicePolicyManager;
import android.app.admin.DevicePolicyManager;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
@@ -87,6 +88,7 @@ import android.os.StrictMode;
import android.os.SystemClock;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.SystemProperties;
import android.os.Trace;
import android.os.Trace;
import android.os.UserHandle;
import android.os.WorkSource;
import android.os.WorkSource;
import android.provider.Settings;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.util.DisplayMetrics;
@@ -5380,12 +5382,25 @@ public class WindowManagerService extends IWindowManager.Stub
            mInputMonitor.setEventDispatchingLw(mEventDispatchingEnabled);
            mInputMonitor.setEventDispatchingLw(mEventDispatchingEnabled);
        }
        }


        // start QuickBoot to check if need restore from exception
        if (SystemProperties.getBoolean("persist.sys.quickboot_ongoing", false))
            checkQuickBootException();

        mPolicy.enableScreenAfterBoot();
        mPolicy.enableScreenAfterBoot();


        // Make sure the last requested orientation has been applied.
        // Make sure the last requested orientation has been applied.
        updateRotationUnchecked(false, false);
        updateRotationUnchecked(false, false);
    }
    }


    private void checkQuickBootException() {
        Intent intent = new Intent("qualcomm.intent.action.QUICKBOOT");
        intent.putExtra("mode", 2);
        try {
            mContext.startActivityAsUser(intent,UserHandle.CURRENT);
        } catch (ActivityNotFoundException e) {
        }
    }

    public void showBootMessage(final CharSequence msg, final boolean always) {
    public void showBootMessage(final CharSequence msg, final boolean always) {
        boolean first = false;
        boolean first = false;
        synchronized(mWindowMap) {
        synchronized(mWindowMap) {