new compilation mode for android system

This commit is contained in:
Edouard DUPIN 2012-09-12 18:18:38 +02:00
parent 1b51dc051e
commit 236784a6d3
6 changed files with 113 additions and 33 deletions

2
Build

@ -1 +1 @@
Subproject commit 9c3bc9ecb3d34caa2351555d79d3b783affb19a6 Subproject commit f0785e65dcabf471d1a60282522738ff2ff00903

View File

@ -75,7 +75,7 @@ public class __PROJECT_NAME__ extends Activity {
private Thread mAudioThread; private Thread mAudioThread;
static { static {
System.loadLibrary("__PROJECT_PACKAGE__"); System.loadLibrary("__PROJECT_NAME__");
} }
@Override protected void onCreate(Bundle savedInstanceState) @Override protected void onCreate(Bundle savedInstanceState)
@ -98,7 +98,7 @@ public class __PROJECT_NAME__ extends Activity {
ApplicationInfo appInfo = null; ApplicationInfo appInfo = null;
PackageManager packMgmr = getPackageManager(); PackageManager packMgmr = getPackageManager();
try { try {
appInfo = packMgmr.getApplicationInfo("com.__PROJECT_VENDOR__.__PROJECT_PACKAGE__", 0); appInfo = packMgmr.getApplicationInfo("__PROJECT_ORG_TYPE__.__PROJECT_VENDOR__.__PROJECT_PACKAGE__", 0);
} catch (NameNotFoundException e) { } catch (NameNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("Unable to locate assets, aborting..."); throw new RuntimeException("Unable to locate assets, aborting...");

View File

@ -40,9 +40,10 @@ EWOL_TMP_PATH:=$(LOCAL_PATH)
$(FILE_ABSTRACTION_DEST): $(FILE_ABSTRACTION) $(FILE_ABSTRACTION_DEST): $(FILE_ABSTRACTION)
@mkdir -p $(dir $(EWOL_TMP_PATH)/$@) @mkdir -p $(dir $(EWOL_TMP_PATH)/$@)
@cp -f $(FILE_ABSTRACTION) $(EWOL_TMP_PATH)/$@ @cp -f $(FILE_ABSTRACTION) $(EWOL_TMP_PATH)/$@
@sed -i "s|__PROJECT_VENDOR__|$(PROJECT_VENDOR)|" $(EWOL_TMP_PATH)/$@ @sed -i "s|__PROJECT_ORG_TYPE__|$(call convert-special-char,$(CONFIG___EWOL_APPL_ORGANISATION_TYPE__))|" $(EWOL_TMP_PATH)/$@
@sed -i "s|__PROJECT_NAME__|$(PROJECT_NAME)|" $(EWOL_TMP_PATH)/$@ @sed -i "s|__PROJECT_VENDOR__|$(call convert-special-char,$(CONFIG___EWOL_APPL_COMPAGNY__))|" $(EWOL_TMP_PATH)/$@
@sed -i "s|__PROJECT_PACKAGE__|$(PROJECT_PACKAGE)|" $(EWOL_TMP_PATH)/$@ @sed -i "s|__PROJECT_NAME__|$(call convert-special-char,$(CONFIG___EWOL_APPL_NAME__))|" $(EWOL_TMP_PATH)/$@
@sed -i "s|__PROJECT_PACKAGE__|$(call convert-special-char,$(CONFIG___EWOL_APPL_NAME__))|" $(EWOL_TMP_PATH)/$@
# this is the abstraction file for Android # this is the abstraction file for Android

View File

@ -38,6 +38,7 @@ static jobject javaObjectActivity = 0;
static jmethodID javaClassActivityEntryPoint = 0; // basic methode to call ... static jmethodID javaClassActivityEntryPoint = 0; // basic methode to call ...
static jmethodID javaClassActivityEntryPoint__CPP_keyboardShow = 0; // basic methode to call ... static jmethodID javaClassActivityEntryPoint__CPP_keyboardShow = 0; // basic methode to call ...
static jmethodID javaClassActivityEntryPoint__CPP_keyboardHide = 0; // basic methode to call ... static jmethodID javaClassActivityEntryPoint__CPP_keyboardHide = 0; // basic methode to call ...
static jmethodID javaClassActivityEntryPoint__CPP_OrientationChange = 0;
// generic classes // generic classes
static jclass javaDefaultClassString = 0; // default string class static jclass javaDefaultClassString = 0; // default string class
@ -101,6 +102,58 @@ void SendJava_KeyboardShow(bool showIt)
g_JavaVM->DetachCurrentThread(); g_JavaVM->DetachCurrentThread();
} }
void SendJava_OrientationChange(bool showIt)
{
EWOL_DEBUG("C->java : call java");
if (NULL == g_JavaVM) {
EWOL_DEBUG("C->java : JVM not initialised");
return;
}
JNIEnv *JavaVirtualMachinePointer_tmp;
int status = g_JavaVM->GetEnv((void **) &JavaVirtualMachinePointer_tmp, JNI_VERSION_1_6);
if (status == JNI_EDETACHED) {
JavaVMAttachArgs lJavaVMAttachArgs;
lJavaVMAttachArgs.version = JNI_VERSION_1_6;
lJavaVMAttachArgs.name = "EwolNativeThread";
lJavaVMAttachArgs.group = NULL;
status = g_JavaVM->AttachCurrentThread(&JavaVirtualMachinePointer_tmp, &lJavaVMAttachArgs);
if (status != JNI_OK) {
EWOL_DEBUG("C->java : AttachCurrentThread failed : " << status);
return;
}
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
EWOL_DEBUG("C->java : EXEPTION ...");
JavaVirtualMachinePointer->ExceptionDescribe();
JavaVirtualMachinePointer->ExceptionClear();
}
}
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
EWOL_DEBUG("C->java : EXEPTION ...");
JavaVirtualMachinePointer->ExceptionDescribe();
JavaVirtualMachinePointer->ExceptionClear();
}
if (NULL == JavaVirtualMachinePointer) {
EWOL_DEBUG("C->java : JVM not initialised");
return;
}
//Call java ...
JavaVirtualMachinePointer->CallVoidMethod(javaObjectActivity, javaClassActivityEntryPoint__CPP_OrientationChange);
// manage execption :
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
EWOL_DEBUG("C->java : EXEPTION ...");
JavaVirtualMachinePointer->ExceptionDescribe();
JavaVirtualMachinePointer->ExceptionClear();
}
// Finished with the JVM.
g_JavaVM->DetachCurrentThread();
}
void SendSystemMessage(const char * dataString) void SendSystemMessage(const char * dataString)
{ {
EWOL_DEBUG("C->java : send message to the java : \"" << dataString << "\""); EWOL_DEBUG("C->java : send message to the java : \"" << dataString << "\"");
@ -183,8 +236,7 @@ extern "C"
/* Call to initialize the graphics state */ /* Call to initialize the graphics state */
void Java___PROJECT_ORG_TYPE_____PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityParamSetArchiveDir( JNIEnv* env, jobject thiz, jint mode, jstring myString)
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityParamSetArchiveDir( JNIEnv* env, jobject thiz, jint mode, jstring myString)
{ {
// direct setting of the date in the string system ... // direct setting of the date in the string system ...
jboolean isCopy; jboolean isCopy;
@ -197,8 +249,7 @@ extern "C"
} }
} }
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivitySetJavaVortualMachineStart( JNIEnv* env, jclass classBase, jobject obj) void Java___PROJECT_ORG_TYPE_____PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivitySetJavaVortualMachineStart( JNIEnv* env, jclass classBase, jobject obj)
//void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivitySetJavaVortualMachineStart( JNIEnv* env)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Set JVM Pointer **"); EWOL_DEBUG("** Set JVM Pointer **");
@ -206,9 +257,9 @@ extern "C"
JavaVirtualMachinePointer = env; JavaVirtualMachinePointer = env;
// get default needed all time elements : // get default needed all time elements :
if (NULL != JavaVirtualMachinePointer) { if (NULL != JavaVirtualMachinePointer) {
javaClassActivity = JavaVirtualMachinePointer->FindClass("com/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__" ); javaClassActivity = JavaVirtualMachinePointer->FindClass("__PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__" );
if (javaClassActivity == 0) { if (javaClassActivity == 0) {
EWOL_DEBUG("C->java : Can't find com/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__ class"); EWOL_DEBUG("C->java : Can't find __PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__ class");
// remove access on the virtual machine : // remove access on the virtual machine :
JavaVirtualMachinePointer = NULL; JavaVirtualMachinePointer = NULL;
return; return;
@ -216,25 +267,33 @@ extern "C"
// get the activity object : // get the activity object :
javaClassActivityEntryPoint = JavaVirtualMachinePointer->GetStaticMethodID(javaClassActivity, "eventFromCPP", "([Ljava/lang/String;)V" ); javaClassActivityEntryPoint = JavaVirtualMachinePointer->GetStaticMethodID(javaClassActivity, "eventFromCPP", "([Ljava/lang/String;)V" );
if (javaClassActivityEntryPoint == 0) { if (javaClassActivityEntryPoint == 0) {
EWOL_DEBUG("C->java : Can't find com/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.eventFromCPP" ); EWOL_DEBUG("C->java : Can't find __PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.eventFromCPP" );
// remove access on the virtual machine : // remove access on the virtual machine :
JavaVirtualMachinePointer = NULL; JavaVirtualMachinePointer = NULL;
return; return;
} }
javaClassActivityEntryPoint__CPP_keyboardShow = JavaVirtualMachinePointer->GetMethodID(javaClassActivity, "CPP_keyboardShow", "()V" ); javaClassActivityEntryPoint__CPP_keyboardShow = JavaVirtualMachinePointer->GetMethodID(javaClassActivity, "CPP_keyboardShow", "()V" );
if (javaClassActivityEntryPoint__CPP_keyboardShow == 0) { if (javaClassActivityEntryPoint__CPP_keyboardShow == 0) {
EWOL_DEBUG("C->java : Can't find com/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.CPP_keyboardShow" ); EWOL_DEBUG("C->java : Can't find __PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.CPP_keyboardShow" );
// remove access on the virtual machine : // remove access on the virtual machine :
JavaVirtualMachinePointer = NULL; JavaVirtualMachinePointer = NULL;
return; return;
} }
javaClassActivityEntryPoint__CPP_keyboardHide = JavaVirtualMachinePointer->GetMethodID(javaClassActivity, "CPP_keyboardHide", "()V" ); javaClassActivityEntryPoint__CPP_keyboardHide = JavaVirtualMachinePointer->GetMethodID(javaClassActivity, "CPP_keyboardHide", "()V" );
if (javaClassActivityEntryPoint__CPP_keyboardHide == 0) { if (javaClassActivityEntryPoint__CPP_keyboardHide == 0) {
EWOL_DEBUG("C->java : Can't find com/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.CPP_keyboardHide" ); EWOL_DEBUG("C->java : Can't find __PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.CPP_keyboardHide" );
// remove access on the virtual machine : // remove access on the virtual machine :
JavaVirtualMachinePointer = NULL; JavaVirtualMachinePointer = NULL;
return; return;
} }
javaClassActivityEntryPoint__CPP_OrientationChange = JavaVirtualMachinePointer->GetMethodID(javaClassActivity, "CPP_OrientationChange", "(I)V" );
if (javaClassActivityEntryPoint__CPP_OrientationChange == 0) {
EWOL_DEBUG("C->java : Can't find __PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.CPP_OrientationChange" );
// remove access on the virtual machine :
JavaVirtualMachinePointer = NULL;
return;
}
//javaObjectActivity = JavaVirtualMachinePointer->NewGlobalRef(obj); //javaObjectActivity = JavaVirtualMachinePointer->NewGlobalRef(obj);
javaObjectActivity = obj; javaObjectActivity = obj;
@ -247,7 +306,7 @@ extern "C"
} }
} }
} }
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivitySetJavaVortualMachineStop( JNIEnv* env ) void Java___PROJECT_ORG_TYPE_____PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivitySetJavaVortualMachineStop( JNIEnv* env )
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Remove JVM Pointer **"); EWOL_DEBUG("** Remove JVM Pointer **");

