From cc69f210a77463ddb9898d5366dc0f24ccc1ec6f Mon Sep 17 00:00:00 2001 From: Hak Matsuda Date: Sat, 9 Nov 2013 01:03:15 -0800 Subject: [PATCH] - Using hard-fp - Immersive mode in android-19 - Fixed local reference release in JNI helper - Misc fixes Change-Id: I3ab19c2b66648bb7a011c462d9d98e75bc136ce6 --- .../android-17/samples/Teapot/AndroidManifest.xml | 2 +- .../android-17/samples/Teapot/jni/Android.mk | 8 ++++++++ .../android-17/samples/Teapot/jni/Application.mk | 2 +- .../android-17/samples/Teapot/project.properties | 2 +- .../com/sample/teapot/TeapotNativeActivity.java | 8 +++++++- .../samples/MoreTeapots/AndroidManifest.xml | 2 +- .../android-18/samples/MoreTeapots/jni/Android.mk | 8 ++++++++ .../samples/MoreTeapots/jni/Application.mk | 2 +- .../MoreTeapots/jni/MoreTeapotsNativeActivity.cpp | 2 +- .../samples/MoreTeapots/project.properties | 2 +- .../moreteapots/MoreTeapotsNativeActivity.java | 14 +++++++++++--- ndk/sources/android/ndk_helper/Android.mk | 10 ++++++++++ ndk/sources/android/ndk_helper/JNIHelper.cpp | 6 +++--- 13 files changed, 54 insertions(+), 14 deletions(-) diff --git a/ndk/platforms/android-17/samples/Teapot/AndroidManifest.xml b/ndk/platforms/android-17/samples/Teapot/AndroidManifest.xml index 510e97ab6..1f1ef97bc 100644 --- a/ndk/platforms/android-17/samples/Teapot/AndroidManifest.xml +++ b/ndk/platforms/android-17/samples/Teapot/AndroidManifest.xml @@ -5,7 +5,7 @@ + android:targetSdkVersion="19" /> = 14) + else if(SDK_INT >= 14 && SDK_INT < 19) { getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LOW_PROFILE); } + else if(SDK_INT >= 19) + { + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); + } } // Our popup window, you will call it from your C/C++ code later diff --git a/ndk/platforms/android-18/samples/MoreTeapots/AndroidManifest.xml b/ndk/platforms/android-18/samples/MoreTeapots/AndroidManifest.xml index ae0bc3d63..6bef3560c 100644 --- a/ndk/platforms/android-18/samples/MoreTeapots/AndroidManifest.xml +++ b/ndk/platforms/android-18/samples/MoreTeapots/AndroidManifest.xml @@ -5,7 +5,7 @@ + android:targetSdkVersion="19" /> = 11 && SDK_INT < 14) { + if(SDK_INT >= 11 && SDK_INT < 14) + { getWindow().getDecorView().setSystemUiVisibility(View.STATUS_BAR_HIDDEN); - }else if(SDK_INT >= 14){ + } + else if(SDK_INT >= 14 && SDK_INT < 19) + { getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LOW_PROFILE); } - + else if(SDK_INT >= 19) + { + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); + } } protected void onPause() diff --git a/ndk/sources/android/ndk_helper/Android.mk b/ndk/sources/android/ndk_helper/Android.mk index e7134da3b..98dc1bea8 100644 --- a/ndk/sources/android/ndk_helper/Android.mk +++ b/ndk/sources/android/ndk_helper/Android.mk @@ -10,6 +10,16 @@ LOCAL_EXPORT_LDLIBS := -llog -landroid -lEGL -lGLESv2 LOCAL_STATIC_LIBRARIES := cpufeatures android_native_app_glue + +ifneq ($(filter %armeabi-v7a,$(TARGET_ARCH_ABI)),) +LOCAL_CFLAGS += -mhard-float -D_NDK_MATH_NO_SOFTFP=1 +LOCAL_EXPORT_CFLAGS += -mhard-float -D_NDK_MATH_NO_SOFTFP=1 +LOCAL_EXPORT_LDLIBS += -lm_hard +ifeq (,$(filter -fuse-ld=mcld,$(APP_LDFLAGS) $(LOCAL_LDFLAGS))) +LOCAL_EXPORT_LDFLAGS += -Wl,--no-warn-mismatch +endif +endif + include $(BUILD_STATIC_LIBRARY) #$(call import-module,android/native_app_glue) diff --git a/ndk/sources/android/ndk_helper/JNIHelper.cpp b/ndk/sources/android/ndk_helper/JNIHelper.cpp index e06520a4f..e1e7f00ce 100644 --- a/ndk/sources/android/ndk_helper/JNIHelper.cpp +++ b/ndk/sources/android/ndk_helper/JNIHelper.cpp @@ -131,8 +131,8 @@ bool JNIHelper::ReadFile( const char* fileName, s.append( fileName ); std::ifstream f( s.c_str(), std::ios::binary ); - env->DeleteLocalRef( str_path ); env->ReleaseStringUTFChars( str_path, path ); + env->DeleteLocalRef( str_path ); activity_->vm->DetachCurrentThread(); if( f ) @@ -197,8 +197,8 @@ std::string JNIHelper::GetExternalFilesDir() const char* path = env->GetStringUTFChars( strPath, NULL ); std::string s( path ); - env->DeleteLocalRef( strPath ); env->ReleaseStringUTFChars( strPath, path ); + env->DeleteLocalRef( strPath ); activity_->vm->DetachCurrentThread(); pthread_mutex_unlock( &mutex_ ); @@ -277,9 +277,9 @@ std::string JNIHelper::ConvertString( const char* str, std::string s = std::string( cparam ); + env->ReleaseStringUTFChars( object, cparam ); env->DeleteLocalRef( strEncode ); env->DeleteLocalRef( object ); - env->ReleaseStringUTFChars( object, cparam ); activity_->vm->DetachCurrentThread(); pthread_mutex_unlock( &mutex_ );