From 7fabfd402f235ebcf64cfde3b399b8b62b969243 Mon Sep 17 00:00:00 2001 From: fhuya Date: Mon, 2 Sep 2019 17:31:51 -0700 Subject: Split the Android platform java logic into an Android library module (`lib`) and an application module (`app`). The application module `app` serves double duties of providing the prebuilt Godot binaries ('android_debug.apk', 'android_release.apk') and the Godot custom build template ('android_source.zip'). --- platform/android/java/lib/AndroidManifest.xml | 19 + platform/android/java/lib/CMakeLists.txt | 18 + platform/android/java/lib/THIRDPARTY.md | 39 + .../vending/billing/IInAppBillingService.aidl | 281 ++++ .../vending/licensing/ILicenseResultListener.aidl | 21 + .../vending/licensing/ILicensingService.aidl | 23 + platform/android/java/lib/build.gradle | 91 ++ ...ogle.android.vending.expansion.downloader.patch | 300 +++++ .../com.google.android.vending.licensing.patch | 42 + .../notify_panel_notification_icon_bg.png | Bin 0 -> 1843 bytes .../notify_panel_notification_icon_bg.png | Bin 0 -> 718 bytes .../android/java/lib/res/drawable-nodpi/icon.png | Bin 0 -> 7569 bytes .../notify_panel_notification_icon_bg.png | Bin 0 -> 462 bytes .../notify_panel_notification_icon_bg.png | Bin 0 -> 2830 bytes .../java/lib/res/layout/downloading_expansion.xml | 165 +++ .../status_bar_ongoing_event_progress_bar.xml | 108 ++ .../android/java/lib/res/values-ar/strings.xml | 4 + .../android/java/lib/res/values-bg/strings.xml | 4 + .../android/java/lib/res/values-ca/strings.xml | 4 + .../android/java/lib/res/values-cs/strings.xml | 4 + .../android/java/lib/res/values-da/strings.xml | 4 + .../android/java/lib/res/values-de/strings.xml | 4 + .../android/java/lib/res/values-el/strings.xml | 4 + .../android/java/lib/res/values-en/strings.xml | 4 + .../android/java/lib/res/values-es-rES/strings.xml | 4 + .../android/java/lib/res/values-es/strings.xml | 4 + .../android/java/lib/res/values-fa/strings.xml | 15 + .../android/java/lib/res/values-fi/strings.xml | 4 + .../android/java/lib/res/values-fr/strings.xml | 4 + .../android/java/lib/res/values-hi/strings.xml | 4 + .../android/java/lib/res/values-hr/strings.xml | 4 + .../android/java/lib/res/values-hu/strings.xml | 4 + .../android/java/lib/res/values-in/strings.xml | 4 + .../android/java/lib/res/values-it/strings.xml | 4 + .../android/java/lib/res/values-iw/strings.xml | 4 + .../android/java/lib/res/values-ja/strings.xml | 4 + .../android/java/lib/res/values-ko/strings.xml | 55 + .../android/java/lib/res/values-lt/strings.xml | 4 + .../android/java/lib/res/values-lv/strings.xml | 4 + .../android/java/lib/res/values-nb/strings.xml | 4 + .../android/java/lib/res/values-nl/strings.xml | 4 + .../android/java/lib/res/values-pl/strings.xml | 4 + .../android/java/lib/res/values-pt/strings.xml | 4 + .../android/java/lib/res/values-ro/strings.xml | 4 + .../android/java/lib/res/values-ru/strings.xml | 4 + .../android/java/lib/res/values-sk/strings.xml | 4 + .../android/java/lib/res/values-sl/strings.xml | 4 + .../android/java/lib/res/values-sr/strings.xml | 4 + .../android/java/lib/res/values-sv/strings.xml | 4 + .../android/java/lib/res/values-th/strings.xml | 4 + .../android/java/lib/res/values-tl/strings.xml | 4 + .../android/java/lib/res/values-tr/strings.xml | 4 + .../android/java/lib/res/values-uk/strings.xml | 4 + .../android/java/lib/res/values-vi/strings.xml | 4 + .../android/java/lib/res/values-zh-rCN/strings.xml | 4 + .../android/java/lib/res/values-zh-rHK/strings.xml | 4 + .../android/java/lib/res/values-zh-rTW/strings.xml | 4 + platform/android/java/lib/res/values/strings.xml | 55 + platform/android/java/lib/res/values/styles.xml | 25 + .../vending/expansion/downloader/Constants.java | 236 ++++ .../expansion/downloader/DownloadProgressInfo.java | 80 ++ .../downloader/DownloaderClientMarshaller.java | 297 +++++ .../downloader/DownloaderServiceMarshaller.java | 201 +++ .../vending/expansion/downloader/Helpers.java | 367 ++++++ .../expansion/downloader/IDownloaderClient.java | 126 ++ .../expansion/downloader/IDownloaderService.java | 83 ++ .../vending/expansion/downloader/IStub.java | 41 + .../vending/expansion/downloader/SystemFacade.java | 129 ++ .../downloader/impl/CustomIntentService.java | 112 ++ .../expansion/downloader/impl/DownloadInfo.java | 92 ++ .../downloader/impl/DownloadNotification.java | 229 ++++ .../expansion/downloader/impl/DownloadThread.java | 852 +++++++++++++ .../downloader/impl/DownloaderService.java | 1346 ++++++++++++++++++++ .../expansion/downloader/impl/DownloadsDB.java | 510 ++++++++ .../expansion/downloader/impl/HttpDateTime.java | 200 +++ .../android/vending/licensing/AESObfuscator.java | 110 ++ .../vending/licensing/APKExpansionPolicy.java | 414 ++++++ .../android/vending/licensing/DeviceLimiter.java | 47 + .../android/vending/licensing/LicenseChecker.java | 389 ++++++ .../vending/licensing/LicenseCheckerCallback.java | 67 + .../vending/licensing/LicenseValidator.java | 231 ++++ .../vending/licensing/NullDeviceLimiter.java | 32 + .../android/vending/licensing/Obfuscator.java | 48 + .../google/android/vending/licensing/Policy.java | 65 + .../vending/licensing/PreferenceObfuscator.java | 80 ++ .../android/vending/licensing/ResponseData.java | 81 ++ .../vending/licensing/ServerManagedPolicy.java | 300 +++++ .../android/vending/licensing/StrictPolicy.java | 100 ++ .../vending/licensing/ValidationException.java | 33 + .../android/vending/licensing/util/Base64.java | 578 +++++++++ .../licensing/util/Base64DecoderException.java | 32 + .../vending/licensing/util/URIQueryDecoder.java | 60 + .../lib/src/org/godotengine/godot/Dictionary.java | 81 ++ .../java/lib/src/org/godotengine/godot/Godot.java | 1111 ++++++++++++++++ .../godot/GodotDownloaderAlarmReceiver.java | 59 + .../godotengine/godot/GodotDownloaderService.java | 84 ++ .../lib/src/org/godotengine/godot/GodotIO.java | 631 +++++++++ .../godotengine/godot/GodotInstrumentation.java | 50 + .../lib/src/org/godotengine/godot/GodotLib.java | 214 ++++ .../src/org/godotengine/godot/GodotPaymentV3.java | 230 ++++ .../src/org/godotengine/godot/GodotRenderer.java | 61 + .../lib/src/org/godotengine/godot/GodotView.java | 170 +++ .../org/godotengine/godot/input/GodotEditText.java | 171 +++ .../godotengine/godot/input/GodotInputHandler.java | 360 ++++++ .../godot/input/GodotTextInputWrapper.java | 150 +++ .../godot/input/InputManagerCompat.java | 135 ++ .../godotengine/godot/input/InputManagerV16.java | 102 ++ .../src/org/godotengine/godot/input/Joystick.java | 44 + .../godotengine/godot/payments/ConsumeTask.java | 116 ++ .../godot/payments/HandlePurchaseTask.java | 93 ++ .../godotengine/godot/payments/PaymentsCache.java | 72 ++ .../godot/payments/PaymentsManager.java | 419 ++++++ .../godotengine/godot/payments/PurchaseTask.java | 118 ++ .../godot/payments/ReleaseAllConsumablesTask.java | 141 ++ .../godotengine/godot/payments/ValidateTask.java | 142 +++ .../lib/src/org/godotengine/godot/utils/Crypt.java | 69 + .../godot/utils/CustomSSLSocketFactory.java | 69 + .../src/org/godotengine/godot/utils/GLUtils.java | 157 +++ .../org/godotengine/godot/utils/HttpRequester.java | 227 ++++ .../org/godotengine/godot/utils/RequestParams.java | 85 ++ .../lib/src/org/godotengine/godot/xr/XRMode.java | 51 + .../godotengine/godot/xr/ovr/OvrConfigChooser.java | 112 ++ .../godot/xr/ovr/OvrContextFactory.java | 58 + .../godot/xr/ovr/OvrWindowSurfaceFactory.java | 60 + .../godot/xr/regular/RegularConfigChooser.java | 151 +++ .../godot/xr/regular/RegularContextFactory.java | 81 ++ .../xr/regular/RegularFallbackConfigChooser.java | 61 + 127 files changed, 14916 insertions(+) create mode 100644 platform/android/java/lib/AndroidManifest.xml create mode 100644 platform/android/java/lib/CMakeLists.txt create mode 100644 platform/android/java/lib/THIRDPARTY.md create mode 100644 platform/android/java/lib/aidl/com/android/vending/billing/IInAppBillingService.aidl create mode 100644 platform/android/java/lib/aidl/com/android/vending/licensing/ILicenseResultListener.aidl create mode 100644 platform/android/java/lib/aidl/com/android/vending/licensing/ILicensingService.aidl create mode 100644 platform/android/java/lib/build.gradle create mode 100644 platform/android/java/lib/patches/com.google.android.vending.expansion.downloader.patch create mode 100644 platform/android/java/lib/patches/com.google.android.vending.licensing.patch create mode 100644 platform/android/java/lib/res/drawable-hdpi/notify_panel_notification_icon_bg.png create mode 100644 platform/android/java/lib/res/drawable-mdpi/notify_panel_notification_icon_bg.png create mode 100644 platform/android/java/lib/res/drawable-nodpi/icon.png create mode 100644 platform/android/java/lib/res/drawable-xhdpi/notify_panel_notification_icon_bg.png create mode 100644 platform/android/java/lib/res/drawable-xxhdpi/notify_panel_notification_icon_bg.png create mode 100644 platform/android/java/lib/res/layout/downloading_expansion.xml create mode 100644 platform/android/java/lib/res/layout/status_bar_ongoing_event_progress_bar.xml create mode 100644 platform/android/java/lib/res/values-ar/strings.xml create mode 100644 platform/android/java/lib/res/values-bg/strings.xml create mode 100644 platform/android/java/lib/res/values-ca/strings.xml create mode 100644 platform/android/java/lib/res/values-cs/strings.xml create mode 100644 platform/android/java/lib/res/values-da/strings.xml create mode 100644 platform/android/java/lib/res/values-de/strings.xml create mode 100644 platform/android/java/lib/res/values-el/strings.xml create mode 100644 platform/android/java/lib/res/values-en/strings.xml create mode 100644 platform/android/java/lib/res/values-es-rES/strings.xml create mode 100644 platform/android/java/lib/res/values-es/strings.xml create mode 100644 platform/android/java/lib/res/values-fa/strings.xml create mode 100644 platform/android/java/lib/res/values-fi/strings.xml create mode 100644 platform/android/java/lib/res/values-fr/strings.xml create mode 100644 platform/android/java/lib/res/values-hi/strings.xml create mode 100644 platform/android/java/lib/res/values-hr/strings.xml create mode 100644 platform/android/java/lib/res/values-hu/strings.xml create mode 100644 platform/android/java/lib/res/values-in/strings.xml create mode 100644 platform/android/java/lib/res/values-it/strings.xml create mode 100644 platform/android/java/lib/res/values-iw/strings.xml create mode 100644 platform/android/java/lib/res/values-ja/strings.xml create mode 100644 platform/android/java/lib/res/values-ko/strings.xml create mode 100644 platform/android/java/lib/res/values-lt/strings.xml create mode 100644 platform/android/java/lib/res/values-lv/strings.xml create mode 100644 platform/android/java/lib/res/values-nb/strings.xml create mode 100644 platform/android/java/lib/res/values-nl/strings.xml create mode 100644 platform/android/java/lib/res/values-pl/strings.xml create mode 100644 platform/android/java/lib/res/values-pt/strings.xml create mode 100644 platform/android/java/lib/res/values-ro/strings.xml create mode 100644 platform/android/java/lib/res/values-ru/strings.xml create mode 100644 platform/android/java/lib/res/values-sk/strings.xml create mode 100644 platform/android/java/lib/res/values-sl/strings.xml create mode 100644 platform/android/java/lib/res/values-sr/strings.xml create mode 100644 platform/android/java/lib/res/values-sv/strings.xml create mode 100644 platform/android/java/lib/res/values-th/strings.xml create mode 100644 platform/android/java/lib/res/values-tl/strings.xml create mode 100644 platform/android/java/lib/res/values-tr/strings.xml create mode 100644 platform/android/java/lib/res/values-uk/strings.xml create mode 100644 platform/android/java/lib/res/values-vi/strings.xml create mode 100644 platform/android/java/lib/res/values-zh-rCN/strings.xml create mode 100644 platform/android/java/lib/res/values-zh-rHK/strings.xml create mode 100644 platform/android/java/lib/res/values-zh-rTW/strings.xml create mode 100644 platform/android/java/lib/res/values/strings.xml create mode 100644 platform/android/java/lib/res/values/styles.xml create mode 100644 platform/android/java/lib/src/com/google/android/vending/expansion/downloader/Constants.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/expansion/downloader/DownloadProgressInfo.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/expansion/downloader/DownloaderClientMarshaller.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/expansion/downloader/DownloaderServiceMarshaller.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/expansion/downloader/Helpers.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/expansion/downloader/IDownloaderClient.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/expansion/downloader/IDownloaderService.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/expansion/downloader/IStub.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/expansion/downloader/SystemFacade.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/CustomIntentService.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadInfo.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadThread.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloaderService.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadsDB.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/HttpDateTime.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/AESObfuscator.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/APKExpansionPolicy.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/DeviceLimiter.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/LicenseChecker.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/LicenseCheckerCallback.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/LicenseValidator.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/NullDeviceLimiter.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/Obfuscator.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/Policy.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/PreferenceObfuscator.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/ResponseData.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/ServerManagedPolicy.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/StrictPolicy.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/ValidationException.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/util/Base64.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/util/Base64DecoderException.java create mode 100644 platform/android/java/lib/src/com/google/android/vending/licensing/util/URIQueryDecoder.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/Dictionary.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/Godot.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/GodotDownloaderService.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/GodotIO.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/GodotInstrumentation.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/GodotLib.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/GodotPaymentV3.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/GodotRenderer.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/GodotView.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/input/GodotTextInputWrapper.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/input/InputManagerCompat.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/input/InputManagerV16.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/input/Joystick.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/payments/ConsumeTask.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/payments/HandlePurchaseTask.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/payments/PaymentsCache.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/payments/PaymentsManager.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/payments/PurchaseTask.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/payments/ValidateTask.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/utils/Crypt.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/utils/GLUtils.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/utils/HttpRequester.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/utils/RequestParams.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/xr/XRMode.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrConfigChooser.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrContextFactory.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrWindowSurfaceFactory.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java create mode 100644 platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularFallbackConfigChooser.java (limited to 'platform/android/java/lib') diff --git a/platform/android/java/lib/AndroidManifest.xml b/platform/android/java/lib/AndroidManifest.xml new file mode 100644 index 0000000000..517fc403b2 --- /dev/null +++ b/platform/android/java/lib/AndroidManifest.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + diff --git a/platform/android/java/lib/CMakeLists.txt b/platform/android/java/lib/CMakeLists.txt new file mode 100644 index 0000000000..d3bdf6a5f2 --- /dev/null +++ b/platform/android/java/lib/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.6) +project(godot) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +set(GODOT_ROOT_DIR ../../../..) + +# Get sources +file(GLOB_RECURSE SOURCES ${GODOT_ROOT_DIR}/*.c**) +file(GLOB_RECURSE HEADERS ${GODOT_ROOT_DIR}/*.h**) + +add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS}) +target_include_directories(${PROJECT_NAME} + SYSTEM PUBLIC + ${GODOT_ROOT_DIR} + ${GODOT_ROOT_DIR}/modules/gdnative/include) diff --git a/platform/android/java/lib/THIRDPARTY.md b/platform/android/java/lib/THIRDPARTY.md new file mode 100644 index 0000000000..2496b59263 --- /dev/null +++ b/platform/android/java/lib/THIRDPARTY.md @@ -0,0 +1,39 @@ +# Third-party libraries + +This file list third-party libraries used in the Android source folder, +with their provenance and, when relevant, modifications made to those files. + +## com.android.vending.billing + +- Upstream: https://github.com/googlesamples/android-play-billing/tree/master/TrivialDrive/app/src/main +- Version: git (7a94c69, 2019) +- License: Apache 2.0 + +Overwrite the file `aidl/com/android/vending/billing/IInAppBillingService.aidl`. + +## com.google.android.vending.expansion.downloader + +- Upstream: https://github.com/google/play-apk-expansion/tree/master/apkx_library +- Version: git (9ecf54e, 2017) +- License: Apache 2.0 + +Overwrite all files under: + +- `src/com/google/android/vending/expansion/downloader` + +Some files have been modified for yet unclear reasons. +See the `patches/com.google.android.vending.expansion.downloader.patch` file. + +## com.google.android.vending.licensing + +- Upstream: https://github.com/google/play-licensing/tree/master/lvl_library/ +- Version: git (eb57657, 2018) with modifications +- License: Apache 2.0 + +Overwrite all files under: + +- `aidl/com/android/vending/licensing` +- `src/com/google/android/vending/licensing` + +Some files have been modified to silence linter errors or fix downstream issues. +See the `patches/com.google.android.vending.licensing.patch` file. diff --git a/platform/android/java/lib/aidl/com/android/vending/billing/IInAppBillingService.aidl b/platform/android/java/lib/aidl/com/android/vending/billing/IInAppBillingService.aidl new file mode 100644 index 0000000000..0f2bcae338 --- /dev/null +++ b/platform/android/java/lib/aidl/com/android/vending/billing/IInAppBillingService.aidl @@ -0,0 +1,281 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.vending.billing; + +import android.os.Bundle; + +/** + * InAppBillingService is the service that provides in-app billing version 3 and beyond. + * This service provides the following features: + * 1. Provides a new API to get details of in-app items published for the app including + * price, type, title and description. + * 2. The purchase flow is synchronous and purchase information is available immediately + * after it completes. + * 3. Purchase information of in-app purchases is maintained within the Google Play system + * till the purchase is consumed. + * 4. An API to consume a purchase of an inapp item. All purchases of one-time + * in-app items are consumable and thereafter can be purchased again. + * 5. An API to get current purchases of the user immediately. This will not contain any + * consumed purchases. + * + * All calls will give a response code with the following possible values + * RESULT_OK = 0 - success + * RESULT_USER_CANCELED = 1 - User pressed back or canceled a dialog + * RESULT_SERVICE_UNAVAILABLE = 2 - The network connection is down + * RESULT_BILLING_UNAVAILABLE = 3 - This billing API version is not supported for the type requested + * RESULT_ITEM_UNAVAILABLE = 4 - Requested SKU is not available for purchase + * RESULT_DEVELOPER_ERROR = 5 - Invalid arguments provided to the API + * RESULT_ERROR = 6 - Fatal error during the API action + * RESULT_ITEM_ALREADY_OWNED = 7 - Failure to purchase since item is already owned + * RESULT_ITEM_NOT_OWNED = 8 - Failure to consume since item is not owned + */ +interface IInAppBillingService { + /** + * Checks support for the requested billing API version, package and in-app type. + * Minimum API version supported by this interface is 3. + * @param apiVersion billing API version that the app is using + * @param packageName the package name of the calling app + * @param type type of the in-app item being purchased ("inapp" for one-time purchases + * and "subs" for subscriptions) + * @return RESULT_OK(0) on success and appropriate response code on failures. + */ + int isBillingSupported(int apiVersion, String packageName, String type); + + /** + * Provides details of a list of SKUs + * Given a list of SKUs of a valid type in the skusBundle, this returns a bundle + * with a list JSON strings containing the productId, price, title and description. + * This API can be called with a maximum of 20 SKUs. + * @param apiVersion billing API version that the app is using + * @param packageName the package name of the calling app + * @param type of the in-app items ("inapp" for one-time purchases + * and "subs" for subscriptions) + * @param skusBundle bundle containing a StringArrayList of SKUs with key "ITEM_ID_LIST" + * @return Bundle containing the following key-value pairs + * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes + * on failures. + * "DETAILS_LIST" with a StringArrayList containing purchase information + * in JSON format similar to: + * '{ "productId" : "exampleSku", + * "type" : "inapp", + * "price" : "$5.00", + * "price_currency": "USD", + * "price_amount_micros": 5000000, + * "title : "Example Title", + * "description" : "This is an example description" }' + */ + Bundle getSkuDetails(int apiVersion, String packageName, String type, in Bundle skusBundle); + + /** + * Returns a pending intent to launch the purchase flow for an in-app item by providing a SKU, + * the type, a unique purchase token and an optional developer payload. + * @param apiVersion billing API version that the app is using + * @param packageName package name of the calling app + * @param sku the SKU of the in-app item as published in the developer console + * @param type of the in-app item being purchased ("inapp" for one-time purchases + * and "subs" for subscriptions) + * @param developerPayload optional argument to be sent back with the purchase information + * @return Bundle containing the following key-value pairs + * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes + * on failures. + * "BUY_INTENT" - PendingIntent to start the purchase flow + * + * The Pending intent should be launched with startIntentSenderForResult. When purchase flow + * has completed, the onActivityResult() will give a resultCode of OK or CANCELED. + * If the purchase is successful, the result data will contain the following key-value pairs + * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response + * codes on failures. + * "INAPP_PURCHASE_DATA" - String in JSON format similar to + * '{"orderId":"12999763169054705758.1371079406387615", + * "packageName":"com.example.app", + * "productId":"exampleSku", + * "purchaseTime":1345678900000, + * "purchaseToken" : "122333444455555", + * "developerPayload":"example developer payload" }' + * "INAPP_DATA_SIGNATURE" - String containing the signature of the purchase data that + * was signed with the private key of the developer + */ + Bundle getBuyIntent(int apiVersion, String packageName, String sku, String type, + String developerPayload); + + /** + * Returns the current SKUs owned by the user of the type and package name specified along with + * purchase information and a signature of the data to be validated. + * This will return all SKUs that have been purchased in V3 and managed items purchased using + * V1 and V2 that have not been consumed. + * @param apiVersion billing API version that the app is using + * @param packageName package name of the calling app + * @param type of the in-app items being requested ("inapp" for one-time purchases + * and "subs" for subscriptions) + * @param continuationToken to be set as null for the first call, if the number of owned + * skus are too many, a continuationToken is returned in the response bundle. + * This method can be called again with the continuation token to get the next set of + * owned skus. + * @return Bundle containing the following key-value pairs + * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes + on failures. + * "INAPP_PURCHASE_ITEM_LIST" - StringArrayList containing the list of SKUs + * "INAPP_PURCHASE_DATA_LIST" - StringArrayList containing the purchase information + * "INAPP_DATA_SIGNATURE_LIST"- StringArrayList containing the signatures + * of the purchase information + * "INAPP_CONTINUATION_TOKEN" - String containing a continuation token for the + * next set of in-app purchases. Only set if the + * user has more owned skus than the current list. + */ + Bundle getPurchases(int apiVersion, String packageName, String type, String continuationToken); + + /** + * Consume the last purchase of the given SKU. This will result in this item being removed + * from all subsequent responses to getPurchases() and allow re-purchase of this item. + * @param apiVersion billing API version that the app is using + * @param packageName package name of the calling app + * @param purchaseToken token in the purchase information JSON that identifies the purchase + * to be consumed + * @return RESULT_OK(0) if consumption succeeded, appropriate response codes on failures. + */ + int consumePurchase(int apiVersion, String packageName, String purchaseToken); + + /** + * This API is currently under development. + */ + int stub(int apiVersion, String packageName, String type); + + /** + * Returns a pending intent to launch the purchase flow for upgrading or downgrading a + * subscription. The existing owned SKU(s) should be provided along with the new SKU that + * the user is upgrading or downgrading to. + * @param apiVersion billing API version that the app is using, must be 5 or later + * @param packageName package name of the calling app + * @param oldSkus the SKU(s) that the user is upgrading or downgrading from, + * if null or empty this method will behave like {@link #getBuyIntent} + * @param newSku the SKU that the user is upgrading or downgrading to + * @param type of the item being purchased, currently must be "subs" + * @param developerPayload optional argument to be sent back with the purchase information + * @return Bundle containing the following key-value pairs + * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes + * on failures. + * "BUY_INTENT" - PendingIntent to start the purchase flow + * + * The Pending intent should be launched with startIntentSenderForResult. When purchase flow + * has completed, the onActivityResult() will give a resultCode of OK or CANCELED. + * If the purchase is successful, the result data will contain the following key-value pairs + * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response + * codes on failures. + * "INAPP_PURCHASE_DATA" - String in JSON format similar to + * '{"orderId":"12999763169054705758.1371079406387615", + * "packageName":"com.example.app", + * "productId":"exampleSku", + * "purchaseTime":1345678900000, + * "purchaseToken" : "122333444455555", + * "developerPayload":"example developer payload" }' + * "INAPP_DATA_SIGNATURE" - String containing the signature of the purchase data that + * was signed with the private key of the developer + */ + Bundle getBuyIntentToReplaceSkus(int apiVersion, String packageName, + in List oldSkus, String newSku, String type, String developerPayload); + + /** + * Returns a pending intent to launch the purchase flow for an in-app item. This method is + * a variant of the {@link #getBuyIntent} method and takes an additional {@code extraParams} + * parameter. This parameter is a Bundle of optional keys and values that affect the + * operation of the method. + * @param apiVersion billing API version that the app is using, must be 6 or later + * @param packageName package name of the calling app + * @param sku the SKU of the in-app item as published in the developer console + * @param type of the in-app item being purchased ("inapp" for one-time purchases + * and "subs" for subscriptions) + * @param developerPayload optional argument to be sent back with the purchase information + * @extraParams a Bundle with the following optional keys: + * "skusToReplace" - List - an optional list of SKUs that the user is + * upgrading or downgrading from. + * Pass this field if the purchase is upgrading or downgrading + * existing subscriptions. + * The specified SKUs are replaced with the SKUs that the user is + * purchasing. Google Play replaces the specified SKUs at the start of + * the next billing cycle. + * "replaceSkusProration" - Boolean - whether the user should be credited for any unused + * subscription time on the SKUs they are upgrading or downgrading. + * If you set this field to true, Google Play swaps out the old SKUs + * and credits the user with the unused value of their subscription + * time on a pro-rated basis. + * Google Play applies this credit to the new subscription, and does + * not begin billing the user for the new subscription until after + * the credit is used up. + * If you set this field to false, the user does not receive credit for + * any unused subscription time and the recurrence date does not + * change. + * Default value is true. Ignored if you do not pass skusToReplace. + * "accountId" - String - an optional obfuscated string that is uniquely + * associated with the user's account in your app. + * If you pass this value, Google Play can use it to detect irregular + * activity, such as many devices making purchases on the same + * account in a short period of time. + * Do not use the developer ID or the user's Google ID for this field. + * In addition, this field should not contain the user's ID in + * cleartext. + * We recommend that you use a one-way hash to generate a string from + * the user's ID, and store the hashed string in this field. + * "vr" - Boolean - an optional flag indicating whether the returned intent + * should start a VR purchase flow. The apiVersion must also be 7 or + * later to use this flag. + */ + Bundle getBuyIntentExtraParams(int apiVersion, String packageName, String sku, + String type, String developerPayload, in Bundle extraParams); + + /** + * Returns the most recent purchase made by the user for each SKU, even if that purchase is + * expired, canceled, or consumed. + * @param apiVersion billing API version that the app is using, must be 6 or later + * @param packageName package name of the calling app + * @param type of the in-app items being requested ("inapp" for one-time purchases + * and "subs" for subscriptions) + * @param continuationToken to be set as null for the first call, if the number of owned + * skus is too large, a continuationToken is returned in the response bundle. + * This method can be called again with the continuation token to get the next set of + * owned skus. + * @param extraParams a Bundle with extra params that would be appended into http request + * query string. Not used at this moment. Reserved for future functionality. + * @return Bundle containing the following key-value pairs + * "RESPONSE_CODE" with int value: RESULT_OK(0) if success, + * {@link IabHelper#BILLING_RESPONSE_RESULT_*} response codes on failures. + * + * "INAPP_PURCHASE_ITEM_LIST" - ArrayList containing the list of SKUs + * "INAPP_PURCHASE_DATA_LIST" - ArrayList containing the purchase information + * "INAPP_DATA_SIGNATURE_LIST"- ArrayList containing the signatures + * of the purchase information + * "INAPP_CONTINUATION_TOKEN" - String containing a continuation token for the + * next set of in-app purchases. Only set if the + * user has more owned skus than the current list. + */ + Bundle getPurchaseHistory(int apiVersion, String packageName, String type, + String continuationToken, in Bundle extraParams); + + /** + * This method is a variant of {@link #isBillingSupported}} that takes an additional + * {@code extraParams} parameter. + * @param apiVersion billing API version that the app is using, must be 7 or later + * @param packageName package name of the calling app + * @param type of the in-app item being purchased ("inapp" for one-time purchases and "subs" + * for subscriptions) + * @param extraParams a Bundle with the following optional keys: + * "vr" - Boolean - an optional flag to indicate whether {link #getBuyIntentExtraParams} + * supports returning a VR purchase flow. + * @return RESULT_OK(0) on success and appropriate response code on failures. + */ + int isBillingSupportedExtraParams(int apiVersion, String packageName, String type, + in Bundle extraParams); +} diff --git a/platform/android/java/lib/aidl/com/android/vending/licensing/ILicenseResultListener.aidl b/platform/android/java/lib/aidl/com/android/vending/licensing/ILicenseResultListener.aidl new file mode 100644 index 0000000000..869cb16f68 --- /dev/null +++ b/platform/android/java/lib/aidl/com/android/vending/licensing/ILicenseResultListener.aidl @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.vending.licensing; + +oneway interface ILicenseResultListener { + void verifyLicense(int responseCode, String signedData, String signature); +} diff --git a/platform/android/java/lib/aidl/com/android/vending/licensing/ILicensingService.aidl b/platform/android/java/lib/aidl/com/android/vending/licensing/ILicensingService.aidl new file mode 100644 index 0000000000..9541a2090c --- /dev/null +++ b/platform/android/java/lib/aidl/com/android/vending/licensing/ILicensingService.aidl @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.vending.licensing; + +import com.android.vending.licensing.ILicenseResultListener; + +oneway interface ILicensingService { + void checkLicense(long nonce, String packageName, in ILicenseResultListener listener); +} diff --git a/platform/android/java/lib/build.gradle b/platform/android/java/lib/build.gradle new file mode 100644 index 0000000000..6d07504e45 --- /dev/null +++ b/platform/android/java/lib/build.gradle @@ -0,0 +1,91 @@ +apply plugin: 'com.android.library' + +dependencies { + implementation "com.android.support:support-core-utils:28.0.0" +} + +def pathToRootDir = "../../../../" +// Note: Only keep the abis you support to speed up the gradle 'assemble' task. +def supportedAbis = ["armv7", "arm64v8", "x86", "x86_64"] + +android { + compileSdkVersion versions.compileSdk + buildToolsVersion versions.buildTools + useLibrary 'org.apache.http.legacy' + + defaultConfig { + minSdkVersion versions.minSdk + targetSdkVersion versions.targetSdk + } + + lintOptions { + abortOnError false + disable 'MissingTranslation', 'UnusedResources' + } + + packagingOptions { + exclude 'META-INF/LICENSE' + exclude 'META-INF/NOTICE' + } + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src'] + res.srcDirs = ['res'] + aidl.srcDirs = ['aidl'] + assets.srcDirs = ['assets'] + } + debug.jniLibs.srcDirs = ['libs/debug'] + release.jniLibs.srcDirs = ['libs/release'] + } + + libraryVariants.all { variant -> + variant.outputs.all { output -> + output.outputFileName = "godot-lib.${variant.name}.aar" + } + + def buildType = variant.buildType.name.capitalize() + + def taskPrefix = "" + if (project.path != ":") { + taskPrefix = project.path + ":" + } + + // Disable the externalNativeBuild* task as it would cause build failures since the cmake build + // files is only setup for editing support. + gradle.startParameter.excludedTaskNames += taskPrefix + "externalNativeBuild" + buildType + + // Create tasks to generate the Godot native libraries. + def taskName = "compileGodotNativeLibs" + buildType + def releaseTarget = "release" + if (buildType == "Debug") { + releaseTarget += "_debug" + } + + def abiTaskNames = [] + // Creating gradle tasks to generate the native libraries for the supported abis. + supportedAbis.each { abi -> + def abiTaskName = taskName + abi.capitalize() + abiTaskNames += abiTaskName + tasks.create(name: abiTaskName, type: Exec) { + executable "scons" + args "--directory=${pathToRootDir}", "platform=android", "target=${releaseTarget}", "android_arch=${abi}" + } + } + + // Creating gradle task to run all of the previously generated tasks. + tasks.create(name: taskName, type: GradleBuild) { + tasks = abiTaskNames + } + + // Schedule the tasks so the generated libs are present before the aar file is packaged. + tasks["merge${buildType}JniLibFolders"].dependsOn taskName + } + + externalNativeBuild { + cmake { + path "CMakeLists.txt" + } + } +} diff --git a/platform/android/java/lib/patches/com.google.android.vending.expansion.downloader.patch b/platform/android/java/lib/patches/com.google.android.vending.expansion.downloader.patch new file mode 100644 index 0000000000..49cc41e817 --- /dev/null +++ b/platform/android/java/lib/patches/com.google.android.vending.expansion.downloader.patch @@ -0,0 +1,300 @@ +diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/DownloaderClientMarshaller.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/DownloaderClientMarshaller.java +index ad6ea0de6..452c7d148 100644 +--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/DownloaderClientMarshaller.java ++++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/DownloaderClientMarshaller.java +@@ -32,6 +32,9 @@ import android.os.Messenger; + import android.os.RemoteException; + import android.util.Log; + ++// -- GODOT start -- ++import java.lang.ref.WeakReference; ++// -- GODOT end -- + + + /** +@@ -118,29 +121,46 @@ public class DownloaderClientMarshaller { + /** + * Target we publish for clients to send messages to IncomingHandler. + */ +- final Messenger mMessenger = new Messenger(new Handler() { ++ // -- GODOT start -- ++ private final MessengerHandlerClient mMsgHandler = new MessengerHandlerClient(this); ++ final Messenger mMessenger = new Messenger(mMsgHandler); ++ ++ private static class MessengerHandlerClient extends Handler { ++ private final WeakReference mDownloader; ++ public MessengerHandlerClient(Stub downloader) { ++ mDownloader = new WeakReference<>(downloader); ++ } ++ + @Override + public void handleMessage(Message msg) { +- switch (msg.what) { +- case MSG_ONDOWNLOADPROGRESS: +- Bundle bun = msg.getData(); +- if ( null != mContext ) { +- bun.setClassLoader(mContext.getClassLoader()); +- DownloadProgressInfo dpi = (DownloadProgressInfo) msg.getData() +- .getParcelable(PARAM_PROGRESS); +- mItf.onDownloadProgress(dpi); +- } +- break; +- case MSG_ONDOWNLOADSTATE_CHANGED: +- mItf.onDownloadStateChanged(msg.getData().getInt(PARAM_NEW_STATE)); +- break; +- case MSG_ONSERVICECONNECTED: +- mItf.onServiceConnected( +- (Messenger) msg.getData().getParcelable(PARAM_MESSENGER)); +- break; ++ Stub downloader = mDownloader.get(); ++ if (downloader != null) { ++ downloader.handleMessage(msg); + } + } +- }); ++ } ++ ++ private void handleMessage(Message msg) { ++ switch (msg.what) { ++ case MSG_ONDOWNLOADPROGRESS: ++ Bundle bun = msg.getData(); ++ if (null != mContext) { ++ bun.setClassLoader(mContext.getClassLoader()); ++ DownloadProgressInfo dpi = (DownloadProgressInfo)msg.getData() ++ .getParcelable(PARAM_PROGRESS); ++ mItf.onDownloadProgress(dpi); ++ } ++ break; ++ case MSG_ONDOWNLOADSTATE_CHANGED: ++ mItf.onDownloadStateChanged(msg.getData().getInt(PARAM_NEW_STATE)); ++ break; ++ case MSG_ONSERVICECONNECTED: ++ mItf.onServiceConnected( ++ (Messenger)msg.getData().getParcelable(PARAM_MESSENGER)); ++ break; ++ } ++ } ++ // -- GODOT end -- + + public Stub(IDownloaderClient itf, Class downloaderService) { + mItf = itf; +diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/DownloaderServiceMarshaller.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/DownloaderServiceMarshaller.java +index 979352299..3771d19c9 100644 +--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/DownloaderServiceMarshaller.java ++++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/DownloaderServiceMarshaller.java +@@ -25,6 +25,9 @@ import android.os.Message; + import android.os.Messenger; + import android.os.RemoteException; + ++// -- GODOT start -- ++import java.lang.ref.WeakReference; ++// -- GODOT end -- + + + /** +@@ -108,32 +111,49 @@ public class DownloaderServiceMarshaller { + + private static class Stub implements IStub { + private IDownloaderService mItf = null; +- final Messenger mMessenger = new Messenger(new Handler() { ++ // -- GODOT start -- ++ private final MessengerHandlerServer mMsgHandler = new MessengerHandlerServer(this); ++ final Messenger mMessenger = new Messenger(mMsgHandler); ++ ++ private static class MessengerHandlerServer extends Handler { ++ private final WeakReference mDownloader; ++ public MessengerHandlerServer(Stub downloader) { ++ mDownloader = new WeakReference<>(downloader); ++ } ++ + @Override + public void handleMessage(Message msg) { +- switch (msg.what) { +- case MSG_REQUEST_ABORT_DOWNLOAD: +- mItf.requestAbortDownload(); +- break; +- case MSG_REQUEST_CONTINUE_DOWNLOAD: +- mItf.requestContinueDownload(); +- break; +- case MSG_REQUEST_PAUSE_DOWNLOAD: +- mItf.requestPauseDownload(); +- break; +- case MSG_SET_DOWNLOAD_FLAGS: +- mItf.setDownloadFlags(msg.getData().getInt(PARAMS_FLAGS)); +- break; +- case MSG_REQUEST_DOWNLOAD_STATE: +- mItf.requestDownloadStatus(); +- break; +- case MSG_REQUEST_CLIENT_UPDATE: +- mItf.onClientUpdated((Messenger) msg.getData().getParcelable( +- PARAM_MESSENGER)); +- break; ++ Stub downloader = mDownloader.get(); ++ if (downloader != null) { ++ downloader.handleMessage(msg); + } + } +- }); ++ } ++ ++ private void handleMessage(Message msg) { ++ switch (msg.what) { ++ case MSG_REQUEST_ABORT_DOWNLOAD: ++ mItf.requestAbortDownload(); ++ break; ++ case MSG_REQUEST_CONTINUE_DOWNLOAD: ++ mItf.requestContinueDownload(); ++ break; ++ case MSG_REQUEST_PAUSE_DOWNLOAD: ++ mItf.requestPauseDownload(); ++ break; ++ case MSG_SET_DOWNLOAD_FLAGS: ++ mItf.setDownloadFlags(msg.getData().getInt(PARAMS_FLAGS)); ++ break; ++ case MSG_REQUEST_DOWNLOAD_STATE: ++ mItf.requestDownloadStatus(); ++ break; ++ case MSG_REQUEST_CLIENT_UPDATE: ++ mItf.onClientUpdated((Messenger)msg.getData().getParcelable( ++ PARAM_MESSENGER)); ++ break; ++ } ++ } ++ // -- GODOT end -- + + public Stub(IDownloaderService itf) { + mItf = itf; +diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/Helpers.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/Helpers.java +index e4b1b0f1c..36cd6aacf 100644 +--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/Helpers.java ++++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/Helpers.java +@@ -24,7 +24,10 @@ import android.os.StatFs; + import android.os.SystemClock; + import android.util.Log; + +-import com.android.vending.expansion.downloader.R; ++// -- GODOT start -- ++//import com.android.vending.expansion.downloader.R; ++import org.godotengine.godot.R; ++// -- GODOT end -- + + import java.io.File; + import java.text.SimpleDateFormat; +@@ -146,12 +149,14 @@ public class Helpers { + } + return ""; + } +- return String.format("%.2f", ++ // -- GODOT start -- ++ return String.format(Locale.ENGLISH, "%.2f", + (float) overallProgress / (1024.0f * 1024.0f)) + + "MB /" + +- String.format("%.2f", (float) overallTotal / ++ String.format(Locale.ENGLISH, "%.2f", (float) overallTotal / + (1024.0f * 1024.0f)) + + "MB"; ++ // -- GODOT end -- + } + + /** +@@ -184,7 +189,9 @@ public class Helpers { + } + + public static String getSpeedString(float bytesPerMillisecond) { +- return String.format("%.2f", bytesPerMillisecond * 1000 / 1024); ++ // -- GODOT start -- ++ return String.format(Locale.ENGLISH, "%.2f", bytesPerMillisecond * 1000 / 1024); ++ // -- GODOT end -- + } + + public static String getTimeRemaining(long durationInMilliseconds) { +diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/SystemFacade.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/SystemFacade.java +index 12edd97ab..a0e1165cc 100644 +--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/SystemFacade.java ++++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/SystemFacade.java +@@ -26,6 +26,10 @@ import android.net.NetworkInfo; + import android.telephony.TelephonyManager; + import android.util.Log; + ++// -- GODOT start -- ++import android.annotation.SuppressLint; ++// -- GODOT end -- ++ + /** + * Contains useful helper functions, typically tied to the application context. + */ +@@ -51,6 +55,7 @@ class SystemFacade { + return null; + } + ++ @SuppressLint("MissingPermission") + NetworkInfo activeInfo = connectivity.getActiveNetworkInfo(); + if (activeInfo == null) { + if (Constants.LOGVV) { +@@ -69,6 +74,7 @@ class SystemFacade { + return false; + } + ++ @SuppressLint("MissingPermission") + NetworkInfo info = connectivity.getActiveNetworkInfo(); + boolean isMobile = (info != null && info.getType() == ConnectivityManager.TYPE_MOBILE); + TelephonyManager tm = (TelephonyManager) mContext +diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java +index f1536e80e..4b214b22d 100644 +--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java ++++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java +@@ -16,7 +16,11 @@ + + package com.google.android.vending.expansion.downloader.impl; + +-import com.android.vending.expansion.downloader.R; ++// -- GODOT start -- ++//import com.android.vending.expansion.downloader.R; ++import org.godotengine.godot.R; ++// -- GODOT end -- ++ + import com.google.android.vending.expansion.downloader.DownloadProgressInfo; + import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller; + import com.google.android.vending.expansion.downloader.Helpers; +diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadThread.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadThread.java +index b2e0e7af0..c114b8a64 100644 +--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadThread.java ++++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadThread.java +@@ -146,8 +146,12 @@ public class DownloadThread { + + try { + PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); +- wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, Constants.TAG); +- wakeLock.acquire(); ++ // -- GODOT start -- ++ //wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, Constants.TAG); ++ //wakeLock.acquire(); ++ wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "org.godot.game:wakelock"); ++ wakeLock.acquire(20 * 60 * 1000L /*20 minutes*/); ++ // -- GODOT end -- + + if (Constants.LOGV) { + Log.v(Constants.TAG, "initiating download for " + mInfo.mFileName); +diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloaderService.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloaderService.java +index 4babe476f..8d41a7690 100644 +--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloaderService.java ++++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloaderService.java +@@ -50,6 +50,10 @@ import android.provider.Settings.Secure; + import android.telephony.TelephonyManager; + import android.util.Log; + ++// -- GODOT start -- ++import android.annotation.SuppressLint; ++// -- GODOT end -- ++ + import java.io.File; + + /** +@@ -578,6 +582,7 @@ public abstract class DownloaderService extends CustomIntentService implements I + Log.w(Constants.TAG, + "couldn't get connectivity manager to poll network state"); + } else { ++ @SuppressLint("MissingPermission") + NetworkInfo activeInfo = mConnectivityManager + .getActiveNetworkInfo(); + updateNetworkState(activeInfo); diff --git a/platform/android/java/lib/patches/com.google.android.vending.licensing.patch b/platform/android/java/lib/patches/com.google.android.vending.licensing.patch new file mode 100644 index 0000000000..4adb81d951 --- /dev/null +++ b/platform/android/java/lib/patches/com.google.android.vending.licensing.patch @@ -0,0 +1,42 @@ +diff --git a/platform/android/java/src/com/google/android/vending/licensing/PreferenceObfuscator.java b/platform/android/java/src/com/google/android/vending/licensing/PreferenceObfuscator.java +index 7c42bfc28..feb579af0 100644 +--- a/platform/android/java/src/com/google/android/vending/licensing/PreferenceObfuscator.java ++++ b/platform/android/java/src/com/google/android/vending/licensing/PreferenceObfuscator.java +@@ -45,6 +45,9 @@ public class PreferenceObfuscator { + public void putString(String key, String value) { + if (mEditor == null) { + mEditor = mPreferences.edit(); ++ // -- GODOT start -- ++ mEditor.apply(); ++ // -- GODOT end -- + } + String obfuscatedValue = mObfuscator.obfuscate(value, key); + mEditor.putString(key, obfuscatedValue); +diff --git a/platform/android/java/src/com/google/android/vending/licensing/util/Base64.java b/platform/android/java/src/com/google/android/vending/licensing/util/Base64.java +index a0d2779af..a8bf65f9c 100644 +--- a/platform/android/java/src/com/google/android/vending/licensing/util/Base64.java ++++ b/platform/android/java/src/com/google/android/vending/licensing/util/Base64.java +@@ -31,6 +31,10 @@ package com.google.android.vending.licensing.util; + * @version 1.3 + */ + ++// -- GODOT start -- +import org.godotengine.godot.BuildConfig; ++// -- GODOT end -- ++ + /** + * Base64 converter class. This code is not a full-blown MIME encoder; + * it simply converts binary data to base64 data and back. +@@ -341,7 +345,11 @@ public class Base64 { + e += 4; + } + +- assert (e == outBuff.length); ++ // -- GODOT start -- ++ //assert (e == outBuff.length); ++ if (BuildConfig.DEBUG && e != outBuff.length) ++ throw new RuntimeException(); ++ // -- GODOT end -- + return outBuff; + } + diff --git a/platform/android/java/lib/res/drawable-hdpi/notify_panel_notification_icon_bg.png b/platform/android/java/lib/res/drawable-hdpi/notify_panel_notification_icon_bg.png new file mode 100644 index 0000000000..2c246b04a4 Binary files /dev/null and b/platform/android/java/lib/res/drawable-hdpi/notify_panel_notification_icon_bg.png differ diff --git a/platform/android/java/lib/res/drawable-mdpi/notify_panel_notification_icon_bg.png b/platform/android/java/lib/res/drawable-mdpi/notify_panel_notification_icon_bg.png new file mode 100644 index 0000000000..8bcd464bed Binary files /dev/null and b/platform/android/java/lib/res/drawable-mdpi/notify_panel_notification_icon_bg.png differ diff --git a/platform/android/java/lib/res/drawable-nodpi/icon.png b/platform/android/java/lib/res/drawable-nodpi/icon.png new file mode 100644 index 0000000000..6ad9b43117 Binary files /dev/null and b/platform/android/java/lib/res/drawable-nodpi/icon.png differ diff --git a/platform/android/java/lib/res/drawable-xhdpi/notify_panel_notification_icon_bg.png b/platform/android/java/lib/res/drawable-xhdpi/notify_panel_notification_icon_bg.png new file mode 100644 index 0000000000..372b763ec5 Binary files /dev/null and b/platform/android/java/lib/res/drawable-xhdpi/notify_panel_notification_icon_bg.png differ diff --git a/platform/android/java/lib/res/drawable-xxhdpi/notify_panel_notification_icon_bg.png b/platform/android/java/lib/res/drawable-xxhdpi/notify_panel_notification_icon_bg.png new file mode 100644 index 0000000000..b458ff3057 Binary files /dev/null and b/platform/android/java/lib/res/drawable-xxhdpi/notify_panel_notification_icon_bg.png differ diff --git a/platform/android/java/lib/res/layout/downloading_expansion.xml b/platform/android/java/lib/res/layout/downloading_expansion.xml new file mode 100644 index 0000000000..4a9700965f --- /dev/null +++ b/platform/android/java/lib/res/layout/downloading_expansion.xml @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + +