Add RECEIVER_EXPORTED flags to screenshots

Builds on T+ require either the RECEIVER_EXPORTED or
RECEIVER_NOT_EXPORTED flag to be set when registering a broadcast
receiver. Recently a change went in to change from logging a
warning to throwing an error, causing sysui to crash when screenshots
are taken. This change adds the RECEIVER_EXPORTED flag to screenshot
code.

Bug: 213406883
Fix: 213406883
Test: verified that warnings no longer appear and sysui does not
crash when taking a screenshot

Change-Id: I0fa1c2272f1a994e51945be5f6c67cdccbb84cc2
This commit is contained in:
Miranda Kephart
2022-01-06 12:23:45 -05:00
parent 06425229da
commit dbf18a285b
2 changed files with 3 additions and 2 deletions

View File

@@ -178,7 +178,7 @@ public class ScreenshotHelper {
public ScreenshotHelper(Context context) {
mContext = context;
IntentFilter filter = new IntentFilter(ACTION_USER_SWITCHED);
mContext.registerReceiver(mBroadcastReceiver, filter);
mContext.registerReceiver(mBroadcastReceiver, filter, Context.RECEIVER_EXPORTED);
}
/**

View File

@@ -113,7 +113,8 @@ public class TakeScreenshotService extends Service {
@Override
public IBinder onBind(@NonNull Intent intent) {
registerReceiver(mCloseSystemDialogs, new IntentFilter(ACTION_CLOSE_SYSTEM_DIALOGS));
registerReceiver(mCloseSystemDialogs, new IntentFilter(ACTION_CLOSE_SYSTEM_DIALOGS),
Context.RECEIVER_EXPORTED);
final Messenger m = new Messenger(mHandler);
if (DEBUG_SERVICE) {
Log.d(TAG, "onBind: returning connection: " + m);