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

Commit 066572e0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Disallow wear remote intent from background process" into main

parents 15991295 89cb7171
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -6984,4 +6984,7 @@
    <!-- Whether WM DisplayContent supports high performance transitions
         (lower-end devices may want to disable) -->
    <bool name="config_deviceSupportsHighPerfTransitions">true</bool>

    <!-- Wear devices: An intent action that is used for remote intent. -->
    <string name="config_wearRemoteIntentAction" translatable="false" />
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -5385,4 +5385,6 @@

  <!-- Whether WM DisplayContent supports high performance transitions -->
  <java-symbol type="bool" name="config_deviceSupportsHighPerfTransitions" />

  <java-symbol type="string" name="config_wearRemoteIntentAction" />
</resources>
+17 −0
Original line number Diff line number Diff line
@@ -2656,6 +2656,11 @@ public class ActivityManagerService extends IActivityManager.Stub
        return mBackgroundLaunchBroadcasts;
    }
    private String getWearRemoteIntentAction() {
        return mContext.getResources().getString(
                    com.android.internal.R.string.config_wearRemoteIntentAction);
    }
    /**
     * Ensures that the given package name has an explicit set of allowed associations.
     * If it does not, give it an empty set.
@@ -15213,6 +15218,18 @@ public class ActivityManagerService extends IActivityManager.Stub
                intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
            }
            // TODO: b/329211459 - Remove this after background remote intent is fixed.
            if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH)
                    && getWearRemoteIntentAction().equals(action)) {
                final int callerProcState = callerApp != null
                        ? callerApp.getCurProcState()
                        : ActivityManager.PROCESS_STATE_NONEXISTENT;
                if (ActivityManager.RunningAppProcessInfo.procStateToImportance(callerProcState)
                        > ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
                    return ActivityManager.START_CANCELED;
                }
            }
            switch (action) {
                case Intent.ACTION_MEDIA_SCANNER_SCAN_FILE:
                    UserManagerInternal umInternal = LocalServices.getService(