1

I am trying to execute a system command to open a terminal(using am instruction) from eclipse.

The below is my c++ code from eclipse (used through JNI):

    JNIEXPORT jstring JNICALL Java_com_example_vulnapp_NewActivity_stringFromJNICPP(JNIEnv * env, jobject obj)
 {
     LOGI("sys cmd:%x", system);
     system("am start -a android.intent.action.MAIN -c android.intent.category.TEST -n com.android.term/.Term");
    LOGI("After command executed");
     return env->NewStringUTF("Hello From CPP");
 }

The below is the manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.vulnapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="12"
        android:targetSdkVersion="23" />
    <uses-permission android:name = "android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
    <uses-permission android:name="android.permission.SMS" />
    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" android:protectionLevel="signature"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".NewActivity" >

        </activity>

    </application>

</manifest>

When I try to run the application in the emulator I get the following error: Error from logcat I will be very grateful if someone could help me with this. I am really stuck up with this for a long time.

Akshaya
  • 17
  • 5

2 Answers2

2

Add android:protectionLevel="signature" in manifest

<permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" android:protectionLevel="signature"/>
Rajesh Gopu
  • 863
  • 9
  • 33
0

Maybe You should try to disable auto-fill, but it works only on Android Oreo. Check this link

Simply add this code to your app :

      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        window.decorView.importantForAutofill = 
        View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS;
    }
Roman Soviak
  • 791
  • 2
  • 9
  • 30