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

Commit 3d3a3147 authored by jrior001's avatar jrior001 Committed by Michael Bestas
Browse files

Allow lid to send a generic COVER_CHANGED broadcast

This intent will be used to launch a common app for devices
with a view window flip cover(LG, Asus..) or dotcase(HTC).

Updated for Lineage SDK and squashed with the following change:

  Author: Ethan Chen <intervigil@gmail.com>
  Date:   Sat Jan 28 21:39:21 2017 -0800

    Correctly name LID_STATE_CHANGED broadcast

    Change-Id: I472becdcf310fab8536fb24e6cacf646199f464d

Change-Id: I8ce163d0d3f71e40680f42348847e548b41a0045
parent ccb1044e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -25,4 +25,7 @@
    <permission android:name="android.permission.PREVENT_POWER_KEY"
        android:protectionLevel="signature|privileged" />

    <!-- Used to launch a common app (FlipFlap) for devices with flip cover. -->
    <protected-broadcast android:name="lineageos.intent.action.LID_STATE_CHANGED" />

</manifest>
+9 −0
Original line number Diff line number Diff line
@@ -7596,6 +7596,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        synchronized (mLock) {
            updateWakeGestureListenerLp();
        }
        sendLidChangeBroadcast();
    }

    private void sendLidChangeBroadcast() {
        Log.d(TAG, "Sending cover change broadcast, mLidState=" + mLidState);
        Intent intent = new Intent(lineageos.content.Intent.ACTION_LID_STATE_CHANGED);
        intent.putExtra(lineageos.content.Intent.EXTRA_LID_STATE, mLidState);
        intent.setFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
        mContext.sendBroadcastAsUser(intent, UserHandle.SYSTEM);
    }

    void updateUiMode() {