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

Commit e7ba1304 authored by Achim Thesmann's avatar Achim Thesmann
Browse files

Remove mBalAllowedByPiCreatorWithHardening

Since BAL hardening is enabled on all trunk stable builds, the value of
mBalAllowedByPiCreatorWithHardening and mBalAllowedByPiCreator is the
same and logging both is unnecessary.

Test: atest BackgroundActivityStartControllerTests BackgroundActivityLaunchTest
Flag: EXEMPT refactoring
Change-Id: Ide580fb2798229fb24a8e174b08bc8dd00e31bf0
parent affb0174
Loading
Loading
Loading
Loading
+4 −14
Original line number Diff line number Diff line
@@ -312,7 +312,6 @@ public class BackgroundActivityStartController {
        private final @ActivityManager.ProcessState int mCallingUidProcState;
        private final boolean mIsCallingUidPersistentSystemProcess;
        final BackgroundStartPrivileges mBalAllowedByPiSender;
        final BackgroundStartPrivileges mBalAllowedByPiCreatorWithHardening;
        final BackgroundStartPrivileges mBalAllowedByPiCreator;
        private final String mRealCallingPackage;
        private final int mRealCallingUid;
@@ -379,22 +378,14 @@ public class BackgroundActivityStartController {

            if (mAutoOptInCaller) {
                // grant BAL privileges unless explicitly opted out
                mBalAllowedByPiCreatorWithHardening = mBalAllowedByPiCreator =
                mBalAllowedByPiCreator =
                        callerBackgroundActivityStartMode == MODE_BACKGROUND_ACTIVITY_START_DENIED
                                ? BackgroundStartPrivileges.NONE
                                : BackgroundStartPrivileges.ALLOW_BAL;
            } else {
                // for PendingIntents we restrict BAL based on target_sdk
                mBalAllowedByPiCreatorWithHardening = getBackgroundStartPrivilegesAllowedByCreator(
                mBalAllowedByPiCreator = getBackgroundStartPrivilegesAllowedByCreator(
                        callingUid, callingPackage, checkedOptions);
                final BackgroundStartPrivileges mBalAllowedByPiCreatorWithoutHardening =
                        callerBackgroundActivityStartMode
                                == MODE_BACKGROUND_ACTIVITY_START_DENIED
                                ? BackgroundStartPrivileges.NONE
                                : BackgroundStartPrivileges.ALLOW_BAL;
                mBalAllowedByPiCreator = balRequireOptInByPendingIntentCreator()
                        ? mBalAllowedByPiCreatorWithHardening
                        : mBalAllowedByPiCreatorWithoutHardening;
            }

            if (mAutoOptInReason != null) {
@@ -585,9 +576,8 @@ public class BackgroundActivityStartController {
            if (mCallerApp != null) {
                sb.append("; inVisibleTask: ").append(mCallerApp.hasActivityInVisibleTask());
            }
            sb.append("; balAllowedByPiCreator: ").append(mBalAllowedByPiCreator);
            sb.append("; balAllowedByPiCreatorWithHardening: ")
                    .append(mBalAllowedByPiCreatorWithHardening);
            sb.append("; balAllowedByPiCreator: ")
                    .append(mBalAllowedByPiCreator);
            if (mResultForCaller != null) {
                sb.append("; resultIfPiCreatorAllowsBal: ")
                        .append(balCodeToString(mResultForCaller.mCode));
+0 −2
Original line number Diff line number Diff line
@@ -571,7 +571,6 @@ public class BackgroundActivityStartControllerTests {
                        + "callerApp: mCallerApp; "
                        + "inVisibleTask: false; "
                        + "balAllowedByPiCreator: BSP.ALLOW_BAL; "
                        + "balAllowedByPiCreatorWithHardening: BSP.ALLOW_BAL; "
                        + "callerStartMode: MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED; "
                        + "hasRealCaller: true; "
                        + "isCallForResult: false; "
@@ -674,7 +673,6 @@ public class BackgroundActivityStartControllerTests {
                        + "callerApp: mCallerApp; "
                        + "inVisibleTask: false; "
                        + "balAllowedByPiCreator: BSP.NONE; "
                        + "balAllowedByPiCreatorWithHardening: BSP.NONE; "
                        + "callerStartMode: MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED; "
                        + "hasRealCaller: true; "
                        + "isCallForResult: false; "