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

Unverified Commit 3c2dec69 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 b97a5739
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -829,6 +829,11 @@
    <protected-broadcast android:name="android.app.admin.action.DEVICE_POLICY_SET_RESULT" />
    <protected-broadcast android:name="android.app.admin.action.DEVICE_POLICY_CHANGED" />

    <!-- 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
@@ -5828,6 +5828,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() {