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

Commit 24793c59 authored by Emma James's avatar Emma James Committed by Android (Google) Code Review
Browse files

Merge "Use target sdk for background check on Wear remote intents." into main

parents d38429f4 e9671aff
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -148,6 +148,14 @@ class BroadcastController {
    @EnabledSince(targetSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
    private static final long DYNAMIC_RECEIVER_EXPLICIT_EXPORT_REQUIRED = 161145287L;

    /**
     * It is now required for apps to be in the foreground to send remote intent broadcasts on Wear
     * devices.
     */
    @ChangeId
    @EnabledSince(targetSdkVersion = Build.VERSION_CODES.BAKLAVA)
    private static final long WEAR_REMOTE_INTENT_BLOCKED_IN_BACKGROUND = 419106561L;

    // Maximum number of receivers an app can register.
    private static final int MAX_RECEIVERS_ALLOWED_PER_APP = 1000;

@@ -1088,10 +1096,14 @@ class BroadcastController {
                intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
            }

            // TODO: b/329211459 - Remove this after background remote intent is fixed.
            // TODO: b/329211459 - Remove this when the remote intent broadcast receiver is removed
            // from Wear.
            if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH)
                    && getWearRemoteIntentAction().equals(action)) {
                final int callerProcState = callerApp != null
                    && getWearRemoteIntentAction().equals(action)
                    && CompatChanges.isChangeEnabled(
                            WEAR_REMOTE_INTENT_BLOCKED_IN_BACKGROUND, callingUid)) {
                final int callerProcState =
                        callerApp != null
                                ? callerApp.getCurProcState()
                                : ActivityManager.PROCESS_STATE_NONEXISTENT;
                if (ActivityManager.RunningAppProcessInfo.procStateToImportance(callerProcState)