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

Commit ad969ad7 authored by Guojing Yuan's avatar Guojing Yuan
Browse files

Fix a CDM crash during association

The issue happens when the package is power save whitelisted by the
system but doesn't have REQUEST_COMPANION_RUN_IN_BACKGROUND permission.

Fix: 205356884

Test: N/A
Change-Id: Idc4203030ecd70df470b080cb2a38219a88875c0
parent 90dda86f
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -757,7 +757,12 @@ public class CompanionDeviceManagerService extends SystemService {
                android.Manifest.permission.REQUEST_COMPANION_RUN_IN_BACKGROUND)) {
            mPowerWhitelistManager.addToWhitelist(packageInfo.packageName);
        } else {
            try {
                mPowerWhitelistManager.removeFromWhitelist(packageInfo.packageName);
            } catch (UnsupportedOperationException e) {
                Slog.w(LOG_TAG, packageInfo.packageName + " can't be removed from power save"
                        + " whitelist. It might due to the package is whitelisted by the system.");
            }
        }

        NetworkPolicyManager networkPolicyManager = NetworkPolicyManager.from(getContext());