Google Play服务器在许可响应中返回的响应代码(值)是多少?

Jam*_*mes 5 android android-lvl

我想在我的Android许可证政策中满足LICENSE_OLD_KEY.我打算修改ServerManagedPolicy它,因为它不适合这个,据我所知,它似乎只是寻找Policy.LICENSEDPolicy.NOT_LICENSEDprocessServerResponse方法:

public void processServerResponse(int response, ResponseData rawData) {

    // Update retry counter
    if (response != Policy.RETRY) {
        setRetryCount(0);
    } else {
        setRetryCount(mRetryCount + 1);
    }

    if (response == Policy.LICENSED) {
        // Update server policy data
        Map<String, String> extras = decodeExtras(rawData.extra);
        mLastResponse = response;
        setValidityTimestamp(extras.get("VT"));
        setRetryUntil(extras.get("GT"));
        setMaxRetries(extras.get("GR"));
    } else if (response == Policy.NOT_LICENSED) {
        // Clear out stale policy data
        setValidityTimestamp(DEFAULT_VALIDITY_TIMESTAMP);
        setRetryUntil(DEFAULT_RETRY_UNTIL);
        setMaxRetries(DEFAULT_MAX_RETRIES);
    }

    setLastResponse(response);
    mPreferences.commit();
}
Run Code Online (Sandbox Code Playgroud)

我想知道LICENSE_OLD_KEY的响应代码是什么,因为Policy中不存在:

public static final int LICENSED = 0x0100;
public static final int NOT_LICENSED = 0x0231;
public static final int RETRY = 0x0123;
Run Code Online (Sandbox Code Playgroud)

我看了一下这里,但我找不到列出名称和值的任何地方.

我可以看到LicenseValidator中有一个服务器响应代码列表,但它们与Policy中的响应代码不匹配:

    // Server response codes.
private static final int LICENSED = 0x0;
private static final int NOT_LICENSED = 0x1;
private static final int LICENSED_OLD_KEY = 0x2;
private static final int ERROR_NOT_MARKET_MANAGED = 0x3;
private static final int ERROR_SERVER_FAILURE = 0x4;
private static final int ERROR_OVER_QUOTA = 0x5;

private static final int ERROR_CONTACTING_SERVER = 0x101;
private static final int ERROR_INVALID_PACKAGE_NAME = 0x102;
private static final int ERROR_NON_MATCHING_UID = 0x103;
Run Code Online (Sandbox Code Playgroud)

Jam*_*mes 5

考虑一下我决定尝试使用AlertDialog在手机上显示Google Play服务器返回的原因代码.这是我发现的:

在开发人员控制台配置文件中选择LICENSED,返回数字256,按照Policy.LICENSED.

选择NOT_LICENSED返回数字561,再次按照Policy.NOT_LICENSED.

最后选择LICENSED_OLD_KEY返回数字256,这与数字相同Policy.LICENSED.

因此,似乎不再使用LICENSED_OLD_KEY,或者说LICENSED和LICENSED_OLD_KEY之间没有区别.这是一个有点混乱给出的信息,谷歌在其文档中提供了这里.

请注意,我尝试卸载我的应用程序并在开发人员控制台中选择不同的选项几次,但它总是得到相同的答案!