Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Verified Commit fffa00a8 authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

Complete IInAppBillingService interface

parent c34c17b4
Loading
Loading
Loading
Loading
+15 −1
Original line number Original line Diff line number Diff line
@@ -185,5 +185,19 @@ interface IInAppBillingService {
    Bundle getBuyIntentToReplaceSkus(int apiVersion, String packageName,
    Bundle getBuyIntentToReplaceSkus(int apiVersion, String packageName,
        in List<String> oldSkus, String newSku, String type, String developerPayload) = 6;
        in List<String> oldSkus, String newSku, String type, String developerPayload) = 6;


    Bundle queryPurchases(int apiVersion, String packageName, String type, String continuationToken, in Bundle extras) = 10;
    Bundle getBuyIntentV6(int apiVersion, String packageName, String sku, String type, String developerPayload, in Bundle extras) = 7;

    Bundle getPurchasesV6(int apiVersion, String packageName, String type, String continuationToken, in Bundle extras) = 8;

    int isBillingSupportedV7(int apiVersion, String packageName, String type, in Bundle extras) = 9;

    Bundle getPurchasesV9(int apiVersion, String packageName, String type, String continuationToken, in Bundle extras) = 10;

    Bundle consumePurchaseV9(int apiVersion, String packageName, String purchaseToken, in Bundle extras) = 11;

    Bundle getPriceChangeConfirmationIntent(int apiVersion, String packageName, String sku, String type, in Bundle extras) = 800;

    Bundle getSkuDetailsV10(int apiVersion, String packageName, String type, in Bundle skuBundle, in Bundle extras) = 900;

    Bundle acknowledgePurchase(int apiVersion, String packageName, String purchaseToken, in Bundle extras) = 901;
}
}
+53 −16
Original line number Original line Diff line number Diff line
@@ -20,21 +20,39 @@ public class InAppBillingService extends Service {
    private final IInAppBillingService.Stub mInAppBillingService = new IInAppBillingService.Stub() {
    private final IInAppBillingService.Stub mInAppBillingService = new IInAppBillingService.Stub() {
        @Override
        @Override
        public int isBillingSupported(int apiVersion, String packageName, String type) throws RemoteException {
        public int isBillingSupported(int apiVersion, String packageName, String type) throws RemoteException {
            Log.d(TAG, "isBillingSupported(" + apiVersion + ", " + packageName + ", " + type + ")");
            return isBillingSupportedV7(apiVersion, packageName, type, new Bundle());
            return 0;
        }
        }


        @Override
        @Override
        public Bundle getSkuDetails(int apiVersion, String packageName, String type, Bundle skusBundle) throws RemoteException {
        public Bundle getSkuDetails(int apiVersion, String packageName, String type, Bundle skusBundle) throws RemoteException {
            Log.d(TAG, "getSkuDetails(" + apiVersion + ", " + packageName + ", " + type + ")");
            return getSkuDetailsV10(apiVersion, packageName, type, skusBundle, new Bundle());
        }

        @Override
        public Bundle getBuyIntent(int apiVersion, String packageName, String sku, String type, String developerPayload) throws RemoteException {
            return getBuyIntentV6(apiVersion, packageName, sku, type, developerPayload, new Bundle());
        }

        @Override
        public Bundle getPurchases(int apiVersion, String packageName, String type, String continuationToken) throws RemoteException {
            return getPurchasesV6(apiVersion, packageName, type, continuationToken, new Bundle());
        }

        @Override
        public int consumePurchase(int apiVersion, String packageName, String purchaseToken) throws RemoteException {
            return consumePurchaseV9(apiVersion, packageName, purchaseToken, new Bundle()).getInt("RESPONSE_CODE", 8);
        }

        @Override
        public Bundle getBuyIntentToReplaceSkus(int apiVersion, String packageName, List<String> oldSkus, String newSku, String type, String developerPayload) throws RemoteException {
            Log.d(TAG, "getBuyIntentToReplaceSkus(" + apiVersion + ", " + packageName + ", " + newSku + ", " + type + ", " + developerPayload + ")");
            Bundle data = new Bundle();
            Bundle data = new Bundle();
            data.putInt("RESPONSE_CODE", 0);
            data.putInt("RESPONSE_CODE", 4);
            data.putStringArrayList("DETAILS_LIST", new ArrayList<String>());
            return data;
            return data;
        }
        }


        @Override
        @Override
        public Bundle getBuyIntent(int apiVersion, String packageName, String sku, String type, String developerPayload) throws RemoteException {
        public Bundle getBuyIntentV6(int apiVersion, String packageName, String sku, String type, String developerPayload, Bundle extras) throws RemoteException {
            Log.d(TAG, "getBuyIntent(" + apiVersion + ", " + packageName + ", " + sku + ", " + type + ", " + developerPayload + ")");
            Log.d(TAG, "getBuyIntent(" + apiVersion + ", " + packageName + ", " + sku + ", " + type + ", " + developerPayload + ")");
            Bundle data = new Bundle();
            Bundle data = new Bundle();
            data.putInt("RESPONSE_CODE", 4);
            data.putInt("RESPONSE_CODE", 4);
@@ -42,7 +60,18 @@ public class InAppBillingService extends Service {
        }
        }


        @Override
        @Override
        public Bundle getPurchases(int apiVersion, String packageName, String type, String continuationToken) throws RemoteException {
        public Bundle getPurchasesV6(int apiVersion, String packageName, String type, String continuationToken, Bundle extras) throws RemoteException {
            return getPurchasesV9(apiVersion, packageName, type, continuationToken, extras);
        }

        @Override
        public int isBillingSupportedV7(int apiVersion, String packageName, String type, Bundle extras) throws RemoteException {
            Log.d(TAG, "isBillingSupported(" + apiVersion + ", " + packageName + ", " + type + ")");
            return 0;
        }

        @Override
        public Bundle getPurchasesV9(int apiVersion, String packageName, String type, String continuationToken, Bundle extras) throws RemoteException {
            Log.d(TAG, "getPurchases(" + apiVersion + ", " + packageName + ", " + type + ", " + continuationToken + ")");
            Log.d(TAG, "getPurchases(" + apiVersion + ", " + packageName + ", " + type + ", " + continuationToken + ")");
            Bundle data = new Bundle();
            Bundle data = new Bundle();
            data.putInt("RESPONSE_CODE", 0);
            data.putInt("RESPONSE_CODE", 0);
@@ -53,27 +82,35 @@ public class InAppBillingService extends Service {
        }
        }


        @Override
        @Override
        public int consumePurchase(int apiVersion, String packageName, String purchaseToken) throws RemoteException {
        public Bundle consumePurchaseV9(int apiVersion, String packageName, String purchaseToken, Bundle extras) throws RemoteException {
            Log.d(TAG, "consumePurchase(" + apiVersion + ", " + packageName + ", " + purchaseToken + ")");
            Log.d(TAG, "consumePurchase(" + apiVersion + ", " + packageName + ", " + purchaseToken + ")");
            return 8;
            Bundle data = new Bundle();
            data.putInt("RESPONSE_CODE", 8);
            return data;
        }
        }


        @Override
        @Override
        public Bundle getBuyIntentToReplaceSkus(int apiVersion, String packageName, List<String> oldSkus, String newSku, String type, String developerPayload) throws RemoteException {
        public Bundle getPriceChangeConfirmationIntent(int apiVersion, String packageName, String sku, String type, Bundle extras) throws RemoteException {
            Log.d(TAG, "getBuyIntentToReplaceSkus(" + apiVersion + ", " + packageName + ", " + newSku + ", " + type + ", " + developerPayload + ")");
            Log.d(TAG, "getPriceChangeConfirmationIntent(" + apiVersion + ", " + packageName + ", " + sku + ", " + type + ")");
            Bundle data = new Bundle();
            Bundle data = new Bundle();
            data.putInt("RESPONSE_CODE", 4);
            data.putInt("RESPONSE_CODE", 4);
            return data;
            return data;
        }
        }


        @Override
        @Override
        public Bundle queryPurchases(int apiVersion, String packageName, String type, String continuationToken, Bundle extras) throws RemoteException {
        public Bundle getSkuDetailsV10(int apiVersion, String packageName, String type, Bundle skuBundle, Bundle extras) throws RemoteException {
            Log.d(TAG, "queryPurchases(" + apiVersion + ", " + packageName + ", " + type + ", " + continuationToken + ")");
            Log.d(TAG, "getSkuDetails(" + apiVersion + ", " + packageName + ", " + type + ")");
            Bundle data = new Bundle();
            Bundle data = new Bundle();
            data.putInt("RESPONSE_CODE", 0);
            data.putInt("RESPONSE_CODE", 0);
            data.putStringArrayList("INAPP_PURCHASE_ITEM_LIST", new ArrayList<String>());
            data.putStringArrayList("DETAILS_LIST", new ArrayList<String>());
            data.putStringArrayList("INAPP_PURCHASE_DATA_LIST", new ArrayList<String>());
            return data;
            data.putStringArrayList("INAPP_DATA_SIGNATURE_LIST", new ArrayList<String>());
        }

        @Override
        public Bundle acknowledgePurchase(int apiVersion, String packageName, String purchaseToken, Bundle extras) throws RemoteException {
            Log.d(TAG, "acknowledgePurchase(" + apiVersion + ", " + packageName + ", " + purchaseToken + ")");
            Bundle data = new Bundle();
            data.putInt("RESPONSE_CODE", 8);
            return data;
            return data;
        }
        }