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

Commit 5eea3d38 authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Merge 48f0129a on remote branch

Change-Id: I717b2f178b73bc92ec948f590d207a33e02a7652
parents 74b2320d 48f0129a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -93,6 +93,12 @@ public class AlarmManager
     * wakes up.
     */
    public static final int ELAPSED_REALTIME = 3;
    /** @hide
     * Alarm time in {@link System#currentTimeMillis System.currentTimeMillis()}
     * (wall clock time in UTC), which will wake up the device when
     * it goes off. And it will power on the devices when it shuts down.
     */
    public static final int RTC_POWEROFF_WAKEUP = 4;

    /** @hide */
    public static final long WINDOW_EXACT = 0;
+10 −3
Original line number Diff line number Diff line
@@ -484,7 +484,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    private static final int MSG_DISABLE_POINTER_LOCATION = 2;
    private static final int MSG_DISPATCH_MEDIA_KEY_WITH_WAKE_LOCK = 3;
    private static final int MSG_DISPATCH_MEDIA_KEY_REPEAT_WITH_WAKE_LOCK = 4;
    boolean mWifiDisplayConnected;
    boolean mWifiDisplayConnected = false;
    int     mWifiDisplayUIBCRotation = -1;

    private class PolicyHandler extends Handler {
        @Override
@@ -4357,6 +4358,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                } else {
                    mWifiDisplayConnected = false;
                }
                mWifiDisplayUIBCRotation =
                        intent.getIntExtra("wfd_UIBC_rot", -1);
                updateRotation(true);
            }
        }
