Use custom permission for unfiltered broadcast receiver in CallActivity

Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
Álvaro Brey 2022-06-14 15:51:04 +02:00
parent 67298a63e6
commit bb7e82fbcb
No known key found for this signature in database
GPG key ID: 2585783189A62105
3 changed files with 14 additions and 1 deletions

View file

@ -83,6 +83,10 @@ android {
testInstrumentationRunnerArgument "TEST_SERVER_URL", "${NC_TEST_SERVER_BASEURL}"
testInstrumentationRunnerArgument "TEST_SERVER_USERNAME", "${NC_TEST_SERVER_USERNAME}"
testInstrumentationRunnerArgument "TEST_SERVER_PASSWORD", "${NC_TEST_SERVER_PASSWORD}"
def localBroadcastPermission = "com.nextcloud.talk.permission.PRIVATE_BROADCAST"
manifestPlaceholders.broadcastPermission = localBroadcastPermission
buildConfigField "String", "PERMISSION_LOCAL_BROADCAST", "\"${localBroadcastPermission}\""
}
buildTypes {

View file

@ -79,6 +79,11 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<permission
android:name="${broadcastPermission}"
android:protectionLevel="signature" />
<uses-permission android:name="${broadcastPermission}"/>
<application
android:name=".application.NextcloudTalkApplication"
android:allowBackup="true"

View file

@ -52,6 +52,7 @@ import android.widget.RelativeLayout;
import android.widget.Toast;
import com.bluelinelabs.logansquare.LoganSquare;
import com.nextcloud.talk.BuildConfig;
import com.nextcloud.talk.R;
import com.nextcloud.talk.adapters.ParticipantDisplayItem;
import com.nextcloud.talk.adapters.ParticipantsAdapter;
@ -2555,7 +2556,10 @@ public class CallActivity extends CallBaseActivity {
}
}
};
registerReceiver(mReceiver, new IntentFilter(MICROPHONE_PIP_INTENT_NAME));
registerReceiver(mReceiver,
new IntentFilter(MICROPHONE_PIP_INTENT_NAME),
BuildConfig.PERMISSION_LOCAL_BROADCAST,
null);
updateUiForPipMode();
} else {