View File

@ -49,13 +49,15 @@ namespace ewol
int64_t ticTime; int64_t ticTime;
bool display; bool display;
bool drwingDone; bool drwingDone;
const char * m_displayName;
bool m_displayFPS;
public: public:
/** /**
* @brief Constructor * @brief Constructor
* @param --- * @param ---
* @return --- * @return ---
*/ */
Fps(void) Fps(const char * displayName, bool displayFPS)
{ {
startTime = -1; startTime = -1;
nbCallTime = 0; nbCallTime = 0;
@ -69,6 +71,8 @@ namespace ewol
ticTime = 0; ticTime = 0;
display = false; display = false;
drwingDone = false; drwingDone = false;
m_displayName = displayName;
m_displayFPS = displayFPS;
} }
/** /**
* @brief Destructor * @brief Destructor
@ -117,17 +121,21 @@ namespace ewol
avg_idle += processTimeLocal; avg_idle += processTimeLocal;
} }
if (true == display) { if (true == display) {
EWOL_DEBUG("display property : " << nbDisplayTime << "/" << nbCallTime << "fps");
if (nbDisplayTime>0) { if (nbDisplayTime>0) {
EWOL_DEBUG("Time Drawind : " << (float)((float)min / 1000.0) << "ms " EWOL_DEBUG(m_displayName << " : Active : "
<< (float)((float)min / 1000.0) << "ms "
<< (float)((float)avg / (float)nbDisplayTime / 1000.0) << "ms " << (float)((float)avg / (float)nbDisplayTime / 1000.0) << "ms "
<< (float)((float)max / 1000.0) << "ms "); << (float)((float)max / 1000.0) << "ms ");
} }
if (nbCallTime-nbDisplayTime>0) { if (nbCallTime-nbDisplayTime>0) {
EWOL_DEBUG("Time idle : " << (float)((float)min_idle / 1000.0) << "ms " EWOL_DEBUG(m_displayName << " : idle : "
<< (float)((float)min_idle / 1000.0) << "ms "
<< (float)((float)avg_idle / (float)(nbCallTime-nbDisplayTime) / 1000.0) << "ms " << (float)((float)avg_idle / (float)(nbCallTime-nbDisplayTime) / 1000.0) << "ms "
<< (float)((float)max_idle / 1000.0) << "ms "); << (float)((float)max_idle / 1000.0) << "ms ");
} }
if (true == m_displayFPS) {
EWOL_DEBUG("FPS : " << nbDisplayTime << "/" << nbCallTime << "fps");
}
max = 0; max = 0;
min = 99999999999999LL; min = 99999999999999LL;
avg = 0; avg = 0;

View File

@ -447,40 +447,52 @@ void eSystem::ClipBoardArrive(ewol::clipBoard::clipboardListe_te clipboardID)
} }
static ewol::Fps l_FpsSystem; static ewol::Fps l_FpsSystemEvent( "Event ", false);
static ewol::Fps l_FpsSystemContext( "Context ", false);
static ewol::Fps l_FpsSystem( "Draw ", true);
bool eSystem::Draw(bool displayEveryTime) bool eSystem::Draw(bool displayEveryTime)
{ {
int64_t currentTime = ewol::GetTime(); int64_t currentTime = ewol::GetTime();
// FPS display system
l_FpsSystem.Tic();
if (true == isGlobalSystemInit) { if (true == isGlobalSystemInit) {
// process the events // process the events
l_FpsSystemEvent.Tic();
ewolProcessEvents(); ewolProcessEvents();
// call all the widget that neded to do something periodicly // call all the widget that neded to do something periodicly
ewol::widgetManager::PeriodicCall(currentTime); ewol::widgetManager::PeriodicCall(currentTime);
// Remove all widget that they are no more usefull (these who decided to destroy themself) // Remove all widget that they are no more usefull (these who decided to destroy themself)
ewol::EObjectManager::RemoveAllAutoRemove(); ewol::EObjectManager::RemoveAllAutoRemove();
ewol::Windows* tmpWindows = eSystem::GetCurrentWindows(); ewol::Windows* tmpWindows = eSystem::GetCurrentWindows();
// check if the user selected a windows // check if the user selected a windows
if (NULL == tmpWindows) { if (NULL != tmpWindows) {
// TODO : Display a stipid texture
} else {
// Redraw all needed elements // Redraw all needed elements
tmpWindows->OnRegenerateDisplay(); tmpWindows->OnRegenerateDisplay();
// check if the regenerate is needed ... }
if( true == ewol::widgetManager::IsDrawingNeeded() l_FpsSystemEvent.IncrementCounter();
l_FpsSystemEvent.Toc();
bool needRedraw = ewol::widgetManager::IsDrawingNeeded();
l_FpsSystemContext.Tic();
if (NULL != tmpWindows) {
if( true == needRedraw
|| true == displayEveryTime) { || true == displayEveryTime) {
ewol::resource::UpdateContext(); ewol::resource::UpdateContext();
l_FpsSystemContext.IncrementCounter();
}
}
l_FpsSystemContext.Toc();
l_FpsSystem.Tic();
if (NULL != tmpWindows) {
if( true == needRedraw
|| true == displayEveryTime) {
l_FpsSystem.IncrementCounter(); l_FpsSystem.IncrementCounter();
tmpWindows->SysDraw(); tmpWindows->SysDraw();
} }
} }
l_FpsSystem.Toc();
glFlush(); glFlush();
} }
// FPS display system
l_FpsSystem.Toc();
return true; return true;
} }