@@ -4576,10 +4579,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                // enable 180 degree rotation while docked.
                preferredRotation = mDeskDockEnablesAccelerometer
                        ? sensorRotation : mDeskDockRotation;
            } else if ((mHdmiPlugged || mWifiDisplayConnected) && mDemoHdmiRotationLock) {
            } else if ((mHdmiPlugged || mWifiDisplayConnected) &&
                    mDemoHdmiRotationLock) {
                // Ignore sensor when plugged into HDMI when demo HDMI rotation lock enabled.
                // Note that the dock orientation overrides the HDMI orientation.
                // Note that the dock orientation overrides the HDMI orientation
                preferredRotation = mDemoHdmiRotation;
            } else if ( mWifiDisplayConnected && (mWifiDisplayUIBCRotation > -1)) {
                // Ignore sensor when WFD is active and UIBC rotation is enabled
                preferredRotation = mWifiDisplayUIBCRotation;
            } else if (mHdmiPlugged && mDockMode == Intent.EXTRA_DOCK_STATE_UNDOCKED
                    && mUndockedHdmiRotation >= 0) {
                // Ignore sensor when plugged into HDMI and an undocked orientation has
+65 −5
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ import static android.app.AlarmManager.RTC_WAKEUP;
import static android.app.AlarmManager.RTC;
import static android.app.AlarmManager.ELAPSED_REALTIME_WAKEUP;
import static android.app.AlarmManager.ELAPSED_REALTIME;
import static android.app.AlarmManager.RTC_POWEROFF_WAKEUP;

import com.android.internal.util.LocalLog;

@@ -75,6 +76,7 @@ class AlarmManagerService extends IAlarmManager.Stub {
    private static final int RTC_MASK = 1 << RTC;
    private static final int ELAPSED_REALTIME_WAKEUP_MASK = 1 << ELAPSED_REALTIME_WAKEUP; 
    private static final int ELAPSED_REALTIME_MASK = 1 << ELAPSED_REALTIME;
    private static final int RTC_POWEROFF_WAKEUP_MASK = 1 << RTC_POWEROFF_WAKEUP;
    private static final int TIME_CHANGED_MASK = 1 << 16;
    private static final int IS_WAKEUP_MASK = RTC_WAKEUP_MASK|ELAPSED_REALTIME_WAKEUP_MASK;

@@ -106,6 +108,7 @@ class AlarmManagerService extends IAlarmManager.Stub {

    private int mDescriptor;
    private long mNextWakeup;
    private long mNextRtcWakeup;
    private long mNextNonWakeup;
    private int mBroadcastRefCount = 0;
    private PowerManager.WakeLock mWakeLock;
@@ -159,6 +162,15 @@ class AlarmManagerService extends IAlarmManager.Stub {
            return alarms.get(index);
        }

        long getWhenByElapsedTime(long whenElapsed) {
            for(int i=0;i< alarms.size();i++) {
                if(alarms.get(i).whenElapsed == whenElapsed)
                    return alarms.get(i).when;
            }

            return 0;
        }

        boolean canHold(long whenElapsed, long maxWhen) {
            return (end >= whenElapsed) && (start <= maxWhen);
        }
@@ -292,6 +304,18 @@ class AlarmManagerService extends IAlarmManager.Stub {
            return false;
        }

        boolean isRtcPowerOffWakeup() {
            final int N = alarms.size();
            for (int i = 0; i < N; i++) {
                Alarm a = alarms.get(i);
                // non-wakeup alarms are types 1 and 3, i.e. have the low bit set
                if (a.type == RTC_POWEROFF_WAKEUP) {
                    return true;
                }
            }
            return false;
        }

        @Override
        public String toString() {
            StringBuilder b = new StringBuilder(40);
@@ -327,7 +351,7 @@ class AlarmManagerService extends IAlarmManager.Stub {
    private final ArrayList<Batch> mAlarmBatches = new ArrayList<Batch>();

    static long convertToElapsed(long when, int type) {
        final boolean isRtc = (type == RTC || type == RTC_WAKEUP);
        final boolean isRtc = (type == RTC || type == RTC_WAKEUP || type == RTC_POWEROFF_WAKEUP);
        if (isRtc) {
            when -= System.currentTimeMillis() - SystemClock.elapsedRealtime();
        }
@@ -470,7 +494,7 @@ class AlarmManagerService extends IAlarmManager.Stub {
    public AlarmManagerService(Context context) {
        mContext = context;
        mDescriptor = init();
        mNextWakeup = mNextNonWakeup = 0;
        mNextWakeup = mNextRtcWakeup = mNextNonWakeup = 0;

        // We have to set current TimeZone info to kernel
        // because kernel doesn't keep this after reboot
@@ -540,7 +564,7 @@ class AlarmManagerService extends IAlarmManager.Stub {
            windowLength = AlarmManager.INTERVAL_HOUR;
        }

        if (type < RTC_WAKEUP || type > ELAPSED_REALTIME) {
        if (type < RTC_WAKEUP || type > RTC_POWEROFF_WAKEUP) {
            throw new IllegalArgumentException("Invalid alarm type " + type);
        }

@@ -656,6 +680,17 @@ class AlarmManagerService extends IAlarmManager.Stub {
        }
        return null;
    }
    private Batch findFirstRtcWakeupBatchLocked() {
        final int N = mAlarmBatches.size();
        for (int i = 0; i < N; i++) {
            Batch b = mAlarmBatches.get(i);
            if (b.isRtcPowerOffWakeup()) {
                return b;
            }
        }
        return null;
    }


    private void rescheduleKernelAlarmsLocked() {
        // Schedule the next upcoming wakeup alarm.  If there is a deliverable batch
@@ -663,6 +698,7 @@ class AlarmManagerService extends IAlarmManager.Stub {
        if (mAlarmBatches.size() > 0) {
            final Batch firstWakeup = findFirstWakeupBatchLocked();
            final Batch firstBatch = mAlarmBatches.get(0);
            final Batch firstRtcWakeup = findFirstRtcWakeupBatchLocked();
            if (firstWakeup != null && mNextWakeup != firstWakeup.start) {
                mNextWakeup = firstWakeup.start;
                setLocked(ELAPSED_REALTIME_WAKEUP, firstWakeup.start);
@@ -671,6 +707,14 @@ class AlarmManagerService extends IAlarmManager.Stub {
                mNextNonWakeup = firstBatch.start;
                setLocked(ELAPSED_REALTIME, firstBatch.start);
            }
            if (firstRtcWakeup != null && mNextRtcWakeup != firstRtcWakeup.start) {
                mNextRtcWakeup = firstRtcWakeup.start;
                long when = firstRtcWakeup.getWhenByElapsedTime(mNextRtcWakeup);
                if (when != 0) {
                    setLocked(RTC_POWEROFF_WAKEUP, when);
                }
            }

        }
    }

@@ -781,6 +825,20 @@ class AlarmManagerService extends IAlarmManager.Stub {
        boolean didRemove = false;
        for (int i = mAlarmBatches.size() - 1; i >= 0; i--) {
            Batch b = mAlarmBatches.get(i);
            ArrayList<Alarm> alarmList = b.alarms;
            Alarm alarm = null;
            for (int j = alarmList.size() - 1; j >= 0; j--) {
                alarm = alarmList.get(j);
                if (alarm.type == RTC_POWEROFF_WAKEUP && alarm.operation.equals(operation)) {
                    long alarmSeconds, alarmNanoseconds;
                    alarmSeconds = alarm.when / 1000;
                    alarmNanoseconds = (alarm.when % 1000) * 1000 * 1000;
                    Slog.w(TAG,"Clear alarm type=" + alarm.type + ",alarmSeconds=" +
                       alarmSeconds);
                    clear(mDescriptor, alarm.type, alarmSeconds, alarmNanoseconds);
                    mNextRtcWakeup = 0;
                }
            }
            didRemove |= b.remove(operation);
            if (b.size() == 0) {
                mAlarmBatches.remove(i);
@@ -1046,6 +1104,7 @@ class AlarmManagerService extends IAlarmManager.Stub {
        case RTC_WAKEUP : return "RTC_WAKEUP";
        case ELAPSED_REALTIME : return "ELAPSED";
        case ELAPSED_REALTIME_WAKEUP: return "ELAPSED_WAKEUP";
        case RTC_POWEROFF_WAKEUP : return "RTC_POWEROFF_WAKEUP";
        default:
            break;
        }
@@ -1067,6 +1126,7 @@ class AlarmManagerService extends IAlarmManager.Stub {
    private native int init();
    private native void close(int fd);
    private native void set(int fd, int type, long seconds, long nanoseconds);
    private native void clear(int fd, int type, long seconds, long nanoseconds);
    private native int waitForAlarm(int fd);
    private native int setKernelTimezone(int fd, int minuteswest);

@@ -1252,7 +1312,6 @@ class AlarmManagerService extends IAlarmManager.Stub {
                            recordWakeupAlarms(mAlarmBatches, nowELAPSED, nowRTC);
                        }
                    }

                    triggerAlarmsLocked(triggerList, nowELAPSED, nowRTC);
                    rescheduleKernelAlarmsLocked();

@@ -1293,7 +1352,8 @@ class AlarmManagerService extends IAlarmManager.Stub {
                                fs.nesting++;
                            }
                            if (alarm.type == ELAPSED_REALTIME_WAKEUP
                                    || alarm.type == RTC_WAKEUP) {
                                    || alarm.type == RTC_WAKEUP
                                    || alarm.type == RTC_POWEROFF_WAKEUP) {
                                bs.numWakeup++;
                                fs.numWakeup++;
                                ActivityManagerNative.noteWakeupAlarm(
+4 −0
Original line number Diff line number Diff line
@@ -62,6 +62,10 @@ public class BootReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(final Context context, Intent intent) {

        boolean fromQuickBoot = intent.getBooleanExtra("from_quickboot", false);
        if (fromQuickBoot) return;

        // Log boot events in the background to avoid blocking the main thread with I/O
        new Thread() {
            @Override
+2 −1
Original line number Diff line number Diff line
@@ -219,6 +219,7 @@ class ServerThread {
        boolean disableSystemUI = SystemProperties.getBoolean("config.disable_systemui", false);
        boolean disableNonCoreServices = SystemProperties.getBoolean("config.disable_noncore", false);
        boolean disableNetwork = SystemProperties.getBoolean("config.disable_network", false);
        boolean disableAtlas = SystemProperties.getBoolean("config.disable_atlas", false);

        try {
            Slog.i(TAG, "Display Manager");
@@ -823,7 +824,7 @@ class ServerThread {
                }
            }

            if (!disableNonCoreServices) {
            if (!disableNonCoreServices && !disableAtlas) {
                try {
                    Slog.i(TAG, "Assets Atlas Service");
                    atlas = new AssetAtlasService(context);
Loading