summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-04-14 22:43:44 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-04-14 22:43:44 -0300
commitec4ef2d2e794819548d731f93728266d31261d71 (patch)
tree6c2940a9029d07a22288c93684dac19cc39de7ed /platform/android
parent162d2ebe4f1a6da2da62ad45c4cbfb161157d31d (diff)
-Added google play services (needed for some stuff)
-Added new screen resizing options, stretch_2d is removed, new much more flexible ones. -Fixed bug in viewport (can create more instances in 3d-in-2d demo now) -Can set android permissions and screen sizes manually in the export settings -Changed export templates extension to .tpz (too many people unzipped the manually..) -File dialog now ensures that the proper extension is used (will not allow to save without it) -Fixed bug that made collision exceptions not work in 2D
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/AndroidManifest.xml.template181
-rw-r--r--platform/android/detect.py1
-rw-r--r--platform/android/export/export.cpp273
-rw-r--r--platform/android/java/src/com/android/godot/GodotPaymentV3.java10
-rw-r--r--platform/android/java/src/com/android/godot/payments/HandlePurchaseTask.java4
-rw-r--r--platform/android/java/src/com/android/godot/payments/PaymentsManager.java9
6 files changed, 457 insertions, 21 deletions
diff --git a/platform/android/AndroidManifest.xml.template b/platform/android/AndroidManifest.xml.template
index 99c3650efa..e723b693d8 100644
--- a/platform/android/AndroidManifest.xml.template
+++ b/platform/android/AndroidManifest.xml.template
@@ -5,6 +5,11 @@
android:versionName="1.0"
android:installLocation="preferExternal"
>
+<supports-screens android:smallScreens="true"
+ android:normalScreens="true"
+ android:largeScreens="true"
+ android:xlargeScreens="true"/>
+
<application android:label="@string/godot_project_name_string" android:icon="@drawable/icon">
<activity android:name="com.android.godot.Godot"
android:label="@string/godot_project_name_string"
@@ -26,15 +31,173 @@ $$ADD_APPLICATION_CHUNKS$$
</application>
<uses-feature android:glEsVersion="0x00020000"/>
- <uses-permission android:name="android.permission.INTERNET"></uses-permission>
- <uses-permission android:name="android.permission.READ_CONTACTS"/>
- <uses-permission android:name="com.android.vending.BILLING" />
- <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
- <uses-permission android:name="android.permission.RECEIVE_SMS"/>
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
-
- <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="15"/>
+<uses-permission android:name="godot.ACCESS_CHECKIN_PROPERTIES"/>
+<uses-permission android:name="godot.ACCESS_COARSE_LOCATION"/>
+<uses-permission android:name="godot.ACCESS_FINE_LOCATION"/>
+<uses-permission android:name="godot.ACCESS_LOCATION_EXTRA_COMMANDS"/>
+<uses-permission android:name="godot.ACCESS_MOCK_LOCATION"/>
+<uses-permission android:name="godot.ACCESS_NETWORK_STATE"/>
+<uses-permission android:name="godot.ACCESS_SURFACE_FLINGER"/>
+<uses-permission android:name="godot.ACCESS_WIFI_STATE"/>
+<uses-permission android:name="godot.ACCOUNT_MANAGER"/>
+<uses-permission android:name="godot.ADD_VOICEMAIL"/>
+<uses-permission android:name="godot.AUTHENTICATE_ACCOUNTS"/>
+<uses-permission android:name="godot.BATTERY_STATS"/>
+<uses-permission android:name="godot.BIND_ACCESSIBILITY_SERVICE"/>
+<uses-permission android:name="godot.BIND_APPWIDGET"/>
+<uses-permission android:name="godot.BIND_DEVICE_ADMIN"/>
+<uses-permission android:name="godot.BIND_INPUT_METHOD"/>
+<uses-permission android:name="godot.BIND_NFC_SERVICE"/>
+<uses-permission android:name="godot.BIND_NOTIFICATION_LISTENER_SERVICE"/>
+<uses-permission android:name="godot.BIND_PRINT_SERVICE"/>
+<uses-permission android:name="godot.BIND_REMOTEVIEWS"/>
+<uses-permission android:name="godot.BIND_TEXT_SERVICE"/>
+<uses-permission android:name="godot.BIND_VPN_SERVICE"/>
+<uses-permission android:name="godot.BIND_WALLPAPER"/>
+<uses-permission android:name="godot.BLUETOOTH"/>
+<uses-permission android:name="godot.BLUETOOTH_ADMIN"/>
+<uses-permission android:name="godot.BLUETOOTH_PRIVILEGED"/>
+<uses-permission android:name="godot.BRICK"/>
+<uses-permission android:name="godot.BROADCAST_PACKAGE_REMOVED"/>
+<uses-permission android:name="godot.BROADCAST_SMS"/>
+<uses-permission android:name="godot.BROADCAST_STICKY"/>
+<uses-permission android:name="godot.BROADCAST_WAP_PUSH"/>
+<uses-permission android:name="godot.CALL_PHONE"/>
+<uses-permission android:name="godot.CALL_PRIVILEGED"/>
+<uses-permission android:name="godot.CAMERA"/>
+<uses-permission android:name="godot.CAPTURE_AUDIO_OUTPUT"/>
+<uses-permission android:name="godot.CAPTURE_SECURE_VIDEO_OUTPUT"/>
+<uses-permission android:name="godot.CAPTURE_VIDEO_OUTPUT"/>
+<uses-permission android:name="godot.CHANGE_COMPONENT_ENABLED_STATE"/>
+<uses-permission android:name="godot.CHANGE_CONFIGURATION"/>
+<uses-permission android:name="godot.CHANGE_NETWORK_STATE"/>
+<uses-permission android:name="godot.CHANGE_WIFI_MULTICAST_STATE"/>
+<uses-permission android:name="godot.CHANGE_WIFI_STATE"/>
+<uses-permission android:name="godot.CLEAR_APP_CACHE"/>
+<uses-permission android:name="godot.CLEAR_APP_USER_DATA"/>
+<uses-permission android:name="godot.CONTROL_LOCATION_UPDATES"/>
+<uses-permission android:name="godot.DELETE_CACHE_FILES"/>
+<uses-permission android:name="godot.DELETE_PACKAGES"/>
+<uses-permission android:name="godot.DEVICE_POWER"/>
+<uses-permission android:name="godot.DIAGNOSTIC"/>
+<uses-permission android:name="godot.DISABLE_KEYGUARD"/>
+<uses-permission android:name="godot.DUMP"/>
+<uses-permission android:name="godot.EXPAND_STATUS_BAR"/>
+<uses-permission android:name="godot.FACTORY_TEST"/>
+<uses-permission android:name="godot.FLASHLIGHT"/>
+<uses-permission android:name="godot.FORCE_BACK"/>
+<uses-permission android:name="godot.GET_ACCOUNTS"/>
+<uses-permission android:name="godot.GET_PACKAGE_SIZE"/>
+<uses-permission android:name="godot.GET_TASKS"/>
+<uses-permission android:name="godot.GET_TOP_ACTIVITY_INFO"/>
+<uses-permission android:name="godot.GLOBAL_SEARCH"/>
+<uses-permission android:name="godot.HARDWARE_TEST"/>
+<uses-permission android:name="godot.INJECT_EVENTS"/>
+<uses-permission android:name="godot.INSTALL_LOCATION_PROVIDER"/>
+<uses-permission android:name="godot.INSTALL_PACKAGES"/>
+<uses-permission android:name="godot.INSTALL_SHORTCUT"/>
+<uses-permission android:name="godot.INTERNAL_SYSTEM_WINDOW"/>
+<uses-permission android:name="godot.INTERNET"/>
+<uses-permission android:name="godot.KILL_BACKGROUND_PROCESSES"/>
+<uses-permission android:name="godot.LOCATION_HARDWARE"/>
+<uses-permission android:name="godot.MANAGE_ACCOUNTS"/>
+<uses-permission android:name="godot.MANAGE_APP_TOKENS"/>
+<uses-permission android:name="godot.MANAGE_DOCUMENTS"/>
+<uses-permission android:name="godot.MASTER_CLEAR"/>
+<uses-permission android:name="godot.MEDIA_CONTENT_CONTROL"/>
+<uses-permission android:name="godot.MODIFY_AUDIO_SETTINGS"/>
+<uses-permission android:name="godot.MODIFY_PHONE_STATE"/>
+<uses-permission android:name="godot.MOUNT_FORMAT_FILESYSTEMS"/>
+<uses-permission android:name="godot.MOUNT_UNMOUNT_FILESYSTEMS"/>
+<uses-permission android:name="godot.NFC"/>
+<uses-permission android:name="godot.PERSISTENT_ACTIVITY"/>
+<uses-permission android:name="godot.PROCESS_OUTGOING_CALLS"/>
+<uses-permission android:name="godot.READ_CALENDAR"/>
+<uses-permission android:name="godot.READ_CALL_LOG"/>
+<uses-permission android:name="godot.READ_CONTACTS"/>
+<uses-permission android:name="godot.READ_EXTERNAL_STORAGE"/>
+<uses-permission android:name="godot.READ_FRAME_BUFFER"/>
+<uses-permission android:name="godot.READ_HISTORY_BOOKMARKS"/>
+<uses-permission android:name="godot.READ_INPUT_STATE"/>
+<uses-permission android:name="godot.READ_LOGS"/>
+<uses-permission android:name="godot.READ_PHONE_STATE"/>
+<uses-permission android:name="godot.READ_PROFILE"/>
+<uses-permission android:name="godot.READ_SMS"/>
+<uses-permission android:name="godot.READ_SOCIAL_STREAM"/>
+<uses-permission android:name="godot.READ_SYNC_SETTINGS"/>
+<uses-permission android:name="godot.READ_SYNC_STATS"/>
+<uses-permission android:name="godot.READ_USER_DICTIONARY"/>
+<uses-permission android:name="godot.REBOOT"/>
+<uses-permission android:name="godot.RECEIVE_BOOT_COMPLETED"/>
+<uses-permission android:name="godot.RECEIVE_MMS"/>
+<uses-permission android:name="godot.RECEIVE_SMS"/>
+<uses-permission android:name="godot.RECEIVE_WAP_PUSH"/>
+<uses-permission android:name="godot.RECORD_AUDIO"/>
+<uses-permission android:name="godot.REORDER_TASKS"/>
+<uses-permission android:name="godot.RESTART_PACKAGES"/>
+<uses-permission android:name="godot.SEND_RESPOND_VIA_MESSAGE"/>
+<uses-permission android:name="godot.SEND_SMS"/>
+<uses-permission android:name="godot.SET_ACTIVITY_WATCHER"/>
+<uses-permission android:name="godot.SET_ALARM"/>
+<uses-permission android:name="godot.SET_ALWAYS_FINISH"/>
+<uses-permission android:name="godot.SET_ANIMATION_SCALE"/>
+<uses-permission android:name="godot.SET_DEBUG_APP"/>
+<uses-permission android:name="godot.SET_ORIENTATION"/>
+<uses-permission android:name="godot.SET_POINTER_SPEED"/>
+<uses-permission android:name="godot.SET_PREFERRED_APPLICATIONS"/>
+<uses-permission android:name="godot.SET_PROCESS_LIMIT"/>
+<uses-permission android:name="godot.SET_TIME"/>
+<uses-permission android:name="godot.SET_TIME_ZONE"/>
+<uses-permission android:name="godot.SET_WALLPAPER"/>
+<uses-permission android:name="godot.SET_WALLPAPER_HINTS"/>
+<uses-permission android:name="godot.SIGNAL_PERSISTENT_PROCESSES"/>
+<uses-permission android:name="godot.STATUS_BAR"/>
+<uses-permission android:name="godot.SUBSCRIBED_FEEDS_READ"/>
+<uses-permission android:name="godot.SUBSCRIBED_FEEDS_WRITE"/>
+<uses-permission android:name="godot.SYSTEM_ALERT_WINDOW"/>
+<uses-permission android:name="godot.TRANSMIT_IR"/>
+<uses-permission android:name="godot.UNINSTALL_SHORTCUT"/>
+<uses-permission android:name="godot.UPDATE_DEVICE_STATS"/>
+<uses-permission android:name="godot.USE_CREDENTIALS"/>
+<uses-permission android:name="godot.USE_SIP"/>
+<uses-permission android:name="godot.VIBRATE"/>
+<uses-permission android:name="godot.WAKE_LOCK"/>
+<uses-permission android:name="godot.WRITE_APN_SETTINGS"/>
+<uses-permission android:name="godot.WRITE_CALENDAR"/>
+<uses-permission android:name="godot.WRITE_CALL_LOG"/>
+<uses-permission android:name="godot.WRITE_CONTACTS"/>
+<uses-permission android:name="godot.WRITE_EXTERNAL_STORAGE"/>
+<uses-permission android:name="godot.WRITE_GSERVICES"/>
+<uses-permission android:name="godot.WRITE_HISTORY_BOOKMARKS"/>
+<uses-permission android:name="godot.WRITE_PROFILE"/>
+<uses-permission android:name="godot.WRITE_SECURE_SETTINGS"/>
+<uses-permission android:name="godot.WRITE_SETTINGS"/>
+<uses-permission android:name="godot.WRITE_SMS"/>
+<uses-permission android:name="godot.WRITE_SOCIAL_STREAM"/>
+<uses-permission android:name="godot.WRITE_SYNC_SETTINGS"/>
+<uses-permission android:name="godot.WRITE_USER_DICTIONARY"/>
+<uses-permission android:name="godot.custom.0"/>
+<uses-permission android:name="godot.custom.1"/>
+<uses-permission android:name="godot.custom.2"/>
+<uses-permission android:name="godot.custom.3"/>
+<uses-permission android:name="godot.custom.4"/>
+<uses-permission android:name="godot.custom.5"/>
+<uses-permission android:name="godot.custom.6"/>
+<uses-permission android:name="godot.custom.7"/>
+<uses-permission android:name="godot.custom.8"/>
+<uses-permission android:name="godot.custom.9"/>
+<uses-permission android:name="godot.custom.0"/>
+<uses-permission android:name="godot.custom.11"/>
+<uses-permission android:name="godot.custom.12"/>
+<uses-permission android:name="godot.custom.13"/>
+<uses-permission android:name="godot.custom.14"/>
+<uses-permission android:name="godot.custom.15"/>
+<uses-permission android:name="godot.custom.16"/>
+<uses-permission android:name="godot.custom.17"/>
+<uses-permission android:name="godot.custom.18"/>
+<uses-permission android:name="godot.custom.19"/>
+
+<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="15"/>
</manifest>
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 17e97fae0f..72a16ab59a 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -57,6 +57,7 @@ def configure(env):
env['SPAWN'] = methods.win32_spawn
env.android_source_modules.append("../libs/apk_expansion")
+ env.android_source_modules.append("../libs/google_play_services")
ndk_platform=""
ndk_platform="android-15"
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index a9b96a116b..51db77595b 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -10,10 +10,169 @@
#include "os/os.h"
#include "platform/android/logo.h"
+
+static const char* android_perms[]={
+"ACCESS_CHECKIN_PROPERTIES",
+"ACCESS_COARSE_LOCATION",
+"ACCESS_FINE_LOCATION",
+"ACCESS_LOCATION_EXTRA_COMMANDS",
+"ACCESS_MOCK_LOCATION",
+"ACCESS_NETWORK_STATE",
+"ACCESS_SURFACE_FLINGER",
+"ACCESS_WIFI_STATE",
+"ACCOUNT_MANAGER",
+"ADD_VOICEMAIL",
+"AUTHENTICATE_ACCOUNTS",
+"BATTERY_STATS",
+"BIND_ACCESSIBILITY_SERVICE",
+"BIND_APPWIDGET",
+"BIND_DEVICE_ADMIN",
+"BIND_INPUT_METHOD",
+"BIND_NFC_SERVICE",
+"BIND_NOTIFICATION_LISTENER_SERVICE",
+"BIND_PRINT_SERVICE",
+"BIND_REMOTEVIEWS",
+"BIND_TEXT_SERVICE",
+"BIND_VPN_SERVICE",
+"BIND_WALLPAPER",
+"BLUETOOTH",
+"BLUETOOTH_ADMIN",
+"BLUETOOTH_PRIVILEGED",
+"BRICK",
+"BROADCAST_PACKAGE_REMOVED",
+"BROADCAST_SMS",
+"BROADCAST_STICKY",
+"BROADCAST_WAP_PUSH",
+"CALL_PHONE",
+"CALL_PRIVILEGED",
+"CAMERA",
+"CAPTURE_AUDIO_OUTPUT",
+"CAPTURE_SECURE_VIDEO_OUTPUT",
+"CAPTURE_VIDEO_OUTPUT",
+"CHANGE_COMPONENT_ENABLED_STATE",
+"CHANGE_CONFIGURATION",
+"CHANGE_NETWORK_STATE",
+"CHANGE_WIFI_MULTICAST_STATE",
+"CHANGE_WIFI_STATE",
+"CLEAR_APP_CACHE",
+"CLEAR_APP_USER_DATA",
+"CONTROL_LOCATION_UPDATES",
+"DELETE_CACHE_FILES",
+"DELETE_PACKAGES",
+"DEVICE_POWER",
+"DIAGNOSTIC",
+"DISABLE_KEYGUARD",
+"DUMP",
+"EXPAND_STATUS_BAR",
+"FACTORY_TEST",
+"FLASHLIGHT",
+"FORCE_BACK",
+"GET_ACCOUNTS",
+"GET_PACKAGE_SIZE",
+"GET_TASKS",
+"GET_TOP_ACTIVITY_INFO",
+"GLOBAL_SEARCH",
+"HARDWARE_TEST",
+"INJECT_EVENTS",
+"INSTALL_LOCATION_PROVIDER",
+"INSTALL_PACKAGES",
+"INSTALL_SHORTCUT",
+"INTERNAL_SYSTEM_WINDOW",
+"INTERNET",
+"KILL_BACKGROUND_PROCESSES",
+"LOCATION_HARDWARE",
+"MANAGE_ACCOUNTS",
+"MANAGE_APP_TOKENS",
+"MANAGE_DOCUMENTS",
+"MASTER_CLEAR",
+"MEDIA_CONTENT_CONTROL",
+"MODIFY_AUDIO_SETTINGS",
+"MODIFY_PHONE_STATE",
+"MOUNT_FORMAT_FILESYSTEMS",
+"MOUNT_UNMOUNT_FILESYSTEMS",
+"NFC",
+"PERSISTENT_ACTIVITY",
+"PROCESS_OUTGOING_CALLS",
+"READ_CALENDAR",
+"READ_CALL_LOG",
+"READ_CONTACTS",
+"READ_EXTERNAL_STORAGE",
+"READ_FRAME_BUFFER",
+"READ_HISTORY_BOOKMARKS",
+"READ_INPUT_STATE",
+"READ_LOGS",
+"READ_PHONE_STATE",
+"READ_PROFILE",
+"READ_SMS",
+"READ_SOCIAL_STREAM",
+"READ_SYNC_SETTINGS",
+"READ_SYNC_STATS",
+"READ_USER_DICTIONARY",
+"REBOOT",
+"RECEIVE_BOOT_COMPLETED",
+"RECEIVE_MMS",
+"RECEIVE_SMS",
+"RECEIVE_WAP_PUSH",
+"RECORD_AUDIO",
+"REORDER_TASKS",
+"RESTART_PACKAGES",
+"SEND_RESPOND_VIA_MESSAGE",
+"SEND_SMS",
+"SET_ACTIVITY_WATCHER",
+"SET_ALARM",
+"SET_ALWAYS_FINISH",
+"SET_ANIMATION_SCALE",
+"SET_DEBUG_APP",
+"SET_ORIENTATION",
+"SET_POINTER_SPEED",
+"SET_PREFERRED_APPLICATIONS",
+"SET_PROCESS_LIMIT",
+"SET_TIME",
+"SET_TIME_ZONE",
+"SET_WALLPAPER",
+"SET_WALLPAPER_HINTS",
+"SIGNAL_PERSISTENT_PROCESSES",
+"STATUS_BAR",
+"SUBSCRIBED_FEEDS_READ",
+"SUBSCRIBED_FEEDS_WRITE",
+"SYSTEM_ALERT_WINDOW",
+"TRANSMIT_IR",
+"UNINSTALL_SHORTCUT",
+"UPDATE_DEVICE_STATS",
+"USE_CREDENTIALS",
+"USE_SIP",
+"VIBRATE",
+"WAKE_LOCK",
+"WRITE_APN_SETTINGS",
+"WRITE_CALENDAR",
+"WRITE_CALL_LOG",
+"WRITE_CONTACTS",
+"WRITE_EXTERNAL_STORAGE",
+"WRITE_GSERVICES",
+"WRITE_HISTORY_BOOKMARKS",
+"WRITE_PROFILE",
+"WRITE_SECURE_SETTINGS",
+"WRITE_SETTINGS",
+"WRITE_SMS",
+"WRITE_SOCIAL_STREAM",
+"WRITE_SYNC_SETTINGS",
+"WRITE_USER_DICTIONARY",
+NULL};
+
class EditorExportPlatformAndroid : public EditorExportPlatform {
OBJ_TYPE( EditorExportPlatformAndroid,EditorExportPlatform );
+
+ enum {
+ MAX_USER_PERMISSIONS=20,
+ SCREEN_SMALL=0,
+ SCREEN_NORMAL=1,
+ SCREEN_LARGE=2,
+ SCREEN_XLARGE=3,
+ SCREEN_MAX=4
+ };
+
String custom_release_package;
String custom_debug_package;
@@ -47,6 +206,10 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
Thread *device_thread;
Ref<ImageTexture> logo;
+ Set<String> perms;
+ String user_perms[MAX_USER_PERMISSIONS];
+ bool screen_support[SCREEN_MAX];
+
volatile bool quit_request;
@@ -104,11 +267,33 @@ bool EditorExportPlatformAndroid::_set(const StringName& p_name, const Variant&
_signed=p_value;
else if (n=="screen/orientation")
orientation=p_value;
+ else if (n=="screen/support_small")
+ screen_support[SCREEN_SMALL]=p_value;
+ else if (n=="screen/support_normal")
+ screen_support[SCREEN_NORMAL]=p_value;
+ else if (n=="screen/support_large")
+ screen_support[SCREEN_LARGE]=p_value;
+ else if (n=="screen/support_xlarge")
+ screen_support[SCREEN_XLARGE]=p_value;
else if (n=="keystore/release")
release_keystore=p_value;
else if (n=="keystore/release_user")
release_username=p_value;
- else
+ else if (n.begins_with("permissions/")) {
+
+ String what = n.get_slice("/",1).to_upper();
+ bool state = p_value;
+ if (state)
+ perms.insert(what);
+ else
+ perms.erase(what);
+ } else if (n.begins_with("user_permissions/")) {
+
+ int which = n.get_slice("/",1).to_int();
+ ERR_FAIL_INDEX_V(which,MAX_USER_PERMISSIONS,false);
+ user_perms[which]=p_value;
+
+ } else
return false;
return true;
@@ -132,15 +317,33 @@ bool EditorExportPlatformAndroid::_get(const StringName& p_name,Variant &r_ret)
r_ret=_signed;
else if (n=="screen/orientation")
r_ret=orientation;
+ else if (n=="screen/support_small")
+ r_ret=screen_support[SCREEN_SMALL];
+ else if (n=="screen/support_normal")
+ r_ret=screen_support[SCREEN_NORMAL];
+ else if (n=="screen/support_large")
+ r_ret=screen_support[SCREEN_LARGE];
+ else if (n=="screen/support_xlarge")
+ r_ret=screen_support[SCREEN_XLARGE];
else if (n=="keystore/release")
r_ret=release_keystore;
else if (n=="keystore/release_user")
r_ret=release_username;
- else
+ else if (n.begins_with("permissions/")) {
+
+ String what = n.get_slice("/",1).to_upper();
+ r_ret = perms.has(what);
+ } else if (n.begins_with("user_permissions/")) {
+
+ int which = n.get_slice("/",1).to_int();
+ ERR_FAIL_INDEX_V(which,MAX_USER_PERMISSIONS,false);
+ r_ret=user_perms[which];
+ } else
return false;
return true;
}
+
void EditorExportPlatformAndroid::_get_property_list( List<PropertyInfo> *p_list) const{
p_list->push_back( PropertyInfo( Variant::STRING, "custom_package/debug", PROPERTY_HINT_FILE,"apk"));
@@ -152,9 +355,25 @@ void EditorExportPlatformAndroid::_get_property_list( List<PropertyInfo> *p_list
p_list->push_back( PropertyInfo( Variant::STRING, "package/icon",PROPERTY_HINT_FILE,"png") );
p_list->push_back( PropertyInfo( Variant::BOOL, "package/signed") );
p_list->push_back( PropertyInfo( Variant::INT, "screen/orientation",PROPERTY_HINT_ENUM,"Landscape,Portrait") );
+ p_list->push_back( PropertyInfo( Variant::BOOL, "screen/support_small") );
+ p_list->push_back( PropertyInfo( Variant::BOOL, "screen/support_normal") );
+ p_list->push_back( PropertyInfo( Variant::BOOL, "screen/support_large") );
+ p_list->push_back( PropertyInfo( Variant::BOOL, "screen/support_xlarge") );
p_list->push_back( PropertyInfo( Variant::STRING, "keystore/release",PROPERTY_HINT_FILE,"keystore") );
p_list->push_back( PropertyInfo( Variant::STRING, "keystore/release_user" ) );
+ const char **perms = android_perms;
+ while(*perms) {
+
+ p_list->push_back( PropertyInfo( Variant::BOOL, "permissions/"+String(*perms).to_lower()));
+ perms++;
+ }
+
+ for(int i=0;i<MAX_USER_PERMISSIONS;i++) {
+
+ p_list->push_back( PropertyInfo( Variant::STRING, "user_permissions/"+itos(i)));
+ }
+
//p_list->push_back( PropertyInfo( Variant::INT, "resources/pack_mode", PROPERTY_HINT_ENUM,"Copy,Single Exec.,Pack (.pck),Bundles (Optical)"));
}
@@ -536,6 +755,53 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest) {
}
}
+ if (tname=="uses-permission" && /*nspace=="android" &&*/ attrname=="name") {
+
+ if (value.begins_with("godot.custom")) {
+
+ int which = value.get_slice(".",2).to_int();
+ if (which>=0 && which<MAX_USER_PERMISSIONS && user_perms[which].strip_edges()!="") {
+
+ string_table[attr_value]=user_perms[which].strip_edges();
+ }
+
+ } else if (value.begins_with("godot.")) {
+ String perm = value.get_slice(".",1);
+ if (perms.has(perm)) {
+ string_table[attr_value]="android.permission."+perm;
+ }
+
+ }
+ }
+
+ if (tname=="supports-screens" ) {
+
+ if (attr_value==0xFFFFFFFF) {
+ WARN_PRINT("Screen res name in a resource, should be plaintext")
+ } else if (attrname=="smallScreens") {
+
+ print_line("SMALLSCREEN");
+ string_table[attr_value]=screen_support[SCREEN_SMALL]?"true":"false";
+
+ } else if (attrname=="mediumScreens") {
+
+ print_line("MEDSCREEN");
+ string_table[attr_value]=screen_support[SCREEN_NORMAL]?"true":"false";
+
+ } else if (attrname=="largeScreens") {
+
+ print_line("LARGECREEN");
+ string_table[attr_value]=screen_support[SCREEN_LARGE]?"true":"false";
+
+ } else if (attrname=="xlargeScreens") {
+
+ print_line("XLARGECREEN");
+ string_table[attr_value]=screen_support[SCREEN_XLARGE]?"true":"false";
+
+ }
+ }
+
+
iofs+=20;
}
@@ -1144,6 +1410,9 @@ EditorExportPlatformAndroid::EditorExportPlatformAndroid() {
Image img( _android_logo );
logo = Ref<ImageTexture>( memnew( ImageTexture ));
logo->create_from_image(img);
+
+ for(int i=0;i<4;i++)
+ screen_support[i]=true;
}
bool EditorExportPlatformAndroid::can_export(String *r_error) const {
diff --git a/platform/android/java/src/com/android/godot/GodotPaymentV3.java b/platform/android/java/src/com/android/godot/GodotPaymentV3.java
index 9d2893cde6..23f5bf34d3 100644
--- a/platform/android/java/src/com/android/godot/GodotPaymentV3.java
+++ b/platform/android/java/src/com/android/godot/GodotPaymentV3.java
@@ -24,8 +24,12 @@ public class GodotPaymentV3 extends Godot.SingletonBase {
}
});
};
+
+/* public string requestPurchasedTicket(){
+ activity.getPaymentsManager()
+ }
-
+*/
static public Godot.SingletonBase initialize(Activity p_activity) {
return new GodotPaymentV3(p_activity);
@@ -40,8 +44,8 @@ public class GodotPaymentV3 extends Godot.SingletonBase {
- public void callbackSuccess(){
- GodotLib.callobject(purchaseCallbackId, "purchase_success", new Object[]{});
+ public void callbackSuccess(String ticket){
+ GodotLib.callobject(purchaseCallbackId, "purchase_success", new Object[]{ticket});
}
public void callbackFail(){
diff --git a/platform/android/java/src/com/android/godot/payments/HandlePurchaseTask.java b/platform/android/java/src/com/android/godot/payments/HandlePurchaseTask.java
index 08fc405183..531a786dc9 100644
--- a/platform/android/java/src/com/android/godot/payments/HandlePurchaseTask.java
+++ b/platform/android/java/src/com/android/godot/payments/HandlePurchaseTask.java
@@ -61,7 +61,7 @@ abstract public class HandlePurchaseTask {
pc.setConsumableFlag("block", productId, true);
pc.setConsumableValue("token", productId, purchaseToken);
- success(purchaseToken, productId);
+ success(purchaseData);
return;
} catch (JSONException e) {
error(e.getMessage());
@@ -71,7 +71,7 @@ abstract public class HandlePurchaseTask {
}
}
- abstract protected void success(String purchaseToken, String sku);
+ abstract protected void success(String ticket);
abstract protected void error(String message);
abstract protected void canceled();
diff --git a/platform/android/java/src/com/android/godot/payments/PaymentsManager.java b/platform/android/java/src/com/android/godot/payments/PaymentsManager.java
index 325e3a0751..983f655c35 100644
--- a/platform/android/java/src/com/android/godot/payments/PaymentsManager.java
+++ b/platform/android/java/src/com/android/godot/payments/PaymentsManager.java
@@ -84,8 +84,9 @@ public class PaymentsManager {
new HandlePurchaseTask(activity){
@Override
- protected void success(String purchaseToken, String sku) {
- validatePurchase(purchaseToken, sku);
+ protected void success(String ticket) {
+ godotPaymentV3.callbackSuccess(ticket);
+ //validatePurchase(purchaseToken, sku);
}
@Override
@@ -112,7 +113,7 @@ public class PaymentsManager {
@Override
protected void success() {
- godotPaymentV3.callbackSuccess();
+ godotPaymentV3.callbackSuccess("");
}
@@ -145,7 +146,5 @@ public class PaymentsManager {
this.godotPaymentV3 = godotPaymentV3;
}
-
-
}