code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
@Override public FeatureManager getFeatureManager() { return instance; }
This {@link FeatureManagerProvider} is used by the testing integration modules to provide a FeatureManager in unit tests. @author Christian Kaltepoth
getFeatureManager
java
togglz/togglz
testing/src/main/java/org/togglz/testing/TestFeatureManagerProvider.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/TestFeatureManagerProvider.java
Apache-2.0
public static void setFeatureManager(FeatureManager instance) { TestFeatureManagerProvider.instance = instance; }
This {@link FeatureManagerProvider} is used by the testing integration modules to provide a FeatureManager in unit tests. @author Christian Kaltepoth
setFeatureManager
java
togglz/togglz
testing/src/main/java/org/togglz/testing/TestFeatureManagerProvider.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/TestFeatureManagerProvider.java
Apache-2.0
@Override public String getName() { return this.getClass().getSimpleName(); }
Simple {@link FeatureManager} for unit tests that enables all features. @author Christian Kaltepoth
getName
java
togglz/togglz
testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
Apache-2.0
@Override public Set<Feature> getFeatures() { return Collections.emptySet(); }
Simple {@link FeatureManager} for unit tests that enables all features. @author Christian Kaltepoth
getFeatures
java
togglz/togglz
testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
Apache-2.0
@Override public FeatureMetaData getMetaData(Feature feature) { return new EmptyFeatureMetaData(feature); }
Simple {@link FeatureManager} for unit tests that enables all features. @author Christian Kaltepoth
getMetaData
java
togglz/togglz
testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
Apache-2.0
@Override public boolean isActive(Feature feature) { return true; }
Simple {@link FeatureManager} for unit tests that enables all features. @author Christian Kaltepoth
isActive
java
togglz/togglz
testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
Apache-2.0
@Override public FeatureUser getCurrentFeatureUser() { return null; }
Simple {@link FeatureManager} for unit tests that enables all features. @author Christian Kaltepoth
getCurrentFeatureUser
java
togglz/togglz
testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
Apache-2.0
@Override public FeatureState getFeatureState(Feature feature) { return new FeatureState(feature, true); }
Simple {@link FeatureManager} for unit tests that enables all features. @author Christian Kaltepoth
getFeatureState
java
togglz/togglz
testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
Apache-2.0
@Override public void setFeatureState(FeatureState state) { throw new UnsupportedOperationException(); }
Simple {@link FeatureManager} for unit tests that enables all features. @author Christian Kaltepoth
setFeatureState
java
togglz/togglz
testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
Apache-2.0
@Override public List<ActivationStrategy> getActivationStrategies() { return Collections.emptyList(); }
Simple {@link FeatureManager} for unit tests that enables all features. @author Christian Kaltepoth
getActivationStrategies
java
togglz/togglz
testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
Apache-2.0
@Override public void enable(Feature feature) { throw new UnsupportedOperationException(); }
Simple {@link FeatureManager} for unit tests that enables all features. @author Christian Kaltepoth
enable
java
togglz/togglz
testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
Apache-2.0
@Override public void disable(Feature feature) { throw new UnsupportedOperationException(); }
Simple {@link FeatureManager} for unit tests that enables all features. @author Christian Kaltepoth
disable
java
togglz/togglz
testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManager.java
Apache-2.0
@Override public int priority() { return 20; }
This {@link FeatureManagerProvider} is a fallback for unit tests. It will return a {@link FallbackTestFeatureManager} which will simply enable all features. @author Christian Kaltepoth
priority
java
togglz/togglz
testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManagerProvider.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManagerProvider.java
Apache-2.0
@Override public FeatureManager getFeatureManager() { return new FallbackTestFeatureManager(); }
This {@link FeatureManagerProvider} is a fallback for unit tests. It will return a {@link FallbackTestFeatureManager} which will simply enable all features. @author Christian Kaltepoth
getFeatureManager
java
togglz/togglz
testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManagerProvider.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/fallback/FallbackTestFeatureManagerProvider.java
Apache-2.0
public static <F extends Feature> VariationSetBuilder<F> create(Class<F> featureClass) { return new VariationSetBuilder<>(featureClass); }
Default implementation of {@link VariationSet} that allows to build the set dynamically. @param <F> The feature class @author Christian Kaltepoth
create
java
togglz/togglz
testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
Apache-2.0
public VariationSetBuilder<F> vary(F f) { featuresToVary.add(f); featuresToEnable.remove(f); featuresToDisable.remove(f); return this; }
Vary this feature in the variation set.
vary
java
togglz/togglz
testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
Apache-2.0
public VariationSetBuilder<F> enable(F f) { featuresToVary.remove(f); featuresToEnable.add(f); featuresToDisable.remove(f); return this; }
Enable this feature in the variation set.
enable
java
togglz/togglz
testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
Apache-2.0
public VariationSetBuilder<F> disable(F f) { featuresToVary.remove(f); featuresToEnable.remove(f); featuresToDisable.add(f); return this; }
Disable this feature in the variation set.
disable
java
togglz/togglz
testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
Apache-2.0
public VariationSetBuilder<F> enableAll() { for (F f : featureClass.getEnumConstants()) { enable(f); } return this; }
Enable all features in the variation set.
enableAll
java
togglz/togglz
testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
Apache-2.0
public VariationSetBuilder<F> disableAll() { for (F f : featureClass.getEnumConstants()) { disable(f); } return this; }
Disable all features in the variation set.
disableAll
java
togglz/togglz
testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
Apache-2.0
@Override public Set<Set<F>> getVariants() { // start with a single variant with all feature disabled Set<Set<F>> variantSet = new LinkedHashSet<>(); variantSet.add(new HashSet<F>()); for (F feature : featureClass.getEnumConstants()) { // enable the feature in all vari...
Disable all features in the variation set.
getVariants
java
togglz/togglz
testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
Apache-2.0
private Set<Set<F>> deepCopy(Set<Set<F>> src) { Set<Set<F>> copy = new LinkedHashSet<Set<F>>(); for (Set<F> variant : src) { copy.add(new HashSet<F>(variant)); } return copy; }
Disable all features in the variation set.
deepCopy
java
togglz/togglz
testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
Apache-2.0
@Override public Class<F> getFeatureClass() { return featureClass; }
Disable all features in the variation set.
getFeatureClass
java
togglz/togglz
testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
https://github.com/togglz/togglz/blob/master/testing/src/main/java/org/togglz/testing/vary/VariationSetBuilder.java
Apache-2.0
@Test public void verifySigningCertificate_ALLOW() throws Throwable { final CountDownLatch signal = new CountDownLatch(1); uiThreadTestRule.runOnUiThread(new Runnable() { @Override public void run() { final Context context = Instrumentation...
1. Global test cases. Doesn't require any additional step to run.
verifySigningCertificate_ALLOW
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void run() { final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); new PiracyChecker(context) .enableSigningCertificates("VHZs2aiTBiap/F+AYhYeppy0aF0=") .callback(n...
1. Global test cases. Doesn't require any additional step to run.
run
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void allow() { assertTrue("PiracyChecker OK", true); signal.countDown(); }
1. Global test cases. Doesn't require any additional step to run.
allow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void doNotAllow(@NotNull PiracyCheckerError error, @Nullable PirateApp app) { fail(Arrays.toString(LibraryUtilsKt.getApkSignatures(context))); signal.countDown(); ...
1. Global test cases. Doesn't require any additional step to run.
doNotAllow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Test public void verifySigningCertificate_DONTALLOW() throws Throwable { final CountDownLatch signal = new CountDownLatch(1); uiThreadTestRule.runOnUiThread(new Runnable() { @Override public void run() { final Context context = Instrumenta...
1. Global test cases. Doesn't require any additional step to run.
verifySigningCertificate_DONTALLOW
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void run() { final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); new PiracyChecker(context) .enableSigningCertificates("478yYkKAQF+KST8y4ATKvHkYibo=") .callback(n...
1. Global test cases. Doesn't require any additional step to run.
run
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void allow() { fail("PiracyChecker FAILED: The signing certificate is invalid."); signal.countDown(); }
1. Global test cases. Doesn't require any additional step to run.
allow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void doNotAllow(@NotNull PiracyCheckerError error, @Nullable PirateApp app) { if (error == PiracyCheckerError.SIGNATURE_NOT_VALID) assertTrue("PiracyChecker OK", true); ...
1. Global test cases. Doesn't require any additional step to run.
doNotAllow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Test public void verifyInstaller_DONTALLOW() throws Throwable { final CountDownLatch signal = new CountDownLatch(1); uiThreadTestRule.runOnUiThread(new Runnable() { @Override public void run() { final Context context = InstrumentationRegis...
1. Global test cases. Doesn't require any additional step to run.
verifyInstaller_DONTALLOW
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void run() { final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); new PiracyChecker(context) .enableInstallerId(InstallerID.GOOGLE_PLAY) .enableInstallerId(Install...
1. Global test cases. Doesn't require any additional step to run.
run
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void allow() { fail("PiracyChecker FAILED: The app has been installed using another " + "store."); signal.countDown(); }
1. Global test cases. Doesn't require any additional step to run.
allow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void doNotAllow(@NotNull PiracyCheckerError error, @Nullable PirateApp app) { if (error == PiracyCheckerError.INVALID_INSTALLER_ID) assertTrue("PiracyChecker OK", true); ...
1. Global test cases. Doesn't require any additional step to run.
doNotAllow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Test public void verifyUnauthorizedApps_ALLOW() throws Throwable { final CountDownLatch signal = new CountDownLatch(1); uiThreadTestRule.runOnUiThread(new Runnable() { @Override public void run() { final Context context = InstrumentationRe...
1. Global test cases. Doesn't require any additional step to run.
verifyUnauthorizedApps_ALLOW
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void run() { final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); new PiracyChecker(context) .enableUnauthorizedAppsCheck() .callback(new PiracyCheckerCallback() {...
1. Global test cases. Doesn't require any additional step to run.
run
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void allow() { assertTrue("PiracyChecker OK", true); signal.countDown(); }
1. Global test cases. Doesn't require any additional step to run.
allow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void doNotAllow(@NotNull PiracyCheckerError error, @Nullable PirateApp app) { fail(error.toString()); signal.countDown(); }
1. Global test cases. Doesn't require any additional step to run.
doNotAllow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Test public void verifyThirdPartyStores_ALLOW() throws Throwable { final CountDownLatch signal = new CountDownLatch(1); uiThreadTestRule.runOnUiThread(new Runnable() { @Override public void run() { final Context context = InstrumentationRe...
1. Global test cases. Doesn't require any additional step to run.
verifyThirdPartyStores_ALLOW
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void run() { final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); new PiracyChecker(context) .enableUnauthorizedAppsCheck() .callback(new PiracyCheckerCallback() {...
1. Global test cases. Doesn't require any additional step to run.
run
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void allow() { assertTrue("PiracyChecker OK", true); signal.countDown(); }
1. Global test cases. Doesn't require any additional step to run.
allow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void doNotAllow(@NotNull PiracyCheckerError error, @Nullable PirateApp app) { fail(error.toString()); signal.countDown(); }
1. Global test cases. Doesn't require any additional step to run.
doNotAllow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Test public void verifyDeepPirate_ALLOW() throws Throwable { final CountDownLatch signal = new CountDownLatch(1); uiThreadTestRule.runOnUiThread(new Runnable() { @Override public void run() { final Context context = InstrumentationRegistry...
1. Global test cases. Doesn't require any additional step to run.
verifyDeepPirate_ALLOW
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void run() { final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); new PiracyChecker(context) .enableFoldersCheck() .callback(new PiracyCheckerCallback() { ...
1. Global test cases. Doesn't require any additional step to run.
run
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void allow() { assertTrue("PiracyChecker OK", true); signal.countDown(); }
1. Global test cases. Doesn't require any additional step to run.
allow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void doNotAllow(@NotNull PiracyCheckerError error, @Nullable PirateApp app) { fail(error.toString()); signal.countDown(); }
1. Global test cases. Doesn't require any additional step to run.
doNotAllow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Test public void verifyDebug_DONTALLOW() throws Throwable { final CountDownLatch signal = new CountDownLatch(1); uiThreadTestRule.runOnUiThread(new Runnable() { @Override public void run() { final Context context = InstrumentationRegistry....
1. Global test cases. Doesn't require any additional step to run.
verifyDebug_DONTALLOW
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void run() { final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); new PiracyChecker(context) .enableDebugCheck() .callback(new PiracyCheckerCallback() { ...
1. Global test cases. Doesn't require any additional step to run.
run
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void allow() { fail("PiracyChecker FAILED: Tests are running on a debug build."); signal.countDown(); }
1. Global test cases. Doesn't require any additional step to run.
allow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void doNotAllow(@NotNull PiracyCheckerError error, @Nullable PirateApp app) { if (error == PiracyCheckerError.USING_DEBUG_APP) assertTrue("PiracyChecker OK", true); ...
1. Global test cases. Doesn't require any additional step to run.
doNotAllow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Test public void verifyEmulator_DONTALLOW() throws Throwable { final CountDownLatch signal = new CountDownLatch(1); uiThreadTestRule.runOnUiThread(new Runnable() { @Override public void run() { final Context context = InstrumentationRegist...
1. Global test cases. Doesn't require any additional step to run.
verifyEmulator_DONTALLOW
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void run() { final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); new PiracyChecker(context) .enableEmulatorCheck(false) .callback(new PiracyCheckerCallback() { ...
1. Global test cases. Doesn't require any additional step to run.
run
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void allow() { fail("PiracyChecker FAILED: Tests are running on an emulator."); signal.countDown(); }
1. Global test cases. Doesn't require any additional step to run.
allow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void doNotAllow(@NotNull PiracyCheckerError error, @Nullable PirateApp app) { if (error == PiracyCheckerError.USING_APP_IN_EMULATOR) assertTrue("PiracyChecker OK", true); ...
1. Global test cases. Doesn't require any additional step to run.
doNotAllow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Test public void verifyEmulatorDeep_DONTALLOW() throws Throwable { final CountDownLatch signal = new CountDownLatch(1); uiThreadTestRule.runOnUiThread(new Runnable() { @Override public void run() { final Context context = InstrumentationRe...
1. Global test cases. Doesn't require any additional step to run.
verifyEmulatorDeep_DONTALLOW
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void run() { final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); new PiracyChecker(context) .enableEmulatorCheck(true) .callback(new PiracyCheckerCallback() { ...
1. Global test cases. Doesn't require any additional step to run.
run
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void allow() { fail("PiracyChecker FAILED: Tests are running on an emulator."); signal.countDown(); }
1. Global test cases. Doesn't require any additional step to run.
allow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Override public void doNotAllow(@NotNull PiracyCheckerError error, @Nullable PirateApp app) { if (error == PiracyCheckerError.USING_APP_IN_EMULATOR) assertTrue("PiracyChecker OK", true); ...
1. Global test cases. Doesn't require any additional step to run.
doNotAllow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/PiracyCheckerTest.java
Apache-2.0
@Test public void verifyUnauthorizedCustomApp_ALLOW() throws Throwable { final CountDownLatch signal = new CountDownLatch(1); uiThreadTestRule.runOnUiThread(new Runnable() { @Override public void run() { final Context context = Instrumentat...
2. Specific test cases for unauthorized apps. Requires to install an unauthorized app before running this tests.
verifyUnauthorizedCustomApp_ALLOW
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
Apache-2.0
@Override public void run() { final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); new PiracyChecker(context) .addAppToCheck(new PirateApp("Demo", uiTh...
2. Specific test cases for unauthorized apps. Requires to install an unauthorized app before running this tests.
run
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
Apache-2.0
@Override public void allow() { assertTrue("PiracyChecker OK", true); signal.countDown(); }
2. Specific test cases for unauthorized apps. Requires to install an unauthorized app before running this tests.
allow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
Apache-2.0
@Override public void doNotAllow(@NotNull PiracyCheckerError error, @Nullable PirateApp app) { fail("PiracyChecker FAILED : PiracyCheckError is not " + error.toString()); ...
2. Specific test cases for unauthorized apps. Requires to install an unauthorized app before running this tests.
doNotAllow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
Apache-2.0
@Test public void verifyUnauthorizedCustomApp_DONTALLOW() throws Throwable { final CountDownLatch signal = new CountDownLatch(1); uiThreadTestRule.runOnUiThread(new Runnable() { @Override public void run() { final Context context = Instrume...
2. Specific test cases for unauthorized apps. Requires to install an unauthorized app before running this tests.
verifyUnauthorizedCustomApp_DONTALLOW
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
Apache-2.0
@Override public void run() { final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); new PiracyChecker(context) .addAppToCheck( new PirateApp("Demo", uiThreadTestRule.getActivity...
2. Specific test cases for unauthorized apps. Requires to install an unauthorized app before running this tests.
run
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
Apache-2.0
@Override public void allow() { fail("PiracyChecker FAILED: There is a custom unauthorized app " + "installed."); signal.countDown(); }
2. Specific test cases for unauthorized apps. Requires to install an unauthorized app before running this tests.
allow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
Apache-2.0
@Override public void doNotAllow(@NotNull PiracyCheckerError error, @Nullable PirateApp app) { if (error == PiracyCheckerError.PIRATE_APP_INSTALLED) assertTrue("PiracyChecker OK", true); ...
2. Specific test cases for unauthorized apps. Requires to install an unauthorized app before running this tests.
doNotAllow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
Apache-2.0
@Test public void verifyUnauthorizedApps_DONTALLOW() throws Throwable { final CountDownLatch signal = new CountDownLatch(1); uiThreadTestRule.runOnUiThread(new Runnable() { @Override public void run() { final Context context = Instrumentati...
2. Specific test cases for unauthorized apps. Requires to install an unauthorized app before running this tests.
verifyUnauthorizedApps_DONTALLOW
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
Apache-2.0
@Override public void run() { final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); new PiracyChecker(context) .enableUnauthorizedAppsCheck() .blockIfUnauthorizedAppUninstalled("pir...
2. Specific test cases for unauthorized apps. Requires to install an unauthorized app before running this tests.
run
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
Apache-2.0
@Override public void allow() { fail("PiracyChecker FAILED: There is an unauthorized app installed."); signal.countDown(); }
2. Specific test cases for unauthorized apps. Requires to install an unauthorized app before running this tests.
allow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
Apache-2.0
@Override public void doNotAllow(@NotNull PiracyCheckerError error, @Nullable PirateApp app) { if (error == PiracyCheckerError.PIRATE_APP_INSTALLED) assertTrue("PiracyChecker OK", true); ...
2. Specific test cases for unauthorized apps. Requires to install an unauthorized app before running this tests.
doNotAllow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java
Apache-2.0
@Test public void verifyBlockUnauthorizedApps_DONTALLOW() throws Throwable { final CountDownLatch signal = new CountDownLatch(1); uiThreadTestRule.runOnUiThread(new Runnable() { @Override public void run() { final Context context = Instrume...
3. Specific test cases for unauthorized apps. Requires to uninstall an unauthorized app before running this tests.
verifyBlockUnauthorizedApps_DONTALLOW
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppUninstalledTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppUninstalledTest.java
Apache-2.0
@Override public void run() { final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); new PiracyChecker(context) .enableUnauthorizedAppsCheck() .blockIfUnauthorizedAppUninstalled("pir...
3. Specific test cases for unauthorized apps. Requires to uninstall an unauthorized app before running this tests.
run
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppUninstalledTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppUninstalledTest.java
Apache-2.0
@Override public void allow() { fail("PiracyChecker FAILED: There was an unauthorized app installed " + "previously."); signal.countDown(); }
3. Specific test cases for unauthorized apps. Requires to uninstall an unauthorized app before running this tests.
allow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppUninstalledTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppUninstalledTest.java
Apache-2.0
@Override public void doNotAllow(@NotNull PiracyCheckerError error, @Nullable PirateApp app) { if (error == PiracyCheckerError.BLOCK_PIRATE_APP) assertTrue("PiracyChecker OK", true); ...
3. Specific test cases for unauthorized apps. Requires to uninstall an unauthorized app before running this tests.
doNotAllow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppUninstalledTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppUninstalledTest.java
Apache-2.0
@Test public void verifyUnauthorizedApps_ALLOW() throws Throwable { final CountDownLatch signal = new CountDownLatch(1); uiThreadTestRule.runOnUiThread(new Runnable() { @Override public void run() { final Context context = InstrumentationRe...
3. Specific test cases for unauthorized apps. Requires to uninstall an unauthorized app before running this tests.
verifyUnauthorizedApps_ALLOW
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppUninstalledTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppUninstalledTest.java
Apache-2.0
@Override public void run() { final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); new PiracyChecker(context) .enableUnauthorizedAppsCheck() .callback(new PiracyCheckerCallback() {...
3. Specific test cases for unauthorized apps. Requires to uninstall an unauthorized app before running this tests.
run
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppUninstalledTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppUninstalledTest.java
Apache-2.0
@Override public void allow() { assertTrue("PiracyChecker OK", true); signal.countDown(); }
3. Specific test cases for unauthorized apps. Requires to uninstall an unauthorized app before running this tests.
allow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppUninstalledTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppUninstalledTest.java
Apache-2.0
@Override public void doNotAllow(@NotNull PiracyCheckerError error, @Nullable PirateApp app) { fail(error.toString()); signal.countDown(); }
3. Specific test cases for unauthorized apps. Requires to uninstall an unauthorized app before running this tests.
doNotAllow
java
javiersantos/PiracyChecker
app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppUninstalledTest.java
https://github.com/javiersantos/PiracyChecker/blob/master/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppUninstalledTest.java
Apache-2.0
public String obfuscate(String original, String key) { if (original == null) { return null; } try { // Header is appended as an integrity check return Base64.encode(mEncryptor.doFinal((header + key + original).getBytes(UTF8))); } catch (UnsupportedEnco...
@param salt an array of random bytes to use for each (un)obfuscation @param applicationId application identifier, e.g. the package name @param deviceId device identifier. Use as many sources as possible to create this unique identifier.
obfuscate
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/AESObfuscator.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/AESObfuscator.java
Apache-2.0
public String unobfuscate(String obfuscated, String key) throws ValidationException { if (obfuscated == null) { return null; } try { String result = new String(mDecryptor.doFinal(Base64.decode(obfuscated)), UTF8); // Check for presence of header. This serves a...
@param salt an array of random bytes to use for each (un)obfuscation @param applicationId application identifier, e.g. the package name @param deviceId device identifier. Use as many sources as possible to create this unique identifier.
unobfuscate
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/AESObfuscator.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/AESObfuscator.java
Apache-2.0
public void resetPolicy() { mPreferences.putString(PREF_LAST_RESPONSE, Integer.toString(Policy.RETRY)); setRetryUntil(DEFAULT_RETRY_UNTIL); setMaxRetries(DEFAULT_MAX_RETRIES); setRetryCount(Long.parseLong(DEFAULT_RETRY_COUNT)); setValidityTimestamp(DEFAULT_VALIDITY_TIMESTAMP); ...
We call this to guarantee that we fetch a fresh policy from the server. This is to be used if the URL is invalid.
resetPolicy
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/APKExpansionPolicy.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/APKExpansionPolicy.java
Apache-2.0
private static PublicKey generatePublicKey(String encodedPublicKey) { try { byte[] decodedKey = Base64.decode(encodedPublicKey); KeyFactory keyFactory = KeyFactory.getInstance(KEY_FACTORY_ALGORITHM); return keyFactory.generatePublic(new X509EncodedKeySpec(decodedKey)); ...
Generates a PublicKey instance from a string containing the Base64-encoded public key. @param encodedPublicKey Base64-encoded public key @throws IllegalArgumentException if encodedPublicKey is invalid
generatePublicKey
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
Apache-2.0
private static String getVersionCode(Context context, String packageName) { try { return String.valueOf( context.getPackageManager().getPackageInfo(packageName, 0).versionCode); } catch (NameNotFoundException e) { Log.e(TAG, "Package not found. could not get versi...
Get version code for the application package name. @param packageName application package name @return the version code or empty string if package not found
getVersionCode
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
Apache-2.0
public synchronized void checkAccess(LibraryCheckerCallback callback) { // If we have a valid recent LICENSED response, we can skip asking // Market. if (mPolicy.allowAccess()) { Log.i(TAG, "Using cached license response"); callback.allow(Policy.LICENSED); } else ...
Checks if the user should have access to the app. Binds the service if necessary. <p> NOTE: This call uses a trivially obfuscated string (base64-encoded). For best security, we recommend obfuscating the string that is passed into bindService using another method of your own devising. <p> source string: "com.android.ven...
checkAccess
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
Apache-2.0
private void runChecks() { LibraryValidator validator; while ((validator = mPendingChecks.poll()) != null) { try { Log.i(TAG, "Calling checkLicense on service for " + validator.getPackageName()); mService.checkLicense( validator.getNonce(),...
Checks if the user should have access to the app. Binds the service if necessary. <p> NOTE: This call uses a trivially obfuscated string (base64-encoded). For best security, we recommend obfuscating the string that is passed into bindService using another method of your own devising. <p> source string: "com.android.ven...
runChecks
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
Apache-2.0
public synchronized void finishAllChecks() { for (LibraryValidator validator : mChecksInProgress) { try { finishCheck(validator); } catch (Exception ignored) { } } for (LibraryValidator validator : mPendingChecks) { try { ...
Checks if the user should have access to the app. Binds the service if necessary. <p> NOTE: This call uses a trivially obfuscated string (base64-encoded). For best security, we recommend obfuscating the string that is passed into bindService using another method of your own devising. <p> source string: "com.android.ven...
finishAllChecks
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
Apache-2.0
private synchronized void finishCheck(LibraryValidator validator) { mChecksInProgress.remove(validator); if (mChecksInProgress.isEmpty()) { cleanupService(); } }
Checks if the user should have access to the app. Binds the service if necessary. <p> NOTE: This call uses a trivially obfuscated string (base64-encoded). For best security, we recommend obfuscating the string that is passed into bindService using another method of your own devising. <p> source string: "com.android.ven...
finishCheck
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
Apache-2.0
public synchronized void onServiceConnected(ComponentName name, IBinder service) { mService = ILicensingService.Stub.asInterface(service); runChecks(); }
Checks if the user should have access to the app. Binds the service if necessary. <p> NOTE: This call uses a trivially obfuscated string (base64-encoded). For best security, we recommend obfuscating the string that is passed into bindService using another method of your own devising. <p> source string: "com.android.ven...
onServiceConnected
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
Apache-2.0
public synchronized void onServiceDisconnected(ComponentName name) { // Called when the connection with the service has been // unexpectedly disconnected. That is, Market crashed. // If there are any checks in progress, the timeouts will handle them. Log.w(TAG, "Service unexpectedly disc...
Checks if the user should have access to the app. Binds the service if necessary. <p> NOTE: This call uses a trivially obfuscated string (base64-encoded). For best security, we recommend obfuscating the string that is passed into bindService using another method of your own devising. <p> source string: "com.android.ven...
onServiceDisconnected
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
Apache-2.0
private synchronized void handleServiceConnectionError(LibraryValidator validator) { mPolicy.processServerResponse(Policy.RETRY, null); if (mPolicy.allowAccess()) { validator.getCallback().allow(Policy.RETRY); } else { validator.getCallback().dontAllow(Policy.RETRY); ...
Generates policy response for service connection errors, as a result of disconnections or timeouts.
handleServiceConnectionError
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
Apache-2.0
private void cleanupService() { if (mService != null) { try { mContext.unbindService(this); } catch (IllegalArgumentException e) { // Somehow we've already been unbound. This is a non-fatal error. Log.e(TAG, "Unable to unbind from licensing...
Unbinds service if necessary and removes reference to it.
cleanupService
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java
Apache-2.0
public LibraryCheckerCallback getCallback() { return mCallback; }
Contains data related to a licensing request and methods to check and process the response.
getCallback
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/LibraryValidator.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/LibraryValidator.java
Apache-2.0
public int getNonce() { return mNonce; }
Contains data related to a licensing request and methods to check and process the response.
getNonce
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/LibraryValidator.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/LibraryValidator.java
Apache-2.0
public String getPackageName() { return mPackageName; }
Contains data related to a licensing request and methods to check and process the response.
getPackageName
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/LibraryValidator.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/LibraryValidator.java
Apache-2.0
public void check(PublicKey publicKey, int responseCode, String signedData, Calendar calendar, String signature) { String userId = null; // Skip signature check for unsuccessful requests ResponseData data = null; if (calendar == null) { handleInvalidRes...
Verifies the response from server and calls appropriate callback method. @param publicKey public key associated with the developer account @param responseCode server response code @param signedData signed data from server @param signature server signature
check
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/LibraryValidator.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/LibraryValidator.java
Apache-2.0
private void handleResponse(int response, ResponseData rawData) { // Update policy data and increment retry counter (if needed) mPolicy.processServerResponse(response, rawData); // Given everything we know, including cached data, ask the policy if we should grant // access. if (...
Confers with policy and calls appropriate callback method.
handleResponse
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/LibraryValidator.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/LibraryValidator.java
Apache-2.0
@SuppressLint("CommitPrefEdits") public void putString(String key, String value) { if (mEditor == null) { mEditor = mPreferences.edit(); } String obfuscatedValue = mObfuscator.obfuscate(value, key); mEditor.putString(key, obfuscatedValue); }
Constructor. @param sp A SharedPreferences instance provided by the system. @param o The Obfuscator to use when reading or writing data.
putString
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/PreferenceObfuscator.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/PreferenceObfuscator.java
Apache-2.0
public String getString(String key, String defValue) { String result; String value = mPreferences.getString(key, null); if (value != null) { try { result = mObfuscator.unobfuscate(value, key); } catch (ValidationException e) { // Unable to ...
Constructor. @param sp A SharedPreferences instance provided by the system. @param o The Obfuscator to use when reading or writing data.
getString
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/PreferenceObfuscator.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/PreferenceObfuscator.java
Apache-2.0
public void commit() { if (mEditor != null) { mEditor.commit(); mEditor = null; } }
Constructor. @param sp A SharedPreferences instance provided by the system. @param o The Obfuscator to use when reading or writing data.
commit
java
javiersantos/PiracyChecker
library/src/main/java/com/github/javiersantos/licensing/PreferenceObfuscator.java
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/PreferenceObfuscator.java
Apache-2.0