Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Fix BuildConfig.Flavor equality checks (#1381)
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro authored and bluemarvin committed Jul 9, 2019
1 parent f22769d commit f8b42cb
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import org.mozilla.vrbrowser.crashreporting.CrashReporterService;
import org.mozilla.vrbrowser.crashreporting.GlobalExceptionHandler;
import org.mozilla.vrbrowser.geolocation.GeolocationWrapper;
import org.mozilla.vrbrowser.input.DeviceType;
import org.mozilla.vrbrowser.utils.DeviceType;
import org.mozilla.vrbrowser.input.MotionEventGenerator;
import org.mozilla.vrbrowser.search.SearchEngineWrapper;
import org.mozilla.vrbrowser.telemetry.TelemetryWrapper;
Expand Down Expand Up @@ -186,7 +186,7 @@ protected void onCreate(Bundle savedInstanceState) {
// Set a global exception handler as soon as possible
GlobalExceptionHandler.register(this.getApplicationContext());

if (BuildConfig.FLAVOR_platform == "oculusvr") {
if (DeviceType.isOculusBuild()) {
workaroundGeckoSigAction();
}
mUiThread = Thread.currentThread();
Expand Down Expand Up @@ -497,7 +497,7 @@ public void onBackPressed() {

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (BuildConfig.FLAVOR_platform == "oculusvr") {
if (DeviceType.isOculusBuild()) {
int action = event.getAction();
if (action != KeyEvent.ACTION_DOWN) {
return super.dispatchKeyEvent(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.mozilla.vrbrowser.BuildConfig;
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.telemetry.TelemetryWrapper;
import org.mozilla.vrbrowser.utils.DeviceType;
import org.mozilla.vrbrowser.utils.LocaleUtils;
import org.mozilla.vrbrowser.utils.StringUtils;

Expand Down Expand Up @@ -362,7 +363,7 @@ public void setMSAALevel(int level) {
}

public boolean getLayersEnabled() {
if (BuildConfig.FLAVOR_platform.equalsIgnoreCase("oculusvr")) {
if (DeviceType.isOculusBuild()) {
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.browser.SettingsStore;
import org.mozilla.vrbrowser.search.SearchEngineWrapper;
import org.mozilla.vrbrowser.utils.DeviceType;
import org.mozilla.vrbrowser.utils.UrlUtils;

import java.net.URI;
Expand Down Expand Up @@ -100,7 +101,7 @@ public static void init(Context aContext) {
final JSONPingSerializer serializer = new JSONPingSerializer();
final FileTelemetryStorage storage = new FileTelemetryStorage(configuration, serializer);
TelemetryScheduler scheduler;
if (BuildConfig.FLAVOR_platform.equals("oculusvr") || BuildConfig.FLAVOR_platform.equals("oculusvrStore")) {
if (DeviceType.isOculus6DOFBuild()) {
scheduler = new FxRTelemetryScheduler();
} else {
scheduler = new JobSchedulerTelemetryScheduler();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import android.widget.LinearLayout;
import android.widget.TextView;

import org.mozilla.vrbrowser.input.DeviceType;
import org.mozilla.vrbrowser.utils.DeviceType;
import org.mozilla.vrbrowser.R;

import androidx.annotation.Nullable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.audio.AudioEngine;
import org.mozilla.vrbrowser.browser.SettingsStore;
import org.mozilla.vrbrowser.input.DeviceType;
import org.mozilla.vrbrowser.utils.DeviceType;
import org.mozilla.vrbrowser.ui.views.UIButton;
import org.mozilla.vrbrowser.ui.widgets.UIWidget;
import org.mozilla.vrbrowser.ui.widgets.WidgetManagerDelegate;
import org.mozilla.vrbrowser.ui.widgets.WidgetPlacement;

import androidx.annotation.IdRes;
import androidx.core.app.ActivityCompat;

public class VoiceSearchWidget extends UIDialog implements WidgetManagerDelegate.PermissionListener,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.mozilla.vrbrowser.ui.views.settings.SingleEditSetting;
import org.mozilla.vrbrowser.ui.views.settings.SwitchSetting;
import org.mozilla.vrbrowser.ui.widgets.WidgetManagerDelegate;
import org.mozilla.vrbrowser.utils.DeviceType;

class DisplayOptionsView extends SettingsView {
private AudioEngine mAudio;
Expand Down Expand Up @@ -245,8 +246,7 @@ protected void onDismiss() {
if (!mMSAARadio.getValueForId(mMSAARadio.getCheckedRadioButtonId()).equals(SettingsStore.MSAA_DEFAULT_LEVEL)) {
setMSAAMode(mMSAARadio.getIdForValue(SettingsStore.MSAA_DEFAULT_LEVEL), true);
}
if (BuildConfig.FLAVOR_platform == "oculusvr" ||
BuildConfig.FLAVOR_platform == "wavevr") {
if (DeviceType.isOculusBuild() || DeviceType.isWaveBuild()) {
if (!mFoveatedAppRadio.getValueForId(mFoveatedAppRadio.getCheckedRadioButtonId()).equals(SettingsStore.FOVEATED_APP_DEFAULT_LEVEL)) {
setFoveatedLevel(mFoveatedAppRadio, mFoveatedAppRadio.getIdForValue(SettingsStore.FOVEATED_APP_DEFAULT_LEVEL), true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.mozilla.vrbrowser.ui.views.settings.ButtonSetting;
import org.mozilla.vrbrowser.ui.views.settings.SwitchSetting;
import org.mozilla.vrbrowser.ui.widgets.WidgetManagerDelegate;
import org.mozilla.vrbrowser.utils.DeviceType;

import java.util.ArrayList;

Expand Down Expand Up @@ -91,8 +92,9 @@ private void initialize(Context aContext) {
mPermissionButtons.add(Pair.create(findViewById(R.id.locationPermissionButton), Manifest.permission.ACCESS_FINE_LOCATION));
mPermissionButtons.add(Pair.create(findViewById(R.id.storagePermissionButton), Manifest.permission.READ_EXTERNAL_STORAGE));

if (BuildConfig.FLAVOR_platform == "oculusvr3dof" || BuildConfig.FLAVOR_platform == "oculusvr")
if (DeviceType.isOculusBuild()) {
findViewById(R.id.cameraPermissionButton).setVisibility(View.GONE);
}

for (Pair<ButtonSetting, String> button: mPermissionButtons) {
if (mWidgetManager.isPermissionGranted(button.second)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.mozilla.vrbrowser.input;
package org.mozilla.vrbrowser.utils;

import android.util.Log;

import org.mozilla.vrbrowser.BuildConfig;

public class DeviceType {
// These values need to match those in Device.h
public static final int Unknown = 0;
Expand All @@ -21,4 +23,16 @@ public static void setType(int aType) {
public static int getType() {
return mType;
}

public static boolean isOculusBuild() {
return BuildConfig.FLAVOR_platform.toLowerCase().contains("oculusvr");
}

public static boolean isOculus6DOFBuild() {
return BuildConfig.FLAVOR_platform.equalsIgnoreCase("oculusvr") || BuildConfig.FLAVOR_platform.equalsIgnoreCase("oculusvrStore");
}

public static boolean isWaveBuild() {
return BuildConfig.FLAVOR_platform.toLowerCase().contains("wavevr");
}
}

0 comments on commit f8b42cb

Please sign in to comment.