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

Commit a3653d22 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

LGEStarRIL: Ignore SCREEN_ON/SCREEN_OFF events on star

Logic is taken directly from the p99x stock ROMs: SCREEN_OFF causes
the radio to stop genereating events, including the CBC batt refreshes.

This causes the battery to stop updating while the screen is off.

Change-Id: Iae78cde0442832d985a782d9ed1bb6d59223f234
parent afffa0f2
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -87,6 +87,27 @@ public class LGEStarRIL extends RIL implements CommandsInterface {

    public LGEStarRIL(Context context, int networkMode, int cdmaSubscription) {
        super(context, networkMode, cdmaSubscription);
        /* The star needs to ignore SCREEN_X states, in order to keep the
         * batt updates running. The cosmo doesn't need this */
        if (!SystemProperties.get("ro.build.product").equals("p920")) {
            context.unregisterReceiver(mIntentReceiver);
            BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
                @Override
                    public void onReceive(Context context, Intent intent) {
                        if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
                            Log.d(LOG_TAG, "RIL received ACTION_SCREEN_ON Intent -> SKIP");
                        } else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
                            Log.d(LOG_TAG, "RIL received ACTION_SCREEN_OFF Intent -> SKIP");
                        } else {
                            Log.w(LOG_TAG, "RIL received unexpected Intent: " + intent.getAction());
                        }
                    }
            };
            IntentFilter filter = new IntentFilter();
            filter.addAction(Intent.ACTION_SCREEN_ON);
            filter.addAction(Intent.ACTION_SCREEN_OFF);
            context.registerReceiver(mIntentReceiver, filter);
        }
    }

    protected boolean mPrepSetupPending = true;