Skip to content

Commit d1c5323

Browse files
committed
Include ResponseData, signed data and signature to allow server-side use
1 parent 89ebdfc commit d1c5323

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lvl_library/src/main/java/com/google/android/vending/licensing/LicenseChecker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public synchronized void checkAccess(LicenseCheckerCallback callback) {
142142
// Market.
143143
if (mPolicy.allowAccess()) {
144144
Log.i(TAG, "Using cached license response");
145-
callback.allow(Policy.LICENSED);
145+
callback.allow(Policy.LICENSED, null, null, null);
146146
} else {
147147
LicenseValidator validator = new LicenseValidator(mPolicy, new NullDeviceLimiter(),
148148
callback, generateNonce(), mPackageName, mVersionCode);
@@ -337,7 +337,7 @@ private synchronized void handleServiceConnectionError(LicenseValidator validato
337337
mPolicy.processServerResponse(Policy.RETRY, null);
338338

339339
if (mPolicy.allowAccess()) {
340-
validator.getCallback().allow(Policy.RETRY);
340+
validator.getCallback().allow(Policy.RETRY, null, null, null);
341341
} else {
342342
validator.getCallback().dontAllow(Policy.RETRY);
343343
}

lvl_library/src/main/java/com/google/android/vending/licensing/LicenseCheckerCallback.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public interface LicenseCheckerCallback {
4040
* @param reason Policy.LICENSED or Policy.RETRY typically. (although in
4141
* theory the policy can return Policy.NOT_LICENSED here as well)
4242
*/
43-
public void allow(int reason);
43+
public void allow(int reason, ResponseData data, String signedData, String signature);
4444

4545
/**
4646
* Don't allow use. App should inform user and take appropriate action.

lvl_library/src/main/java/com/google/android/vending/licensing/LicenseValidator.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,22 +170,22 @@ public void verify(PublicKey publicKey, int responseCode, String signedData, Str
170170
case LICENSED:
171171
case LICENSED_OLD_KEY:
172172
int limiterResponse = mDeviceLimiter.isDeviceAllowed(userId);
173-
handleResponse(limiterResponse, data);
173+
handleResponse(limiterResponse, data, signedData, signature);
174174
break;
175175
case NOT_LICENSED:
176-
handleResponse(Policy.NOT_LICENSED, data);
176+
handleResponse(Policy.NOT_LICENSED, data, signedData, signature);
177177
break;
178178
case ERROR_CONTACTING_SERVER:
179179
Log.w(TAG, "Error contacting licensing server.");
180-
handleResponse(Policy.RETRY, data);
180+
handleResponse(Policy.RETRY, data, signedData, signature);
181181
break;
182182
case ERROR_SERVER_FAILURE:
183183
Log.w(TAG, "An error has occurred on the licensing server.");
184-
handleResponse(Policy.RETRY, data);
184+
handleResponse(Policy.RETRY, data, signedData, signature);
185185
break;
186186
case ERROR_OVER_QUOTA:
187187
Log.w(TAG, "Licensing server is refusing to talk to this device, over quota.");
188-
handleResponse(Policy.RETRY, data);
188+
handleResponse(Policy.RETRY, data, signedData, signature);
189189
break;
190190
case ERROR_INVALID_PACKAGE_NAME:
191191
handleApplicationError(LicenseCheckerCallback.ERROR_INVALID_PACKAGE_NAME);
@@ -208,14 +208,14 @@ public void verify(PublicKey publicKey, int responseCode, String signedData, Str
208208
* @param response
209209
* @param rawData
210210
*/
211-
private void handleResponse(int response, ResponseData rawData) {
211+
private void handleResponse(int response, ResponseData rawData, String signedData, String signature) {
212212
// Update policy data and increment retry counter (if needed)
213213
mPolicy.processServerResponse(response, rawData);
214214

215215
// Given everything we know, including cached data, ask the policy if we should grant
216216
// access.
217217
if (mPolicy.allowAccess()) {
218-
mCallback.allow(response);
218+
mCallback.allow(response, rawData, signedData, signature);
219219
} else {
220220
mCallback.dontAllow(response);
221221
}

0 commit comments

Comments
 (0)