AndroidRuntime: java.lang.SecurityException: Permission Denial


在android调用另一个进程中的activity时,发生下面的错误:

E AndroidRuntime: java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.mediatek.op01.plugin/com.mediatek.phone.callforward.CallForwardTimeActivity (has extras) } from ProcessRecord{2e4925ca 6339:com.android.phone/1001} (pid=6339, uid=1001) not exported from uid 1000


intent跳转时发现没有权限引起的:

         Intent intent = new Intent(mPluginContext, CallForwardTimeActivity.class);
         mActivity.startActivityForResult(intent, SET_TIME_REQUEST);


经查看发现将exported属性变为true即可:

        <activity android:name="com.mediatek.phone.callforward.CallForwardTimeActivity"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:launchMode="singleTop"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
        </activity>

猜你喜欢

转载自blog.csdn.net/tingsky9985/article/details/52397976
今日推荐