ipc/android: Single point of truth for action name.

This commit is contained in:
Ryan Pavlik 2020-11-12 11:28:53 -06:00 committed by Lubosz Sarnecki
parent aa222ebba1
commit d9053e0dc5
3 changed files with 9 additions and 2 deletions
src/xrt/ipc/android
build.gradle
src/main
AndroidManifest.xml
java/org/freedesktop/monado/ipc

View file

@ -12,6 +12,13 @@ android {
// needed for ASharedMemory, etc.
minSdkVersion 26
targetSdkVersion project.sharedTargetSdk
// Single point of truth for this name.
def serviceAction = "org.freedesktop.monado.ipc.CONNECT"
manifestPlaceholders = [
serviceActionName: serviceAction
]
buildConfigField("String", "SERVICE_ACTION", "\"${serviceAction}\"")
}
buildTypes {

View file

@ -12,7 +12,7 @@
android:exported="true"
android:foregroundServiceType="connectedDevice|mediaPlayback">
<intent-filter>
<action android:name="org.freedesktop.monado.ipc.CONNECT" />
<action android:name="${serviceActionName}" />
</intent-filter>
</service>
</application>

View file

@ -152,7 +152,7 @@ public class Client implements ServiceConnection {
return false;
}
Intent intent = new Intent("org.freedesktop.monado.ipc.CONNECT")
intent = new Intent(BuildConfig.SERVICE_ACTION)
.setPackage(packageName);
context.startForegroundService(intent);