Skip to content

Commit

Permalink
Add destroy for LVL checker
Browse files Browse the repository at this point in the history
  • Loading branch information
javiersantos committed Mar 19, 2017
1 parent e6538bc commit ae6fffb
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class PiracyChecker {

protected static final String LIBRARY_PREFERENCES_NAME = "license_check";

// Library configuration/customizations
protected Context context;
protected String unlicensedDialogTitle;
protected String unlicensedDialogDescription;
Expand All @@ -54,6 +55,10 @@ public class PiracyChecker {
protected List<InstallerID> installerIDs;
protected PiracyCheckerCallback callback;

// LVL
protected LibraryChecker libraryLVLChecker;


public PiracyChecker(Context context) {
this(context, context.getString(R.string.app_unlicensed), context.getString(R.string.app_unlicensed_description));
}
Expand Down Expand Up @@ -198,6 +203,12 @@ public PiracyChecker callback(PiracyCheckerCallback callback) {
return this;
}

public void destroy() {
if (libraryLVLChecker != null) {
libraryLVLChecker.onDestroy();
}
}

public void start() {
if (callback != null) {
verify(callback);
Expand Down Expand Up @@ -248,10 +259,10 @@ protected void verify(final PiracyCheckerCallback verifyCallback) {
if (enableLVL) {
String deviceId = Settings.Secure.getString(context.getContentResolver(),
Settings.Secure.ANDROID_ID);
LibraryChecker libraryChecker = new LibraryChecker(context, new
libraryLVLChecker = new LibraryChecker(context, new
ServerManagedPolicy(context, new AESObfuscator(LibraryUtils.SALT, context
.getPackageName(), deviceId)), licenseBase64);
libraryChecker.checkAccess(new LibraryCheckerCallback() {
libraryLVLChecker.checkAccess(new LibraryCheckerCallback() {
@Override
public void allow(int reason) {
doExtraVerification(verifyCallback, true);
Expand Down

0 comments on commit ae6fffb

Please sign in to comment.