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

Unverified Commit 7f81aae9 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).

Co-authored-by: default avatarEthan Chen <intervigil@gmail.com>
Change-Id: I8ce163d0d3f71e40680f42348847e548b41a0045
parent 8cc3dec9
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -855,6 +855,11 @@
    <protected-broadcast android:name="android.telephony.satellite.action.SATELLITE_START_NON_EMERGENCY_SESSION" />


    <!-- LineageOS additions -->

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

    <!-- ====================================================================== -->
    <!--                          RUNTIME PERMISSIONS                           -->
    <!-- ====================================================================== -->
+10 −0
Original line number Diff line number Diff line
@@ -6929,6 +6929,16 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        synchronized (mLock) {
            updateWakeGestureListenerLp();
        }
        sendLidChangeBroadcast();
    }

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

    void updateUiMode() {