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

Commit 2ed15874 authored by Devi Sandeep Endluri V V's avatar Devi Sandeep Endluri V V Committed by Linux Build Service Account
Browse files

Fix: Added safe check to prevent app crash.

PowerManagerService instance with respect to NSRM is
not handled properly which results in application crash.
Safe checks are added to prevent crashes.

Change-Id: I4ab69e85b1f0a7a4d018b844f4e3dc7f6e1410e8
CRs-Fixed: 1051580
parent 5003353c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -474,7 +474,7 @@ public final class PowerManagerService extends SystemService
    // Set of app ids that are temporarily allowed to acquire wakelocks due to high-pri message
    int[] mDeviceIdleTempWhitelist = new int[0];

    private QCNsrmPowerExtension qcNsrmPowExt = new QCNsrmPowerExtension(this);
    private QCNsrmPowerExtension qcNsrmPowExt;

    private final SparseIntArray mUidState = new SparseIntArray();

@@ -506,7 +506,7 @@ public final class PowerManagerService extends SystemService
                Process.THREAD_PRIORITY_DISPLAY, false /*allowIo*/);
        mHandlerThread.start();
        mHandler = new PowerManagerHandler(mHandlerThread.getLooper());

        qcNsrmPowExt = new QCNsrmPowerExtension(this);
        synchronized (mLock) {
            mWakeLockSuspendBlocker = createSuspendBlockerLocked("PowerManagerService.WakeLocks");
            mDisplaySuspendBlocker = createSuspendBlockerLocked("PowerManagerService.Display");
+6 −2
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ public final class QCNsrmPowerExtension {
    private final ArrayList<Integer> mPmsBlockedUids = new ArrayList<Integer>();

    public QCNsrmPowerExtension (PowerManagerService handle) {
        PowerManagerService pmHandle = handle ;
       pmHandle = handle ;
    }

    protected void checkPmsBlockedWakelocks (
@@ -139,8 +139,9 @@ public final class QCNsrmPowerExtension {
        if (wakeLock != null && ((wakeLock.mFlags &
                                  PowerManager.WAKE_LOCK_LEVEL_MASK
                                  ) == PowerManager.PARTIAL_WAKE_LOCK )) {
            if (wakeLock.mDisabled != update) {
            if (wakeLock.mDisabled != update && pmHandle != null) {
                wakeLock.mDisabled = update;
                  if (localLOGV) Slog.v(TAG, "updatePmsBlockWakelock pmHandle "+pmHandle);
                if (wakeLock.mDisabled) {
                    // This wake lock is no longer being respected.
                    pmHandle.notifyWakeLockReleasedLocked(wakeLock);
@@ -149,6 +150,9 @@ public final class QCNsrmPowerExtension {
                }
                return true;
            }
            else {
               if (localLOGV) Slog.v(TAG, "updatePmsBlockWakelock pmHandle "+pmHandle );
            }
        }
        return false;
    }