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

Commit 22669f5b authored by Jacob Hobbie's avatar Jacob Hobbie
Browse files

Adding broadcasts receiver flags.

Adding flags to a few files such that they specify if their unprotected
broadcasts are exported or nto exported. Marking a receiver as exported
is a no-op, and will maintain current behavior. All permission protected
broadcasts should be marked as exported. Marking a receiver as not
exported will prevent other apps from sending that receiver broadcasts.
ACTION_CLOSE_SYSTEM_DIALOG is exported since it's deprecated in S+ and
is only used during testing, otherwise the system drops it anyways.

Test: no-op
Bug: 161145287
Change-Id: Ifbae5de03e6dbaa36b66299a830de077d0a688e2
parent c27e4cdf
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -147,7 +147,8 @@ final class WifiDisplayAdapter extends DisplayAdapter {
                        getContext(), getHandler(), mWifiDisplayListener);

                getContext().registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL,
                        new IntentFilter(ACTION_DISCONNECT), null, mHandler);
                        new IntentFilter(ACTION_DISCONNECT), null, mHandler,
                        Context.RECEIVER_NOT_EXPORTED);
            }
        });
    }
+2 −1
Original line number Diff line number Diff line
@@ -138,7 +138,8 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn
        // By default CLOSE_SYSTEM_DIALOGS broadcast is sent only for current user, which is user
        // 10 on devices with headless system user enabled.
        // In order to receive the broadcast, register the broadcast receiver with UserHandle.ALL.
        context.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, filter, null, null);
        context.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, filter, null, null,
                Context.RECEIVER_EXPORTED);

        mHasTelephony =
                context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
+1 −1
Original line number Diff line number Diff line
@@ -213,7 +213,7 @@ public final class ShutdownThread extends Thread {
        CloseDialogReceiver(Context context) {
            mContext = context;
            IntentFilter filter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
            context.registerReceiver(this, filter);
            context.registerReceiver(this, filter, Context.RECEIVER_EXPORTED);
        }

        @Override
+1 −1
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ class Vr2dDisplay {
                        }
                    }
                }
            }, intentFilter);
            }, intentFilter, Context.RECEIVER_NOT_EXPORTED);
        }
    }