Changeset 4697


Ignore:
Timestamp:
Dec 18, 2013 11:42:04 AM (7 years ago)
Author:
nanang
Message:

Re #1716: Misc fixes/updates on Android app based on pjsua2+SWIG, e.g: fixed java string comparisons, added build config for ndk-build (for native debugging), updates on SVN props.

Location:
pjproject/branches/projects/pjsua2
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/pjsua2/configure-android

    r4691 r4697  
    8787  export CXX="${NDK_CXX}" 
    8888 
    89   export LDFLAGS="${LDFLAGS} -nostdlib -L${ANDROID_SYSROOT}/usr/lib/ -L${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi" 
    90   export LIBS="${LIBS} -lgnustl_static -lc -lgcc ${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o" 
    91   export CFLAGS="${CFLAGS} ${NDK_CFLAGS} -I${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.7/include -I${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi/include" 
     89  export LDFLAGS="${LDFLAGS} -nostdlib -L${ANDROID_SYSROOT}/usr/lib/" 
     90  export LIBS="${LIBS} -lc -lgcc" 
     91  export CFLAGS="${CFLAGS} ${NDK_CFLAGS}" 
    9292  export CPPFLAGS="${CFLAGS} -fexceptions -frtti" 
    9393  export CXXFLAGS="${NDK_CXXFLAGS} -fexceptions -frtti" 
     
    111111  export CXX="${ANDROID_TC}/bin/${TARGET_HOST}-g++" 
    112112 
    113   export LDFLAGS="${LDFLAGS} -nostdlib -L${ANDROID_SYSROOT}/usr/lib/ -L${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi" 
    114   export LIBS="${LIBS} -lgnustl_static -lc -lgcc ${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o" 
    115   export CFLAGS="${CFLAGS} -I${ANDROID_SYSROOT}/usr/include -I${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.7/include -I${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi/include" 
     113  export LDFLAGS="${LDFLAGS} -nostdlib -L${ANDROID_SYSROOT}/usr/lib/" 
     114  export LIBS="${LIBS} -lc -lgcc" 
     115  export CFLAGS="${CFLAGS} -I${ANDROID_SYSROOT}/usr/include" 
    116116  export CPPFLAGS="${CFLAGS} -fexceptions -frtti" 
    117117  export CXXFLAGS="${CXXFLAGS} -shared --sysroot=${ANDROID_SYSROOT} -fexceptions -frtti" 
    118118 
    119119fi 
     120 
     121# C++ STL 
     122# Note: STL for pjsua2 sample app is specified in pjsip-apps/src/swig/java/android/jni/Application.mk 
     123 
     124# gnustl 
     125STDCPP_TC_VER=`ls -d ${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/[0-9]* | sort -gr | head -1` 
     126STDCPP_CFLAGS="-I${STDCPP_TC_VER}/include -I${STDCPP_TC_VER}/libs/armeabi/include" 
     127STDCPP_LIBS="${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o -lgnustl_static" 
     128STDCPP_LDFLAGS="-L${STDCPP_TC_VER}/libs/armeabi" 
     129 
     130# stlport 
     131#STDCPP_CFLAGS="-I${ANDROID_NDK_ROOT}/sources/cxx-stl/stlport/stlport" 
     132#STDCPP_LIBS="${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o -lstlport_static -ldl" 
     133#STDCPP_LDFLAGS="-L${ANDROID_NDK_ROOT}/sources/cxx-stl/stlport/libs/armeabi" 
     134 
     135export CFLAGS="${CFLAGS} ${STDCPP_CFLAGS}" 
     136export LIBS="${STDCPP_LIBS} ${LIBS}" 
     137export LDFLAGS="${LDFLAGS} ${STDCPP_LDFLAGS}" 
    120138 
    121139# Print settings 
  • pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/java/android

    • Property svn:ignore
      •  

        old new  
        11bin 
        22gen 
         3obj 
         4.cproject 
  • pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/java/android/AndroidManifest.xml

    • Property svn:eol-style set to LF
  • pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/java/android/libs/armeabi

    • Property svn:ignore set to
      *
  • pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/java/android/project.properties

    • Property svn:eol-style set to LF
  • pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/java/android/src/org/pjsip/pjsua2/app/MainActivity.java

    r4693 r4697  
    2626import android.content.DialogInterface; 
    2727import android.content.Intent; 
     28import android.content.pm.ApplicationInfo; 
    2829import android.view.LayoutInflater; 
    2930import android.view.Menu; 
     
    8384                if (app == null) { 
    8485                        app = new MyApp(); 
     86                        /* Wait for GDB to init */ 
     87                        if ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { 
     88                                try { 
     89                                        Thread.sleep(5000); 
     90                                } catch (InterruptedException e) {} 
     91                        } 
     92                         
    8593                    app.init(this, getFilesDir().getAbsolutePath()); 
    8694                } 
     
    128136        @Override 
    129137        public boolean onOptionsItemSelected(MenuItem item) { 
    130                 CharSequence str = item.getTitle(); 
    131138                switch (item.getItemId()) { 
    132139                case R.id.action_acc_config: 
     
    368375                                                buddyListSelectedIdx = -1; 
    369376                                } else { 
    370                                         if (old_cfg.getUri() != cfg.getUri()) { 
     377                                        if (!old_cfg.getUri().equals(cfg.getUri())) { 
    371378                                                account.delBuddy(buddyListSelectedIdx); 
    372379                                                account.addBuddy(cfg); 
  • pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/java/android/src/org/pjsip/pjsua2/app/MyApp.java

    r4696 r4697  
    168168                        if (bi.getPresStatus().getStatus() == pjsua_buddy_status.PJSUA_BUDDY_STATUS_ONLINE) { 
    169169                                status = bi.getPresStatus().getStatusText(); 
    170                                 if (status == null || status == "") { 
     170                                if (status == null || status.isEmpty()) { 
    171171                                        status = "Online"; 
    172172                                } 
     
    340340        public void delAcc(MyAccount acc) { 
    341341                accList.remove(acc); 
    342                 /* GC will delete the acc soon? */ 
    343342        } 
    344343         
     
    369368                        System.out.println(e); 
    370369                } 
     370                 
     371                /* Suggest to delete, as we found this causes crash when the Java 
     372                 * deletes it later after lib has been destroyed. 
     373                 */ 
     374                json.delete(); 
    371375        } 
    372376 
     
    410414                        json.saveFile(filename); 
    411415                } catch (Exception e) {} 
     416 
     417                /* Suggest to delete, as we found this causes crash when the Java 
     418                 * deletes it later after lib has been destroyed. 
     419                 */ 
     420                json.delete(); 
    412421        } 
    413422         
     
    415424                String configPath = appDir + "/" + configName; 
    416425                saveConfig(configPath); 
     426                 
     427                /* Try force GC to avoid late destroy of PJ objects as they should be 
     428                 * deleted before lib is destroyed. 
     429                 */ 
     430                System.gc(); 
     431                 
    417432                try { 
    418433                        ep.libDestroy(); 
Note: See TracChangeset for help on using the changeset viewer.