Clean up flavors by using buildConfigField

This commit is contained in:
TacoTheDank 2022-06-05 22:40:26 -04:00 committed by Cameron Gutman
parent 8dd8dbc1d1
commit b5b3d81f00
7 changed files with 10 additions and 24 deletions

View File

@ -32,6 +32,7 @@ android {
applicationId "com.limelight.root"
dimension "root"
buildConfigField "boolean", "ROOT_BUILD", "true"
}
nonRoot {
@ -43,6 +44,7 @@ android {
applicationId "com.limelight"
dimension "root"
buildConfigField "boolean", "ROOT_BUILD", "false"
}
}
@ -68,6 +70,8 @@ android {
buildTypes {
debug {
applicationIdSuffix ".debug"
resValue "string", "app_label", "Moonlight (Debug)"
resValue "string", "app_label_root", "Moonlight (Root Debug)"
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
@ -104,6 +108,8 @@ android {
//
// TL;DR: Leave the following line alone!
applicationIdSuffix ".unofficial"
resValue "string", "app_label", "Moonlight"
resValue "string", "app_label_root", "Moonlight (Root)"
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_label" translatable="false">Moonlight (Debug)</string>
<string name="app_label_root" translatable="false">Moonlight (Root Debug)</string>
</resources>

View File

@ -2,8 +2,8 @@ package com.limelight.binding.input.capture;
import android.app.Activity;
import com.limelight.BuildConfig;
import com.limelight.LimeLog;
import com.limelight.LimelightBuildProps;
import com.limelight.R;
import com.limelight.binding.input.evdev.EvdevCaptureProviderShim;
import com.limelight.binding.input.evdev.EvdevListener;
@ -16,7 +16,7 @@ public class InputCaptureManager {
}
// LineageOS implemented broken NVIDIA capture extensions, so avoid using them on root builds.
// See https://github.com/LineageOS/android_frameworks_base/commit/d304f478a023430f4712dbdc3ee69d9ad02cebd3
else if (!LimelightBuildProps.ROOT_BUILD && ShieldCaptureProvider.isCaptureProviderSupported()) {
else if (!BuildConfig.ROOT_BUILD && ShieldCaptureProvider.isCaptureProviderSupported()) {
LimeLog.info("Using NVIDIA mouse capture extension");
return new ShieldCaptureProvider(activity);
}

View File

@ -3,12 +3,12 @@ package com.limelight.binding.input.evdev;
import android.app.Activity;
import com.limelight.LimelightBuildProps;
import com.limelight.BuildConfig;
import com.limelight.binding.input.capture.InputCaptureProvider;
public class EvdevCaptureProviderShim {
public static boolean isCaptureProviderSupported() {
return LimelightBuildProps.ROOT_BUILD;
return BuildConfig.ROOT_BUILD;
}
// We need to construct our capture provider using reflection because it isn't included in non-root builds

View File

@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_label" translatable="false">Moonlight</string>
<string name="app_label_root" translatable="false">Moonlight (Root)</string>
<!-- Shortcut strings -->
<string name="scut_deleted_pc">PC deleted</string>
<string name="scut_not_paired">PC not paired</string>

View File

@ -1,5 +0,0 @@
package com.limelight;
public class LimelightBuildProps {
public static final boolean ROOT_BUILD = false;
}

View File

@ -1,5 +0,0 @@
package com.limelight;
public class LimelightBuildProps {
public static final boolean ROOT_BUILD = true;
}