Bug 1169393 - Move Adjust-related stuff to AdjustConstants. r=nalexander

This commit is contained in:
Richard Newman 2015-05-29 15:52:42 -07:00
parent ce42617b97
commit 0d4cf25552
5 changed files with 36 additions and 24 deletions

View File

@ -0,0 +1,31 @@
//#filter substitution
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko;
import org.mozilla.gecko.adjust.AdjustHelperInterface;
//#ifdef MOZ_INSTALL_TRACKING
import org.mozilla.gecko.adjust.AdjustHelper;
//#else
import org.mozilla.gecko.adjust.StubAdjustHelper;
//#endif
public class AdjustConstants {
public static final String MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN =
//#ifdef MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN
"@MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN@";
//#else
null;
//#endif
public static AdjustHelperInterface getAdjustHelper() {
//#ifdef MOZ_INSTALL_TRACKING
return new AdjustHelper();
//#else
return new StubAdjustHelper();
//#endif
}
}

View File

@ -8,13 +8,6 @@ package org.mozilla.gecko;
import android.os.Build;
import org.mozilla.gecko.adjust.AdjustHelperInterface;
//#ifdef MOZ_INSTALL_TRACKING
import org.mozilla.gecko.adjust.AdjustHelper;
//#else
import org.mozilla.gecko.adjust.StubAdjustHelper;
//#endif
/**
* A collection of constants that pertain to the build and runtime state of the
* application. Typically these are sourced from build-time definitions (see
@ -319,19 +312,4 @@ public class AppConstants {
//#else
false;
//#endif
public static final String MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN =
//#ifdef MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN
"@MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN@";
//#else
null;
//#endif
public static AdjustHelperInterface getAdjustHelper() {
//#ifdef MOZ_INSTALL_TRACKING
return new AdjustHelper();
//#else
return new StubAdjustHelper();
//#endif
}
}

View File

@ -4,6 +4,7 @@
package org.mozilla.gecko;
import org.mozilla.gecko.AdjustConstants;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.db.BrowserDB;
@ -155,7 +156,7 @@ public class GeckoApplication extends Application
super.onCreate();
if (AppConstants.MOZ_INSTALL_TRACKING) {
AppConstants.getAdjustHelper().onCreate(this, AppConstants.MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN);
AdjustConstants.getAdjustHelper().onCreate(this, AdjustConstants.MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN);
}
}

View File

@ -5,6 +5,7 @@
package org.mozilla.gecko.distribution;
import org.mozilla.gecko.AdjustConstants;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
@ -60,7 +61,7 @@ public class ReferrerReceiver extends BroadcastReceiver {
if (AppConstants.MOZ_INSTALL_TRACKING) {
// Allow the Adjust handler to process the intent.
try {
AppConstants.getAdjustHelper().onReceive(context, intent);
AdjustConstants.getAdjustHelper().onReceive(context, intent);
} catch (Exception e) {
Log.e(LOGTAG, "Got exception in Adjust's onReceive; ignoring referrer intent.", e);
}

View File

@ -17,6 +17,7 @@ constants_jar.sources = [
'SysInfo.java',
]
constants_jar.generated_sources = [
'preprocessed/org/mozilla/gecko/AdjustConstants.java',
'preprocessed/org/mozilla/gecko/AppConstants.java',
]